Convert to Bayer Format

Image sample files are everywhere, but files in Bayer format are not easy to find. Actually I didn’t have one until we ordered a GeniCam camera. Therefore I made this tool to convert to Bayer formatted files.

Bayer files (I name it .bay) hold one or more raw Bayer frames, like .yuv in the sense that neither of them contains meta data. I convert to .bay with Opencv SDK. OpenCV has functions to convert from Bayer to other format, e.g. CV_BayerRG2RGB, but no support for conversion the other way. Therefore I manipulate the bytes manually, in MatToMatOrBits_MatToBits in gui.cpp in the download link below.

Command line to run the tool, mux.exe, to convert to*.bay:

  1. from .jpg: converts to .bay picture: mux.exe –FileIn pic.jpg –FileOut pic.bay –Action 2
  2. from .mp4: it also converts to .bay video, which only means multiple frames one after another: mux.exe –FileIn video.mp4 –FileOut video.bay –Action 1

Source code and executable:

Runtime DLLs required: Visual Studio 2015 Debug x64, OpenCV 2.4 for VC14

Comments are closed.
%d bloggers like this: