How to call a function and show output of an image

1 visualizzazione (ultimi 30 giorni)
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)

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by