MATLAB: How to cut out the white border in this binary image, but keep the rest

digital image processingimageimage processing

I want to be able to delete the white border for the image attached, but keep everything else. How do I go about doing this?

Best Answer

  • Another possible way is to use bwconvfull function, like:
    % Read and binarize the image
    I = imread('inTT.png');
    BW = imbinarize(rgb2gray(I));
    % Delete white background using bwconvfull
    BWConv = bwconvhull(~BW);
    BW2 = BW & BWConv;