Ejemplo n.º 1
0
    def __init__(self, backend : FaceAligner):
        cs = backend.get_control_sheet()

        q_align_mode_label = QLabelPopupInfo(label=L('@QFaceAligner.align_mode'), popup_info_text=L('@QFaceAligner.help.align_mode'))
        q_align_mode = QComboBoxCSWDynamicSingleSwitch(cs.align_mode, reflect_state_widgets=[q_align_mode_label])

        q_face_coverage_label = QLabelPopupInfo(label=L('@QFaceAligner.face_coverage'), popup_info_text=L('@QFaceAligner.help.face_coverage') )
        q_face_coverage       = QSpinBoxCSWNumber(cs.face_coverage, reflect_state_widgets=[q_face_coverage_label])

        q_resolution_label = QLabelPopupInfo(label=L('@QFaceAligner.resolution'), popup_info_text=L('@QFaceAligner.help.resolution') )
        q_resolution       = QSpinBoxCSWNumber(cs.resolution, reflect_state_widgets=[q_resolution_label])

        q_exclude_moving_parts_label = QLabelPopupInfo(label=L('@QFaceAligner.exclude_moving_parts'), popup_info_text=L('@QFaceAligner.help.exclude_moving_parts') )
        q_exclude_moving_parts = QCheckBoxCSWFlag(cs.exclude_moving_parts, reflect_state_widgets=[q_exclude_moving_parts_label])

        q_head_mode_label = QLabelPopupInfo(label=L('@QFaceAligner.head_mode'), popup_info_text=L('@QFaceAligner.help.head_mode') )
        q_head_mode = QCheckBoxCSWFlag(cs.head_mode, reflect_state_widgets=[q_head_mode_label])

        q_freeze_z_rotation_label = QLabelPopupInfo(label=L('@QFaceAligner.freeze_z_rotation') )
        q_freeze_z_rotation = QCheckBoxCSWFlag(cs.freeze_z_rotation, reflect_state_widgets=[q_freeze_z_rotation_label])

        q_x_offset_label = QLabelPopupInfo(label=L('@QFaceAligner.x_offset'))
        q_x_offset       = QSpinBoxCSWNumber(cs.x_offset, reflect_state_widgets=[q_x_offset_label])

        q_y_offset_label = QLabelPopupInfo(label=L('@QFaceAligner.y_offset'))
        q_y_offset       = QSpinBoxCSWNumber(cs.y_offset, reflect_state_widgets=[q_y_offset_label])

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_align_mode_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_align_mode, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_face_coverage_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_face_coverage, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_resolution_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_resolution, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_exclude_moving_parts_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_exclude_moving_parts, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_head_mode_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_head_mode, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_freeze_z_rotation_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_freeze_z_rotation, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addLayout( qtx.QXVBoxLayout([q_x_offset_label, q_y_offset_label]), row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addLayout( qtx.QXHBoxLayout([q_x_offset, q_y_offset]), row, 1, alignment=qtx.AlignLeft )
        row += 1

        super().__init__(backend, L('@QFaceAligner.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]))
Ejemplo n.º 2
0
    def __init__(self, backend):
        cs = backend.get_control_sheet()

        q_median_blur_label = QLabelPopupInfo(label=L('@QFrameAdjuster.median_blur_per'), popup_info_text=L('@QFrameAdjuster.help.median_blur_per') )
        q_median_blur       = QSliderCSWNumber(cs.median_blur_per, reflect_state_widgets=[q_median_blur_label])

        q_degrade_bicubic_label = QLabelPopupInfo(label=L('@QFrameAdjuster.degrade_bicubic_per'), popup_info_text=L('@QFrameAdjuster.help.degrade_bicubic_per') )
        q_degrade_bicubic       = QSliderCSWNumber(cs.degrade_bicubic_per, reflect_state_widgets=[q_degrade_bicubic_label])

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_median_blur_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_median_blur, row, 1)
        row += 1
        grid_l.addWidget(q_degrade_bicubic_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter  )
        grid_l.addWidget(q_degrade_bicubic, row, 1)
        row += 1

        super().__init__(backend, L('@QFrameAdjuster.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]) )
Ejemplo n.º 3
0
    def __init__(self, backend: FaceSwapper, dfm_models_path: Path):
        self._dfm_models_path = dfm_models_path

        cs = backend.get_control_sheet()

        btn_open_folder = self.btn_open_folder = qtx.QXPushButton(
            image=QXImageDB.eye_outline('light gray'),
            tooltip_text='Reveal in Explorer',
            released=self._btn_open_folder_released,
            fixed_size=(24, 22))

        q_device_label = QLabelPopupInfo(
            label=L('@common.device'),
            popup_info_text=L('@common.help.device'))
        q_device = QComboBoxCSWDynamicSingleSwitch(
            cs.device, reflect_state_widgets=[q_device_label])

        q_model_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.model'),
            popup_info_text=L('@QFaceSwapper.help.model'))
        q_model = QComboBoxCSWDynamicSingleSwitch(
            cs.model, reflect_state_widgets=[q_model_label, btn_open_folder])

        q_model_dl_error = self._q_model_dl_error = QErrorCSWError(
            cs.model_dl_error)
        q_model_dl_progress = self._q_model_dl_progress = QProgressBarCSWProgress(
            cs.model_dl_progress)

        q_model_info_label = self._q_model_info_label = QLabelPopupInfoCSWInfoLabel(
            cs.model_info_label)

        q_swap_all_faces_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.swap_all_faces'))
        q_swap_all_faces = QCheckBoxCSWFlag(
            cs.swap_all_faces, reflect_state_widgets=[q_swap_all_faces_label])

        q_face_id_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.face_id'),
            popup_info_text=L('@QFaceSwapper.help.face_id'))
        q_face_id = QSpinBoxCSWNumber(cs.face_id,
                                      reflect_state_widgets=[q_face_id_label])

        q_morph_factor_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.morph_factor'),
            popup_info_text=L('@QFaceSwapper.help.morph_factor'))
        q_morph_factor = QSliderCSWNumber(
            cs.morph_factor, reflect_state_widgets=[q_morph_factor_label])

        q_sharpen_amount_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.presharpen_amount'),
            popup_info_text=L('@QFaceSwapper.help.presharpen_amount'))
        q_sharpen_amount = QSliderCSWNumber(
            cs.presharpen_amount,
            reflect_state_widgets=[q_sharpen_amount_label])

        q_pre_gamma_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.pregamma'),
            popup_info_text=L('@QFaceSwapper.help.pregamma'))

        q_pre_gamma_red = QSpinBoxCSWNumber(
            cs.pre_gamma_red, reflect_state_widgets=[q_pre_gamma_label])
        q_pre_gamma_green = QSpinBoxCSWNumber(cs.pre_gamma_green)
        q_pre_gamma_blue = QSpinBoxCSWNumber(cs.pre_gamma_blue)

        q_post_gamma_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.postgamma'))

        q_post_gamma_red = QSpinBoxCSWNumber(
            cs.post_gamma_red, reflect_state_widgets=[q_post_gamma_label])
        q_post_gamma_green = QSpinBoxCSWNumber(cs.post_gamma_green)
        q_post_gamma_blue = QSpinBoxCSWNumber(cs.post_gamma_blue)

        q_two_pass_label = QLabelPopupInfo(
            label=L('@QFaceSwapper.two_pass'),
            popup_info_text=L('@QFaceSwapper.help.two_pass'))
        q_two_pass = QCheckBoxCSWFlag(cs.two_pass,
                                      reflect_state_widgets=[q_two_pass_label])

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_device_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_device, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_model_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(
            qtx.QXHBoxLayout(
                [q_model, 2, btn_open_folder, 2, q_model_info_label]), row, 1)
        row += 1
        grid_l.addWidget(q_model_dl_progress, row, 0, 1, 2)
        row += 1
        grid_l.addWidget(q_model_dl_error, row, 0, 1, 2)
        row += 1
        grid_l.addWidget(q_swap_all_faces_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_swap_all_faces, 4, q_face_id_label, 4, q_face_id]),
                         row,
                         1,
                         alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_morph_factor_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_morph_factor, row, 1)
        row += 1
        grid_l.addWidget(q_sharpen_amount_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_sharpen_amount, row, 1)
        row += 1
        grid_l.addWidget(q_pre_gamma_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(
            qtx.QXHBoxLayout(
                [q_pre_gamma_red, q_pre_gamma_green, q_pre_gamma_blue]), row,
            1)
        row += 1
        grid_l.addWidget(q_post_gamma_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(
            qtx.QXHBoxLayout(
                [q_post_gamma_red, q_post_gamma_green, q_post_gamma_blue]),
            row, 1)
        row += 1
        grid_l.addWidget(q_two_pass_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_two_pass, row, 1)
        row += 1

        super().__init__(backend,
                         L('@QFaceSwapper.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]))
Ejemplo n.º 4
0
    def __init__(self, backend):
        cs = backend.get_control_sheet()

        q_marker_type_label = QLabelPopupInfo(
            label=L('@QFaceMarker.marker_type'),
            popup_info_text=L('@QFaceMarker.help.marker_type'))
        q_marker_type = QComboBoxCSWDynamicSingleSwitch(
            cs.marker_type, reflect_state_widgets=[q_marker_type_label])

        q_device_label = QLabelPopupInfo(
            label=L('@common.device'),
            popup_info_text=L('@common.help.device'))
        q_device = QComboBoxCSWDynamicSingleSwitch(
            cs.device, reflect_state_widgets=[q_device_label])

        q_marker_coverage_label = QLabelPopupInfo(
            label=L('@QFaceMarker.marker_coverage'),
            popup_info_text=L('@QFaceMarker.help.marker_coverage'))
        q_marker_coverage = QSpinBoxCSWNumber(
            cs.marker_coverage,
            reflect_state_widgets=[q_marker_coverage_label])

        q_temporal_smoothing_label = QLabelPopupInfo(
            label=L('@QFaceMarker.temporal_smoothing'),
            popup_info_text=L('@QFaceMarker.help.temporal_smoothing'))
        q_temporal_smoothing = QSpinBoxCSWNumber(
            cs.temporal_smoothing,
            reflect_state_widgets=[q_temporal_smoothing_label])

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_marker_type_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_marker_type, row, 1, 1, 3)
        row += 1
        grid_l.addWidget(q_device_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_device, row, 1, 1, 3)
        row += 1

        sub_row = 0
        sub_grid_l = qtx.QXGridLayout(spacing=5)
        sub_grid_l.addWidget(q_marker_coverage_label,
                             sub_row,
                             0,
                             1,
                             1,
                             alignment=qtx.AlignRight | qtx.AlignVCenter)
        sub_grid_l.addWidget(q_marker_coverage,
                             sub_row,
                             1,
                             1,
                             1,
                             alignment=qtx.AlignLeft)
        sub_row += 1
        sub_grid_l.addWidget(q_temporal_smoothing_label,
                             sub_row,
                             0,
                             1,
                             1,
                             alignment=qtx.AlignRight | qtx.AlignVCenter)
        sub_grid_l.addWidget(q_temporal_smoothing,
                             sub_row,
                             1,
                             1,
                             1,
                             alignment=qtx.AlignLeft)
        sub_row += 1

        grid_l.addLayout(sub_grid_l, row, 0, 1, 4, alignment=qtx.AlignCenter)
        row += 1

        super().__init__(backend,
                         L('@QFaceMarker.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]))
Ejemplo n.º 5
0
    def __init__(self, backend: FaceAnimator, animatables_path: Path):
        self._animatables_path = animatables_path

        cs = backend.get_control_sheet()

        btn_open_folder = self.btn_open_folder = qtx.QXPushButton(
            image=QXImageDB.eye_outline('light gray'),
            tooltip_text='Reveal in Explorer',
            released=self._btn_open_folder_released,
            fixed_size=(24, 22))

        q_device_label = QLabelPopupInfo(
            label=L('@common.device'),
            popup_info_text=L('@common.help.device'))
        q_device = QComboBoxCSWDynamicSingleSwitch(
            cs.device, reflect_state_widgets=[q_device_label])

        q_animatable_label = QLabelPopupInfo(
            label=L('@QFaceAnimator.animatable'))
        q_animatable = QComboBoxCSWDynamicSingleSwitch(
            cs.animatable,
            reflect_state_widgets=[q_animatable_label, btn_open_folder])

        q_animator_face_id_label = QLabelPopupInfo(
            label=L('@QFaceAnimator.animator_face_id'))
        q_animator_face_id = QSpinBoxCSWNumber(
            cs.animator_face_id,
            reflect_state_widgets=[q_animator_face_id_label])

        q_relative_mode_label = QLabelPopupInfo(
            label=L('@QFaceAnimator.relative_mode'))
        q_relative_mode = QCheckBoxCSWFlag(
            cs.relative_mode, reflect_state_widgets=[q_relative_mode_label])

        q_relative_power = QSliderCSWNumber(cs.relative_power)

        q_update_animatables = QXPushButtonCSWSignal(
            cs.update_animatables,
            image=QXImageDB.reload_outline('light gray'),
            button_size=(24, 22))

        q_reset_reference_pose = QXPushButtonCSWSignal(
            cs.reset_reference_pose,
            text=L('@QFaceAnimator.reset_reference_pose'))

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_device_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_device, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_animatable_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(
            qtx.QXHBoxLayout(
                [q_animatable, 2, btn_open_folder, 2, q_update_animatables]),
            row, 1)
        row += 1
        grid_l.addWidget(q_animator_face_id_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_animator_face_id, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_relative_mode_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_relative_mode, 2, q_relative_power]),
                         row,
                         1,
                         alignment=qtx.AlignLeft)

        row += 1
        grid_l.addWidget(q_reset_reference_pose, row, 0, 1, 2)
        row += 1

        super().__init__(backend,
                         L('@QFaceAnimator.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]))
Ejemplo n.º 6
0
    def __init__(self, backend: FileSource):
        cs = backend.get_control_sheet()

        q_input_type = QButtonCSWDynamicSingleSwitch(cs.input_type,
                                                     horizontal=True,
                                                     radio_buttons=True)
        q_input_paths = QPathEditCSWPaths(cs.input_paths)
        q_error = QErrorCSWError(cs.error)

        q_target_width_label = QLabelPopupInfo(
            label=L('@QFileSource.target_width'),
            popup_info_text=L('@QFileSource.help.target_width'))
        q_target_width = QSpinBoxCSWNumber(
            cs.target_width, reflect_state_widgets=[q_target_width_label])

        q_fps_label = QLabelPopupInfo(
            label=L('@QFileSource.fps'),
            popup_info_text=L('@QFileSource.help.fps'))
        q_fps = QSpinBoxCSWNumber(cs.fps, reflect_state_widgets=[q_fps_label])

        q_is_realtime_label = QLabelPopupInfo(
            label=L('@QFileSource.is_realtime'),
            popup_info_text=L('@QFileSource.help.is_realtime'))
        q_is_realtime = QCheckBoxCSWFlag(
            cs.is_realtime, reflect_state_widgets=[q_is_realtime_label])

        q_is_autorewind_label = QLabelPopupInfo(
            label=L('@QFileSource.is_autorewind'))
        q_is_autorewind = QCheckBoxCSWFlag(
            cs.is_autorewind, reflect_state_widgets=[q_is_autorewind_label])

        btn_size = (32, 32)
        btn_color = '#E01010'
        btn_seek_begin = QXPushButtonCSWSignal(
            cs.seek_begin,
            image=QXImageDB.play_skip_back_circle_outline(btn_color),
            button_size=btn_size)
        btn_seek_backward = QXPushButtonCSWSignal(
            cs.seek_backward,
            image=QXImageDB.play_back_circle_outline(btn_color),
            button_size=btn_size)
        btn_play = QXPushButtonCSWSignal(
            cs.play,
            image=QXImageDB.play_circle_outline(btn_color),
            button_size=btn_size)
        btn_pause = QXPushButtonCSWSignal(
            cs.pause,
            image=QXImageDB.pause_circle_outline(btn_color),
            button_size=btn_size)
        btn_seek_forward = QXPushButtonCSWSignal(
            cs.seek_forward,
            image=QXImageDB.play_forward_circle_outline(btn_color),
            button_size=btn_size)
        btn_seek_end = QXPushButtonCSWSignal(
            cs.seek_end,
            image=QXImageDB.play_skip_forward_circle_outline(btn_color),
            button_size=btn_size)

        q_frame_slider = QSliderCSWNumbers(cs.frame_index, cs.frame_count)

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_target_width_label,
                         row,
                         0,
                         1,
                         2,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_target_width, row, 2, 1, 2, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_is_realtime_label, 5, q_is_realtime, 5, q_fps_label]),
                         row,
                         0,
                         1,
                         2,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_fps, row, 2, 1, 2, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_is_autorewind_label,
                         row,
                         0,
                         1,
                         2,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_is_autorewind,
                         row,
                         2,
                         1,
                         2,
                         alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(qtx.QXFrameHBox([
            btn_seek_begin, btn_seek_backward, btn_play, btn_pause,
            btn_seek_forward, btn_seek_end
        ],
                                         spacing=1),
                         row,
                         0,
                         1,
                         4,
                         alignment=qtx.AlignCenter)
        row += 1
        grid_l.addWidget(q_frame_slider, row, 0, 1, 4)
        row += 1

        main_l = qtx.QXVBoxLayout(
            [q_input_type, q_input_paths, q_error, grid_l], spacing=5)

        super().__init__(backend,
                         L('@QFileSource.module_title'),
                         layout=main_l,
                         content_align_top=True)
Ejemplo n.º 7
0
    def __init__(self, backend: CameraSource):
        cs = backend.get_control_sheet()

        q_driver_label = QLabelPopupInfo(
            label=L('@QCameraSource.driver'),
            popup_info_text=L('@QCameraSource.help.driver'))
        q_driver = QComboBoxCSWDynamicSingleSwitch(
            cs.driver, reflect_state_widgets=[q_driver_label])

        q_device_idx_label = QLabelPopupInfo(
            label=L('@QCameraSource.device_index'))
        q_device_idx = QComboBoxCSWDynamicSingleSwitch(
            cs.device_idx, reflect_state_widgets=[q_device_idx_label])

        q_resolution_label = QLabelPopupInfo(
            label=L('@QCameraSource.resolution'),
            popup_info_text=L('@QCameraSource.help.resolution'))
        q_resolution = QComboBoxCSWDynamicSingleSwitch(
            cs.resolution, reflect_state_widgets=[q_resolution_label])

        q_fps_label = QLabelPopupInfo(
            label=L('@QCameraSource.fps'),
            popup_info_text=L('@QCameraSource.help.fps'))
        q_fps = QSpinBoxCSWNumber(cs.fps, reflect_state_widgets=[q_fps_label])

        q_rotation_label = QLabelPopupInfo(label=L('@QCameraSource.rotation'))
        q_rotation = QComboBoxCSWDynamicSingleSwitch(
            cs.rotation, reflect_state_widgets=[q_rotation_label])

        q_flip_horizontal_label = QLabelPopupInfo(
            label=L('@QCameraSource.flip_horizontal'))
        q_flip_horizontal = QCheckBoxCSWFlag(
            cs.flip_horizontal,
            reflect_state_widgets=[q_flip_horizontal_label])

        q_camera_settings_group_label = QLabelPopupInfo(
            label=L('@QCameraSource.camera_settings'))

        q_open_settings = QXPushButtonCSWSignal(
            cs.open_settings, text=L('@QCameraSource.open_settings'))
        q_load_settings = QXPushButtonCSWSignal(
            cs.load_settings,
            text=L('@QCameraSource.load_settings'),
            reflect_state_widgets=[q_camera_settings_group_label])
        q_save_settings = QXPushButtonCSWSignal(
            cs.save_settings, text=L('@QCameraSource.save_settings'))

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_driver_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_driver, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_device_idx_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_device_idx, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_resolution_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_resolution, row, 1, alignment=qtx.AlignLeft)
        row += 1
        btn_height = 24
        grid_l.addWidget(q_camera_settings_group_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(qtx.QXWidgetHBox(
            [q_open_settings, q_load_settings, q_save_settings],
            contents_margins=(1, 0, 1, 0),
            spacing=1,
            fixed_height=btn_height),
                         row,
                         1,
                         alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_fps_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_fps, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_rotation_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_rotation, row, 1, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_flip_horizontal_label,
                         row,
                         0,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_flip_horizontal, row, 1, alignment=qtx.AlignLeft)
        row += 1

        super().__init__(backend,
                         L('@QCameraSource.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l], spacing=5),
                         content_align_top=True)
Ejemplo n.º 8
0
    def __init__(self, backend: FaceDetector):
        if not isinstance(backend, FaceDetector):
            raise ValueError('backend must be an instance of FaceDetector')

        self._backend = backend
        self._bc_out = backend.get_bc_out()
        self._weak_heap = backend.get_weak_heap()
        self._bcd_id = None
        self._timer = qtx.QXTimer(interval=10,
                                  timeout=self._on_timer_10ms,
                                  start=True)

        face_coords_label = self._q_face_coords_label = qtx.QXLabel(
            font=QXFontDB.get_fixedwidth_font(size=7), word_wrap=False)
        q_detected_faces = self._q_detected_faces = qtx.QXCollapsibleSection(
            title=L('@QFaceDetector.detected_faces'),
            content_layout=qtx.QXVBoxLayout([face_coords_label]),
            is_opened=True)

        cs = backend.get_control_sheet()

        q_detector_type_label = QLabelPopupInfo(
            label=L('@QFaceDetector.detector_type'),
            popup_info_text=L('@QFaceDetector.help.detector_type'))
        q_detector_type = QComboBoxCSWDynamicSingleSwitch(
            cs.detector_type, reflect_state_widgets=[q_detector_type_label])

        q_device_label = QLabelPopupInfo(
            label=L('@common.device'),
            popup_info_text=L('@common.help.device'))
        q_device = QComboBoxCSWDynamicSingleSwitch(
            cs.device, reflect_state_widgets=[q_device_label])

        q_fixed_window_size_label = QLabelPopupInfo(
            label=L('@QFaceDetector.window_size'),
            popup_info_text=L('@QFaceDetector.help.window_size'))
        q_fixed_window_size = QSpinBoxCSWNumber(cs.fixed_window_size,
                                                reflect_state_widgets=[
                                                    q_fixed_window_size_label,
                                                    q_detected_faces
                                                ])

        q_threshold_label = QLabelPopupInfo(
            label=L('@QFaceDetector.threshold'),
            popup_info_text=L('@QFaceDetector.help.threshold'))
        q_threshold = QSpinBoxCSWNumber(
            cs.threshold, reflect_state_widgets=[q_threshold_label])

        q_max_faces_label = QLabelPopupInfo(
            label=L('@QFaceDetector.max_faces'),
            popup_info_text=L('@QFaceDetector.help.max_faces'))
        q_max_faces = QSpinBoxCSWNumber(
            cs.max_faces, reflect_state_widgets=[q_max_faces_label])

        q_sort_by_label = QLabelPopupInfo(
            label=L('@QFaceDetector.sort_by'),
            popup_info_text=L('@QFaceDetector.help.sort_by'))
        q_sort_by = QComboBoxCSWDynamicSingleSwitch(
            cs.sort_by, reflect_state_widgets=[q_sort_by_label])

        q_temporal_smoothing_label = QLabelPopupInfo(
            label=L('@QFaceDetector.temporal_smoothing'),
            popup_info_text=L('@QFaceDetector.help.temporal_smoothing'))
        q_temporal_smoothing = QSpinBoxCSWNumber(
            cs.temporal_smoothing,
            reflect_state_widgets=[q_temporal_smoothing_label])

        grid_l = qtx.QXGridLayout(vertical_spacing=5, horizontal_spacing=5)
        row = 0
        grid_l.addWidget(q_detector_type_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_detector_type, row, 1, 1, 3)
        row += 1
        grid_l.addWidget(q_device_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_device, row, 1, 1, 3)
        row += 1
        grid_l.addWidget(q_fixed_window_size_label,
                         row,
                         0,
                         1,
                         2,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_fixed_window_size,
                         row,
                         2,
                         1,
                         2,
                         alignment=qtx.AlignLeft)
        row += 1
        grid_l.addWidget(q_threshold_label,
                         row,
                         0,
                         1,
                         2,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_threshold, row, 2, 1, 2, alignment=qtx.AlignLeft)
        row += 1
        grid_l.addLayout(qtx.QXHBoxLayout([q_max_faces_label, 5, q_max_faces]),
                         row,
                         0,
                         1,
                         2,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(qtx.QXHBoxLayout([q_sort_by_label, 5, q_sort_by]),
                         row,
                         2,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_temporal_smoothing_label, 5, q_temporal_smoothing]),
                         row,
                         0,
                         1,
                         4,
                         alignment=qtx.AlignCenter)
        row += 1
        grid_l.addWidget(q_detected_faces, row, 0, 1, 4)
        row += 1
        super().__init__(backend,
                         L('@QFaceDetector.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]))
Ejemplo n.º 9
0
    def __init__(self, backend: StreamOutput):
        cs = backend.get_control_sheet()

        q_average_fps_label = QLabelPopupInfo(
            label=L('@QStreamOutput.avg_fps'),
            popup_info_text=L('@QStreamOutput.help.avg_fps'))
        q_average_fps = QLabelCSWNumber(
            cs.avg_fps, reflect_state_widgets=[q_average_fps_label])

        q_source_type_label = QLabelPopupInfo(
            label=L('@QStreamOutput.source_type'))
        q_source_type = QComboBoxCSWDynamicSingleSwitch(
            cs.source_type, reflect_state_widgets=[q_source_type_label])

        q_show_hide_window = QXPushButtonCSWSignal(
            cs.show_hide_window,
            text=L('@QStreamOutput.show_hide_window'),
            button_size=(None, 22))

        q_aligned_face_id_label = QLabelPopupInfo(
            label=L('@QStreamOutput.aligned_face_id'),
            popup_info_text=L('@QStreamOutput.help.aligned_face_id'))
        q_aligned_face_id = QSpinBoxCSWNumber(
            cs.aligned_face_id,
            reflect_state_widgets=[q_aligned_face_id_label])

        q_target_delay_label = QLabelPopupInfo(
            label=L('@QStreamOutput.target_delay'),
            popup_info_text=L('@QStreamOutput.help.target_delay'))
        q_target_delay = QSpinBoxCSWNumber(
            cs.target_delay, reflect_state_widgets=[q_target_delay_label])

        q_save_sequence_path_label = QLabelPopupInfo(
            label=L('@QStreamOutput.save_sequence_path'),
            popup_info_text=L('@QStreamOutput.help.save_sequence_path'))
        q_save_sequence_path = QPathEditCSWPaths(cs.save_sequence_path,
                                                 reflect_state_widgets=[
                                                     q_target_delay_label,
                                                     q_save_sequence_path_label
                                                 ])
        q_save_sequence_path_error = QErrorCSWError(
            cs.save_sequence_path_error)

        q_save_fill_frame_gap_label = QLabelPopupInfo(
            label=L('@QStreamOutput.save_fill_frame_gap'),
            popup_info_text=L('@QStreamOutput.help.save_fill_frame_gap'))
        q_save_fill_frame_gap = QCheckBoxCSWFlag(
            cs.save_fill_frame_gap,
            reflect_state_widgets=[q_save_fill_frame_gap_label])

        q_is_streaming_label = QLabelPopupInfo(label='mpegts udp://')
        q_is_streaming = QCheckBoxCSWFlag(
            cs.is_streaming, reflect_state_widgets=[q_is_streaming_label])

        q_stream_addr = QLineEditCSWText(cs.stream_addr,
                                         font=QXFontDB.get_fixedwidth_font())
        q_stream_port = QSpinBoxCSWNumber(cs.stream_port)

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_average_fps_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_average_fps,
                         row,
                         1,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1
        grid_l.addWidget(q_source_type_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_source_type,
                         row,
                         1,
                         1,
                         1,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        grid_l.addWidget(q_show_hide_window, row, 2, 1, 1)

        row += 1
        grid_l.addWidget(q_aligned_face_id_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_aligned_face_id,
                         row,
                         1,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1
        grid_l.addWidget(q_target_delay_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_target_delay,
                         row,
                         1,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1

        grid_l.addWidget(q_save_sequence_path_label,
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_save_sequence_path,
                         row,
                         1,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_save_fill_frame_gap, 4, q_save_fill_frame_gap_label]),
                         row,
                         1,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1
        grid_l.addWidget(q_save_sequence_path_error, row, 0, 1, 3)
        row += 1
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_is_streaming, 4, q_is_streaming_label]),
                         row,
                         0,
                         1,
                         1,
                         alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(qtx.QXHBoxLayout(
            [q_stream_addr,
             qtx.QXLabel(text=':'), q_stream_port]),
                         row,
                         1,
                         1,
                         2,
                         alignment=qtx.AlignLeft | qtx.AlignVCenter)
        row += 1

        super().__init__(backend,
                         L('@QStreamOutput.module_title'),
                         layout=grid_l)
Ejemplo n.º 10
0
    def __init__(self, backend):
        cs = backend.get_control_sheet()

        q_device_label = QLabelPopupInfo(label=L('@common.device'), popup_info_text=L('@common.help.device'))
        q_device       = QComboBoxCSWDynamicSingleSwitch(cs.device, reflect_state_widgets=[q_device_label])

        q_face_x_offset_label = QLabelPopupInfo(label=L('@QFaceMerger.face_x_offset'))
        q_face_x_offset       = QSpinBoxCSWNumber(cs.face_x_offset, reflect_state_widgets=[q_face_x_offset_label])

        q_face_y_offset_label = QLabelPopupInfo(label=L('@QFaceMerger.face_y_offset'))
        q_face_y_offset       = QSpinBoxCSWNumber(cs.face_y_offset, reflect_state_widgets=[q_face_y_offset_label])

        q_face_scale_label = QLabelPopupInfo(label=L('@QFaceMerger.face_scale') )
        q_face_scale       = QSpinBoxCSWNumber(cs.face_scale, reflect_state_widgets=[q_face_scale_label])

        q_face_mask_type_label = QLabelPopupInfo(label=L('@QFaceMerger.face_mask_type') )
        q_face_mask_source_label = QLabelPopupInfo(label='SRC')
        q_face_mask_source       = QCheckBoxCSWFlag(cs.face_mask_source, reflect_state_widgets=[q_face_mask_type_label, q_face_mask_source_label])
        q_face_mask_celeb_label  = QLabelPopupInfo(label='CELEB')
        q_face_mask_celeb        = QCheckBoxCSWFlag(cs.face_mask_celeb, reflect_state_widgets=[q_face_mask_celeb_label, q_face_mask_source_label])
        q_face_mask_lmrks_label  = QLabelPopupInfo(label='LMRKS')
        q_face_mask_lmrks        = QCheckBoxCSWFlag(cs.face_mask_lmrks, reflect_state_widgets=[q_face_mask_lmrks_label, q_face_mask_source_label])

        q_face_mask_erode_label = QLabelPopupInfo(label=L('@QFaceMerger.face_mask_erode') )
        q_face_mask_erode       = QSpinBoxCSWNumber(cs.face_mask_erode, reflect_state_widgets=[q_face_mask_erode_label])

        q_face_mask_blur_label = QLabelPopupInfo(label=L('@QFaceMerger.face_mask_blur') )
        q_face_mask_blur       = QSpinBoxCSWNumber(cs.face_mask_blur, reflect_state_widgets=[q_face_mask_blur_label])

        q_color_transfer_label = QLabelPopupInfo(label=L('@QFaceMerger.color_transfer'), popup_info_text=L('@QFaceMerger.help.color_transfer'))
        q_color_transfer       = QComboBoxCSWDynamicSingleSwitch(cs.color_transfer, reflect_state_widgets=[q_color_transfer_label])

        q_interpolation_label = QLabelPopupInfo(label=L('@QFaceMerger.interpolation') )
        q_interpolation       = QComboBoxCSWDynamicSingleSwitch(cs.interpolation, reflect_state_widgets=[q_interpolation_label])

        q_color_compression_label = QLabelPopupInfo(label=L('@QFaceMerger.color_compression') )
        q_color_compression       = QSliderCSWNumber(cs.color_compression, reflect_state_widgets=[q_color_compression_label])

        q_face_opacity_label = QLabelPopupInfo(label=L('@QFaceMerger.face_opacity') )
        q_face_opacity       = QSliderCSWNumber(cs.face_opacity, reflect_state_widgets=[q_face_opacity_label])

        grid_l = qtx.QXGridLayout(spacing=5)
        row = 0
        grid_l.addWidget(q_device_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_device, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addLayout( qtx.QXVBoxLayout([q_face_x_offset_label, q_face_y_offset_label]), row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout( qtx.QXHBoxLayout([q_face_x_offset, q_face_y_offset]), row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_face_scale_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_face_scale, row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget( q_face_mask_type_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout( qtx.QXHBoxLayout([q_face_mask_source, q_face_mask_source_label, 5,
                                            q_face_mask_celeb, q_face_mask_celeb_label, 5,
                                            q_face_mask_lmrks, q_face_mask_lmrks_label]), row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addLayout(qtx.QXVBoxLayout([q_face_mask_erode_label,q_face_mask_blur_label]), row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addLayout(qtx.QXHBoxLayout([q_face_mask_erode,q_face_mask_blur], spacing=3), row, 1, alignment=qtx.AlignLeft )
        row += 1
        grid_l.addWidget(q_color_transfer_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_color_transfer, row, 1 )
        row += 1
        grid_l.addWidget(q_interpolation_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_interpolation, row, 1)
        row += 1
        grid_l.addWidget(q_color_compression_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_color_compression, row, 1)
        row += 1
        grid_l.addWidget(q_face_opacity_label, row, 0, alignment=qtx.AlignRight | qtx.AlignVCenter)
        grid_l.addWidget(q_face_opacity, row, 1)
        row += 1

        super().__init__(backend, L('@QFaceMerger.module_title'),
                         layout=qtx.QXVBoxLayout([grid_l]) )