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

New to MATLAB?

How to threshold in this.?

Asked by Lalit Patil

Lalit Patil (view profile)

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

Image Analyst (view profile)

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

Lalit Patil (view profile)

on 16 Feb 2013

i have changed link..

Lalit Patil

Lalit Patil (view profile)

1 Answer

Answer by Image Analyst

Image Analyst (view profile)

on 16 Feb 2013
Edited by Image Analyst

Image Analyst (view profile)

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

Lalit Patil (view profile)

on 16 Feb 2013

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

but i want code for this..

Image Analyst

Image Analyst (view profile)

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

Lalit Patil (view profile)

on 18 Feb 2013

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

Image Analyst

Image Analyst (view profile)

Contact us