Open an image file containing minimally processed linear RGB intensities.
A = imread('foosballraw.tiff');
The image data is the raw sensor data after correcting the black level and scaling to 16 bits per pixel. Interpolate the intensities to reconstruct color by using the demosaic function. The color filter array pattern is RGGB.
A_demosaiced = demosaic(A,'rggb');
Display the image. To shrink the image so that it appears fully on the screen, set the optional initial magnification to a value less than 100.
figure
imshow(A_demosaiced,'InitialMagnification',25)
title('Sensor Data Without sRGB Gamma Correction')
The image appears dark because it is in the linear RGB color space. Apply gamma correction to the image according to the sRGB standard, storing the values in double precision.
A_sRGB = lin2rgb(A_demosaiced,'OutputType','double');
Display the gamma-corrected image, setting the optional magnification.
figure
imshow(A_sRGB,'InitialMagnification',25)
title('Sensor Data With sRGB Gamma Correction');
The gamma-corrected image looks brighter than the linear image, as expected.