From 31c5df6cb52cb0deadb67074d6a39d61694074d4 Mon Sep 17 00:00:00 2001 From: Thierry Zamofing Date: Fri, 9 Sep 2022 17:43:43 +0200 Subject: [PATCH] toward trace of camera --- swissmx.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/swissmx.py b/swissmx.py index ee3df71..c1af0ca 100755 --- a/swissmx.py +++ b/swissmx.py @@ -410,6 +410,13 @@ class WndSwissMx(QMainWindow, Ui_MainWindow): #bm.setTransform(tr) # assign transform grp.addItem(obj) + #--- camera tracong images --- + self._goTrace=grp=pg.ItemGroup() # the transformation is the same as for tracked objects + grp.setZValue(-20) #lower than other objects + self.vb.addItem(grp) + + + #--- testing scan grid --- #self.track_objects() # first call is needed to initialize the structure self._goTracked # #go=UsrGO.Grid((120, -100), (200, 150), (30, 22), 2) @@ -1070,12 +1077,29 @@ class WndSwissMx(QMainWindow, Ui_MainWindow): pFix=pg.Point(self._goFixGrp.mapFromScene(pos)) pFix-=bm.pos()+bm.size()/2 + + #create trace + img=pg.ImageItem(self._goImg.image) + img.setZValue(100) + trImg=self._goImgGrp.transform() + trTrk=self._goTracked.transform() + + tr=trImg*trTrk.inverted()[0] #TODO: check if oder correct !!! + #tr.scale(.5,.5) + img.setTransform(tr) + + self._goTrace.addItem(img) + _log.debug(f'dist to beam ({pFix[0]:>0.6g} {pFix[1]:>0.6g}mm)') fx_motor=self.tweakers["fast_x"] fy_motor=self.tweakers["fast_y"] fx_motor.move_rel(pFix[0]) fy_motor.move_rel(pFix[1]) + self._goTrace.setTransform(self._goTracked.transform()) + + + #fx_motor.move_abs(fx_motor.get_val()+pFix[0]) #fy_motor.move_abs(fy_motor.get_val()+pFix[1])