資源簡介
test_opencv.cpp
代碼片段和文件信息
#include?
#include?“opencv.hpp“
#include?“zbar.h“
using?namespace?std;
using?namespace?cv;
using?namespace?zbar;
void?utf8ToGB2312(string?utf?string&?gb)??
{?
//just?for?windows??
int?len?=?MultiByteToWideChar(CP_UTF8?0?utf.c_str()?-1?NULL?0);??
wchar_t*?wstr?=?new?wchar_t[len+1];??
memset(wstr?0?len+1);??
MultiByteToWideChar(CP_UTF8?0?utf.c_str()?-1?wstr?len);??
len?=?WideCharToMultiByte(CP_ACP?0?wstr?-1?NULL?0?NULL?NULL);??
char*?str?=?new?char[len+1];??
memset(str?0?len+1);??
WideCharToMultiByte(CP_ACP?0?wstr?-1?str?len?NULL?NULL);??
if(wstr)??
delete[]?wstr;??
gb?=?str;??
delete[]?str;??
}??
int?StartQRCodeAnalysis()
{
ImageScanner?scanner;
scanner.set_config(ZBAR_NONE?ZBAR_CFG_ENABLE?1);
CvCapture*?capture;???
capture?=cvCaptureFromCAM(0)?;
IplImage*?frame;
IplImage*?frame_gray;
frame?=?cvQueryframe(?capture?);
cvNamedWindow(“Webcam“0);
string?str;
while?(1)
{
評論
共有 條評論