Edge detection of sharp and blur spheres

14 次查看(过去 30 天)
I have a few zstack images of microscopic spheres that I want to process to segment, create masks, and find volumes of the spheres. I have a code that reads in the stack but I'm having some trouble segmenting individual slices using edge detection. I've included the segmentation part of the code below. I've tried all the methods in edge function and Canny seems to be the best in ignoring noise as well as detecting blur objects. I use the fill edge gaps code here https://www.peterkovesi.com/matlabfns/#edgelink to close some of the open edges. I've also tried multiple structuring elements for the dilation step. Here's a matlab workspace file with the zstack that I'm currently working with: https://we.tl/t-2iR53itzPm
  1. I wanted some help improving the code to be able to detect blur objects better and create an image of filled objects where none of the objects are missed so I can use it as a mask.
  2. I'm not sure what's the best way to close the open edges of objects along the image boundaries.
Any help would be greatly appreciated!
I = zstack(:,:,iZ);
% [~,threshold] = edge(I,'sobel');
[~,threshold] = edge(I,'Canny');
fudgeFactor = 1; %0.75 for sobel
% BWs = edge(I,'sobel',threshold * fudgeFactor); %creates gradient edge and applies threshold
BWc = edge(I,'Canny',threshold * fudgeFactor); %creates gradient edge and applies threshold
figure;imagesc(BWc); axis equal
BWfc = filledgegaps(BWc,2);
figure;imagesc(BWfc); axis equal
se0 = strel('line',1.5,0); %Create two perpindicular linear structuring elements
se90 = strel('line',1.5,90);
BWfcdil = imdilate(BWfc,se90); %Dilate the binary gradient mask
figure;imagesc(BWfcdil);axis equal
BWdfill = imfill(BWfcdil,'holes'); %Fill the hole in the gradient
figure;imagesc(BWdfill);axis equal

回答(1 个)

Piyush Dubey
Piyush Dubey 2023-7-27
Hi Vignesh,
Considering segments of spheres will be recognized as a circle and these circles might have variable sharpness. There are many ways using which circles can be recognized. MATLAB provides with the function named ‘imfindcircles’ in which circles can be detected in any form. Documentation to the same is attached below:
Hope this helps.

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by