Ask Your Question

Revision history [back]

python - cv2 alias issue

I'm playing videos with this piece of code:

class Player(threading.Thread):
def __init__(self, video):
    threading.Thread.__init__(self)
    self.config = Conf.Conf()
    self.video = video
    self.cap = cv2.VideoCapture(video)
    self.frameTitle = self.config.SOFTWARE_TITLE + self.config.VERSION

def run(self):
    while(self.cap.isOpened()):
        ret, frame = self.cap.read()
        if ret:
            cv2.namedWindow(self.frameTitle, cv2.WND_PROP_FULLSCREEN)
            cv2.setWindowProperty(self.frameTitle, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
            cv2.imshow(self.frameTitle, frame)

            if cv2.waitKey(10) & 0xFF == ord('q'):
                self.Stop()
                self.ClosePlayer()
        else:
            self.cap.set(cv2.CAP_PROP_POS_FRAMES, 0)

def Stop(self):
    self.cap.release()

def ClosePlayer(self):
    cv2.destroyAllWindows()

Now, my problem is that videos loose quality and it seems like there's aliasing on smooth shapes. As seen in this picture.

This code is working on a Win10 machine with Python 2.7 (32-bit) and cv2 version 3.4.0.

Edit: I can see correctly videos if I play them on VLC or Windows Media Player. See this pic for infos on the videos I'm working with.

python - cv2 alias issue

I'm playing videos with this piece of code:

class Player(threading.Thread):
def __init__(self, video):
    threading.Thread.__init__(self)
    self.config = Conf.Conf()
    self.video = video
    self.cap = cv2.VideoCapture(video)
    self.frameTitle = self.config.SOFTWARE_TITLE + self.config.VERSION

def run(self):
    while(self.cap.isOpened()):
        ret, frame = self.cap.read()
        if ret:
            cv2.namedWindow(self.frameTitle, cv2.WND_PROP_FULLSCREEN)
            cv2.setWindowProperty(self.frameTitle, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
            cv2.imshow(self.frameTitle, frame)

            if cv2.waitKey(10) & 0xFF == ord('q'):
                self.Stop()
                self.ClosePlayer()
        else:
            self.cap.set(cv2.CAP_PROP_POS_FRAMES, 0)

def Stop(self):
    self.cap.release()

def ClosePlayer(self):
    cv2.destroyAllWindows()

Now, my problem is that videos loose quality and it seems like there's aliasing on smooth shapes. As seen in this picture.

This code is working on a Win10 machine with Python 2.7 (32-bit) and cv2 version 3.4.0.

Edit: I can see correctly videos if I play them on VLC or Windows Media Player. See this pic for infos on the videos I'm working with.