Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

zbar

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 "GREY" format too...

like image 704
sashoalm Avatar asked Oct 15 '15 07:10

sashoalm


1 Answers

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.

like image 52
Hans Passant Avatar answered Nov 01 '22 15:11

Hans Passant