How to call a function and show output of an image
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 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!