MATLAB Answers


Segmenatation for an image.

Asked by mecheal
on 22 Jul 2013

how can i segment and count the number of non overlapping blood cells in this image :

i need a code for doing this...


2 Answers

Answer by Image Analyst
on 22 Jul 2013

First of all, look over my image segmentation demo. 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.


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);
%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?

on 23 Jul 2013

great idea MR. matt ,, but i ran ur code , there was a small problem , u count a overlapped cells , i just want u to modify ur code to just count the UNOVERLAPPED CELLS ,,,WITH GREAT REGARDS,,,

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.

Answer by Elad
on 23 Jul 2013

Detecting and counting objects with circular features:


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!