RAW 图像文件 - 我的数据是什么格式?

发布于 2024-11-17 17:18:16 字数 178 浏览 1 评论 0原文

我正在处理 .raw 图像文件,但我不确定图像是如何存储的。每个像素都是无符号的 16 位值,典型值范围从 0 到大约 1000(整数形式)。这对于十六进制值来说不够位,而且它不是 RGB (0-255),所以我不太确定它是什么。

奖励:如果您知道如何在 OpenCV 中将其转换为灰度(或只是数学上的),那也会有很大的帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏雨凉 2024-11-24 17:18:16

RAW 这个名称源自这样一个事实:文件中存储的值不是像素 RGB 值,而是从相机本身测量的原始值。仅当您了解相机的工作原理时,这些值才有意义。有一些标准,但实际上,您应该将 RAW 视为定义不明确、未记录的专有格式的集合,这些格式可能不会直观地符合您对图像存储方式的任何想法。

查看 DCRaw——几乎所有支持 RAW 的程序都使用它的代码

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

作者对几乎所有专有 RAW 格式进行了逆向工程和实现,并使其保持最新。

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.

一直在等你来 2024-11-24 17:18:16

其他答案是正确的,RAW不是标准,它是简写。相机 CCD 通常每个像素没有单独的红色、绿色和蓝色像素,相反,它们将使用所谓的 拜耳模式,然后仅保存该模式的像素值。然后,您需要将该模式转换为 RGB 值。

另外,对于额外的问题,如果您只是想将 RGB 图像转换为灰度图像或类似的图像,您可以使用矩阵运算符,或调用 convertTO

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

别在捏我脸啦 2024-11-24 17:18:16

忘记了 16 位的 R/G/B 是什么:

“红色可以有 5 位,绿色可以有 6 位,蓝色可以有 5 位”

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

之前在游戏代码中看到过它的使用。

尽管也有专有的 RAW 格式,但在黑暗中完成拍摄。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文