Fitting largest circle in free area in image with distributed particle

后端 未结 5 547
無奈伤痛
無奈伤痛 2020-12-07 16:49

I am working on images to detect and fit the largest possible circle in any of the free areas of an image containing distributed particles:

5条回答
  •  误落风尘
    2020-12-07 17:02

    You can use bwdist from Image Processing Toolbox to compute the distance transform of the image. This can be regarded as a method to create voronoi diagram that well explained in @AnderBiguri's answer.

    img = imread('AbmxL.jpg');
    %convert the image to a binary image
    points = img(:,:,3)<200;
    %compute the distance transform of the binary image
    dist = bwdist(points);
    %find the circle that has maximum radius
    radius = max(dist(:));
    %find position of the circle
    [x y] = find(dist == radius);
    imshow(dist,[]);
    hold on
    plot(y,x,'ro');
    

提交回复
热议问题