Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion QRCode-OpenCV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PROJECT(opencv_tests)
if(NOT OpenCV_DIR)
set(OpenCV_DIR <specify your path to the opencv installation directory>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)
Expand Down
19 changes: 14 additions & 5 deletions QRCode-OpenCV/qrCodeOpencv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// #include <opencv2/opencv.hpp>
#include <opencv2/objdetect.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui/highgui.hpp>
Expand All @@ -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<float>(i,0),bbox.at<float>(i,1)), Point2i(bbox.at<float>((i+1) % n,0), bbox.at<float>((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<float>(0, index),
bbox.at<float>(0, index+1)),
Point(
bbox.at<float>(0, (index+2) % max_index),
bbox.at<float>(0, (index+3) % max_index)),
Scalar(0,255,0),
2);
index+=2;
}
imshow("Result", im);
}
Expand Down