Khaled Bheri Ответов: 1

Количество перекрывающихся объектов


hi. i m working on a project which is related to digital image processing but i can't count the overlapped objects it take multiple overlapped objects as one object. please tell me which method i can use for this problem.... and overlapped objects may be two or more than two..... so please tell me that method which is suitable for this.


Что я уже пробовал:

I = imread('H:\traningimage\005cell.png');
figure; imshow(grayI)
grayI=rgb2gray(I);
%figure; imshow(grayI)
%imcredit('Image courtesy of Dr. Ramiro Massol')
I_eq = adapthisteq(grayI);
%figure; imshow(I_eq)
bw = im2bw(I_eq, graythresh(I_eq));
figure; imshow(bw)
bw2 = imfill(bw,'holes');
bw3 = imopen(bw2, ones(1,1));
ero=strel('disk', 1);
erodedI = imerode(bw3,ero);
figure; imshow(erodedI);title('erogen image');
bw4 = bwareaopen(erodedI, 10);
bw4_perim = bwperim(bw4);
overlay1 = imoverlay(I_eq, bw4_perim, [.3 1 .3]);
figure;imshow(overlay1)
mask_em = imextendedmax(I_eq, 10);
figure;imshow(mask_em)
 mask_em = imclose(mask_em, ones(3,3));
mask_em = imfill(mask_em, 'holes');
mask_em = bwareaopen(mask_em, 10);
overlay2 = imoverlay(I_eq, bw4_perim | mask_em, [.3 1 .3]);
imshow(overlay2)

%********************************************
s  = regionprops(erodedI,'centroid');
centroids = cat(1, s.Centroid);
imshow(overlay2)
hold on
plot(centroids(:,1), centroids(:,2), 'r*')
hold off
%****************************************************************
stats = regionprops('table',erodedI,'Centroid',...
    'MajorAxisLength','MinorAxisLength');
centers = stats.Centroid;
diameters = mean([stats.MajorAxisLength stats.MinorAxisLength],2);
radii = diameters/2;
hold on
viscircles(centers,radii);
hold off
 removeCC = bwareaopen(bw4,1);
 cc=bwconncomp(removeCC);
 Objects_per_unit_area=cc.NumObjects/(size(removeCC,1)*size(removeCC,2));
  imshow(I);title(['number of objects in this image =',num2str(cc.NumObjects)])

1 Ответов

Рейтинг:
7

Maciej Los

Я бы настоятельно рекомендовал задать этот вопрос на форуме Matlab: Главная страница - MATLAB Central[^]