Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

Convert from RGBP or BAYER to BGR?

0 votes

How would one convert RGBP or BAYER to openCV BGR in C++?

I'm aware of functions such as jevois::rawimage::convertToCvBGR(), and jevois::rawimage::convertCvBGRtoRawImage() for converting YUYV to BGR, but it doesn't seem to work for RGBP or BAYER. When I attempt it, I get "Caught std::exception [FTL RawImage::require: Incorrect format for RawImage input: want 640x480 YUYV but image is 640x480 RGGB"

asked May 10, 2018 in Programmer Questions by unswniarc (360 points)

1 Answer

+1 vote
 
Best answer
convertToCvBGR() should work with any of the pixel formats supported by our sensor, including RGBP and BAYER.

Your error is coming from require() which is probably in your top-level module code, just before you do the conversion. require() is used to enforce that the camera (or USB output) format has some specific specs so that the module code does not have to be too complex. For example, often we only support YUYV so that we can use the drawing functions that only work with YUYV.

Indeed, have a look at the image format conversion module at http://jevois.org/doc/ModuleTutorial.html

That one works with all possible camera pixel types. It has no require() call on the inimg. See require() here for more info: http://jevois.org/doc/RawImage_8H_source.html
answered May 11, 2018 by JeVois (46,580 points)
selected May 11, 2018 by unswniarc
...