fixing coordinate transformation
This commit is contained in:
@@ -575,22 +575,26 @@ class FixTargetFrame(UsrROI):
|
||||
param={'grid':grid, 'points':pts, 'code_gen': self.code_gen}
|
||||
|
||||
# TODO: simplify !!!
|
||||
t=self.transform()
|
||||
t=self.transform() #obj_info(t)
|
||||
p=np.array(self.pos())
|
||||
s=self.size()/self._dscr['size']
|
||||
trf=np.array(((t.m11(),t.m12()),(t.m21(),t.m22()),(0,0)))
|
||||
trf[2,:]=p # shift origin
|
||||
trf[:2,:]=(trf[:2,:].T*s).T # same as np.asmatrix(np.diag(s))*trf[:2,:], trf[:2,:]*=s not working, scale before rot / shear
|
||||
|
||||
# trf*'gridpos in um' -> motor pos in mm
|
||||
pos=np.array(param['grid']['pos']) # in um
|
||||
pitch=np.array(param['grid']['pitch']) # in um
|
||||
trf2=np.asmatrix(np.identity(3))
|
||||
trf2[:, :2]=trf
|
||||
trf2*=np.asmatrix(((-1000, 0, 0), (0, 1000, 0), (0, 0, 1)))
|
||||
trf2*=np.asmatrix(((1000, 0, 0), (0, 1000, 0), (0, 0, 1)))
|
||||
trf3=np.asmatrix(((pitch[0], 0, 0), (0, pitch[1], 0), (pos[0], pos[1], 1)))
|
||||
trf=(trf3*trf2)[:, :2]
|
||||
param['trf']=trf
|
||||
# trf*'gridpos' -> motor pos in mm
|
||||
# {'pos': [2080, 2080], 'pitch': [120, 120], 'count': [162, 162]}
|
||||
#np.array((0,0,1))*trf grid 0,0 (top left)
|
||||
#np.array((161,0,1))*trf # grid 161,0 (top right)
|
||||
#np.array((161,161,1))*trf # grid 161,161 (bottom right)
|
||||
return param
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user