NX and NY give me the dimensions of the full image (if I'm correct on that?) but I need the specific location of the lines within those dimensions and I can't figure out how to export those. Here is my code so far...
PRO houghtrans
; Determine path to file.
;file = FILEPATH('H:\Test\Hough\lake.tif')
; Import image from file into IDL.
image = READ_tiff('H:\Test\Hough\dock.tif')
; Determine size of image.
imageSize = SIZE(image, /DIMENSIONS)
; Create window and display original image
DEVICE, DECOMPOSED = 1
WINDOW, 0, XSIZE = imageSize[1], YSIZE = imageSize[2], $
TITLE = 'lake, hough'
TV, image, TRUE = 1
; Use layer from green channel as the intensity of the
; image.
intensity = REFORM(image[1, *, *])
; Determine size of intensity image.
intensitySize = SIZE(intensity, /DIMENSIONS)
; Mask intensity image .
mask = intensity GT 150
DEVICE, DECOMPOSED = 0
LOADCT, 0
;Create another window and display the masked image:
WINDOW, 1, XSIZE = intensitySize[0], $
YSIZE = intensitySize[1], $
TITLE = 'Mask'
TVSCL, mask
;Stop
; Transform mask.
transform = HOUGH(mask, RHO = rho, THETA = theta)
; Scale transform to obtain just the lines over 100 pixels.
transform = (TEMPORARY(transform) - 100) > 0
; Backproject to compare with original image.
backprojection = HOUGH(transform, /BACKPROJECT, $
RHO = rho, THETA = theta, $
NX = intensitySize[0], NY = intensitySize[1])
;stop
;print, intensitySize
;print, rho, theta
;print, theta
openw, 2, 'H:\Test\rho.txt'
printf, 2, rho, format= '(i0)'
close, 2
openw, 3, 'H:\Test\theta.txt'
printf, 3, theta, format= '(f12.10)'
close, 3
;print, intensitySize
;Stop
; Reverse color table to clarify lines. If you are on
; a TrueColor display, set the DECOMPOSED keyword to 0
; before using any color table related routines.
DEVICE, DECOMPOSED = 0
LOADCT, 0
TVLCT, red, green, blue, /GET
TVLCT, 255 - red, 255 - green, 255 - blue
; Display results.
WINDOW, 1, XSIZE = intensitySize[0], $
YSIZE = intensitySize[1], $
TITLE = 'Resulting Lines'
TVSCL, backprojection
|