How to call a function and show output of an image

1 回表示 (過去 30 日間)
Ntiranyibagira Lionel
Ntiranyibagira Lionel 2019 年 10 月 9 日
I am trying to learn Hough transform for circle. How can I read an image and use the written function (call the function) to finally display the output? Here is the code
%Hough Transform for Circles
function acc = houghcircle1(inputimage)
%image size
[rows,columns]=size(inputimage);
%accumulator
acc=zeros(rows,columns);
%image
for x=1:columns
for y=1:rows
if(inputimage(y,x)==0)
for ang=0:360
t=(ang*pi)/180;
x0=round(x-a*cos(t));
y0=round(y-r*sin(t));
if(x00 && y00)
acc(y0,x0)=acc(y0,x0)+1;
end
end
end
end
end
end
I tried to read an image I have in my directory and call the function but cannot display the output to see if the code work.
I=imread('screw.jpg');
houghcircle1(I)

回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by