Message Boards Message Boards

0
|
8673 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Extract a portion of an image

Posted 4 years ago

I've got an image and I want to obtain the centerlines of the image. (Input image) I could obtain the centerlines using the following commands

img = Input_image
gray = ImagePad[ImageCrop[ColorConvert[img, "Grayscale"], ImageDimensions[img] - 6],10]
bin = Binarize[gray, 0.07]
skeleton = Pruning[Pruning@Thinning[bin], 15]

Now, I would like to obtain the centerlines for a particular region of the original image ( the region below the white marking - image). Could someone suggest how this can be done?

POSTED BY: Natash A
5 Replies

AHA!! RemoveBackground did it. Problem solved!! Thanks

RJB

POSTED BY: Roger J Brown

That worked great, Thanks. But I still have the black background. I need that transparent. I will fiddle with Opacity to see if that works but if you have a better way please send it along.

POSTED BY: Roger J Brown

I have accomplished all of what is shown here successfully but have not been able to restore the B/W region to its original. ColorConvert does not seem to be the answer. What I am after is just the large foot in the attached notebook. Could you help me with this last step? Thanks.

POSTED BY: Roger J Brown
Posted 2 years ago

Hi Roger,

To apply a mask to an image, use ImageMultiply.

ImageMultiply[img, reg]
POSTED BY: Rohit Namjoshi

I am not quite sure I completely understand your question, but if I did correctly, and you know which region you want to emphasize, you could do something like this.

yourImage

Click on the Image object and navigate to Mask tool: MaskTools

Select the Freehand shape:

FreehandShape

Mark the region of your interest:

ShapeSelection

And copy the selection as an Image object:

CopyImage

Then, paste and store the copied image:

StoreImage

Then, use RegionBinarize:

enter image description here

You can play with threshold, but I hope you now have the idea how to do it. Note, that this only applies to the case when you know in prior and can do the manual segmentation, otherwise, if you want to do it programmatically, you will have to figure out what is your region of interest first.

Mikayel

POSTED BY: Mikayel Egibyan
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