Loading...
Logo
Processing Forum
Hi all,
I am trying to create a small game for kids about exploiting bubbles with the "touch" of their fingers. I have seen some examples in the web about exploiting bubbles, some with OpenCv and others with GSVideo, but as I need finger tracking I am trying to use the JavaCVPro library, which suggest to use GSVideo for the video capture part and opencv/javacvpro functions for the video processing part.
I am still at the very begining of the game trying to capture any movement. I have correctly done everything with opencv but when I try to use GSVideo for the capture part it gives me the error "Null Pointer Exception", I have checked my code and don´t find the problem, could you please help?
Here it is my code:

Copy code
  1. import hypermedia.video.*;  
  2. import codeanticode.gsvideo.*;

  3. OpenCV opencv;                    
  4. GSCapture cam;
  5. PImage imgSrc;

  6. void setup()
  7.   size( 800, 600 );
  8.  
  9.   //OpenCV
  10.   opencv = new OpenCV( this );    
  11.   //opencv.capture( width,height);       
  12.   
  13.   //GSVideo
  14.   cam=new GSCapture(this,width,height);
  15.   cam.start(); 
  16. }
  17.  
  18. void draw()
  19. {
  20.   //GSVideo
  21.   cam.read();
  22.   imgSrc=cam.get();
  23.   opencv.copy(imgSrc);
  24.   
  25.   //OpenCV 
  26.   //opencv.read();                  
  27.   
  28.   //OpenCV or GSVideo
  29.   opencv.absDiff();               
  30.   opencv.convert(OpenCV.GRAY);
  31.   opencv.threshold(20);
  32.   image(opencv.image(), 0, 0 );  
  33.   opencv.remember();             
  34. }

Thanks in advance and brgds,

Replies(1)

In my opinion, use OpenCV for java (javaCV). I've used JavaCVPro for a bit and I realized it's not good enough (nothing against it, but JavaCV is much better and offers more features). Any help with that subject I can help ;)