loading
 
Shape finding
Erick from Italy  [1 posts]
1 year
Hi to all,
I never wrote here, but I need a little help with your program.

I send to roborealm a bitmap where there is many shapes.
I need to:
- find the maximun encumbrance (showed by a rectangle)
- find center of gravity of shape
- delete possible white hole into the shape
- find all external points of the shape (points forming the line)
- count number of shapes

Are possible this functions?
If yes, could you tell me how?
I need an input because I want to try by myself, but I don't know how to start!
Maybe tell me the instructions and I try!

Thanks
Erick

  
Steven Gentner from United States  [260 posts] 1 year
Erick,

See attached. Note, the biggest issue you probably didn't realize is that RR sees white objects as being on (or foreground) and black pixels as being off (background). So the first thing to do is invert the image.

The attached replicates your image. See the following variables for the actual data:

COG_X
COG_Y
BOUNDING_COORDINATES
SAMPLE_LINE_POINTS

which are arrays for each object containing the actual values. Note that the latter two have -1,-1 in the arrays to signal an object change.

The size/length of COG_X or COG_Y will provide the number of detected objects. As the geo stats module was added there is a bunch more stats computed too which you can see in the Watch_Variable module (last module).

STeven.

 

program.robo
Anonymous 1 year
Thanks Steven,

it works how I want.

And if I want to count the number of shapes what have I to do?

Steven Gentner from United States  [1370 posts] 1 year
There are modules that will do that ... or as mentioned above, you can just check the size of one of the resulting arrays (they have one entry per shape).

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index