Got OpenCV3 working

This commit is contained in:
2024-02-01 21:11:28 +01:00
parent a54193cd90
commit eeb1cd6647
2 changed files with 11 additions and 5 deletions

View File

@ -194,14 +194,20 @@ void PreloadSource::getSumOfRectangleSampling(const QVector<cv::Point2f> pts,
sumValues = 0;
numPixels = 0;
IplImage tmp = image;
IplImage tmp = cvIplImage(image);
assert(image.type() == CV_8U);
for (int i=0; i<4; i++)
{
CvLineIterator iterator;
const int count = cvInitLineIterator( &tmp, pts[i], pts[(i+1)%4], &iterator, 4);
const int count = cvInitLineIterator(
&tmp,
cvPoint(cvRound(pts[i].x), cvRound(pts[i].y)),
cvPoint(cvRound(pts[(i + 1) % 4].x), cvRound(pts[(i + 1) % 4].y)),
&iterator,
4
);
for( int j = 0; j < count; j++ ){
sumValues += iterator.ptr[0];