simpletest.cpp

来自「QR二维码的译码C语言代码实现。希望大家能够一起学习。呵呵」· C++ 代码 · 共 71 行

CPP
71
字号
///////////////////////////////////////////////////////////////////////////// simpletest.cpp --a part of libdecodeqr//// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>//                   JMA  (Japan Medical Association)//                   NaCl (Network Applied Communication Laboratory Ltd.)//// This is free software with ABSOLUTELY NO WARRANTY.// You can redistribute and/or modify it under the terms of LGPL.//// $Id: simpletest.cpp 39 2007-02-23 22:30:08Z zophos $//#include <stdio.h>#include <highgui.h>#include "../../libdecodeqr/decodeqr.h"int main(int argc,char *argv[]){    cvNamedWindow("src",1);    //    // load image    //    IplImage *src=cvLoadImage(argv[1],1);    cvShowImage("src",src);    //    // show version info    //    printf("libdecodeqr version %s\n",qr_decoder_version());    //    // initialize    //    QrDecoderHandle decoder=qr_decoder_open();    //    // do decode using default parameter    //    short stat=qr_decoder_decode_image(decoder,src);    printf("STATUS=%04x\n",stat);    //    // get QR code header    //    QrCodeHeader header;    if(qr_decoder_get_header(decoder,&header)){        //        // get QR code text        // To null terminate, a buffer size is larger than body size.        //        char *buf=new char[header.byte_size+1];        qr_decoder_get_body(decoder,(unsigned char *)buf,header.byte_size+1);        printf("%s\n",buf);    }    //    // finalize    //    qr_decoder_close(decoder);    puts("");    puts("Hit any key to end.");    cvWaitKey(0);    cvDestroyAllWindows();    cvReleaseImage(&src);    return(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?