Forums > Jitter

Circle around an Object (instead of blob bounds)

November 5, 2008 | 11:22 am

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.


November 5, 2008 | 11:31 am

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.


November 5, 2008 | 11:43 am

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


November 5, 2008 | 2:15 pm

On 5 nov. 08, at 12:43, Tjendol wrote:

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

You might want to have a look to cartopol and poltocar.

HTH,
ej


November 5, 2008 | 7:13 pm

Thanks for your answer.
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…


November 5, 2008 | 8:02 pm

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. –

November 5, 2008 | 8:56 pm

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…


November 6, 2008 | 6:00 am

You need to open the patch in Max5.

best,
Zachary


November 6, 2008 | 10:59 am

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…


November 6, 2008 | 11:02 am

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.


Viewing 10 posts - 1 through 10 (of 10 total)