9

« **on:** November 20, 2014, 10:30:25 AM »
I used 1000 UAV images generation model, and the image without distortion correction.Align photo has finished.

I use Python script 1.1 for set map region.But the position is always wrong.

`# Define: Region [Name,CenterX, CenterY, SizeX, SizeY]`

MapRegionVec = [C_4,744300,3074400, 300, 300]

newregion = PhotoScan.Region()

chunk.resetRegion()

#rotate

T = chunk.transform.matrix

v = PhotoScan.Vector( [0,0,0,1] )

v_t = T * v

v_t.size = 3

if chunk.crs:

m = chunk.crs.localframe(v_t)

else:

m=PhotoScan.Matrix().diag([1,1,1,1])

m = m * T

s = math.sqrt(m[0,0]**2 + m[0,1]**2 + m[0,2]**2) #scale factor

R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])

R = R * (1. / s)

newregion.rot = R.t()

#set grid center:

#define float

C1=float(MapRegionVec[1])

C2=float(MapRegionVec[2])

C3=float(MapRegionVec[3])

C4=float(MapRegionVec[4])

centerUTM = PhotoScan.Vector([C1,C2,0])

centerGEO=chunk.crs.unproject(centerUTM)

print ("centerGEO:",centerGEO)

centerGEO.size = 4

centerGEO.w = 1

centerLocal = chunk.transform.matrix.inv() * centerGEO

centerLocal.size = 3

print ("centerUTM=",centerUTM,"centerLocal=",centerLocal)

#define newcenter

newregion.center = PhotoScan.Vector([centerLocal[0], centerLocal[1], chunk.region.center[2]])

print ("newregion.center:",newregion.center)

#define newsize

.......

newregion.size = PhotoScan.Vector([xsize,ysize,chunk.region.size[2]])

chunk.region = newregion

I don't know what is my code error or 1.1 script error,But I'd use this script is run on the UC camera images have no problem.