diff --git a/flake.nix b/flake.nix index 8a034a4..42819c2 100644 --- a/flake.nix +++ b/flake.nix @@ -35,14 +35,14 @@ nativeBuildInputs = with pkgs; [ cmake - opencv2 + opencv3 liblbfgs qt5.full libsForQt5.qt5.wrapQtAppsHook ]; configurePhase = '' - cmake scannerExtract -DCMAKE_BUILD_TYPE=release -DOPENCV2=1 + cmake scannerExtract -DCMAKE_BUILD_TYPE=release ''; buildPhase = '' @@ -90,7 +90,7 @@ default = pkgs.mkShellNoCC { packages = with pkgs; [ cmake - opencv2 + opencv3 liblbfgs gt5.full diff --git a/scannerExtract/preloadsource.cpp b/scannerExtract/preloadsource.cpp index 2504639..98034c5 100644 --- a/scannerExtract/preloadsource.cpp +++ b/scannerExtract/preloadsource.cpp @@ -194,14 +194,20 @@ void PreloadSource::getSumOfRectangleSampling(const QVector 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];