X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Aug 2012 02:44 PM by  anon
hough transform
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:19
New Member


--
09 Aug 2012 02:44 PM
    Hi all, I'm not all too familiar with IDL but am attempting to find the x,y coordinates of the points of a line after performing a hough transformation line detection. Here is what I have so far and I don't know where to go from here as to how to find these x,y line points. Any help would be greatly appreciated 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]) ;print, NX ;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 END

    Deleted User



    New Member


    Posts:19
    New Member


    --
    09 Aug 2012 03:07 PM
    Basically this gives me coordinates in rho,theta (I think) and I need them in image coordinates (x,y)....just to clarify

    Deleted User



    New Member


    Posts:
    New Member


    --
    15 Aug 2012 01:41 PM
    I'm not quite sure if this will help but with some work you could use steps from this article and do the same using IDL functions: http://stackoverflow.com/...transformation-rho-t
    You are not authorized to post a reply.