資源簡介
opencv+zbar識別二維碼
代碼片段和文件信息
#include?“zbar.h“
#include?“opencv.hpp“?
#include?“opencv2/highgui.hpp“
#include?“opencv2/highgui/highgui_c.h“
#include?“opencv2/imgproc/types_c.h“
#include?“opencv2/imgproc.hpp“
#include??
#include?“fstream“
using?namespace?std;
using?namespace?zbar;??//添加zbar名稱空間??????
using?namespace?cv;
int?main(int?argc?char*argv[])
{
VideoCapture?VC(0);
while?(true)
{
ImageScanner?scanner;
scanner.set_config(ZBAR_NONE?ZBAR_CFG_ENABLE?1);
Mat?image;
VC.read(image);
imshow(“Source?Image“?image);
if?(!image.data)
{
cout?<“請確認攝像頭正確采集“?< system(“pause“);
return?0;
}
Mat?imageGray;
cvtColor(image?imageGray?CV_RGB2GRAY);
int?width?=?imageGray.cols;
int?height?=?imageGray.rows;
uchar?*raw?=?(uchar?*)imageG
- 上一篇:編譯原理LLLRSLR作業集錦
- 下一篇:c++ 車輛牌照檢測
評論
共有 條評論