We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
capture the first frame from webcam (Read 383 times)
capture the first frame from webcam
Mar 25th, 2010, 12:08pm
 
Hello,

I am using Processing to build a system which can get images from webcam and analyze the images.  Now I just want to use the first image captured by webcam to do the analysis and after the second frame I don't need to do any analysis( I just need to show on the screen and also save the images after the second frame). However,
the problem I have is the first frame captured is always nothing in it.
Is it due to the speed of capturing image is not fast enough? any skill can achieve this.

Any help would be greatly appreciated!

Thanks,

Code:

import processing.video.*;
Capture myCapture;

int cols= 960;
int rows= 650;
float sum =0;
float sums = 0;
float aves = 0;

float Devmax=0;
float Devmin=1E15;
float casmax=0;
float casmin=1E15;
float catmax=0;
float catmin=1E15;
int nn =0;

float sumcorr=0;

float Dev[][] = new float[cols][rows];
float cas[][] = new float[30][30];
float cat[][] = new float[cols][rows];
float ncas[][] = new float[30][30];
float ncat[][] = new float[cols][rows];
float corr[][] = new float[cols][rows];
float sumt[][] = new float[cols][rows];
float avet[][] = new float[cols][rows];

PImage sample;
PImage test;

void captureEvent(Capture myCapture) {
 myCapture.read();
}

void setup(){
 size(1920, 720);
 background(0);
myCapture = new Capture(this, 960, 720, 20);

}


void draw(){

fill(0,255,0);  
noStroke();

image(myCapture, 0,0);

for (int i = 0 ; i < cols; i++){
  for (int j = 0 ; j < rows; j++){
    color ct = get (i,j);
    cat[i][j] = ct;
  }
}

// the rest is my process of the analysis.
Page Index Toggle Pages: 1