From 976aa025ab75419c77ab48ed44c96f980d1dd68e Mon Sep 17 00:00:00 2001 From: Manuel Schmitzberger Date: Tue, 8 Dec 2020 21:31:15 +0100 Subject: [PATCH 1/2] Reduce opencv libs only to the required one in the QRCode example. --- QRCode-OpenCV/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QRCode-OpenCV/CMakeLists.txt b/QRCode-OpenCV/CMakeLists.txt index e926a8fb7..1cb427ce2 100644 --- a/QRCode-OpenCV/CMakeLists.txt +++ b/QRCode-OpenCV/CMakeLists.txt @@ -5,7 +5,7 @@ PROJECT(opencv_tests) if(NOT OpenCV_DIR) set(OpenCV_DIR installations/OpenCV4/lib/cmake/opencv4/) endif() -find_package( OpenCV REQUIRED ) +find_package(OpenCV REQUIRED core highgui objdetect) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) From 0d1ce6409d06c6c364c2f28ff2ddb06fd7a0bc77 Mon Sep 17 00:00:00 2001 From: Manuel Schmitzberger Date: Wed, 9 Dec 2020 16:15:35 +0100 Subject: [PATCH 2/2] Fix drawing lines in result image in QRcode example. --- QRCode-OpenCV/qrCodeOpencv.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/QRCode-OpenCV/qrCodeOpencv.cpp b/QRCode-OpenCV/qrCodeOpencv.cpp index 64036ccc3..8bed223de 100644 --- a/QRCode-OpenCV/qrCodeOpencv.cpp +++ b/QRCode-OpenCV/qrCodeOpencv.cpp @@ -1,4 +1,3 @@ -// #include #include #include #include @@ -10,10 +9,20 @@ using namespace std; void display(Mat &im, Mat &bbox) { - int n = bbox.rows; - for(int i = 0 ; i < n ; i++) - { - line(im, Point2i(bbox.at(i,0),bbox.at(i,1)), Point2i(bbox.at((i+1) % n,0), bbox.at((i+1) % n,1)), Scalar(255,0,0), 3); + int index = 0; + int max_index = (bbox.cols*2); + for(int l = 0 ; l < bbox.cols; l++) { + line( + im, + Point( + bbox.at(0, index), + bbox.at(0, index+1)), + Point( + bbox.at(0, (index+2) % max_index), + bbox.at(0, (index+3) % max_index)), + Scalar(0,255,0), + 2); + index+=2; } imshow("Result", im); }