openFrameworks can grab live video from a built-in or external camera connected to your computer. It is accomplished using the ofVideoGrabber
class.
Let's implement starting the camera to grab and draw the grabbed video frames on the screen.
Starting a camera can take several seconds. Thus, if we start it in setup()
, the project will take a bit longer to start. It could be quite annoying to keep the camera "on" even when we don't use it. For this reason, we will start the camera only when we need it, by pressing C.
The following are the implementation steps:
ofApp
class:ofVideoGrabber camera;
keyPressed() ...
No credit card required