代码用0退出代码执行..但不能正常工作

时间:2018-04-17 13:06:40

标签: 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
        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()

0 个答案:

没有答案