Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good way to extract dominant colors from image without the shadow?

Is it possible to extract the 'true' color of building façade from a photo/ a set of similar photos and removing the distraction of shadow? Currently, I'm using K-means clustering to get the dominant colors, however, it extracts darker colors (if the building is red, then the 1st color would be dark red) as there are lots of shadow areas in real photos.

Any suggestions are greatly appreciated!

Thanks in advance!

like image 777
sym44 Avatar asked Apr 27 '16 15:04

sym44


2 Answers

You could simply ignore the shadow areas by only evaluating areas of a certain brightness. I suggest you make yourself familiar with the HSI/HSL/HSV colour models

https://en.wikipedia.org/wiki/HSL_and_HSV

Understanding this should help to solve the problem on your own.

like image 128
Piglet Avatar answered Sep 21 '22 03:09

Piglet


If the shadows cover a significant part of the image then this problem is non-trivial.

If the shadow is a small fraction of the area you're interested though you could try using k-medoids instead of k-means and as Piglet mentioned using a different color space with separate chromaticity and luminance channels may help.

like image 38
Keunhong Park Avatar answered Sep 19 '22 03:09

Keunhong Park