資源簡(jiǎn)介
用opencv cv::mat 打開圖片,應(yīng)用zbar解析二維碼圖片,測(cè)試用例,效果不錯(cuò)
代碼片段和文件信息
/////////////////////////////////////////////////////////////////////////
//
//?simpletest.cpp?--a?part?of?libdecodeqr
//
//?Copyright(C)?2007?NISHI?Takao?
//???????????????????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?
#include?
#include?
#include?
#include?
#include?
?
using?namespace?std;
using?namespace?cv;
using?namespace?zbar;
int?main(int?argcchar?*argv[])
{
????Mat?src?=?imread(“12.bmp“0);
//?create?a?reader
ImageScanner?scanner;
//?configure?the?reader
scanner.set_config(ZBAR_NONE?ZBAR_CFG_ENABLE?1);
//?obtain?image?data
?
const?void?*raw?=?NULL;
int?width=src.cols;??
int?height=src.rows;???
raw?=?src.data;
//CvMat?*cv_matrix?=?cvLoadImageM(“12.jpg“CV_LOAD_IMAGE_GRAYSCALE);
//int?width?=?cv_matrix->width;
//int?height=?cv_matrix->height;
//raw?=?(char*)cv_matrix->data.ptr;
//?wrap?image?data
zbar::Image?image(width?height?“Y800“?raw?width?*?height);
//?scan?the?image?for?barcodes
int?n?=?scanner.scan(image);
std::string?strTemp=““;
//?extract?results
for(Image::SymbolIterator?symbol?=?image.symbol_begin();
symbol?!=?image.symbol_end();
++symbol)?{
//?do?something?useful?with?results
strTemp?=strTemp?+symbol->get_data()+“;“;
cout?<“decoded?“?<get_type_name()
<“?symbol?\““?<get_data()?<‘“‘?< }
//?clean?up
image.set_data(NULL?0);
cvWaitKey(0);??
????return(0);
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????23484??2006-10-09?15:57??simple\01-1.jpg
?????文件?????270054??2014-12-06?22:05??simple\12.bmp
?????文件??????30555??2014-12-07?00:45??simple\12.jpg
?????文件????1234657??2012-09-14?19:01??simple\Debug\libiconv-2.dll
?????文件?????902606??2012-10-31?21:14??simple\Debug\libzbar-0.dll
?????文件?????526336??2014-12-07?11:58??simple\Debug\simple.exe
?????文件???????5675??2012-10-31?21:14??simple\include\zbar\Decoder.h
?????文件???????4617??2012-10-31?21:14??simple\include\zbar\Exception.h
?????文件???????8847??2012-10-31?21:14??simple\include\zbar\Image.h
?????文件???????3756??2012-10-31?21:14??simple\include\zbar\ImageScanner.h
?????文件???????7195??2012-10-31?21:14??simple\include\zbar\Processor.h
?????文件???????4197??2012-10-31?21:14??simple\include\zbar\Scanner.h
?????文件??????12718??2012-10-31?21:14??simple\include\zbar\Symbol.h
?????文件???????4457??2012-10-31?21:14??simple\include\zbar\Video.h
?????文件???????3734??2012-10-31?21:14??simple\include\zbar\Window.h
?????文件??????53970??2012-10-31?21:14??simple\include\zbar.h
?????文件???64487424??2014-12-07?11:58??simple\ipch\simple-7a4c416\simple-32f145a0.ipch
?????文件????1234657??2012-09-14?19:01??simple\lib\libiconv-2.dll
?????文件???????3005??2012-10-31?21:14??simple\lib\libzbar-0.def
?????文件?????902606??2012-10-31?21:14??simple\lib\libzbar-0.dll
?????文件??????33374??2012-10-31?21:14??simple\lib\libzbar-0.lib
?????文件????1234657??2012-09-14?19:01??simple\libiconv-2.dll
?????文件?????902606??2012-10-31?21:14??simple\libzbar-0.dll
?????文件???????1754??2014-12-07?11:52??simple\simple.cpp
?????文件????????798??2006-11-19?04:09??simple\simple.dep
?????文件???????4260??2006-11-19?04:09??simple\simple.dsp
?????文件????????758??2006-11-19?04:09??simple\simple.dsw
?????文件???????4333??2006-11-26?15:39??simple\simple.mak
?????文件???????1079??2014-12-07?11:19??simple\simple.sln
????..A..H.?????22016??2014-12-07?11:59??simple\simple.suo
............此處省略13個(gè)文件信息
評(píng)論
共有 條評(píng)論