Reputation: 1156
I'm doing some shape detecting coding with Matlab. I just want to understand the code segment
[H,theta,rho] = hough(BW)
I understand the conversion of the x,y
coordinates to the theta,rho
coordinate system. What I can't understood is the format of the output of hough(BW)
function. Simply the Question is what is the [H,theta,rho]
here. It's better I can get a clear idea about the Hough Transformation Matrix (H)
with an example.
Upvotes: 1
Views: 453
Reputation: 22245
The output is a bit confusing if you're not familiar with Matlab-isms and how the Hough transform works.
H is a table of the accumulated results of the Hough transform with the dimensions rho-theta. So for each pixel in the thresholded image you calculate the rho (distance) and thetas (angles) and increment the corresponding cells by 1.
The rho and theta matrices returned are essentially the row and column headers of the H matrix.
It may help you to look at my Naive Hough implementation for Matlab
Upvotes: 1
Reputation: 114796
Please read the documentation of the hough
function carefully.
Here is a clear explanation what is H
, theta
and rho
:
The function returns
H
, the Hough transform matrix.
theta
(in degrees) andrho
are the arrays ofrho
andtheta
values over which hough generates the Hough transform matrix.
Upvotes: 0