Пример #1
0
    def __init__(self,
                 video,
                 splitType,
                 progressCallback=lambda percent: None,
                 stateCallback=lambda text: None,
                 start=None,
                 end=None):
        """
        Initialise the client class.
        The video can be of type string, cv image or video wrapper.
        """
        self.splitType = splitType
        self.progressCallback = progressCallback
        self.stateCallback = stateCallback

        assert any(splitType == v for (k, v) in SplitType.__dict__.items()
                   if not k.startswith('__')), "Invalid split type"

        if isinstance(video, VideoWrapper):
            self.videoWrapper = video
        elif isinstance(video, type(cv2.VideoCapture())):
            self.videoWrapper = VideoWrapper(video, start, end)
        elif isinstance(video, str):
            self.videoWrapper = VideoWrapper(cv2.VideoCapture(video), start,
                                             end)
        else:
            assert 0, ("Unknown type of video parameter (%s)" % type(video))
Пример #2
0
 def test_faceMemoisation(self):
     """
     Check return time of memoisation and faces are the same
     """
     wrapper = VideoWrapper(self.skyfall, 350, 380)
     self.assertIsNone(wrapper.faces)
     faces = wrapper.getFaces()
     self.assertIsNotNone(wrapper.faces)
     wrapper.video = None
     self.assertEqual(faces, wrapper.getFaces())
Пример #3
0
 def test_validBounds(self):
     frameCount = int(self.skyfall.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT))
     for start, end in [(0, 5),
                        (0, 0),
                        (5, 10),
                        (5, 6),
                        (0, frameCount),
                        (frameCount, frameCount),
                        (frameCount - 1, frameCount),
                        (frameCount - 1, frameCount - 1)]:
         self.assertIsNotNone(VideoWrapper(self.skyfall, start, end))
Пример #4
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle("TeamsVideoSlcier")
        self.croop = (0, 0, 100, 100)

        self._selectedFrames = []

        self.layout = QtWidgets.QVBoxLayout(self)
        self._video_path = "C:\\Users\\Marek\\Downloads\\TeamsVideoSlicer-master\\videos\\2021-10-22 07-54-36.mkv"
        self.loadFramesAlreadyParsed(self._video_path)
        self.video = VideoWrapper(self._video_path)

        self.shadowChanges = ShadowChangesToFiles(self.video, self._video_path)

        self.topBox = QtWidgets.QHBoxLayout()
        self.leftBox = QtWidgets.QVBoxLayout()
        self.selectedFramesWidget = SelectedFramesWidget(
            self.video, self._selectedFrames)

        self.scrollArea = QtWidgets.QScrollArea()
        self.scrollArea.setWidget(self.selectedFramesWidget)
        self.leftBox.addWidget(self.scrollArea)

        self.rightBox = QtWidgets.QGridLayout()

        self.framePreview = FrameWidget(self.video, self.croop)
        self.rightBox.addWidget(self.framePreview)

        self.topBox.addLayout(self.leftBox, 1)
        self.topBox.addLayout(self.rightBox, 3)
        self.layout.addLayout(self.topBox, 3)

        self.bottomBox = QtWidgets.QVBoxLayout()
        self.videoSlider = PreviewSliderWidget(self.video)
        self.bottomBox.addWidget(self.videoSlider)
        self.layout.addLayout(self.bottomBox, 1)

        self.selectedFramesWidget.clicked.connect(self.videoSlider.scrollTo)
        self.framePreview.requestAdd.connect(
            self.selectedFramesWidget.onItemAddClicked)
        self.videoSlider.valueChanged.connect(self.framePreview.showFrame)

        self.selectedFramesWidget.requestRemove.connect(
            self.shadowChanges.deleteFrame)
        self.framePreview.requestAdd.connect(self.shadowChanges.saveFrame)
Пример #5
0
 def test_frameReturn(self):
     """
     Check a certain frame is returned
     """
     self.assertIsNotNone(VideoWrapper(self.skyfall, 360, 380).getFrame(360))
     self.assertRaises(AssertionError, VideoWrapper(self.skyfall, 360, 380).getFrame, 359)
Пример #6
0
 def test_faceReturn(self):
     """
     Check at least a certain amount of faces are returned
     """
     wrapper = VideoWrapper(self.skyfall, 360, 380)
     self.assertTrue(len(wrapper.getFaces()) >= 15 and len(wrapper.getFaces()) <= 20)