MATLAB Answers

0

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

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..

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

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...


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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!