Why can't I apply thresholding on the image?

Hi everyone, I have a region of interest (ROI) as shown in first image. I have extracted the green channel and want to apply thresholding to segment the optic disc. However, when I apply the thresholding, it extract the whole ROI part as shown in second image. Is it due to the black background on the ROI image?
How can I solve this problem? Thank you.

 Accepted Answer

Well it obviously used the wrong threshold. You did not say how you applied the thresholding or got the threshold value. No code was included, probably because you still haven't read the posting guidelines:
You might want to try the interactive threshold program in my File Exchange:

4 Comments

Hi, sorry about that.
For your information, I am using the code as below
T = graythresh(bw); %bw is ROI
bw=imbinarize(bw,T);
figure, imshow(bw);
title('threshold');
Yeah, that T is no good. Try passing in other values for T. Or just use a fixed threshold, like 200 or something.
bw = grayImage > 200;
Thank you Image Analyst
Looks like no one else is going to offer an answer. Since my solution worked, could you click the "Accept this answer" link? Thanks in advance. 🙂

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Asked:

ZWY
on 13 Jun 2022

Commented:

on 17 Jun 2022

Community Treasure Hunt

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

Start Hunting!