06-04-2013 04:26 AM
Hi,
1. How to find which is the dominant color in an image,which method can be used to find it ?
2. How to apply color mask to an image?
Thank you
Mdhubalan Panneerselvam
06-04-2013 03:40 PM - edited 06-04-2013 03:42 PM
Hello Madhubalan,
maybe this can help you get some ideas about finding the dominant color. I am attaching a VI that uses three different methods to determine the dominant color:
1. Red or green or blue (only one of the three, no colors in between)
2. Hue based histogram
3. K means clustering based (you need to install the library from clustering)
The first method returns only red or green or blue value based on the maximum values of the rgb planes.
The second method uses a hue histogram where the rgb values are recalculated. The problem here is the saturation and luminance - the code takes the mean values of both, so its off sometimes.
The third method produces most acurate results, as far as i have been testing it.
If you like, you can test the code, but maybe someone with more experience than me can provide a better solution.
Anyway, I hope this helps you to proceed in the right direction. Aslo, sorry for the dirty and unoptimized code.
I do not understand what did you mean with the color mask?Could you please explain in more detail?
Best regards,
06-05-2013 03:18 AM
Hi,
Thank you for the reply.For color mask,my project is to find the object(screw) from the other objects,i am using the technique from a paper "Fast Object Detection Based on Color Histograms and Local Binary Patterns".In this paper they have to find the printer from other object,i have to find the screw instead of printer.In this paper,they are using few techniques,in which initial step is calculate color mask image show in fig 5.
Thank you
Madhubalan
06-05-2013 08:34 AM
Hi,
Thank you for the reply.For color mask,my project is to find the object(screw) from the other objects,i am using the technique from a paper "Fast Object Detection Based on Color Histograms and Local Binary Patterns".In this paper they have to find the printer from other object,i have to find the screw instead of printer.In this paper,they are using few techniques,in which initial step is calculate color mask image show in fig 5.
Thank you
Madhubalan
06-07-2013 12:49 AM - edited 06-07-2013 12:51 AM
Hello,
I saw the paper. It is an interesting approach.
I have been trying to build the same mask, but had no luck. It seems this is out of my scope, and I really have no time now to dive deeper into this.
I am attaching 2 vi's which produced the best reults so far. Maybe this could help you a bit. Both use a sliding window to determine the regional "dominant colors" and then compare these to the original image (actually grayscale values) and applying the mask. You can see the "dominant" color inside a sliding window by turning on "draw SW?" boolean.
I think you should put some more effort in determining the dominant color.
I am sorry I was unable to help more.
Best regards,
06-07-2013 04:03 AM
Hi,
Thank you very much for your help. You have used IMAQ Extract2, whether it is similar to IMAQ Extract,if it is not the same,please send me IMAQ Extract2 addon.
Regards
MADHUBALAN
06-07-2013 08:03 AM
Hello,
just use IMAQ extract.
Best regards,
06-10-2013 04:17 AM
Hi Klemen,
The Dominant color.vi file that you had sent me gives the output as top most dominant color from an image,using the same source code,how to find(display) the top10 dominant color?
Thank you
MADHUBALAN
06-10-2013 05:00 AM
Hello,
try increasing the number of classes (kmeans) and modify the output accordingly.
Best regards,
06-10-2013 06:47 AM
Hi Klemen,
Can please check and tell whether this source code is correct or not,if not can you please make changes to it?.
Thank you
MADHUBALAN