I'm trying to make a program that captures an image from the webcam, then reloads the captured image in different places on the screen. I'll do more with it later, but I want to iron this problem out before I do any more. My problem is that I want to resize the image that I capture from the webcam when it loads into the program, but it justs crops the image. Is there any way to solve this? My current code is as follows:
import processing.video.*;
Capture cam;
PImage still;
void setup() {
//window size
size(1280, 720, P3D);
noCursor();
//webcam feed
still = loadImage ("capture.jpg");
imageMode (CENTER);
String[] cameras = Capture.list();
//webcam feed
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]);
}
cam = new Capture(this, cameras[0]);
cam.start();
}
}
void draw() {
if (cam.available() == true) {
cam.read();
}
//web cam feed position, size
image(cam, 640, 360, 320, 180);
}
void mousePressed() {
//image capture
saveFrame("data/capture.jpg");
cam.read();
//loads image capture in
image (still, 200, 200, 160, 90);
}