Refining reference HSL value for swatch
By Michael
The reference HSL value of a paint is the output of an algorithm that produces a hue, saturation, lightness (HSL) value of a given swatch of that paint. This isn’t an “exact” value for the paint and can change from swatch to swatch. ArtOrgTool uses the reference HSL to mark the paint on a colorwheel and determine similar and complementary paints.
I’ve been experimenting with a better method for determining the HSL reference value for a paint swatch. Initially, ArtOrgTool simply used the hue with the highest occurance of pixels in a given swatch and a weighted average of the saturation and lightness of that hue. The method in version 1.0 uses a more complex algorithm described below.
The following swatch was made from Daniel Smith’s French Ultramarine.
The graphs below represents the raw HSL data after processing each pixel in the swatch. The swatch was captured with an HP Envy printer/scanner and analyzed with a software program I’ve created using Flutter/Dart.
The first two graphs utilize the same data represented in two different ways. The top graph shows the full range of hues, 40 to 300, along the X axis for all the pixels, and the amount of the given hue on the Y axis. Many of the hues don’t exist in the swatch or only a couple pixels were found with that hue.
The lower graph shows the same range of hues, with the Y axis showing the range of the saturation values. At the bottom of the graph is saturation of 0.0 and the top is 1.0. For example, there are 2703 pixels in the swatch that have a hue of 212 (displayed in the upper graph) and a saturation range of 0.28 to 1.0 (shown in the lower graph).
Many of the colors in these graphs aren’t useful as representatives for the swatch and are filtered out. The final graphs displays the HSL values that meet a the algorithms thresholds. The basic workflow takes the hue with the highest occurance and iterates through the hues left and right till the first hue with less then 100 occurances is found. In the case of the Daniel Smith French Ultramarine swatch, this gives a hue range of 200 to 242. The reference HSL is finalized by calculating a weighted average of saturation and lightness for all the selected hues in the target range.
This gives a final reference HSL of hue: 216.7281 saturation: 0.8343 lightness: 0.5664.
To underscore, this is a reference value for the given swatch. There isn’t any guarnetee that these same values would be determined given a different swatch or a different scanning method, ie a phone camera in direct sunlight versus a flatbed scanner. I’m planning on doing further experiments to explore the variations given different camera hardware, lighting arrangements, paper and swatching methods.