diff --git a/photobooth/CameraOpenCV.py b/photobooth/CameraOpenCV.py index 7706376..86d87ca 100644 --- a/photobooth/CameraOpenCV.py +++ b/photobooth/CameraOpenCV.py @@ -15,9 +15,9 @@ class CameraOpenCV(Camera): self.hasPreview = True self.hasIdle = False - # self._cap = cv2.VideoCapture(0) - # if not self._cap.isOpened(): - # raise RuntimeError('Camera could not be opened') + self._cap = cv2.VideoCapture(0) + if not self._cap.isOpened(): + raise RuntimeError('Camera could not be opened') def getPreview(self): diff --git a/photobooth/Photobooth.py b/photobooth/Photobooth.py index e04d9f2..07e925f 100644 --- a/photobooth/Photobooth.py +++ b/photobooth/Photobooth.py @@ -10,7 +10,7 @@ from PyQt5Gui import PyQt5Gui from CameraOpenCV import CameraOpenCV as Camera -from PIL import Image +from PIL import Image, ImageOps from multiprocessing import Pipe, Process @@ -71,7 +71,7 @@ class Photobooth: while toc < pose_time: self._send.send( Gui.PreviewState( message = str(pose_time - int(toc)), - picture = self._cap.getPreview() ) ) + picture = ImageOps.mirror(self._cap.getPreview()) ) ) toc = time() - tic else: for i in range(pose_time): diff --git a/photobooth/PyQt5Gui.py b/photobooth/PyQt5Gui.py index e02c97d..1122cef 100644 --- a/photobooth/PyQt5Gui.py +++ b/photobooth/PyQt5Gui.py @@ -60,11 +60,9 @@ class PyQt5Gui(Gui.Gui): elif isinstance(state, Gui.PoseState): self._p.setCentralWidget(PyQt5PictureMessage('Will capture 4 pictures!')) elif isinstance(state, Gui.PreviewState): - # img = QImage(state.picture, state.picture.shape[1], state.picture.shape[0], QImage.Format_RGB888) img = ImageQt.ImageQt(state.picture) self._p.setCentralWidget(PyQt5PictureMessage(state.message, img)) elif isinstance(state, Gui.PictureState): - # img = QImage(state.picture, state.picture.shape[1], state.picture.shape[0], QImage.Format_RGB888) img = ImageQt.ImageQt(state.picture) self._p.setCentralWidget(PyQt5PictureMessage('', img)) elif isinstance(state, Gui.ErrorState): @@ -88,7 +86,7 @@ class PyQt5Gui(Gui.Gui): def showIdle(self): self._p.handleKeypressEvent = self.handleKeypressEvent - self._p.setCentralWidget(PyQt5PictureMessage('Hit the button!', 'homer.jpg')) + self._p.setCentralWidget(PyQt5PictureMessage('Hit the button!'))#, 'homer.jpg')) def showError(self, title, message):