Traneptora / jxlatte

Java JPEG XL decoder
MIT License
41 stars 6 forks source link

Discussion: varDCT visualisation colour palette #5

Closed zeroby0 closed 1 year ago

zeroby0 commented 1 year ago

Colours used in the varDCT visualisation are visually very similar to each other.

I used http://vrl.cs.brown.edu/color to generate a color palette with higher visual distance. DCT 256x256, DCT 256x128, and DCT 128x256 reuse the colours of Hornuss, DCT 2x2, and DCT 4x4. But these huge DCTs are rare and it's very difficult to confuse between each other because of the size.

The potential pitfall I see if that all the colours from the original palette have the same luminosity, while the new palette doesn't. So the blending might misrepresent the original image, but I think it's okay.

Do you think it's a good idea to use a visually distinct palette?

I'll post sample vardct visualisations using both the palettes a little while later.

Old Palette

image

Proposed Palette

image

New palette as RGB:

palette = [
    (57,146,131),
    (147,230,183), 
    (27,81,29), 
    (67,226,109), 
    (141,25,147), 
    (197,213,240), 
    (31,65,150), 
    (236,159,231), 
    (97,59,79), 
    (32,216,253), 
    (7,77,101), 
    (167,214,78), 
    (206,19,101), 
    (48,151,46), 
    (232,79,225), 
    (71,149,224), 
    (43,25,217), 
    (240,210,126), 
    (124,68,14), 
    (253,143,47), 
    (187,25,10), 
    (248,163,149), 
    (89,121,254),
    (145,145,145),
    (147,230,183), 
    (27,81,29), 
    (67,226,109), 
]
Traneptora commented 1 year ago

The potential pitfall I see if that all the colours from the original palette have the same luminosity.

The same lightness and saturation was intentional, as colors that are too bright or too dark distort the original image. The idea was that the original image should still be visible underneath the varblocks, so I chose pastel colors with the same lightness and saturation (approximately) in order to achieve this.

Note that it's not perfectly identical, the way I generated R/G/B values was by picking an angle theta between 0 and 2pi and setting the components proportional to cos(theta), cos(theta + 2pi/3) and cos(theta + 4pi/3). This was a way to approximate hue without dealing with the casework that is normally required for HSV->RGB.

zeroby0 commented 1 year ago

The same lightness and saturation was intentional, as colors that are too bright or too dark distort the original image.

Ah yes, that's what I was worried about.

I generated R/G/B values was by picking an angle theta between 0 and 2pi and setting the components proportional to cos(theta), cos(theta + 2pi/3) and cos(theta + 4pi/3).

Really nice! The colours are still perceptually close (IMO), so it isn't great for use in plots, but for the original intended use case I think your colour palette is great!