Hi, what kind of shape detection do you want to do? find_blobs() gives you an area and pixels that match the color settings in that area. This can be used to distinguish between circles and squares. However, I'm assuming you want something else right?

Okay, well, find_blobs() again can be used for this task using just grayscale. The ratio between the area of the bounding box around the object and the number of pixels tracked in the object is different for rectangles, circles, and squares.

However, what's the vision setup for your problem? Are you looking at objects straight on, at angles? With different lighting? Please give me a detailed picture of your problem and what you want to do. You've given two responses now with a low amount of info so I can't really help you if you don't know exactly what you want to do.

I have to recognize a triangle painted on a surface and state where it is relative to the center of the screen and the angle of rotation.
I have to detect a particuoar triangle with angles defined.. for example 45 45 and 90 degrees

Okay, so, find_blobs() will work for this. First, you setup the thresholds to find the color of the triangle. This will let you find all the triangles in the image. find_blobs() will tell you the centroid of the object. So, that's the location. find_blobs() will also tell you the rotation of the object too assuming that it has an interesting enough shape for the rotation to be uniquely determined. If all the sides of the triangle are not equal then this should be the case.

Lastly, if you have other objects in the view... the ratio between the bounding rectangle around the triangle and the number of pixels tracked should be equal to:

pixels*2 = area of rect.

So, you'd filter out all blobs find_blobs() returns that aren't close to that ratio between the number of pixels tracked and the area. Where the definition of "close" is some tolerance you have to determine through testing.

Dear Sir
I am taken rectangular detection examples, it's also working fine but it's detecting all rectangles I want to detect only middle rectangle means what I want to do.
Example: one paper total 8 rectangles are there I want to detect 4th one means what I want to do.
Thanks
and
Regards
Prasath

Dear Sir
Please find below images for your reference, I want to detect that 6 rectangle's presence. In that if anything missing means pin 1 have to on. After that I will control my process by using pin 1 voltage. Can you please send me the code for that.
Thanks
&
Best regards
Prasath