Grid detection of irregular objects
이전 댓글 표시
I would like to fit the holes in the following image to extract the holes' centers, the angle of rotation for the image (the angle in this image happens to be small), and the radii of the holes if they're fit to circles:

After perusing for solutions, I've realized that I'm not able to make much progress without converting this image to black and white, so I've done that:

It seems that detectCircleGridPoints with the asymmetric argument will be the way to go, but I can neither get it to detect any of the objects (perhaps since they're not perfect circles) nor to return the angle of rotation for the image or radii of the detected circles. Any advice for utilizing detectCircleGridPoints or some other approach for acquiring the centers, angle of rotation, and radii would be greatly appreciated! Here is my code:
% Read image
I = imread('rawimage.png');
% Convert image to bw
I = imbinarize(rgb2gray(I), 'adaptive', 'ForegroundPolarity', 'bright', 'Sensitivity', 0.5);
I = imopen(I, strel('disk', 5));
I = imfill(I,'holes');
I = bwareaopen(I, 1000);
I = im2uint8(I);
% Apply grid fit
patternDims = [4, 17];
imagePoints = detectCircleGridPoints(I,patternDims,PatternType="asymmetric");
% Visualize results
J = insertText(I,imagePoints,1:size(imagePoints,1));
J = insertMarker(J,imagePoints,'x',Color="green",Size=5);
imshow(J)
title("Detected a Circle Grid of Dimensions " + mat2str(patternDims))
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!