Extract a portion of an image

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?

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.

Click on the Image object and navigate to Mask tool:

Select the Freehand shape:

Mark the region of your interest:

And copy the selection as an Image object:

Then, paste and store the copied image:

Then, use RegionBinarize:

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

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.

Hi Roger,

To apply a mask to an image, use ImageMultiply.

ImageMultiply[img, reg]

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.

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

RJB