필터 지우기
필터 지우기

is there an alternative of thresholding an image automatically rather than setting it manually?

조회 수: 4 (최근 30일)
actually i am trying to implement a code that identifies just the round objects from an image referring http://www.mathworks.com/products/image/demos.html?file=/products/demos/shipping/images/ipexroundness.html , but the problem is that, every time for a new picture i have to change pixel value and threshold so that round objects are only visible and successfully identifies round objects rather than missing any... any alternative? or any guidence??

채택된 답변

Chandra Kurniawan
Chandra Kurniawan 2011년 12월 27일
Actually function im2bw automatic select threshold value if
you do not pass any parameter except the input image.
Or try another option,, you can use graythresh if you consider not to setting the threshold value manually.
Eq:
J = im2bw(I, graythresh(I));
  댓글 수: 2
bubble  trouble
bubble trouble 2011년 12월 27일
ok will do that thanks a lot... do you have any idea as to how can i store the values in an array that are coming on the image specifically those that are greater than the threshold criteria?
Chandra Kurniawan
Chandra Kurniawan 2011년 12월 27일
Just use 'greater than' operator.
Eq :
threshold = 128;
I = imread('cameraman.tif');
J = I > threshold;
The array J stores all value that greater than threshold as 1

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

bubble  trouble
bubble trouble 2011년 12월 27일
% remove all object containing fewer than 30 pixels
bw = bwareaopen(bw,30);
now the above line is removing objects less than 30 pixels, this is specifically going to work for this picture, and if i do it with some other picture it fails to do it properly hope u are getting what im trying to sayyy....
  댓글 수: 4
Chandra Kurniawan
Chandra Kurniawan 2011년 12월 27일
I'm not sure about this.
But, would you try property measurement of image regions??
Use command 'regionsprops' and select the parameter 'Area'.
You can measure all object area and take a conclusion.
From this step, you will get all object area. There are minimum area and maximum area.
Take the mean of all area and apply this value as P (input parameter in bwareaopen).

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by