Skip to content

Commit dc86c7b

Browse files
committed
add dirsortionCorrection checkbox
1 parent 0923488 commit dc86c7b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

depth_test/depthtest.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def setupUi(self, DepthTest):
5252
self.l_result.setText("")
5353
self.l_result.setObjectName("l_result")
5454
self.b_start = QtWidgets.QPushButton(self.centralwidget)
55-
self.b_start.setGeometry(QtCore.QRect(640, 550, 151, 71))
55+
self.b_start.setGeometry(QtCore.QRect(600, 550, 151, 71))
5656
self.b_start.setObjectName("b_start")
5757
self.l_test = QtWidgets.QLabel(self.centralwidget)
5858
self.l_test.setGeometry(QtCore.QRect(20, 40, 231, 81))
@@ -141,7 +141,7 @@ def setupUi(self, DepthTest):
141141
self.r_center.setChecked(True)
142142
self.r_center.setObjectName("r_center")
143143
self.options_group = QtWidgets.QGroupBox(self.centralwidget)
144-
self.options_group.setGeometry(QtCore.QRect(890, 520, 161, 131))
144+
self.options_group.setGeometry(QtCore.QRect(800, 520, 251, 161))
145145
self.options_group.setObjectName("options_group")
146146
self.c_lrcheck = QtWidgets.QCheckBox(self.options_group)
147147
self.c_lrcheck.setGeometry(QtCore.QRect(10, 30, 97, 26))
@@ -154,6 +154,9 @@ def setupUi(self, DepthTest):
154154
self.c_subpixel.setGeometry(QtCore.QRect(10, 60, 111, 26))
155155
self.c_subpixel.setChecked(True)
156156
self.c_subpixel.setObjectName("c_subpixel")
157+
self.c_distrotion = QtWidgets.QCheckBox(self.options_group)
158+
self.c_distrotion.setGeometry(QtCore.QRect(10, 120, 231, 26))
159+
self.c_distrotion.setObjectName("c_distrotion")
157160
self.l_pixels_no = QtWidgets.QLabel(self.centralwidget)
158161
self.l_pixels_no.setGeometry(QtCore.QRect(270, 650, 91, 31))
159162
font = QtGui.QFont()
@@ -205,12 +208,13 @@ def retranslateUi(self, DepthTest):
205208
self.c_lrcheck.setText(_translate("DepthTest", "lrcheck"))
206209
self.c_extended.setText(_translate("DepthTest", "extended"))
207210
self.c_subpixel.setText(_translate("DepthTest", "subpixel"))
211+
self.c_distrotion.setText(_translate("DepthTest", "distortionCorrection"))
208212
self.l_pixels_no.setText(_translate("DepthTest", "-"))
209213
self.c_matplot.setText(_translate("DepthTest", "Matplot"))
210214

211215

212216
class Camera:
213-
def __init__(self, lrcheck, subpixel, extended):
217+
def __init__(self, lrcheck, subpixel, extended, distortion):
214218
# get mono resolution
215219
cam_res = {
216220
'OV7251': dai.MonoCameraProperties.SensorResolution.THE_480_P,
@@ -256,6 +260,7 @@ def __init__(self, lrcheck, subpixel, extended):
256260
stereo.setLeftRightCheck(lrcheck)
257261
stereo.setSubpixel(subpixel)
258262
stereo.setExtendedDisparity(extended)
263+
stereo.enableDistortionCorrection(distortion)
259264

260265
# Linking
261266
mono_left.out.link(stereo.left)
@@ -398,8 +403,8 @@ def mouseReleaseEvent(self, event: 'QGraphicsSceneMouseEvent') -> None:
398403
self.p2[1] = clamp(self.p2[1], 0, self.height)
399404
self.roi.update(self.p1, self.p2)
400405

401-
def enable_camera(self, lrcheck, subpixel, extended):
402-
self.camera = Camera(lrcheck, subpixel, extended)
406+
def enable_camera(self, lrcheck, subpixel, extended, distortion):
407+
self.camera = Camera(lrcheck, subpixel, extended, distortion)
403408
self.cameraEnabled = True
404409

405410
def disable_camera(self):
@@ -560,7 +565,7 @@ def button_event(self):
560565
self.set_result('')
561566
self.ui.options_group.setDisabled(False)
562567
else:
563-
self.scene.get_frame().enable_camera(self.ui.c_lrcheck.isChecked(), self.ui.c_subpixel.isChecked(), self.ui.c_extended.isChecked())
568+
self.scene.get_frame().enable_camera(self.ui.c_lrcheck.isChecked(), self.ui.c_subpixel.isChecked(), self.ui.c_extended.isChecked(), self.ui.c_distrotion.isChecked())
564569

565570
# print(f'{self.ui.c_lrcheck.isChecked()}, {self.ui.c_subpixel.isChecked()}, {self.ui.c_extended.isChecked()}')
566571
self.error = 0

0 commit comments

Comments
 (0)