python3.6+opencv3.4,中为什么cv和cv2不能同时import 10C

import os
import cv
import cv2
videos_src_path = 'C://Users//Zhu Yunpeng//Downloads//UT'
videos_save_path = 'C://Users//Zhu Yunpeng//Downloads//UT//frames'

videos = os.listdir(videos_src_path)
videos = filter(lambda x: x.endswith('avi'), videos)

for each_video in videos:
print (each_video)

# get the name of each video, and make the directory to save frames
each_video_name, _ = each_video.split('.')
os.mkdir(videos_save_path + '/' + each_video_name)               

each_video_save_full_path = os.path.join(videos_save_path, each_video_name) + '/'

# get the full path of each video, which will open the video tp extract frames
each_video_full_path = os.path.join(videos_src_path, each_video)

cap  = cv2.VideoCapture(each_video_full_path)
frame_count = 1
success = True
while(success):
    success, frame = cap.read()
    print ('Read a new frame: '), success

    params = []
    params.append(cv2.imwrite(cv.CV_IMWRITE_PXM_BINARY)
    params.append(1)
    cv2.imwrite(each_video_save_full_path + each_video_name + "_%d.ppm" % frame_count, frame, params)

    frame_count = frame_count + 1

cap.release()

ModuleNotFoundError: No module named 'cv'
尝试了import cv2.cv as cv,也不好使ModuleNotFoundError: No module named 'cv2.cv'
但是cv2又没有这个模块cv.CV_IMWRITE_PXM_BINARY
是不是新版python里面没有cv模块了?

2个回答

我不是通过anac。。来安装的啊。我发现python3.6就是没有cv这个模块了,坑爹。这个模块cv.CV_IMWRITE_PXM_BINARY,被cv2哪个功能代替了?有人知道么

qq_30354455
桑榆非晚_ 你好,你知道了吗?怎么解决?
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐