Detect voids in FRC by Image Processing Toolbox

15 ビュー (過去 30 日間)
Mikkel Eilers
Mikkel Eilers 2021 年 11 月 25 日
コメント済み: Image Analyst 2021 年 11 月 26 日
I want to detect voids in FRC through image processing, and so far I have put up a code that can detect some circles by drawing a line that represent the diameter for a void, but I cant seem to circle every void with the given diameter.
foto = imread("SNAP-134309-0001.jpg");
gsfoto = im2gray(foto);
BWfoto= imbinarize(gsfoto);
d = drawline;
pos = d.Position;
diffpos = diff(pos);
diameter = hypot(diffpos(1),diffpos(2))
Rmin = diameter*0.275;
Rmax = diameter*0.5;
[centersDark, radiiDark] = imfindcircles(foto,[fix(Rmin),fix(Rmax)],"ObjectPolarity","dark","Sensitivity",0.9,"EdgeThreshold",0.2);
I also cant seem to filter away the black "noise" to detect the voids by "imbinarize".


Image Analyst
Image Analyst 2021 年 11 月 25 日
You forgot to attach the image.
It looks like you're trying to detect bark blobs in a certain range. Why not just use regionprops():
% Throw out blobs in in range
areaMin = pi * Rmin^2 / 4;
areaMax = pi * Rmax^2 / 4;
BWfoto = bwareafilt(BWfoto, areaMin, areaMax);
% Measure what's left to get centers and equivalent circular diameters.
props = regionprops(BWfoto, 'Centroids', 'EquivDiameter');
centroids = vertcat(props.Centroid);
diameters = [props.EquivDiameter];
% Display circles in overlay.
viscircles(centroids, diameters, 'Color', 'r')
If you have some blobs in that size range that are not circular and you don't want those, then you can filter out based on circularity. Untested code:
props = regionprops(BWfoto, 'Centroids', 'EquivDiameter', 'Area', 'Perimeter');
areas = [props.Area];
perimeters = [props.Perimeter];
% Calculate circularities:
circularities = perimeters .^2 ./ (4 * pi * filledAreas);
indexes = find(circularities < 3); % or some number.
% Label the blobs to assign each contiguous blob an ID number.
labeledImage = bwlabel(BWfoto);
% Extract only those that are circular enough.
roundBlobsOnly = ismember(labeledImage, indexes);
  1 件のコメント
Mikkel Eilers
Mikkel Eilers 2021 年 11 月 26 日
Thank you for the answear. Have a good day.


その他の回答 (2 件)

yanqi liu
yanqi liu 2021 年 11 月 26 日
sir,may be upload image file to do some analysis

Mikkel Eilers
Mikkel Eilers 2021 年 11 月 26 日
編集済み: Mikkel Eilers 2021 年 11 月 26 日
Forgot to attach the image.
  1 件のコメント
Image Analyst
Image Analyst 2021 年 11 月 26 日
I don't see anything in there that is circular except possibly some small debris. What are the voids? The light gray, the darker/medium gray blobs, or the really dark/black small blobs? So no wonder imfindcircles() didn't find any since there aren't any. Why do you think you want only circular blobs and not irregularly shaped blobs?


Community Treasure Hunt

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

Start Hunting!

Translated by