Re: Hough transform help [message #31805] |
Mon, 19 August 2002 10:01 |
Chris Torrence
Messages: 5 Registered: March 2001
|
Junior Member |
|
|
Hi Marshall,
Have you tried setting the XMIN and YMIN keywords? HOUGH and RADON assume
that the center of your transform is the center of the image (e.g. at pixel
[127,127] in your case). It then returns theta values in the range 0 to
+180. Positive rho values are above the X axis (at say X=127), while
negative rho values are below the X axis.
Setting XMIN=0 and YMIN=0 will shift the transform origin down to the lower
left corner of your image. Note that you will still get both + and - rho
values, but the negative rho values will all have theta > 90, which
indicates "rays" going from the lower-left to upper-right. This are probably
useless for you, and can be removed by using RMIN=0 and the NRHO keyword.
The easiest way to visualize this is to look at the diagram in the docs
(which I won't attempt to reproduce here), and imagine swinging that tangent
line around the origin, and "shooting" rays thru your image.
Hope this helps.
-Chris
"Marshall Perrin" <mperrin+news@arkham.berkeley.edu> wrote in message
news:ajkipq$b33$1@agate.berkeley.edu...
> I have a 256x256 floating-point image. I am doing this:
> edge_enh = sobel(image)
> h = hough(edge_enh,/gray,rho=rho,theta=theta)
>
> and it very nicely detects the lines in the image as bright
> points in the Hough transform. However, I want to extract the slopes
> and intercepts of those lines (in standard y=mx+b format). Well, that
> should be easy given rho and theta for each line - except that
> the rho which is being returned ranges from -181 to 181.
> Negative values don't make any sense to me, particularly given
> that my image looks something like
> +-----------+
> | \ | |
> | \ | |
> | \ \ | |
> | \ \ | |
> +-----------+
> ..all of which are clearly to the right of the origin and thus should
> have positive rho. It's getting the thetas perfectly correct as far
> as I can tell.
|
|
|