Hi Tushar
1.- Acquiring petri image, using green layer only, manually binarising the whole image.
Play with threshold th1
clear all;clc;close all
A=imread('blood_cells_count.jpg');
A2=A(:,:,2);
th1=190;
A2(A2>th1)=255;
A2(A2<th1)=0;
figure(1);imshow(A);
.
2.- Filling up holes in binarised cells
A20=~A2;
area_threshold=6;
A21 = bwareaopen(A20,area_threshold);
figure(10);imshow(A21);
A22=imfill(A21, 'holes');
figure(11); imshow(A22);
.
3.- It may not be really needed, but just in case, filling up and plotting cell contours
[B,L] = bwboundaries(A22,'noholes');
map=zeros(length(B),3);cmap=colormap(map);
figure(12);imshow(label2rgb(L,cmap, [.5 .5 .5]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 1)
end
.
.
4.- The asked cells count is:
.
5.- Add a halo around each binarised blood cell, neurons are hairy aren't they?
PSF = fspecial('gaussian',5,5);
A3 = deconvlucy(uint8(255*(~A21)),PSF,5);
figure(3);imshow(A3);
.
Comment:
using area threshold may remove a few small cells. Sample arrowed small specks are removed but the circled small cell is also removed.
Perhaps next step would be to consider removing small AND no green marker (dark only) specks.
.
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
Best Answer