Hi all,
I registrated my camera image in Envi and got the pts file. But my
problem is when I warp the image on the pts file using my IDL
program ,the output image isn't the same as the one using Envi warped.
It's not rectified correctly. But using the same pts file in Envi to
warp ,the result is all right. Could anyone tell me why?
The source code :
pro warppts
imageFile="E:\basefile.jpg"
imageData= read_image(imageFile)
ptsFile = "E:\CameraAdd.pts"
nlines = FILE_LINES(ptsFile)
sarr = STRARR(nlines)
OPENR, unit, ptsFile,/GET_LUN
READF, unit, sarr
FREE_LUN, unit
pts = strarr(4,nlines-5)
for i=5,nlines-1 do begin
pts[*,i-5] = double(strsplit(sarr(i),/extract))
endfor
; Set up the arrays of original points to be warped:
XO = double(reform(pts[0,*]))
YO = double(reform(pts[1,*]))
; Set up the arrays of points to be fit:
XI = double(reform(pts[2,*]))
YI = double(reform(pts[3,*]))
; Use POLYWARP to generate the P and Q inputs to POLY_2D:
POLYWARP, XI, YI, XO, YO, 5, P, Q
warpdims = [703,525] ;I get this dimesions from ENVI
registration widget
method = 0
imageWarp = dblarr(3,warpdims[0],warpdims[1])
imageWarp[0,*,*] = POLY_2D(REFORM(imageData[0,*,*]), P,
Q,method,warpdims[0],warpdims[1])
imageWarp[1,*,*] = POLY_2D(REFORM(imageData[1,*,*]), P,
Q,method,warpdims[0],warpdims[1])
imageWarp[2,*,*] = POLY_2D(REFORM(imageData[2,*,*]), P,
Q,method,warpdims[0],warpdims[1])
; Display the new image:
window,0,xsize=warpdims[0],ysize=warpdims[1]
TV, imageWarp,TRUE=1
end
|