## Circle around an Object (instead of blob bounds)

Nov 5, 2008 at 11:22am

# Circle around an Object (instead of blob bounds)

I was wondering if there’s any way to draw a circle around objects and get the radius of the circle in coordinates, so I know the size of the object.

Right now I use blob bounds which outputs the left, top, right and bottom coordinates, but it isn’t sufficient because when the object rotates, the blob bounding box has a different size.

#40675
Nov 5, 2008 at 11:31am

Update:

The alternative would be to measure the greatest distance from the center of an object to the object edge and output the x and y coordinates of that point. For example: if a rectangle is displayed.

I want to be able to output the coordinates the point of the object which is furthest away from the center. I know how to calculate it, but I don’t know how to fetch the data of this point.

#144123
Nov 5, 2008 at 11:43am

The attachment shows what I’m trying to achieve :-) Hope it’s clear…[img]index.php?t=getfile&id=2124&private=0[/img]

#144124
Nov 5, 2008 at 7:13pm

Funny this circle looks exactly like my drawing :) Still I’m stuck with the problem to get this circle to go to most distant point from the center of my object…

#144126
Nov 5, 2008 at 8:02pm

Tjendol,

Why not use jit.blobs.centroids? The 3rd plane gives you the area of blob – you can then compute the radius. See below, hope it helps.

best,
Zachary

– Pasted Max Patch, click to expand. –
#144127
Nov 5, 2008 at 8:56pm

I can not seem to open your example. I tried to save it in notepad as test.pat and I also tried directly pasting it into max msp…

#144128
Nov 6, 2008 at 6:00am

You need to open the patch in Max5.

best,
Zachary

#144129
Nov 6, 2008 at 10:59am

Alternative (see attachment)

Say I know the x coordinate of the red dots…(i get this through cv.jit.blobs.bounds which can output the largest x value.

How can I output the y value that corresponds to the red spot?

Basicly I have my x but need to know the y so combined they form the coordinates of the point that’s furthest away from the center of my object.

Once I know this x and y it shouldn’t be a problem to get the length of the line from the center to this point.

Of course you can also see it the other way around…I start with the largest y coordinate…and need to know the x coordinate belonging to this point on the object.

I have no trouble getting the largest x and y coordinate..it’s the second coordinate of each of these largest coordinates of the bounding box corner I’m stuck at…

#144130
Nov 6, 2008 at 11:02am

I tried this but if i’m right…centroids works with mass..i need the actual size of the object…and preferably the length from center to the point that’s at the largest distance from the center.

#144131

You must be logged in to reply to this topic.