Labeling an Image (houghcircle)

5 ビュー (過去 30 日間)
Calvin
Calvin 2022 年 11 月 7 日
回答済み: Maik 2022 年 11 月 7 日
I have a code that takes an image of coins and draws the respective hough circles around them as well as gives me the circle's radius in a resulting vector. I want to take the radiuses generated in the vector and place them on the respective circle that they align with and I am hvaing an issue doing so. I have tried plotting the values; however, it gives me a different graph. I want the image with the hough circles to have the corresponsing values on that graph as well.Thanks!
Code:
clear all
clc
%Show Image in GrayScale
I = imread('1.png');
imshow(I)
BWI = im2gray(I);
figure
imshow(BWI)
%%Increase Sensitivity if the coins/circles are not found, Make sure radius is correct and includes entire range
[centers,radii] = imfindcircles(BWI,[10 74],'ObjectPolarity','bright', 'Sensitivity',0.93);
viscircles(centers,radii,'color','r')
length(centers)

回答 (1 件)

Maik
Maik 2022 年 11 月 7 日
% Code:
clear all
clc
%Show Image in GrayScale
I = imread('coins.png');
imshow(I)
BWI = im2gray(I);
figure
imshow(BWI)
%%Increase Sensitivity if the coins/circles are not found, Make sure radius is correct and includes entire range
[centers,radii] = imfindcircles(BWI,[8 74],'ObjectPolarity','bright', 'Sensitivity',0.93);
viscircles(centers,radii,'color','r')
ans =
Group with properties: Children: [2×1 Line] Visible: on HitTest: on Show all properties
length(centers)
ans = 10
% Draw Radius Function
for i = 1:size(centers,1)
line([centers(i,1) centers(i,1)],[centers(i,2) centers(i,2)+radii(i,1)], 'color', 'b' );
end

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by