Python 3.x 使用0个退出代码执行的代码。。但没有发挥应有的作用

Python 3.x 使用0个退出代码执行的代码。。但没有发挥应有的作用,python-3.x,opencv,Python 3.x,Opencv,代码正在执行,错误为0,但未显示任何输出,进程已完成,退出代码为0 import cv2 class VideoImagePros(): def imageCap(): vidcap = cv2.VideoCapture("/home/ksourav/Repo/Video/Osaathi.mp4") vidcap.read() success, image = vidcap.read() count = 0

代码正在执行,错误为0,但未显示任何输出,进程已完成,退出代码为0

import cv2

class VideoImagePros():

    def imageCap():
        vidcap = cv2.VideoCapture("/home/ksourav/Repo/Video/Osaathi.mp4")
        vidcap.read()
        success, image = vidcap.read()
        count = 0
        success = True
        while success:
            success, image = vidcap.read()
            'Read a new frame: ', success
            cv2.imwrite("/home/ksourav/Repo/ImageOutput/Code4/Sub1/frame%d.jpg" % count, image)  # save frame as JPEG file
            count += 1



    def tenSec():

        vidcap = cv2.VideoCapture("/home/ksourav/Repo/Video/Osaathi.mp4");
        success, image = vidcap.read()
        count = 0
        success = True

        while success:
            success, image = vidcap.read()
            print('read a new frame:', success)
            if count % 10 == 0:
                cv2.imwrite('/home/ksourav/Repo/ImageOutput/Code4/Sub2/frame%d.jpg' % count, image)
                print('success')
                count += 1



    def spfCap():

        vidcap = cv2.VideoCapture('/home/ksourav/Repo/Video/Osaathi.mp4')
        vidcap.set(cv2.CAP_PROP_POS_MSEC, 20000)  # just cue to 20 sec. position
        success, image = vidcap.read()
        if success:
            cv2.imwrite("/home/ksourav/Repo/ImageOutput/Code4/Sub3/frame20sec.jpg", image)  # save frame as JPEG file
            cv2.imshow("20sec", image)
            cv2.waitKey()



if __name__ == "__main__":
    VideoImagePros()

您的代码定义一个类,然后创建该类的单个实例。您甚至从未尝试运行该类中包含的任何代码。您希望它做什么?你只是构造了一个临时对象,你甚至没有为它定义构造函数……所以你创建了一个对象,但是没有调用任何函数?也许你正在发送你的部分代码?