Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You may add this for win10 cv2.CAP_IMAGES.

#!/usr/bin/python38
#OpenCV 4.1.2, Raspberry pi 4, Thonny IDE.
#Date; 28th October, 2019

import cv2 as cv
import numpy

#cap = cv.VideoCapture('test123a.' + '{:06d}'.format(1,) + '.jpg')
cap = cv.VideoCapture('test123a.%06d.jpg')
cap.set(1, 2)# 2nd number is the frame to show
ret, frame = cap.read()

cv.imshow("Images", frame)
cv.waitKey(0)

OK! I solved format problem. You may add this for win10 cv2.CAP_IMAGES.

#!/usr/bin/python38 #OpenCV 4.1.2, Raspberry pi 4, Thonny IDE. #Date; 28th October, 2019 2019

import cv2 as cv
import numpy

#cap cap = cv.VideoCapture('test123a.' + '{:06d}'.format(1,) cv.VideoCapture('test123a.{}'.format('%06d') + '.jpg')
cap #cap = cv.VideoCapture('test123a.%06d.jpg')
cap.set(1, 2)# 2nd number is the frame to show
ret, frame = cap.read()

cv.imshow("Images", frame)
cv.waitKey(0)

OK! I solved format problem. You may add this for win10 cv2.CAP_IMAGES.

 #!/usr/bin/python38
    #OpenCV 4.1.2, Raspberry pi 4, Thonny IDE.
    #Date; 28th October, 2019

2019
 import cv2 as cv
 import numpy

 cap = cv.VideoCapture('test123a.{}'.format('%06d') + '.jpg')
 #cap = cv.VideoCapture('test123a.%06d.jpg')
 cap.set(1, 2)# 2nd number is the frame to show
 ret, frame = cap.read()

 cv.imshow("Images", frame)
 cv.waitKey(0)