measurement = regionprops(c,img, 'MeanIntensity','Centroid');
measurement1=[cat(1,measurement.MeanIntensity) cat(1,measurement.Centroid)];
k=0;
corr_measurement=[0 0 0];
if isempty(measurement1)~=1
for i=1:size(measurement1,1)
k=k+1;
if measurement1(i)>20
corr_measurement(k,1:3)=measurement1(i,:) ;
end
end
end
if corr_measurement~=[0 0 0]
stats = regionprops('table',img1,'Centroid','MajorAxisLength','MinorAxisLength','Area')
centers=corr_measurement(:,2:3);
diameters = mean([stats.MajorAxisLength stats.MinorAxisLength],2);
radii = diameters/2;
hold on
viscircles(centers,radii);
hold off
num_obj=size(corr_measurement,1)
else
num_obj=0
end