PrazSam
PrazSam

Reputation: 1156

Hough Transform with Matlab

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

Answers (2)

Cameron Lowell Palmer
Cameron Lowell Palmer

Reputation: 22245

The H, theta, and rho

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.

A naive Hough implementation

It may help you to look at my Naive Hough implementation for Matlab

Upvotes: 1

Shai
Shai

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) and rho are the arrays of rho and theta values over which hough generates the Hough transform matrix.

Upvotes: 0

Related Questions