我的环境是:cv2+python3.4,
我写了一个保存帧为图片的python代码
# coding: utf-8
import cv2
cap = cv2.VideoCapture(videoName)
frameList = []
name = "./蓝天/1.jpeg"
while(cap.isOpened()):
ret , frame = cap.read()
if ret == True:
frameList.append(frame)
else:
break
outimg = cv2.imwrite(name , frameList[0] , [int(cv2.IMWRITE_JPEG_QUALITY), 100])
cap.release()
当前目录下的目录“蓝天”也创建了,但是下面没有生成”1.jpeg”这个图片
好像是cv2不支持中文请教各位朋友有什么办法,在此谢过。
需要转换一下,
d = np.fromfile(中文路径.jpg", dtype = "uint8")
im = cv2.imdecode(d,-1)
cv2.imencode(".tif",im)[-1].tofile("tif.tif") 这个代码写到文件tif中转换成tif格式了
语法是
[读取是否成功,帧] = cv2.imencode(扩展名,im)