Segmenatation for an image.
이전 댓글 표시
how can i segment and count the number of non overlapping blood cells in this image :
i need a code for doing this...
답변 (2개)
Image Analyst
2013년 7월 22일
0 개 추천
First of all, look over my image segmentation demo. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 Then look at how I filter out coins based on size. You need to do the same thing. If they overlap the size will be a lot bigger than if they don't overlap. So you just need to tweak the area value in my code and it should work for you.
댓글 수: 9
Image Analyst
2013년 7월 22일
By the way, no need to do hough or edge detection like the tags you or someone added.
mecheal
2013년 7월 22일
Image Analyst
2013년 7월 22일
I might or might not have time to do that for you later today or this week. What was wrong? What happened when you typed in a different number for the size of the smaller objects?
mecheal
2013년 7월 22일
mecheal
2013년 7월 22일
Matt Kindig
2013년 7월 23일
The trick is to play with the threshold (what is being done implicitly by the graythresh() and im2bw() calls). Modifying your code somewhat and filling in the holes, I get:
a=imread('cells.gif');
a_bw = a < 200; %threshold at level=200
a_bw = imfill(a_bw, 'holes'); %remove holes
[labeled,numObjects]=bwlabel(a_bw);
[m,n]=size(a_bw);
s = regionprops(labeled);
B = bwboundaries(a_bw);
imshow(a_bw)
hold on
for k = 1:numel(s)
c = s(k).Centroid;
text(c(1), c(2), sprintf('%d', k), ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle');
end
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'g', 'LineWidth', 0.2)
end
hold off
Matt Kindig
2013년 7월 23일
I'll let you figure out how to determine the overlapping cells, but to get you started, let's take a look at the area of each cell, i.e.,
Centroids = cat(1, s.Centroid);
Area = cat(1, s.Area);
figure();
%draw circles whose color is proportional to cell area
scatter( Centroids(:,1), Centroids(:,2), Area, Area, 'filled');
colormap jet, colorbar, hold on;
title('Area of each region');
The color of each circle is proportional to the area of that region (see the colorbar on the right side of the plot-- this gives the area->color relationship).
Note that some of the cells have markedly higher areas than the others. Can you figure out how to threshold out these areas?
mecheal
2013년 7월 23일
Matt Kindig
2013년 7월 23일
See my comment immediately above. In general, I think it will be easier to count all cells (overlapped and non-overlapped alike), and remove the overlapping ones.
To identify the overlapping ones, you can (as Image Analyst stated) use an area criterion, removing all identified cells that exceed some threshold area. In my code above, I showed you how to visualize the areas of the various regions. I'll let you implement the logic about how to identify the overlapping cells.
Elad
2013년 7월 23일
0 개 추천
Detecting and counting objects with circular features: http://imageprocessingblog.com/detecting-and-counting-objects-with-circular-features/
카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!