SHARE
TWEET

Untitled

a guest Jun 16th, 2012 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Dataflow chaining is the combination of more than 2 functions.
  2. # This is how the data flows in this example code:
  3. getWebcamImage -> addFilters -> showOnScreen
  4.  
  5. # This class symbolizes our image data which is a simple integer in this case
  6. WebcamImage
  7.         init
  8.                 my.data = rand(-100, 100)
  9.        
  10.         get
  11.                 data
  12.                         return my.data
  13.        
  14.         set
  15.                 data newData
  16.                         my.data = newData
  17.  
  18. # Capture one frame
  19. getWebcamImage
  20.         return WebcamImage()
  21.  
  22. # Process image
  23. addFilters image
  24.         source = image.data
  25.         image.data = source + rand(-100, 100)
  26.         return image
  27.  
  28. # Show it on the screen
  29. showOnScreen image
  30.         print image.data
  31.  
  32. # Theoretically you can create a main loop now.
  33. # To demonstrate the data flow I'm just going to do this 10 times:
  34. for i = 1 to 10
  35.         getWebcamImage()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top