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