How to call a function and show output of an image
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Computer Vision with Simulink finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!