Tag Info

New answers tagged

8

The function domCol below is about 100 times faster than DominantColors. Basic plan: Create enough color bins throughout the color space occupied by the image; count the number of pixels in each bin; return the sorted colors. The function works in the LAB color space so we can use EuclideanDistance for the distance between colors. The centers of the bins ...


5

Use of ColorQuantize Much faster. Not exactly the same, but close and for an art project is OK I think. i = ExampleData[{"TestImage", "Lena"}]; QuaCol[i_, n_] := RGBColor /@ Union[Flatten[ImageData[ColorQuantize[i, n]], 1]]


5

The problem is not with DominantColors Try varying the number of colours selected by running this snippet. I vary the number of selected colours from 1 to 10, and measure the time to calculate DominantColours ten times: Table[ First@AbsoluteTiming@ Table[DominantColors[p, i], {p, RandomChoice[pieces, 10]}] , {i, 10}] (* {6.544491, 7.658153, ...



Top 50 recent answers are included