Preview mirrors image
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user