Search code examples
matlabimage-processingimage-segmentationthreshold

how to include a dark border to bright segmented image?


I have an image like this.note that the regions are not perfectly shaped.it is rectangular like region and ellipse like region. I have segmented the ellipse like region using some algorithm.segmented region is bright one.the border (red rectangle) is dark one finally i must get red rectangular like region can you suggest any algorithm to perform this


Solution

  • I see that you have done some real progress on your segmentation. Because you already have an idea of the location of elements you want to segment, you should use a watershed with constraints/markers:

    1. Your actual segmentation represents the inner markers.
    2. You dilate it with a big structuring element (bugger than the inter disk space).
    3. You take the contour of the dilation, and that's your outer markers.
    4. You compute the gradient of the original image.
    5. You apply the watershed on the gradient image, using the markers you have just computed.

    [EDIT] As the segmentation you provided does not match with the original image (different dimensions), I had to simulate roughly a simple segmentation, using this image (the red lines being the the segmentation you already have). And I got this result.