We are about to switch to a new forum software. Until then we have removed the registration on this forum.
What's the best way to capture a frame of video from an attached camera and then display an area of that frame? I assume that when capturing a frame from video, the whole frame is captured and placed in the sketch's "data" directory.
Say the sketch's size is 640 x 480 pixels, so the capture frame is that size as well. Now I want to display, say, the portion of that image (100, 100) upper left to (360, 245) lower right to the sketch window at location (150, 150) upper left?
Thanks for any suggestions!
George Roland
Using Processing v.2.0.3 MacBookPro 15" OS X 10.8.5, Fire-i camera
Answers
I think the get() function will do this. You need to set up a PImage variable to hold the cropped part of the video frame (PImage cropPic) then call:
George Roland
Hold it right there!
get() is a rather in-efficient algorithm, so I dug around in the docs for you, and i found a better way of doing this. I suggest you use the following code instead:
To test, just insert the above code into a blank Processing sketch. If you need an explanation of what is happening, fell free to ask.
-- MenteCode
By "in-efficient", I mean that it'll take up more space. The code you would've written using the get() method would probably be 3x the size of this one.