Ask Your Question
1

How to do a mask or how to transform found contours to filled circles?

asked 2015-07-28 01:30:31 -0600

mmt gravatar image

How to transform all the contours found in a frame to a filled circle?

Let me explain, my video has many small objects, and it is hard to detect using Mosse tracking, because my objects change its form. So I had an idea, change all the found contours to filled circles, it means, convert all this objects found on this image : http://imgur.com/GiPmatl,JGsJX2C to something like this : http://imgur.com/GiPmatl,JGsJX2C#1 .

I am using python.

edit retag flag offensive close merge delete

Comments

may i know what have you tried to do so?

Balaji R gravatar imageBalaji R ( 2015-07-28 01:59:30 -0600 )edit

have you tried fitellipse? Does it solve your problem?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 03:08:48 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-07-28 03:22:35 -0600

Once you have a series of contours, you can convert them to according circles by using

vector< vector<Point> > contours;
vector< Point2f > centers;
vector< float > radiuses;
for(size_t i =0; i<contours.size(); i++){
   Point2f center;
   float radius;
   minEnclosingCircle(contours[i], center, radius);
   centers.push_back(center);
   radiuses.push_back(radius);
}
// Now you can draw each one of them by using the circle command

You are welcome!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-28 01:30:31 -0600

Seen: 1,255 times

Last updated: Jul 28 '15