Initiating the Camera in Processing

Carrying on from my last post discussing about the open CV library, I wanted to learn how the camera worked within processing allowing me to get to know the basics within the software. From what I have discovered I realised it wasn’t hard to access the camera, as it had the similarities of how an image is loaded in processing using the function

– image()

in which I learned from my tutorials within workshops of processing however to display a video, I had to add in a couple of lines extra to allow the video to work properly coming straight from the webcams feed, this is due to the fact that in processing the camera still uses the image() function as it captures a new image frame by frame.

below is an example of the code for the video capturing :

Video

For the camera to be achieved in processing I had to import an existing video library that a previous programmer had already coded for me. To import this within processing all I had to do once the CV library was downloaded was add the line

– import processing.video.*; at the beginning of the sketch

This is when I then had to add the line Capture video1; underneath which then followed onto another class as it was already built into the libraries.

Next we had to determine the size of the how big I wanted the camera to display myself in which I chose 640 x 480 pixels, this was then followed by the if statement showing in the

– Void Draw() section showing in the example above that if the video is available then run the camera.

By getting the grasp of how the camera works within processing shows the first step to my interactive project as I will be experimenting in which effect I will be using to allow interaction between a user and the screen within a public space. I will like to explore more examples of the open CV library as I had come across a template of ¬†tracking the face due to my idea being something related to the user not being aware of the screen while having an image display when the user isn’t conscious of being ‘grabbed and watched’ through the representation of invading your online space through the screen, this way the interactivity of my concept will be accomplished.

Advertisements