Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gohai.glvideo.*;
- GLCapture video;
- void setup() {
- size(320, 240, P2D); // Important to note the renderer
- // Get the list of cameras connected to the Pi
- String[] devices = GLCapture.list();
- println("Devices:");
- printArray(devices);
- // Get the resolutions and framerates supported by the first camera
- if (0 < devices.length) {
- String[] configs = GLCapture.configs(devices[0]);
- println("Configs:");
- printArray(configs);
- }
- // this will use the first recognized camera by default
- video = new GLCapture(this);
- // you could be more specific also, e.g.
- //video = new GLCapture(this, devices[0]);
- //video = new GLCapture(this, devices[0], 640, 480, 25);
- //video = new GLCapture(this, devices[0], configs[0]);
- video.start();
- }
- void draw() {
- background(0);
- // If the camera is sending new data, capture that data
- if (video.available()) {
- video.read();
- }
- // Copy pixels into a PImage object and show on the screen
- image(video, 0, 0, width, height);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement