Python - Accessing and displaying webcam capture - black frame issue

edited March 2016 in Python Mode


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!


from random import randint

def setup():

    global video

    size(1280, 720, P3D)

    video = Capture(this, 640, 480)

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


  • 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: :(|)

  • Thank you very much GoToLoop, that worked! Calling 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.