如何将 OpenCV Tracker 与 tif 图像一起使用?

问题描述

我想将 cv2 Tracker 与连续的图像序列一起使用(以便执行实时跟踪)。因此,我不能使用vs = cv2.VideoCapture("video.mp4"),我会有一堆numpy数组需要一个一个分析,有什么办法可以使用frame = vs.read()来初始化跟踪器并更新跟踪器每个获取的图像?

我已经尝试获取一些图像,然后将它们转换为视频(mp4 或 avi),但是您可以想象这个过程非常缓慢,而且对实时跟踪毫无用处。

我想做这样的事情:

from tifffile import imread,imsave

img = imread("filename.tif") #shape = (1024,1024)

#HERE IS WHERE I HAVE PROBLEMS
vs = Treat_the_image_as_video(img) #In normal cases,here we would use cv2.VideoCapture
frame = vs.read() #?

bBox = get_bBox(image) #Get the bBox from the image (I already have this with cv2.findContours)
tracker = cv2.Trackerkcf_create() #Create tracker
tracker.init(frame,bBox)
while(True):
   (success,bBox) = tracker.update(frame)
   .
   .
   #Place the rectangle and text
   .
   .
   img = imread("filename.tif") #shape = (1024,1024)
   vs = Treat_the_image_as_video(img) #?
   frame = vs.read() #?

如果您能就我如何解决此问题给我任何建议或提示,我将不胜感激。 提前致谢!!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...