Python - Accessing and displaying webcam capture - black frame issue

CGDCGD
edited March 2016 in Python Mode

Hello!

This code is running ok, except the video (webcam capture) is only returning a black frame - I can see the webcam light is on whilst running this code. I couldn't find a working example in the Python examples or the openCV python examples either. Any help is much appreciated!

add_library('video')

from random import randint


def setup():

    global video

    size(1280, 720, P3D)

    video = Capture(this, 640, 480)
    video.start()


def draw():
    print randint(0,9)
    image(video, 0, 0)

Answers

  • edited May 2015 Answer ✓
    • Although you got no specific "Python Mode" examples, yet you should look for "Java Mode" 1s! ~O)
    • Just by looking at your code, I miss the read() method inside movieEvent().
    • Although I'm not sure whether Capture got any of those btW! :-/
    • Nevertheless, take a look at my Java example for Movie class in the link below: :(|)

    http://forum.processing.org/two/discussion/10541/problems-with-video

  • Thank you very much GoToLoop, that worked! Calling video.read() before image(video, 0, 0) solved it.

    I'll be sure to deconstruct and understand java examples in future! Thank you once again, it's really appreciated.

Sign In or Register to comment.