FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Video, Camera
(Moderator: REAS)
   differenceImage/retinaImage
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: differenceImage/retinaImage  (Read 1376 times)
Sprak

20070562007056 WWW
differenceImage/retinaImage
« on: May 17th, 2004, 8:20pm »

Hi,
I'm having some trouble getting the WebcamXtra functions differenceImage() as well as retinaImage() to work properly. The output from image()/cameraImage() is perfect with a clear picture and good framerate, but as I go over to some other of the pixel functions everything just gets messed up. I've dabbled with all the parameters, setting the adaptivity to a whole bunch of different values, dug into the globs stuff but to no avail. I've been using the WebcamXtra with Director prior to going Processing, and it ran like a charm.  
What could be the problem? Any help in this matter would be very much appreciated. Thanks.
 
fjoselevich

parmendilparmendil WWW Email
Re: differenceImage/retinaImage
« Reply #1 on: Jul 15th, 2004, 3:11pm »

I've tried it also and got the same problem than you. I'm looking at the code.
 
Here is an example:  
Code:

JMyron m;//a camera object
   
int xpos = 0;
int ypos = 0;
 
void setup()  
{
     
  size(640, 480);  
  framerate(25);
  m = new JMyron();//make a new instance of the object
  m.start(320,240);//start a capture at 320x240
  m.findGlobs(1);
  m.update();
  m.adaptivity(110);
  m.adapt();// immediately take a snapshot of the background for differencing
  println("Myron " + m.version());
  m.findGlobs(1);
}  
 
void loop(){
  m.update();//update the camera view
  int[] img = m.cameraImage(); ;
  for(int j=0;j<4;j++) {
    switch(j) {
 case 0:  
   img = m.cameraImage();  
   break;
 case 1:
   img = m.retinaImage();  
   break;
 case 2:  
   img = m.differenceImage();  
   break;
 case 3:
   img = m.globsImage();  
   break;    
    }
    for(int i=0;i<320*240;i++){ //loop through all the pixels
   pixels[i+j*320*240] = img[i]; //draw each pixel to the screen
    }
  }
}
 
 public void stop(){
  m.stop();//stop the object
}
 
 
fry

WWW
Re: differenceImage/retinaImage
« Reply #2 on: Jul 15th, 2004, 5:16pm »

not sure if this is your problem, but quicktime movies don't have their 'alpha' channel set, so their colors read as completely transparent.  
 
modifying your program to use the following might fix things, if the above is what is causing your problem:
pixels[i+j*320*240] = img[i] | 0xff000000;
 
Pages: 1 

« Previous topic | Next topic »