1 | initial version |
Ziri's answer is valid, just want to add that there is a way to evaluate "squareness" of a blob,
Given a blob, you can calculate the Shape Factor
You can use cv::contourArea()
to obtain A and cv::arcLength()
to obtain p.
If I remember correctly, for circles you are expected to get values very close to 1. For triangles you are going to get low values around 0.3. For squares you are expected to get values around 0.7-0.8. This will allow you to filter some unwanted blobs.
Hope this helps.
2 | No.2 Revision |
Ziri's answer is valid, just want to add that there is a way to evaluate "squareness" of a blob,
Given a blob, you can calculate the Shape Factor
You can use cv::contourArea()
to obtain A and cv::arcLength()
to obtain p.
If I remember correctly, for circles circled blobs you are expected to get values very close to 1. For triangles triangled blobs you are going to get low values around 0.3.
For squares squared blobs you are expected to get values around 0.7-0.8. This will allow you to filter some unwanted blobs.
Hope this helps.