Esempio n. 1
0
 def render(self):
     return self.frames[0]
     w = self.width
     h = self.height - 15
     try:
         return resize(self.frames[0], w, h, dst=(w, h, 3))
     except IndexError:
         pass
Esempio n. 2
0
 def render(self):
     return self.frames[0]
     w = self.width
     h = self.height - 15
     try:
         return resize(self.frames[0], w, h, dst=(w, h, 3))
     except IndexError:
         pass
Esempio n. 3
0
    def modify_frame(self,
                     frame,
                     vflip=None,
                     hflip=None,
                     gray=False,
                     swap_rb=None,
                     clone=False,
                     croprect=None,
                     size=None):
        if frame is not None:

            def _get_param(param, p):
                if param is None:
                    return getattr(self, p)
                else:
                    return param

            swap_rb = _get_param(swap_rb, 'swap_rb')
            vflip = _get_param(vflip, 'vflip')
            hflip = _get_param(hflip, 'hflip')

            if clone:
                frame = frame.clone()

            if swap_rb:
                frame = cv_swap_rb(frame)

            if gray:
                frame = grayspace(frame)

            if croprect:
                if len(croprect) == 2:  # assume w, h
                    w, h = get_size(frame)
                    croprect = (w - croprect[0]) / 2, (
                        h - croprect[1]) / 2, croprect[0], croprect[1]
                else:
                    pass

                rs = croprect[0]
                re = croprect[0] + croprect[2]
                cs = croprect[1]
                ce = croprect[1] + croprect[3]

                frame = asMat(frame.ndarray[cs:ce, rs:re])

            if size:
                frame = resize(frame, *size)

            if not globalv.video_test:
                if vflip:
                    if hflip:
                        cv_flip(frame, -1)
                    else:
                        cv_flip(frame, 0)
                elif hflip:
                    cv_flip(frame, 1)

        return frame
Esempio n. 4
0
    def render(self):
        return self.frames[0]
#        w = sum([s.size()[0] for s in pychron])
#        h = sum([s.size()[1] for s in pychron])
#        print w,h, pychron[0].size()
        w = self.width
        h = self.height - 15
#        display =
        try:
#            return resize(self.frames[0], w, h, dst=new_dst(w, h, 3))
            return resize(self.frames[0], w, h, dst=(w, h, 3))
        except IndexError:
            pass
Esempio n. 5
0
    def render(self):
        return self.frames[0]
#        w = sum([s.size()[0] for s in pychron])
#        h = sum([s.size()[1] for s in pychron])
#        print w,h, pychron[0].size()
        w = self.width
        h = self.height - 15
#        display =
        try:
#            return resize(self.frames[0], w, h, dst=new_dst(w, h, 3))
            return resize(self.frames[0], w, h, dst=(w, h, 3))
        except IndexError:
            pass
Esempio n. 6
0
    def modify_frame(self, frame, vflip=None, hflip=None , gray=False, swap_rb=None,
                  clone=False, croprect=None, size=None):
#        print size
#        size = (100, 100)
        if frame is not None:
            def _get_param(param, p):
                if param is None:
                    return getattr(self, p)
                else:
#                    setattr(self, p, param)
                    return param
            swap_rb = _get_param(swap_rb, 'swap_rb')
            vflip = _get_param(vflip, 'vflip')
            hflip = _get_param(hflip, 'hflip')

            if clone:
                frame = frame.clone()

            if swap_rb:
                frame = cv_swap_rb(frame)

            if gray:
                frame = grayspace(frame)

            if croprect:
                if len(croprect) == 2:  # assume w, h
                    w, h = get_size(frame)
                    croprect = (w - croprect[0]) / 2, (h - croprect[1]) / 2, croprect[0], croprect[1]
                else:
                    pass

                rs = croprect[0]
                re = croprect[0] + croprect[2]
                cs = croprect[1]
                ce = croprect[1] + croprect[3]

                frame = asMat(frame.ndarray[cs:ce, rs:re])

            if size:
                frame = resize(frame, *size)

            if not globalv.video_test:
                if vflip:
                    if hflip:
                        cv_flip(frame, -1)
                    else:
                        cv_flip(frame, 0)
                elif hflip:
                    cv_flip(frame, 1)

        return frame