Revision history [back]

cv2.VideoCapture() importing file seq. with numbers on the name. Is this a bug?

I was trying to open a tiff file seq. with cv2.VideoCapture(), because it's easier to handle then using cv2.imread.

It works ok in general, but if the file name have numbers in the basename, (before the number padding) it only opens the first frame. looks like its messing with the padding numbers.

If the filename as numbers on the base name ( eg: test123a.000001.tif) it ignores the sequence, and reads 1st frame only.

Steps to reproduce:

Create a file sequence (eg: test123a.000001.tif, test123a.000002.tif, test123a.000003.tif, etc) or download from my share here

import cv2
import numpy

cap = cv2.VideoCapture('C:/images/5frames/test123a.' + '{:06d}'.format(1, ) + '.jpg', cv2.CAP_IMAGES)
cap.set(1, 2)# 2nd number is the frame to show