08-06-2013 05:04 AM - edited 08-06-2013 05:08 AM
Hello smurillo,
i think you should have more flexibility if you perform matching on grayscale channel and then extract the color information. You can for example use color classification with geometric pattern matching, since i now see that your object have different sizes. Or if you create a template for each shape and color and use pattern matching. Then you can also use clustering to get the dominant color (since the objects are monocolored, this should work ok) of the matched pattern (there has been some recent discussion about k-means clustering - the code is also attached there). Maybe it would also work to perform color histogram matching for example. Or extract red, green and blue plane and calculate the average pixels value of each plane. There are some ways, but sadly i cannot say which would work. You have to test this.
First though, i would try to get the shape matches correctly classified (only shape, so it should find for example three big cubes, so the red, green and the blue) and then the color. Also you need to be careful about the lighting - the big green cube does not look very green).
It does not matter where you create the templates. Ni Vision Assistant is easier though.
I will take a look and try to help you if i can.
Best regards,
K
08-07-2013 04:50 AM
Hello,
just a small update about my opinion regarding your project. For best results, you should first define your constraints - mainly your lighting conditions. The image you provided has many shadows and some objects don't even have the correct RGB values (i.e., for some objects, the dominant color plane is different as expected). For example: are all blue object the same color, or are some darker blue?
I am attaching a really simple example of classification first based on pattern matching and then on color (here i take only one pixel, but you could also take a bigger radius for more roboust color detection). I have created the grayscale templates with Ni Vision Assistant.
Are you also planning to correct the lens distortions for your project?
Again, I think you should consider a little bit more about your setup and lighting conditions and assure repeatabilty. It would then be easier to process the acquired images.
Best regards,
K
08-14-2013 04:10 AM
Look at the false positives you have supplied.
There will be a systematic problem with the shapes.
A triangle is always found at the corners of a rectangle, when the triangle is smaller than the rectangle width.
To avoid this problem, capture a background image before placing objects on the surface.
detect the rectangles first, and when they are registered, replace the rectangle with the background image. (copy replace)
this will greatly reduce the number of false positives.
Then detect the circular shapes, and "remove" them using the same technique.
then the triangles cannot possibly create false positives.
for color seperation, try using the HSL space instead of the RGB.
09-05-2013 12:47 PM
Hello!
Just an Update. Your help was very useful, I managed to detect shapes and recognize colors successfully with the last VI. The main problem was the ilumination, but i found a way to fix it with a LED lamp.
Thanks a lot!!!
09-06-2013 03:19 AM
Hey, thanks for the update.
Happy to see that you achieved better results.
Best regards,
K
12-22-2013 04:16 PM - edited 12-22-2013 04:21 PM
the detection of color can get concirtiendo 8bit image, then color filter, removing particles,