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
|