C++ OpenCV QRcode scanner
2021. 1. 26. 00:46ㆍOpenCV/OpenCV C++
반응형
QRCodeDetector를 이용한 QRcode scanner
실행코드
#include "opencv2/opencv.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(void)
{
QRCodeDetector detector;
Mat frame, gray;
frame = imread("qr1.jpg");
if (frame.empty()) {
cerr << "Frame load failed!" << endl;
return -1;
}
cvtColor(frame, gray, COLOR_BGR2GRAY);
vector<Point> points;
if (detector.detect(gray, points)) {
polylines(frame, points, true, Scalar(0, 255, 255), 2);
String info = detector.decode(gray, points);
if (!info.empty()) {
polylines(frame, points, true, Scalar(0, 0, 255), 2);
cout << "Decoded Data : " << info << endl;
}
}
imshow("frame", frame);
waitKey(0);
return 0;
}
결과화면
오류
출처
https://kkokkal.tistory.com/1332
반응형
'OpenCV > OpenCV C++' 카테고리의 다른 글
C++ OpenCV OMR인식 (0) | 2021.02.03 |
---|---|
C++ OpenCV Labeling (0) | 2021.01.20 |
C++ OpenCV Transformation (0) | 2021.01.18 |
C++ OpenCV Segmentation and Labelging (0) | 2021.01.11 |
C++ OpenCV 컬러 흑백 이미지 Histogram(히스토그램) (0) | 2021.01.08 |