How to Create Amazing Webcam Effects Using Java and Processing

MakeUseOf | 3/20/2019 | Ian Buckley
Mireille (Posted by) Level 3
Click For Photo: https://static.makeuseof.com/wp-content/uploads/2019/03/webcam-effects-994x400.jpg




Processing is a powerful tool which allows the creation of art through code. It is the combination of a Java library for working with graphics, and an integrated development environment (IDE) which allows you to write and run code easily.

There are many graphics and animation beginner projects which use Processing, but it is also capable of manipulating live video.

Today - Video - Slideshow - Effects - Mouse

Today you’ll be making a live video slideshow of different effects controlled by the mouse, using the Processing video library. As well as flipping the live video, you’ll learn to resize and color it, and how to make it follow the mouse cursor.

To begin, download Processing and open a blank sketch. This tutorial is based on a Windows system, but it should work on any computer with a webcam.

Processing - Video - Library - Sketch - >

You may need to install the Processing Video library, accessible under Sketch > Import Library > Add Library. Search for Video in the search box, and install the library from The Processing Foundation.

Once installed, you are ready to go. If you want to skip the coding, you can download the complete sketch. It is much better to make it yourself from scratch, however!

Lets - Library - Setup - Function - Processing

Lets begin by importing the library, and creating a setup function. Enter the following into the blank Processing sketch:

import processing.video.*;

Capture - Cam

Capture cam;

size(640,480);

Cam - Capture

cam = new Capture(this, 640, 480);

cam.start();

Video - Library - Capture - Instance - Cam

After importing the video library, you create a Capture instance called cam to store the data from the webcam. In setup, the size function sets up a 640×480 pixel sized window to work in.

The next line assigns cam to a new instance of Capture, for this sketch, which is the same size as the window, before telling the camera to turn on with cam.start().

Part - Processing - Window

Don’t worry if you don’t understand every part of this for now. In short, we have told Processing to make a window, find our...
(Excerpt) Read more at: MakeUseOf
Wake Up To Breaking News!
There's no problem on the inside of a kid that the outside of a dog can't cure.
Sign In or Register to comment.

Welcome to Long Room!

Where The World Finds Its News!