Hello, I would like to segment some images based on some conditions, Could you help me with that?
Hello I have an image that i got after performing clustering for 5 colors. Now there are only 5 colors present in the image. Suppose the colors are (100, 150, 200), (200, 250, 100), (50, 150, 200), (100, 250, 100), (0, 100, 200).
Now I want to split the image into chunks. Each chunks will have some percentage of the pixels of all the 5 colors. Say 20% pixels are of color A and 30% pixels are of color B and so on.
How do I split the image this way?
Example: This is the input image:
This should be the output image:
Each chunk has to have all the clustering colors (i.e. 5 if we use the example above) colors present in the image in it.
yea, you can do something with some algorithm, and you'll get some result ;(
haha .. I was filled with joy when I saw your comment. But then realized something XD
your output image looks more like you want spacial segmentation, like e.g. SLIC
I just want to group the pixels in such a way that each group will have all the 5 colours
What do you mean 5 colors? It looks like an exercise Image histogram is more than 5 colours. Take 5 random pixels and you get regions with 5 colors
use kmean before?
Yes, i did a kmeans on the original image where k = 5.. this way i made sure i get an image with 5 colours only.. now i want this new image as input in some kind of algorithm that will help me to come up with chunks of image. Each chunk should contain all the 5 colours
Yes, i did a kmeans on the original image where k = 5.. this way i made sure i get an image with 5 colors only
Well if you found 5 centroids you have found 5 dominant colors and also their cluster(area) within the whole image. These cluster dont overlap. "Kmeans algorithm is an iterative algorithm that tries to partition the dataset into Kpre-defined distinct non-overlapping subgroups (clusters)". So you divided the image into distinct areas but at same time you are asking where these area overlap(Each chunk should contain all the 5 colours).
My suggestion. Use contours or similar approach to find areas within the image.I think this is what berak was suggesting with "spacial segmentation". Then run kmeans with k5 on these areas so you get clusters with dominant colors
And then check if centroids suffice your criteria. If so - measure the cluster area. If each cluster is sufficiant dominant (maybe like 10% of the whole contours area) - you found your area. I hope this make sense. @berak can you comment on this?
@tsabbir96 -- it would be helpful, if you could explain, why you need this, and what for.
@holger -- the image reminded me of superpixels, but those have no guarantee, that all 5 dominant colors are present
@holger@berak sorry guys, I would have upvoted you. But I guess I need 5 points to do that.. Thanks a lot for your suggestion. Definitely will test the idea.