OpenCV(C++)第一章课后作业

OpenCV(C++)第一章课后作业

检测二维码提取其中数据并画框

#include 
#include 

using namespace std;
using namespace cv;

int main(int argc,char** argv)
{
    Mat QR = imread("./test.jpg");
    Size size = Size(QR.cols/4, QR.rows/4);
    resize(QR, QR,size, INTER_LINEAR);
    QRCodeDetector qr;
    vector list,test;
    /*if (!qr.detect(QR, list))
        return -1;
    for (auto w : list)
        cout << w << endl;
    line(QR, list[0], list[1], Scalar(255,0,0), 3);
    line(QR, list[0], list[3], Scalar(255, 0, 0), 3);
    line(QR, list[1], list[2], Scalar(255, 0, 0), 3);
    line(QR, list[2], list[3], Scalar(255, 0, 0), 3);
    Mat b = cv::Mat::zeros(cv::Size(640, 480), CV_8UC3);*/
    Point origin;
    origin.x = QR.cols/16;
    origin.y = QR.rows/4;
    double fontScale = 0.35;
    string text=qr.detectAndDecode(QR, test);
    cout << text << endl;
    cout << text.length()<

你可能感兴趣的:(opencv,c++,python)