Optical Flux Measurement and Image Gamma/Linearity

1 view (last 30 days)
I'm working on a method for characterizing the flux distribution using images and a flux sensor. I'm struggling with the image processing and I am unsure if linearity is being maintained. I'm using a Cannon 600D camera and shooting in RAW.
As I understand, RAW files should have a linear gamma (edit: or rather, the sensor itself has a linear response to light intensity). However, I get confused when I'm converting the RAW file to grayscale .TIF file as to whether or not I am maintaining the linearity in the pixel values. The post-processing for my RAW files has been carried out as follows
  1. Using Darktable, reduce RAW image saturation to 0, set input color profile to "Standard Color Matrix", and set output color profile to "Linear Rec2020 RGB
  2. Export as uncompressed 16-bit TIF (1 channel).
  3. Make perspective adjustment in photoshop (my images cannot be taken perpendicular to flux's target plane).
  4. Save again as 16-bit TIF.
  5. Use in MATLAB.
Where I'm concerned is, that when viewing my images at different stages in the process using the windows viewer, they are clearly being displayed with a different gamma after being put through photoshop. Below is an example of the same image viewed in windows photos as a RAW file, after processing in darktable, and after taking the darktable file and putting it into photoshop and saving it again without doing anything else. When I take the image from darktable and put it into photoshop, it also tells me that the ICC profile is invalid. However, to make things more confusing, the images after processing in darktable and photoshop look identical when viewed in MATLAB (the gamma appears to be the same as in the photoshop image). Furthermore, if I use imabsdif between the darktable and photoshop images in MATLAB, the maximum difference is just 1, meaning the pixel values are essentially the same. I'm not entirely sure how ICC profiles work but does this mean the file after saving in photoshop has a profile attached to it which tells the monitor to display it differently despite pixel values remaining the same? Or is there something else that causes the images to appear differently?
Does anybody who understands gamma correction and color profiles better know how to ensure that the .tif file going into MATLAB maintains the linearity from the camera sensor? If so, is my process fine for this purpose or should I do something differently?
If somebody has a different technique for going from RAW -> photoshop -> MATLAB while maintaining linearity I would love to hear it (for example if you use a different program instead of darktable).

Answers (1)

Max Enrique Vásquez Tapia
dear did you find any solution?


Find more on Image Processing Toolbox in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!