Message Boards Message Boards

1
|
5291 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Inspect zone of interest in images?

Posted 8 years ago

Hi,

Trying to inspect few little section of 10x10 pixels in a zone of interest determined from a binarized photo, the zone of interest is highlighted as shown below.

enter image description here

How can I capture (randomly) let say 10 images of 10x10 pixels located in the zone of interest from the original image? Getting the captured image coordinates would be good to check the location on the original. Any example would be great. ;)

Thank you

Hugh

POSTED BY: hugh trifol
2 Replies

Hughes,

This sketch uses Erosion with a kernel that has the size of your small images:

pills = Binarize[i];
res = Erosion[pills, BoxMatrix[radii], Padding -> 0];
pos = PixelValuePositions[res, 1];

These positions pos are the coordinates of the center of the small images. Once you have the positions, you need to iterate picking one randomly and removing all the leftover positions that correspond to overlapping small images.

After you have done that, you can extract the small images using ImageTrim:

ImageTrim[image, {#}, radii] & /@ pos

enter image description here

POSTED BY: Matthias Odisio
Posted 8 years ago

Hi again,

Let's take it another way. :) How to get random coordinates within a zone of interest of complex shape with a contour. In my case, the zone of interest can be long and skinny, U-Shape like, etc... so a Centroid function would not work. Hope this clarifies my question ;)

Regards

Hugues

POSTED BY: hugh trifol
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract