We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi yesterday I posted this at the old forum but I cannot find the discussion back anymore so I will repeat my question here.
I am using the processing video library to measure movement. I am using a Webcam as source material and for the measurements the size or resolution needs to be small. But when i am taking a snapshot and use saveFrame I want to use the full resolution.
I believe that this is because the camera keeps recording at the definition stated here:
cam = new Capture (this, VIDEO_WIDTH, VIDEO_HEIGHT, 15);
I have tried adding this before the snapshot:
cam.read();
image(cam, 0, 0, 1280, 720);
delay(100);
saveFrame("test/line-####.bmp");
previousFoto=millis();
println("foto");
delay(100);
background(0);
But the resolution of the camera is still the old resolution set at the beginning. The image is stretched to fit the 1280*720. How can I change the resolution.
Comments
You can't change the resolution of your camera input while the sketch is running. I'd suggest to use a high res camera input and scale it down whenever you need to.
To check what resolution and framerate combinations your camera supporst just run this
String[] cameras = Capture.list(); println(cameras);
There's a small tutorial about it here, too: http://processing.org/reference/libraries/video/Capture.html
I tried adapting the code but it hasnt worked out yet. I use this code as a basis of my project, all credits to creativecoding.org.
the max res of my camera with which I want to saveFrame is 1280x720 the measurement should be done at 1280/2 x 720/2.
Where should I make the changes?
` import processing.video.*;
final int VIDEO_WIDTH = 1280; final int VIDEO_HEIGHT = 720; // Anzahl der Quadranten in der Breite final int VIDEO_COLS = 20; // Anzahl der Quadranten in der Höhe final int VIDEO_ROWS = 20;
float[] activity = new float[VIDEO_COLS * VIDEO_ROWS]; float[] buffer1 = new float[VIDEO_WIDTH * VIDEO_HEIGHT]; float[] buffer2 = new float[buffer1.length]; float[] buffer3 = new float[buffer1.length];
Capture cam = null;
void setup () { size (VIDEO_WIDTH, VIDEO_HEIGHT); cam = new Capture (this, VIDEO_WIDTH, VIDEO_HEIGHT, 15); frameRate (15); }
void draw () {
if (cam.available ()) {
} }
`