How can extract circular edges from this image when the edges are not actually cicular?

1 view (last 30 days)
I have attached the original image as a mat file. So I would ask you download it and see it on your computer. If you focus on the image you see some tiny circles. the image actually looks like a beehive. I want to detect these circles as edges and set them to zero. But I need those detected edges to have the form of circles, so after applying the mask the image would look like something like this:
I have tried unsharp masking for getting the edges:
if true
load frame; % the image
mask = frame;
mask(mask~=0) = 1;
g = frame - mean2(frame);
[fx,fy] = gradient(g);
g = g + fx + fy;
g = imfilter(g,fspecial('gaussian',[3 3],1));
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = g.*(~imdilate(bwmorph(g,'remove'),[strel('line',6,90) strel('line',6,0)]));
g = adapthisteq(imadjust(g,[0 1]),'NumTiles',[10 10],'ClipLimit',0.01,...
'Range','original','Distribution','uniform').*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = imsharpen(g,'Radius',2,'Amount',2,'Threshold',0).*mask;
g = g.*(~imdilate(bwmorph(g,'remove'),[strel('line',6,90) strel('line',6,0)]));
g = imadjust(g,[0 1]);
figure,imshowpair(frame,g,'montage')
colormap bone
set(gcf,'Position',get(0,'Screensize'))
g(g<0) = 0;
end
I have also tried other methods. They all detect the desired edges ( of course they are not perfect) but what they give is not a grid of circles ( thats what i need).
How can I solve this problem? which method should I take?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!