OpenCV/OpenCV C++
C++ OpenCV QRcode scanner
hoya_315
2021. 1. 26. 00:46
반응형
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 4.0 Beta 릴리즈와 QR 코드 해석기
OpenCV 4.0 Beta release and QR code decoder 엊그제 OpenCV 4.0 Beta 버전이 릴리즈되었습니다. OpenCV 4.0 Beta 버전은 아래 링크에서 다운로드 받을 수 있습니다. https://github.com/opencv/opencv/releases..
kkokkal.tistory.com
반응형