towards fiducial detection
This commit is contained in:
32
swissmx.py
32
swissmx.py
@@ -492,11 +492,14 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
action.triggered.connect(self._OLD_escape_goToTellMountPosition)
|
||||
self.toolBar.addAction(action)
|
||||
|
||||
action = QAction(icon, "Auto\nFocus", self)
|
||||
action.triggered.connect(self.cb_autofocus)
|
||||
self.toolBar.addAction(action)
|
||||
|
||||
action = QAction(icon, "Test\nCode", self)
|
||||
action.triggered.connect(self.cb_testcode)
|
||||
self.toolBar.addAction(action)
|
||||
|
||||
|
||||
self.toolBar.addWidget(qutilities.horiz_spacer())
|
||||
|
||||
icon = qtawesome.icon("material.sync")
|
||||
@@ -1359,6 +1362,8 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
if pic.max()>255:
|
||||
scl=2**int(round(np.log2(mx)-8))
|
||||
pic=np.array(pic/scl,dtype=np.uint8)
|
||||
elif pic.dtype!=np.uint8:
|
||||
pic=np.array(pic, dtype=np.uint8)
|
||||
except AttributeError:
|
||||
sim=app._camera._sim
|
||||
pic=cam._sim['imgSeq'][sim['imgIdx']]
|
||||
@@ -1582,6 +1587,11 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
QMessageBox.about(self, "SwissMX", txt)
|
||||
pass
|
||||
|
||||
def cb_autofocus(self):
|
||||
app=QApplication.instance()
|
||||
geo=app._geometry
|
||||
#geo.autofocus(app._camera, self.tweakers['base_z'],rng=(-1, 1), n=30,saveImg=True)
|
||||
geo.autofocus(app._camera, self.tweakers['base_z'],rng=(-1, 1), n=10)
|
||||
|
||||
def cb_testcode(self):
|
||||
try:
|
||||
@@ -1598,18 +1608,13 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
plt.stem(x, y)
|
||||
plt.show(block=False)
|
||||
|
||||
step=2
|
||||
step=5
|
||||
if step==0:
|
||||
vb=self.vb
|
||||
vb.autoRange(items=(self._goImg,))
|
||||
elif step==1:
|
||||
testMatplotlib()
|
||||
elif step==2:
|
||||
app=QApplication.instance()
|
||||
cfg=app._cfg
|
||||
geo=app._geometry
|
||||
geo.autofocus(app._camera, self.tweakers['base_z'])
|
||||
elif step==3:
|
||||
grp=pg.ItemGroup()
|
||||
vb.addItem(grp)
|
||||
obj=UsrGO.Marker((100, 100), (100, 100), mode=1)
|
||||
@@ -1620,7 +1625,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
grp.addItem(obj)
|
||||
tc['grp']=grp
|
||||
vb.autoRange(items=(obj,))
|
||||
elif step==4:
|
||||
elif step==3:
|
||||
grp=tc['grp']
|
||||
tr=grp.transform()
|
||||
# UsrGO.obj_info(tr)
|
||||
@@ -1628,7 +1633,16 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
-.2, 1, 0,
|
||||
0, 0, 1)
|
||||
grp.setTransform(tr)
|
||||
|
||||
elif step==4:
|
||||
app=QApplication.instance()
|
||||
cfg=app._cfg
|
||||
geo=app._geometry
|
||||
geo.autofocus(app._camera, self.tweakers['base_z'],rng=(-1, 1), n=30,saveImg=True)
|
||||
elif step==5:
|
||||
app=QApplication.instance()
|
||||
cfg=app._cfg
|
||||
geo=app._geometry
|
||||
geo.autofocus(app._camera, self.tweakers['base_z'],rng=(-1, 1), n=10)
|
||||
#print(vb.childGroup.childItems())
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user