Пример #1
0
class GetPicture(QWidget):
    """
    Controller class for the Get Picture window used to capture a new user's face.
    Attributes:
        face_recognizer         a FaceRecogniser object used to detect and record a new face for a new identity
        video_widget            custom widget to show the live feed from webcam
    """
    def __init__(self):
        """Class constructor that sets up the window layout and allocates attributes"""
        super().__init__()
        self.title = 'Database Manager - Take Photo'
        self.setFixedSize(600,400)

        self.face_recognizer = FaceRecogniser()
        self.video_widget = VideoWidget(self.face_recognizer)
        h = QHBoxLayout()
        h.addWidget(self.video_widget)
        self.setLayout(h)

    def activate(self):
        """Method to activate this widget and start face detection"""
        self.show()
        self.video_widget.activate()

    def deactivate(self):
        """Method to deactivate this widget and stop face detection"""
        self.hide()
        self.video_widget.deactivate()