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

조회 수: 2 (최근 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