How to count blood cells in opencv? The problem is that they stick together.
The example picture :
Maybe pairwise geometric histogram (Geometric Histograms) suitable for matching partial circle shape?
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.Sign up to join this community
Just an idea with no guarantee of success:
Similarly to @SalemMansour's suggestion it is also an area based approach.
A really rough estimation can be calculated if we can assume
Then you can premeasure the average size of a cell and calculate a cheap mask for the cells like this:
from SimpleCV import * im = Image("s58Hl.jpg") r,g,b = im.splitChannels() cellmask = g.equalize().threshold(90).invert() masksize = cellmask.getGrayNumpy().sum()/255. cellsize = 27*27 # premeasured cell size cellnum = masksize/cellsize print(cellnum)
It gives me ~211 for the cell count.
The mask image is like this:
For this smaller image I would manually count 9 cells:
The solution gives the result of 9.46502057613.
Of course, if any of the assumptions are invalid then this approach is useless. It is also sensitive to the hard color threshold and the cell size constant. Because of the color equalization, it can totally fail if no cell is present in the image.
But it is really simple and cheap :)