在zbar二维码解码器中使用opencv代替imagemagick
我正在使用 Zbar api 编写一个二维码解码器。我正在使用 Windows 预建库。我使用以下代码将图像加载到 ZBar
IplImage *src=cvLoadImage("image.png",CV_LOAD_IMAGE_GRAYSCALE);
ImageScanner scanner;
scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);
int width = src->width;
int height = src->height;
uchar* raw = (uchar *)(src->imageData);
Image image(width, height, "Y800", raw, width * height);
int n = scanner.scan(image);
但无法解码图像。我是否使用正确的方法使用 opencv 读取图像数据? 。当我只测试一张图像时,所有其他图像均已解码并失败。但当我使用 zbarimg 命令行选项时它运行良好
I am writing a qr code decoder using Zbar api. I am using windows pre built libraries . I used the following code to load the image to ZBar
IplImage *src=cvLoadImage("image.png",CV_LOAD_IMAGE_GRAYSCALE);
ImageScanner scanner;
scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);
int width = src->width;
int height = src->height;
uchar* raw = (uchar *)(src->imageData);
Image image(width, height, "Y800", raw, width * height);
int n = scanner.scan(image);
But it failed to decode the image. Am I using the correct way to read image data using opencv ? . When I tested only one image decoded and failed for all others . But it is working well when I used the zbarimg command line option
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论