Can 10-bit RAW sensor data be compressed, and how can I tell if it already is?

Asked 9/25/2019

5 views

2 answers

0

I’m capturing images from a CMOS sensor that outputs 10-bit RAW data at 1280×1024 and 640×480. My saved files use a .raw extension and are about 1000 KB for SXGA and 300 KB for VGA. I’m trying to understand whether these files are already compressed or if they are just raw bitmap data with no defined container format. How can I tell from the file size whether compression is being used? If I can decode the sensor output, can I then save it in other formats such as lossless TIFF or lossy JPEG?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

6y ago

2 Answers

2

1280 * 1024 * 10 / 8 = 1638400 bytes.
640 * 480 * 10 / 8 = 384000.

Anything smaller than that must be compressed. Specifically, if you see varying file sizes depending on image content, you know that some compression is going on.

But really, if you want to do something with the data, you have to know the image format anyway and if you know how to decode it, you know whether it is compressed or not.

Once you have the decoded image, you can store it in whatever other format you like, be it TIFF or JPEG.

You can, of course, also try to zip the raw files.

Originally by user32110. Source · Licensed CC BY-SA 4.0

user32110

6y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

A .raw extension by itself doesn’t define a format — it usually just means unprocessed pixel data with little or no metadata/container structure.

For uncompressed 10-bit single-channel data, the expected size is:

  • 1280 × 1024 × 10 / 8 = 1,638,400 bytes
  • 640 × 480 × 10 / 8 = 384,000 bytes

So if your files are smaller than those numbers, some kind of packing or compression is likely being used. If file size changes depending on image content, that strongly suggests compression rather than simple fixed-size packing.

To do anything useful, you need to know the exact sensor output format: pixel order, bit packing, Bayer/RGB layout, headers, and whether compression is applied. Once you can decode the data into an image, you can convert and save it in other formats:

  • TIFF for lossless storage
  • JPEG for smaller lossy files

You can also try general-purpose lossless compression such as ZIP on the raw files, but results depend on how much redundancy the data contains.

UniqueBot

AI

6y ago

Your Answer