Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to threshold in this.?

Asked by Lalit Patil on 16 Feb 2013

http://www.fileconvoy.com/dfl.php?id=gc213fed1ab02da0d9992250810234ad7ac15079a4

 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

Image Analyst on 16 Feb 2013

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.

Lalit Patil on 16 Feb 2013

i have changed link..

Lalit Patil

1 Answer

Answer by Image Analyst on 16 Feb 2013
Edited by Image Analyst on 16 Feb 2013
Accepted answer

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

Lalit Patil on 16 Feb 2013

yes it, works at min=88 and max=233,

but i want code for this..

Image Analyst on 16 Feb 2013
binaryImage = grayImage >= 88 & grayImage <=233;
Lalit Patil on 18 Feb 2013

Very helpful Demo...:) It Solves many problems...

Image Analyst

Contact us