基本信息
源码名称:C实现二维码识别
源码大小:19.58M
文件格式:.rar
开发语言:C/C++
更新时间:2021-04-10
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


/**********************************************************手动输入图片路径识别二维码

#pragma once
#include "zbar.h"      

#include <opencv2/opencv.hpp>

#include <highgui.hpp>
#include <opencv2/imgproc/types_c.h>
#include <iostream>      



using namespace std;

using namespace zbar;  //添加zbar名称空间    

using namespace cv;



int main(int argc, char*argv[])

{

	ImageScanner scanner;

	scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);

	Mat image = imread("C:\\Users\\Administrator\\Desktop\\Project1\\Project1\\11.jpg");

	if (!image.data)

	{

		cout << "请确认图片" << endl;

		system("pause");

		return 0;

	}

	Mat imageGray;

	cvtColor(image, imageGray, CV_RGB2GRAY);

	int width = imageGray.cols;

	int height = imageGray.rows;

	uchar *raw = (uchar *)imageGray.data;

	Image imageZbar(width, height, "Y800", raw, width * height);

	scanner.scan(imageZbar); //扫描条码    

	Image::SymbolIterator symbol = imageZbar.symbol_begin();

	if (imageZbar.symbol_begin() == imageZbar.symbol_end())

	{

		cout << "查询条码失败,请检查图片!" << endl;

	}

	for (; symbol != imageZbar.symbol_end();   symbol)

	{

		cout << "类型:" << endl << symbol->get_type_name() << endl << endl;

		cout << "条码:" << endl << symbol->get_data() << endl << endl;

	}

	imshow("Source Image", image);

	waitKey();

	imageZbar.set_data(NULL, 0);

	return 0;

}

【源码目录】

二维码1

├── Project1.exe
├── libiconv.dll
├── libzbar64-0.dll
├── opencv_world452d.dll
└── 二维码.txt

0 directories, 5 files