Reputation: 57
As you can see in image, I isolate objects using Otsu method, but shadows make the result innacurate. How to isolate object without shadow?
Upvotes: 0
Views: 7786
Reputation: 12689
I = imread('YgmAf.jpg'); % your original image
imagesc(I)
I=rgb2hsv(I);
I1=I(:,:,2); % change to hsv and select the channel with most clear contrast between object and shadow
thresholded = I1 > 0.23; %% Threshold to isolate lungs
thresholded = bwareaopen(thresholded,100); % remove too small pixels
I2=thresholded.*I1;
I3=edge(I2,'canny',graythresh(I2)); % ostu method
I3 = imfill(I3,'hole');
figure,imagesc(I3) %object binary image
Result image:
Upvotes: 1