Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Dataflow chaining is the combination of more than 2 functions.
- # This is how the data flows in this example code:
- getWebcamImage -> addFilters -> showOnScreen
- # This class symbolizes our image data which is a simple integer in this case
- WebcamImage
- init
- my.data = rand(-100, 100)
- get
- data
- return my.data
- set
- data newData
- my.data = newData
- # Capture one frame
- getWebcamImage
- return WebcamImage()
- # Process image
- addFilters image
- source = image.data
- image.data = source + rand(-100, 100)
- return image
- # Show it on the screen
- showOnScreen image
- print image.data
- # Theoretically you can create a main loop now.
- # To demonstrate the data flow I'm just going to do this 10 times:
- for i = 1 to 10
- getWebcamImage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement