Hi guys,
I am getting this error when running the following code through LabVIEW which is interacting with Python through the cmd line.
import cv2 import sys
argv 0 = This py code
cap = cv2.VideoCapture(sys.argv[1]) print sys.argv[1] new = sys.argv[2] print new if cap.grab() == True: fourcc = cv2.cv.CV_FOURCC('C','V','I','D')
fps = int(cap.get(5)) width = int(cap.get(3)) height = int(cap.get(4)) out = cv2.VideoWriter(new,fourcc, fps, (width,height)) delay = int(1000/fps)#delay in s num = int(cap.get(7)) #number of frames z = float(0.0) for k in range(1,num): ret, frame = cap.read() z += 1 percent = float((z/num)*100) out.write(frame)#write flipped frame print percent cv2.waitKey(1) cap.release() out.release()
I am calling it using a LabVIEW code but effectively I'm just giving a filename to convert from mp4 to AVI.
Any help appreciated.
Woody