Okmain: you have an image but you want a colour

13 points by dangroshev


bitshift

The simplest optimisation is to reduce the amount of data. Okmain downsamples the image by a power of two until the total number of pixels is below 250,000, simply averaging pixel values in Oklab.

I'm curious how this compares to directly sampling pixels without averaging. You mention that averaging helps compensate for noise, but I'd naively guess the noise would be smoothed out by later steps anyway.

(You could also downsample in linear sRGB which I think is more recommended for resizing images, then convert linear sRGB to Oklab. In order to get to your destination you (or a library) already have to convert gamma sRGB → linear sRGB → Oklab. So downsampling in linear doesn't add any conversion work, and it should actually speed things up because you'd only be doing the final Oklab step for 250k pixels, instead of for every pixel in the input.)

quasi_qua_quasi

Ah, I wanted something like this for similar reasons. Weighing by centrality is a nice trick I hadn't thought of!