Fix mistakes in cvimageviewer ploting and selection

This commit is contained in:
2021-07-19 23:04:57 +02:00
parent a9f263b22d
commit 7350c6ce96

View File

@ -84,10 +84,7 @@ cv::Rect CvImageViewer::roiFromSelection()
transfromToSourceCoordinates(selectionRect_.x()+selectionRect_.width(), selectionRect_.y()+selectionRect_.height(), xB, yB);
selectionRect_ = QRect(0, 0, 0, 0);
cv::Rect roi;
if(xA > xB)
roi = cv::Rect(xB, yB, xA-xB, yA-yB);
else
roi = cv::Rect(xA, yA, xB-xA, yB-yA);
roi = cv::Rect(std::min(xA, xB), std::min(yA, yB), std::abs(xA-xB), std::abs(yA-yB));
return roi;
}
@ -261,7 +258,7 @@ void CvImageViewer::plotOnY()
QVector<double> keys;
QVector<double> values;
int x, y;
transfromToSourceCoordinates(xLine_.p1().x(), xLine_.p1().y(), x, y);
transfromToSourceCoordinates(yLine_.p1().x(), yLine_.p1().y(), x, y);
double max = 0;
for(int i = 0; i < origImage_.rows; ++i)
{