using opencv instead of imagemagick in zbar qr code decoder

走远了吗. 提交于 2019-12-05 04:45:48

问题


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

来源:https://stackoverflow.com/questions/9190687/using-opencv-instead-of-imagemagick-in-zbar-qr-code-decoder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!