X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 08 Apr 2013 09:51 AM by  anon
IDL script to applying transformation to image
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
08 Apr 2013 09:51 AM
    Hi, I'm working on a script that will take an image and the coefficients for a polynomial transformation and apply the transformation to the image. My script creates a new image as it's supposed to, but the coefficients I passed should just be a translation of 5 in the x direction and 5 in the y direction. Instead the image is all white with odd short diagonal gray and black lines all over it. Attached is my code and I was wondering if anyone could spot any glaring bug that I'm missing? Thank you. ENVI, /RESTORE_BASE_SAVE_FILES ENVI_BATCH_INIT args = command_line_args() imagedir = args[0] imagename = args[1] Kx00 = FLOAT(args[2]) Kx01 = FLOAT(args[3]) Kx10 = FLOAT(args[4]) Kx11 = FLOAT(args[5]) Ky00 = FLOAT(args[6]) Ky01 = FLOAT(args[7]) Ky10 = FLOAT(args[8]) Ky11 = FLOAT(args[9]) Kx = [[Kx00, Kx01],[Kx10,Kx11]] Ky = [[Ky00, Ky01],[Ky10,Ky11]] CD, imagedir image = imagename ENVI_OPEN_FILE, image, R_FID=Ifid ENVI_FILE_QUERY, Ifid, dims=Idims, ns=Ins, nl=Inl, nb=Inb A = INTARR(Inl, Ins) B = POLY_2D(A, KX, KY) Bsize = SIZE(B, /DIMENSIONS) print, Bsize imgext = STRPOS(imagename, '.img', /REVERSE_SEARCH) imgname = strmid(imagename, 0, imgext) out_name=imagedir+imgname+'_registered.img' openw,2,out_name printf,2,B close,2 envi_file_mng, id=Ifid, /remove exit

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    10 Apr 2013 07:36 AM
    It looks to me you performed poly_2D on an empty array: A = INTARR(Inl, Ins) B = POLY_2D(A, KX, KY) You did not pass any image data doing this. You just generated an integer array based on the size of the input image an performed poly_2d on this array. If you want the data in the array, you would need to use ENVI_GET_DATA.
    You are not authorized to post a reply.