This document will show you how to gamut map an image of your choice based on the HP Indigo press gamut. It will take you about 1 hr to generate a gamut mapped image (run on ECN server & image size 1255x1255) though one step may take a longer time. Before you run the program, 1. Create a folder named GamutMapping and put all .m MATLAB files inside it 2. Inside GamutMapping folder: 1. Create a folder named input and put musicians.tif into input folder 2. Create a folder named data and put IndigoGamut.mat and np8_ycxcz_measured.mat into data folder 3. Create a folder named output 4. Create a folder named hueSlicePlots inside output folder To run this program, first change directory to GamutMapping folder in MATLAB Second, follow the commands below 1. run rgb2ycxcz('musicians.tif') in MATLAB command window 2. run preprocessGamutPlot in MATLAB command window 3. run gamutMappingStep0 in MATLAB command window 4. run softCompressLightness in MATLAB command window Please note that this step will take about 40 mins (run on ECN server) for the musicians image, large image may take a longer time. 5. run gamutMappingStep1 in MATLAB command window 6. run gamutMappingStep2 in MATLAB command window 7. run gamutMappingStep3 in MATLAB command window 8. run gamutMappingStep4 in MATLAB command window 9. run afterProcessGamutPlot in MATLAB command window 10. run ycxcz2rgb('musiciansGM.tif') in MATLAB command window Output results and plots are in /output folder. Functions description: 1. rgb2ycxcz transforms an sRGB image into XYZ to YyCxCz color space based on HP Indigo white point and find all unique YyCxCz values to avoid duplicate computation during gamut mapping process. input: your choice of image output: data/imgYyCxCzUnique.mat Unique image pixel values in YyCxCz data/ic.mat Index vector from unique function data/imgSize.mat row col l Image size 2. preprocessGamutPlot allows you to display 1. HP Indigo press gamut, called destination gamut in YyCxCz color space 2. image gamut, called source gamut in YyCxCz color space 3. Destination gamut and source gamut in one plot 4. Yy vs. Cx plot 5. Cx vs. Cz plot output: output/gamut_dest.png Destination gamut output/gamut_src_beforeGamutMapping.png Source gamut output/gamut_src_dest_beforeGamutMapping.png Source and Destination gamut output/gamut_src_dest_beforeGamutMapping Yy vs. Cx view.png Yy vs. Cx plot output/gamut_src_dest_beforeGamutMapping Cx vs. Cz view.png Cx vs. Cz plot 3. gamutMappingStep0 shifts and rotates source and destination gamut to align with Yy axis and computes lightness, hue, and chroma of source and destination gamut. Also it allows you to display 2D hue sectors view before any compression. output: output/plots/ folder 2D Hue sector view plots without any compression 4. softCompressLightness compresses source lightness into destination gamut lightness with lambda=2/3. Please note that this step will take about 40 mins for the musicians image, large image may take a longer time. output: data/imgYyCxCzUniqueCmpL.mat Soft compressed lightness/Yy 5. gamutMappingStep1 shifts and rotates source and destination gamut to align with Yy axis and computes lightness, hue, and chroma of source and destination gamut. Also it allows you to display 2D hue sectors view after soft compress lightness. output: data/keyInfo.mat Information about source and destination gamut output/plots/ folder 2D Hue sector view plots after soft compress lightness 6. gamutMappingStep2 uses soft compression with lambda=2/3 to compress any source pixels that are outside of bounding cylinder into bounding cylinder which is done by 5 degree hue sector. Bounding cylinder is a rectangle in 2D generated by max destination chroma value and max destination lightness value in any particular hue sector. Also it allows you to display 2D hue sectors view after compression into bounding cylinder. output: output/plots/ folder 2D hue sector view plots after compress into bounding cylinder 7. gamutMappingStep3 uses soft center compression with lambda=2/3 to compress any source pixels that are outside of destination gamut into destination gamut which is done by 5 degree hue sector. In each hue sector, center compression is done by 10 degree sub hue sector and center is at 1/2 of destination lightness. Also it allows you to display 2D hue sectors view after center compression. output: data/ch_src_gamutMapped.mat source gamut chroma value after gamut mapping data/l_src_gamutMapped.mat source gamut lightness value after gamut mapping output/plots/ folder 2D hue sector view plots after center compression 8. gamutMappingStep4 allows you to find out which hue sector contains color with most shift and display the result in the command window. For this test image, the hue sector is at (100,105] and you may find the hue sector view of previous three steps in the output/plots folder. Then, this MATLAB function also updates every pair of Cx and Cz values from compress chroma values, rotates and shifts back source gamut. output: data/imgYyCxCzUniqueUpdate.mat image pixel value in YyCxCz after gamut mapping data/xyz.mat image pixel value in XYZ after gamut mapping Here is the output command from MATLAB: Most color shift occured at hue angle = 104.407794 The hue sector contains most color shift is at (100,105] You may find hue sector plots from output/plots folder 9. afterProcessGamutPlot allows you to display gamut mapped source gamut and destination gamut in one plot, a Yy vs. Cx plot and a Cx vs. Cz plot. output: output/gamut_src_dest_afterGamutMapping.png gamut mapped source gamut and destination gamut output/gamut_src_dest_afterGamutMapping Yy vs. Cx view.png Yy vs. Cx plot output/gamut_src_dest_afterGamutMapping Cx vs. Cz view.png Cx vs. Cz plot 10. ycxcz2rgb transforms YyCxCz source gamut back to XYZ to sRGB and save to a tif image with your choice on name. output: output/musiciansGM.tif gamut mapped output tif image Comments and suggestions are greatly appreciated. For any question, please email us at: Jiayin Liu Baekdu Choi Professor Allebach liu649@purdue.edu choi504@purdue.edu allebach@purdue.edu 12/04/2019