Grasshopper

algorithmic modeling for Rhino

Hi, I am trying to capture an image from a webcam video stream. The python logic is very simple:

If button pressed, store the current frame; then, output the frame that was stored.

if 'image' not in globals():
    image = None

if Capture == True:
    #extract an image
    image = bmp

#output image
snapshot = image

The problem is that, once my button is not pressed, the frame keeps on updating even though I am not storing a new 'image' from my snapshot output. I have attached the GH example file, so that you can see what I mean. 

Any help or advice would be greatly appreciated!

Thanks everyone,

Jake

Views: 291

Attachments:

Replies to This Discussion

I found the solution [with the help of smart friends].

if 'image' not in globals():
    image = None

if Capture == True:
    #extract an image
    image = bmp.CopyPixelsTo(image)

#output image
    snapshot = image

Cheers,

Jake

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service