How to threshold in this.?

clear all;
clc;
I = imread('2.png');
threshold = graythresh(I);
originalImage = im2bw(I, threshold);
i = bwareaopen(originalImage,70);
TI = imfill(i, 'holes');
imshow(TI)
I want to detect only the strip which is on object.?
This code not works.
Is there any other method or modification..?

2 Comments

I wasn't able to download your image. It saves it but it doesn't save it as a real PNG image even though the extension is PNG.
i have changed link..

Sign in to comment.

 Accepted Answer

Image Analyst
Image Analyst on 16 Feb 2013
Edited: Image Analyst on 16 Feb 2013

1 vote

Don't use graythresh(). Pick your own threshold, perhaps using my interactive thresholding function http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image that's in my File Exchange.

3 Comments

yes it, works at min=88 and max=233,
but i want code for this..
binaryImage = grayImage >= 88 & grayImage <=233;
Very helpful Demo...:) It Solves many problems...

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!