필터 지우기
필터 지우기

how to count big cell only?

조회 수: 1 (최근 30일)
Moon Shadow
Moon Shadow 2014년 3월 10일
답변: Image Analyst 2014년 3월 25일
I have image with different cell size but I want Count the number of big cells only!!
I try this code:
A = imread ('cell.png');
level=graythresh(A);
I=im2bw(A,level);
[labeled,numObjects]=bwlabel(I,4)
numObjects = 26

채택된 답변

Dishant Arora
Dishant Arora 2014년 3월 10일
편집: Dishant Arora 2014년 3월 10일
use bwareaopen to remove objects smaller than certain number of pixels.
BW2 = bwareaopen(BW, thresh);
[~, numObjects] = bwlabel(BW2,4);
  댓글 수: 2
Moon Shadow
Moon Shadow 2014년 3월 21일
It did nit worked with me!!
It calculate small and big cells.
I = imread('cell.png'); EDU>> imshow(I); EDU>> bw = im2bw(I); EDU>> figure,imshow(bw);
EDU>> BW2 = bwareaopen(bw, 1000); EDU>> figure,imshow(BW2); [labeled,numObjects]=bwlabel(BW2,4) numObjects = 10
Dishant Arora
Dishant Arora 2014년 3월 25일
Check out for 8-connectivity when using bwlabel or attach your image.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 3월 25일
See my code to extract the largest blob, attached below in blue. In there, there is a general purpose function I wrote that can take the N largest or smallest blobs in a binary image.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by