|
|
|
@ -205,11 +205,11 @@ class MainWindow(QGlPicamera2):
|
|
|
|
|
picam2 = Picamera2()
|
|
|
|
|
#picam2.start_preview(Preview.QTGL)
|
|
|
|
|
#max resolution is (4056, 3040) which is more like 10 fps
|
|
|
|
|
config = picam2.create_preview_configuration(main={"size": (2028, 1520)}, lores={"size": (1920, 1440), "format": "YUV420"})
|
|
|
|
|
config = picam2.create_preview_configuration(main={"size": (2028, 1520)}, lores={"size": (768, 768), "format": "YUV420"})
|
|
|
|
|
picam2.configure(config)
|
|
|
|
|
|
|
|
|
|
app = QApplication([])
|
|
|
|
|
qpicamera2 = MainWindow(picam2, width=1920, height=1440, keep_ar=False)
|
|
|
|
|
qpicamera2 = MainWindow(picam2, width=1350, height=1350, keep_ar=False)
|
|
|
|
|
qpicamera2.setWindowTitle("Qt Picamera2 App")
|
|
|
|
|
|
|
|
|
|
selectedAxis = 'x'
|
|
|
|
@ -218,8 +218,8 @@ l1 = 100
|
|
|
|
|
l2 = 300
|
|
|
|
|
l3 = 40
|
|
|
|
|
w = 20
|
|
|
|
|
roiXCenter = (960, 195)
|
|
|
|
|
roiYCenter = (615, 530)
|
|
|
|
|
roiXCenter = (507, 98)
|
|
|
|
|
roiYCenter = (306, 275)
|
|
|
|
|
roiX = rectsFromPoint(roiXCenter, l1, l2, l3, w, 'x')
|
|
|
|
|
roiY = rectsFromPoint(roiYCenter, l1, l2, l3, w, 'y')
|
|
|
|
|
dilationVal = 75
|
|
|
|
@ -229,13 +229,19 @@ calibrate = True
|
|
|
|
|
oscClient = udp_client.SimpleUDPClient("127.0.0.1", 57120)
|
|
|
|
|
|
|
|
|
|
cv2.startWindowThread()
|
|
|
|
|
cv2.namedWindow("Frame")
|
|
|
|
|
cv2.namedWindow("Frame", cv2.WINDOW_NORMAL)
|
|
|
|
|
cv2.resizeWindow("Frame", 1350, 1350)
|
|
|
|
|
cv2.setMouseCallback("Frame", moveROI)
|
|
|
|
|
|
|
|
|
|
picam2.controls.ScalerCrop = (800, 0, 3040, 3040)
|
|
|
|
|
picam2.controls.Brightness = 0.05
|
|
|
|
|
picam2.controls.Contrast = 0.9
|
|
|
|
|
|
|
|
|
|
(w0, h0) = picam2.stream_configuration("main")["size"]
|
|
|
|
|
(w1, h1) = picam2.stream_configuration("lores")["size"]
|
|
|
|
|
s1 = picam2.stream_configuration("lores")["stride"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
picam2.start()
|
|
|
|
|
qpicamera2.show()
|
|
|
|
|
app.exec()
|
|
|
|
|