clear; close all;

I = imread('Sub.png');

I = rgb2gray(I);

figure; imshow(I)

% se = strel('square',3);

% %# Removes uneven lighting and enhances contrast.

% I = imdivide(I,imclose(I,se));

%I2 = imtophat(I, strel('rectangle', [70 15]));

I2 = imtophat(I, strel('square', 45));

figure; imshow(I2)

% Alpha=.047;

% h = fspecial('motion', 10, 5);

% w=gausswin(I2,Alpha) % you'll have to play with N and alpha

% I2 = imfilter(I2,h,'same','symmetric'); % something like these options

level = .047;

BW = im2bw(I2,level);

D = -bwdist(~BW,'chessboard');

D(~BW) = -Inf;

 

L = watershed(D);

imshow(label2rgb(L,'jet','w'))

More Leena Silvoster's questions See All
Similar questions and discussions