% % verifyInverseGamma.m % % make sure the inverse gamma correction works % sonyControl = imread('sony/psn00001.bmp'); olympusControl = imread('olympus/PIC00001.bmp'); sonyCorrected = inverseGammaCorrectionImage(sonyControl, 'sony'); olympusCorrected = inverseGammaCorrectionImage(olympusControl, 'olympus'); sonyCorrectedColors = getMacbethColors(sonyCorrected); olympusCorrectedColors = getMacbethColors(olympusCorrected); load reflectance600; graySeries = 19:24; sonyCorrectedGrays = sonyCorrectedColors(:,graySeries); olympusCorrectedGrays = olympusCorrectedColors(:,graySeries); sonyCorrectedGrayIntensities = (sonyCorrectedGrays(1,:)+sonyCorrectedGrays(2,:)+sonyCorrectedGrays(1,:))/3; olympusCorrectedGrayIntensities = (olympusCorrectedGrays(1,:)+olympusCorrectedGrays(2,:)+olympusCorrectedGrays(1,:))/3; figure; plot(reflectance600, sonyCorrectedGrayIntensities, 'bo'); title('Inverse gamma corrected plot for Sony camera'); xlabel('reflectance at 600nm'); ylabel('Average RGB'); figure; plot(reflectance600, olympusCorrectedGrayIntensities, 'ko'); title('Inverse gamma corrected plot for Olympus camera'); xlabel('reflectance at 600nm'); ylabel('Average RGB');