What image formats other than “Y800” does zbar::Image::Image() accept?

有些话、适合烂在心里 提交于 2020-01-14 13:17:08

问题


The documentation for zbar::Image::Image() doesn't say anything about the accepted image formats:

zbar::Image::Image ( unsigned width = 0, unsigned height = 0, const std::string & format = "", const void * data = NULL, unsigned long length = 0 ) [inline] constructor.

create a new Image with the specified parameters

Since format is a string, not an enum, I can't know the possible values. The only value I know is Y800 from the scan_image.cpp sample that comes with zbar:

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

Are there any other possible values? Also does it matter if I've compiled it without ImageMagick support (I passed --without-imagemagick to ./configure)?

Edit: I found another possible format mentioned in an answer to another question:

By the Way : zbar Accepts GRAY format too..


回答1:


Digging through the library code, the supported fourcc formats depend on what video capture api you need to use:

  • zbar/video/v4l1.c, Video4Linux, v4l1_formats[] lists GREY, HI24 (HI240), RGBP (RGB565), BGR3 (RGB24), BGR4 (RGB32), RGBO (RGB555), YUY2 (YUV422), YUYV, UYVY, Y41P (YUV411), 422P (YUV422P), 411P (YUV411P), YU12 (YUV420P), YUV9 (YUV410P).

  • zbar/video/vfw.c, Video for Windows, vfw_formats[] lists I420, YV12, NV12, UYVY, YUY2, BGR3, BGR4, YVU9, GREY, Y800, JPEG.

Surely more than you'd like to see, it is also going to depend on what the camera can supply. You'll no doubt have to make this a config setting.



来源:https://stackoverflow.com/questions/33142837/what-image-formats-other-than-y800-does-zbarimageimage-accept

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