From the Lab
SLIC Part 6 - Brightness-Shifted Colours (Histogram-Based Adjustment)
Bernard Llanos — July 16, 2013 - 3:06pm
Method
The method used to obtain colour data for averaging in this post is almost the same as that described in Part 4 (http://gigl.scs.carleton.ca/node/530), except that pixels in an SLIC segment are not assigned the same brightness value. Instead, pixels have their lightness values added to a value equal to the average lightness value of the segment subtracted from the nth or (100-n)th-percentile lightness value of the segment. The result becomes the new lightness value of each pixel. (In this post, I used the average brightness of the image to determine whether to use the nth or the (100-n)th-percentile to alter the brightness values of each segment, for reasons discussed earlier at http://gigl.scs.carleton.ca/node/529)
Following the shift in brightness, all pixels have their lightness values clipped to the range of 0-255 before the image is used for crossfiltering or saved to a file.
Source Images for Colour Data
The following images were obtained by SLIC segmentation, followed by the segment-specific lightness adjustment described above. I used these images as the source data for colours during filtering, but used the original, unprocessed source image for building filtering masks.
Segmented image assigned lightness offsets using 94th-percentile lightnesses (regionSize = 8, regularizer = 0.01)
Segmented image assigned lightness offsets using 99th-percentile lightnesses (regionSize = 31, regularizer = 0.01)
Overall, I prefer the appearance of the segmented images produced using this method over those made by assigning an average colour with a shifted lightness to every pixel in a segment (refer to Part 4). Offsetting pixel lightness values individually results in better detail preservation, although it introduces a certain amount of clipping because, unlike in the averaging method, offset individual pixel lightness values can fall outside 0-255. Both methods result in some loss of colour saturation, although the offset method exhibits this much less than the averaging method by avoiding desaturation caused by averaging neighbouring pixels.
Cross-Filtering Results
Cross-filtering result from a segmented image assigned lightness offsets using 94th-percentile lightnesses (regionSize = 8, regularizer = 0.01, mask size of 64, gamma parameter value of zero)
Cross-filtering result from a segmented image assigned lightness offsets using 99th-percentile lightnesses (regionSize = 31, regularizer = 0.01, mask size of 256, gamma parameter value of zero)
Observations
At small SLIC region sizes, crossfiltering on images produced by offsetting pixel lightness values is very similar to crossfiltering on images produced by offsetting average segment lightness values and assigning the resulting colours to all pixels in the corresponding segments. At larger SLIC region sizes, the averaging method exhibits a far higher reduction in detail and introduces much stronger edges (artifacts) into the final image. However, both methods seem to produce similar colour casts along the upper lobe of the orchid (easily seen in the last image above).
(Image source: Bernard Llanos)