-
From what I can see, it looks like zxing-cpp does not support 16bit depth images, in either LUM/greyscale or RGB/BGR. If this is the case, does anyone have any suggestions on how to preserve the fidelity of the data when sending it to zxing? If this is not the case, can someone show me how to pass in a 16 bit depth image? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You are right: 16bit images are not (directly) supported. There is nothing to worry about with respect to lost fidelity. I highly recommend you convert your 16 bit images outside of zxing-cpp into an 8bit image and use that. That said, you can setup an const uint16_t* data; // greyscale 16 bit image data
int w, h;
auto iv = ImageView(reinterpret_cast<const uint8_t*>(data), w, h, ImageFormat::Lum, 2 * w, 2); The last |
Beta Was this translation helpful? Give feedback.
-
Thanks! I will convert my image externally using OpenCV. |
Beta Was this translation helpful? Give feedback.
You are right: 16bit images are not (directly) supported. There is nothing to worry about with respect to lost fidelity. I highly recommend you convert your 16 bit images outside of zxing-cpp into an 8bit image and use that.
That said, you can setup an
ImageView
object that treats your 16bit data as 8bit data:The last
2
is the pixel stride, i.e. how many bytes need to be moved forward to get to the next pixel. You need to change the above code if you are not on an Intel architecture (byte order).