Separating overlapping cells using marker controlled watershed algorithm
2 views (last 30 days)
Show older comments
Hello,
I am a student of image processing..I am trying to separate
overlapping cells in a blood smear...please refer to the link given below....
The image given above contains many red blood cells(pinkish red) and two white blood cells(purple).My aim is to separate overlapping red blood cells using marker controlled watershed.
I have referred the book Digital Image Processing Using Matlab.
Given below are links to the internal and external marker images....
The internal markers are superimposed on gray image in black,found using imextendedmin function.
The external marker is the watershed of the distance transform of internal marker image
The final image is given below
As it can be seen from the final image,none of the overlaps are separated...I think that it is due to my flawed selection of markers.Can anyone please help me out with this problem?
MY CODE-
%%%%%%%%%%%%%%% MARKER CONTROLLED WATERSHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc close all clear all imtool close all
%%%%%%%%%%%%%%%%%%%%%%%%%Read TheImage%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
img=imread('E:\Image Database\HEME002.jpg'); imtool(img);
%%%%%%%%%%%%%%%%%%%%%%%%%%RGB TO GRAY%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
img_gray=rgb2gray(img); [m n]=size(img_gray);
%%%%%%%%%%%%%%%%%WATERSHED USING GRADIENT%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%gradient of the gray scale img
hy=fspecial('sobel'); hx = hy'; img_y = imfilter(double(img_gray), hy, 'replicate'); img_x = imfilter(double(img_gray), hx, 'replicate'); gradmag = sqrt(img_x.^2 + img_y.^2); imtool(uint8(gradmag))
%internal marker is found(Thershold 50) and imposed as black blobs on gray image
int_marker=imextendedmin(img_gray,50); % Mark pixels int_marker_img=img_gray; % Copy of gray image int_marker_img(int_marker)=0; % Superimpose internal markers
imtool(int_marker); imtool(int_marker_img);
%external marker is found using watershed of internal marker image
Lim=watershed(bwdist(int_marker)); % Watershed of internal markers ext_marker_img=(Lim==0); %
imtool(ext_marker_img);
%modify gradient using minima imposition
mod_gradmag=imimposemin(gradmag,int_marker|ext_marker_img);
imtool(mod_gradmag);
%Watershed Transform of Modified Gradient
L=watershed(mod_gradmag); final_img=img_gray; final_img(L==0)=0;
imtool(final_img);
0 Comments
Answers (0)
See Also
Categories
Find more on Display Image in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!