This commit is contained in:
NikolajDanger
2022-09-21 11:43:13 +02:00
parent ed5070cee4
commit aac4cab563

View File

@ -36,8 +36,6 @@ class Robot(object):
while not self.serial_read.isOpen(): while not self.serial_read.isOpen():
sleep(1) sleep(1)
self._init_camera()
print("Waiting for serial port connection ...") print("Waiting for serial port connection ...")
sleep(2) sleep(2)
@ -73,13 +71,13 @@ class Robot(object):
) )
) )
self.cam = cv2.VideoCapture( return cv2.VideoCapture(
gstreamer_pipeline(), gstreamer_pipeline(),
apiPreference=cv2.CAP_GSTREAMER apiPreference=cv2.CAP_GSTREAMER
) )
def take_photo(self): def take_photo(self):
cap = cv2.VideoCapture(0) cap = self._init_camera()
_, photo = cap.read() _, photo = cap.read()
cap.release() cap.release()
return photo return photo