RAW Image file - what format is my data in?

孤者浪人 提交于 2019-12-21 04:06:40

问题


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.


回答1:


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

http://www.cybercom.net/~dcoffin/dcraw/

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




回答2:


The other answers are correct, RAW is not a standard, it's shorthand. Camera CCDs often do not have separate red, green and blue pixels for each pixel, instead, they will use what's called a Bayer Pattern and then only save the pixel values for that pattern. Then, you will need to convert that pattern to rgb values.

Also, for the bonus question, if you are simply trying to convert a RGB image to grayscale, or something like that, you can either use the matrix operators, or call convertTO




回答3:


Forgot what the R/G/B of 16-bit was:

"there can be 5 bits for red, 6 bits for green, and 5 bits for blue"

http://en.wikipedia.org/wiki/Color_depth#16-bit_direct_color

Seen it used in game code before.

Complete shot in the dark though being as there are also proprietary RAW formats.



来源:https://stackoverflow.com/questions/6539047/raw-image-file-what-format-is-my-data-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!