[英]OpenCV (Python) convert an image to a cv2.VideoCapture object
I would like to transform a static image (jpg) to a cv2.VideoCapture
object.我想将静态图像 (jpg) 转换为cv2.VideoCapture
对象。 I can do a cv2.imread
of the file to produce a numpy
array, which is the same value i would get from doing a read on the capture object, and I know I can create an empty capture object by invoking the constructor without any arguments.我可以对文件执行cv2.imread
以生成一个numpy
数组,这与我从捕获对象上读取得到的值相同,并且我知道我可以通过调用不带任何参数的构造函数来创建一个空的捕获对象. Is there a way I can wedge the cv2.imread
numpy
object into the cv2.VideoCapture
object in a way that the capture object will behave as a video capture with only one frame?有没有一种方法可以将cv2.imread
numpy
对象cv2.VideoCapture
对象中,使捕获对象将表现为只有一帧的视频捕获?
Check if this is helpful检查这是否有帮助
cap = cv2.VideoCapture("c:/fullpath/filename.png")
https://answers.opencv.org/question/317/how-to-read-directory-with-images-by-videocapture/ https://answers.opencv.org/question/317/how-to-read-directory-with-images-by-videocapture/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.