imagesc, subtraction of two images

1 view (last 30 days)
good day .. my aim is it extract optic disc ..i have applied otsu threshold method ..i have 2 subtract two images but when i subtract i get a blank image . my process followed green component -->tophat using large and small structural element that gives me 2 outputs --->then i apply otsu threshold for both tophat(large) and tophat(small) ..after this i want to subtract these otsu images ..but i am not able to do it please help me
se = strel('disk',500,8);
im2 = imtophat(I,se);
se1 = strel('disk',50,8);
im3 = imtophat(I,se1);
IDX = otsu(im2,6);
figure;
subplot(2,2,1);
axis image off;
imagesc(IDX)
colormap(gray);
IDX1 = otsu(im3,6);
figure;
subplot(2,2,1);
axis image off;
imagesc(IDX1)
colormap(gray);
i tried IDX -IDX1 but i amnot getting any image please somebody tell me whr am i goin wrong

Accepted Answer

Image Analyst
Image Analyst on 5 Mar 2014
You need to cast them to double before subtraction because otherwise it leaves them as uint8 and won't allow negative numbers and will clip to zero. Also, please pick better, more descriptive names, like
differenceImage = double(thresholdedImage1) - double(thresholdedImage2);
imshow(differenceImage, []);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!