Extracting the resultant angles from the Hough transform [message #46017] |
Wed, 26 October 2005 02:36  |
txominhermos
Messages: 25 Registered: October 2005
|
Junior Member |
|
|
I am using the IDL's Hough transform function to detect lines in some
crop images.
I can perfom the transformation and the backproject with the lines, but
I dont know it if it possible to extract one list with the value of the
angles that actually are lines in the backproject images.
If you know how to do it,please help me.
Cheers
|
|
|
Re: Extracting the resultant angles from the Hough transform [message #46069 is a reply to message #46017] |
Thu, 03 November 2005 03:53  |
txominhermos
Messages: 25 Registered: October 2005
|
Junior Member |
|
|
THE ANSWER TO THIS QUESTION HAS BEEN GIVEN BY THE RSI TECH SUPPORT
------------------------------------------------------------ --------------------
The THETA output variable can be used to find the angle for a line.
Here is a short example demonstrating how this is done:
;*********************************************************** ****************
pro test
; Choose two points in the range
; 1 < x < 199
; 1 < y < 199
p0 = [40.,20]
p1 = [120,180]
nx = 200d
ny = 200d
array = fltarr(nx,ny)
array[[p0[0],p1[0]],[p0[1],p1[1]]] = 1b
; Display the data:
window, 0, xs = nx, ys = ny, $
xpos = 0, ypos = 0, $
title = 'original data'
tvscl, array
; HOUGH input parameters:
dx = 1.2
dy = 1.0
xmin = 0.0
ymin = 0.0
r = hough(array, rho = rho, theta = theta, $
dx = dx, dy = dy, xmin = xmin, ymin = ymin)
sz = size(r, /dim)
; Locate the line
maxcount = where(r eq max(r))
; Use the output variable THETA to get the line's angle:
radangles = theta[maxcount mod sz[0]] - !pi/2
print, 'Angle(s) : '
print, radangles
print
end
;*********************************************************** ****************
Reply to this post
|
|
|
|
|