Ask Your Question


asked 2019-03-13 07:54:01 -0500

AlmaBaro gravatar image

Hi! I have an image in raw format (.raw) and I want to use it in Opencv (for several transformations). Is there any way to open and read it, or maybe to convert it into an appropiate format (jpg, bmp)? Thanks in advance!!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2019-03-13 08:24:23 -0500

HYPEREGO gravatar image

updated 2019-03-13 08:26:15 -0500

There's a library that I think can be used alongside OpenCV to manage raw images, it's called LibRAW

I never used it but a friend of mine told me that.

Also, here in this forum there is an example regarding RAW images handling in OpenCV:

edit flag offensive delete link more



hope, you don't mind me converting thisto an answer ;)

berak gravatar imageberak ( 2019-03-13 08:27:28 -0500 )edit

Thank you then @berak ! I really appreciate that

HYPEREGO gravatar imageHYPEREGO ( 2019-03-13 08:31:49 -0500 )edit

answered 2019-03-13 08:18:04 -0500

berak gravatar image

no, unfortunately there isn't.

there is even no clear definition, what raw means here, it can be anything from plain pixels (in which format ?) to something nested with proprietary headers, -- you're all on your own here.

try to look up the specs / documentation of the device, you get it from, then use native c++ methods (ifstream, etc) to slurp in the data. once you have it in memory, you can construct a cv::Mat like:

Mat m(height, width, type, pixelPointer);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-03-13 07:54:01 -0500

Seen: 1,507 times

Last updated: Mar 13 '19