How can I remove unnecessary reflections in a image after background subtraction

1 次查看(过去 30 天)
I want to remove reflections from the binarized image (I believe these reflections are due to improper background subtraction). I can't increase the sensitivity factor (which is 0.15 in my code) of binarization since I have to keep this value constant throughout my project. The sensitivity level which I used is in the code is suitable for most of the images in the analysis. So, I prefer not to change this value. I am attaching image and background for reference. I want to remove circled parts from the binarized image. Thanks in advance.
background = im2uint16(mat2gray(imread("Water_T_140_t_inj_15_P_05_M30010.tif")));
Image = im2uint16(mat2gray(imread("Water_T_140_t_inj_15_P_05_M30300.tif")));
SubtractedImage = Image - background;
GrayImage = rgb2gray(SubtractedImage);
BinaryImage=imbinarize(GrayImage, 0.15);

采纳的回答

Image Analyst
Image Analyst 2022-1-12
% Remove blobs smaller than 100 pixels in the image
BinaryImage = bwareaopen(BinaryImage, 100);
Or, if you just want to take the largest blob or two
numBlobsToKeep = 1; % However many you want.
BinaryImage = bwareafilt(BinaryImage, numBlobsToKeep);

更多回答(0 个)

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by