0

I have a raw-12 image file . I want to read this using c++ into 2-d array . but i don't understand the the basic picture of raw-12 file that how pixels are really arranged in it. can anyone help ?

6
  • 3
    Off-topic because this is a problem concerning programming and data structures, not photography. – xiota Aug 30 '18 at 21:32
  • 1
    Hi, welcome to Photo.SE! Is there some special processing of raw files that you need to accomplish, that existing tools or libraries can't do for you? As currently asked, your question is not really on topic here at Photo.SE. We are not a programming-oriented Stack Exchange site. – scottbb Aug 30 '18 at 22:38
  • @xiota , actually i am asking abhout the basic picture of raw-12 file , like how pixels are arranged in it and how demosacising happens . In that link of yours we are taking it in array , and i know that but i don't understand why as i don't understand the configuration of raw-12 – Devendra shaktawat Aug 31 '18 at 3:19
  • 1
    In photography today, generally the RAW formats we work with are manufacturer-specific, like PEF, CR2, NEF, RAF, etc. Working with low-level RAW formats at the file level seems like it's out of the general scope of photography. – mattdm Aug 31 '18 at 16:50
1

The term Raw-12 generally means 12-bits per pixel element and raw is the pixel sensor value.

On top of this if you're dealing with a color sensor, each element is only 1-color, with the color pattern distribution or mosaic dependent upon the device or camera. Typically a "Bayer" pattern is used, but not always, and the color phase varies.

Commercial cameras generally also compress the raw data and insert metadata.

As far as I know, the exact pixel layout definition is not part of a standard but you may be able to extract it from the meta data.

I assume this is a programming assignment for you, because there are already entire suites of software to handle this for commercial cameras.

4
  • Each element of a bayer masked sensor is not only one color. Just look at the sensitivity curves of any Bayer masked sensor. The values in a raw file are monochrome luminance values. In effect what we have with a raw file is three B&W photos. Half the pixels are a B&W photo taken with a green filter in front of it (but non-green objects are still detected, they're just darker than they otherwise would be), one quarter of the pixels are a B&W photo with a violet-blue filter, and one-quarter are a B&W photo with a yellow-orange filter (no, the 'red' filter in Bayer arrays is not really red). – Michael C Aug 31 '18 at 18:05
  • Please see RAW files store 3 colors per pixel, or only one? and Why are Red, Green, and Blue the primary colors of light? and Why don't mainstream sensors use CYM filters instead of RGB? The three color filters for most Bayer masked "RGB" cameras are really 'blue-with a touch of violet', 'Green with a touch of blue', and somewhere between 'Yellow with a touch of green' (which mimics the human eye the most) and 'Yellow with a lot of orange'. – Michael C Aug 31 '18 at 18:15
  • Yes I understand that each color filter is not an impulse function or even an optical notch filter. My use of "1-color" referred to one color filter without attempting to address bandwidth and spectral response. Those details, while interesting, were not pertinent to the question. – user10216038 Aug 31 '18 at 19:42
  • I tend to think that the use of 'one color' leads to the misconception that the color filters on Bayer arrays exactly equate to the 'red', 'green', and 'blue' channels of our output devices, and that is simply not true. For each photosite in a raw file, the monochromatic luminance values must be converted to RGB values for all three color channels. The green filtered pixels, for instance, do not necessarily keep the same value in the green channel as the initial monochromatic value for those pixels. – Michael C Sep 1 '18 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.