sightmachine / SimpleCV

The Open Source Framework for Machine Vision
http://simplecv.org
BSD 3-Clause "New" or "Revised" License
2.68k stars 798 forks source link

virtualCamera video loop issues / #718

Open carlesgutierrez opened 6 years ago

carlesgutierrez commented 6 years ago

Hello, I've been struggle to try to read a video in loop mode. I did not find how to do it. Online Reference I'm now following is here

So , one way to get this somehow working -->

#global variables
cam = VirtualCamera('AbsolutePath/video.mov', 'video')
#functions
def setupVideo():
     cam = VirtualCamera('AbsolutePath/video.mov', 'video')
def updateVideo():
    img = cam.getImage()
    if img:
        img.show()
    else:
        print("end video so -> rewind")
        cam.rewind()

But check if there is or not a img, frezee my Raspberry pi for more than 4 seconds. So I've tried to find first the number of frames of my loaded video with findLastestImage but i've got following error:

while time.mktime(time.localtime()) - os.stat(max_full_path).st_mtime > 0.1: TypeError: coercing to Unicode: need string or buffer, NoneType found

Any fixes, tips or different approaches are welcome. Thanks for your time!