Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RAW Image file - what format is my data in?

I'm working on processing .raw image files, but I'm not sure how the image is being stored. Each pixel is a unsigned 16-bit value, with typical values ranging from 0 to about 1000 (in integer form). This isnt enough bits for hex values, and its not RGB (0-255) so I'm not quite sure what it is.

Bonus: if you have any idea on how to convert this to grayscale in OpenCV (or just mathematically) that would be a huge help too.

like image 868
andrw Avatar asked Jun 30 '11 17:06

andrw


1 Answers

The name RAW comes from the fact that the values stored in the file are not pixel RGB values, but the raw values that were measured from the camera itself. The values have meaning only if you know how the camera works. There are some standards, but really, you should just consider RAW to be a collection of poorly defined, undocumented, proprietary formats that probably won't intuitively match any idea you have about how images are stored.

Check out DCRaw -- it's the code that nearly every program that supports RAW uses

https://www.dechifro.org/dcraw/

The author reverse-engineered and implemented nearly every proprietary RAW format -- and keeps it up to date.

like image 133
Lou Franco Avatar answered Sep 19 '22 01:09

Lou Franco