I am trying to convert an QImage into ZBar image but not able to do it successfully so far. My QImage is with RGB32 format(Attached)
And I am instantiating ZBar as in the below snapshot code:
QImage qimg("/Users/apple/Pictures/image_0027.jpg");
zbar::Image image(qimg.width(), qimg.height(),
"Y800",
const_cast<uchar*>(qimg.bits()),
qimg.bytesPerLine());
zbar::ImageScanner scanner;
scanner.set_config(zbar::ZBAR_NONE, zbar::ZBAR_CFG_ENABLE, 0);
scanner.set_config(zbar::ZBAR_QRCODE, zbar::ZBAR_CFG_ENABLE, 1);
int n = scanner.scan(image);
qDebug() << "n = " << n;
I always see the value of n as 0. Not sure what else we can do. Can someone suggest? Thank you.
Tried converting the formats as well but since ZBar only accepts gray space we are limited there. Also tried changing qimg.bytesPerLine() to qimg.widht()*qimg.height()(as we do with cv::Mat) but to no avail.