loading
 
points within a blob
Dawson from Malaysia  [173 posts]
9 year
Hi Steven,

I would like to check if 2 points, point A and point B are inside the same blob for example Blob1. I just need a Boolean answer 1=yes 0=no. Could RR do this?
Steven Gentner from United States  [273 posts] 9 year
How many blobs are typically in the image? I.e. could you guarantee that < 256 blobs are in the image?

STeven.
Dawson from Malaysia  [173 posts] 9 year
Yes definitely less then 256 blobs. I would say after applying the blob filter there would be less then 50 blobs.
Steven Gentner from United States  [273 posts] 9 year
Dawson,

One way to do this is to use the Blob_Label module to color each of the blobs. As long as there are less than 8000 blobs (I thought it was 256 in my last post), the colors WILL be unique. I.e. no two blobs will have the same color. Using this, you can use the two points to grab the color of the pixel at a specific location after this blob_label module and compare the results. If the colors are the same, you have the same blob.

See the attached on how to do this. I used a new edition of a 'pixel' function (not unlike sin, cos, etc.) as an expression to grab the color of a pixel at a specific location. This is quick and easy to use within a Set_Variable module or even directly in the If_Statement module (split that to make it a bit easier to read).

You will have to change the X,Y location of your points as seen in the Set_Variable module.

You'll have to download the latest version for this to work ... or use the Sample_Color module as a substitute to the pixel function.

STeven.

program.robo
Dawson from Malaysia  [173 posts] 9 year
Hi STeven,

Great solution ;) Thanks

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