Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
schoolare
schoolare's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Capture 2 pictures of users and display both of the picture on screen
[1 Reply]
04-Mar-2013 04:12 PM
Forum:
Core Library Questions
Hi, I am trying write a program to take pictures of the user then show the pictures on the screen.
import processing.video.*;
Capture cam;
Capture cam1;
int count=0;
PImage img;
void setup() {
size(1000, 480);
img = loadImage("background.jpg");
String[] cameras = Capture.list();
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
// The camera can be initialized directly using an
// element from the array returned by list():
cam = new Capture(this, cameras[0]);
cam.start();
cam1 = new Capture(this, cameras[0]);
cam1.start();
}
}
void draw() {
background(255);
if (count==1){
if (cam.available() == true) {
cam.read();
}
}else{
image(img, 0, 0);
}
if (key=='7'){
if (cam.available() == true) {
cam.read();
image(cam, 100, 300, 160,120);
}
}
if (key=='9'){
if (cam.available() == true) {
cam.read();
image(cam, 400, 300, 160,120);
}
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(0, 0, cam);
}
}
void keyPressed(){
if (key==1){
if (count==1){
count=0;
}
}
}
How can I do it?
«Prev
Next »
Moderate user : schoolare
Forum