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.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › OpenCV capture hang under Windows XP/Vista/7
Page Index Toggle Pages: 1
OpenCV capture hang under Windows XP/Vista/7 (Read 7017 times)
OpenCV capture hang under Windows XP/Vista/7
Aug 10th, 2009, 6:06pm
 
Hello,

I have been making use of the OpenCV Java port, but am having significant issues getting the sample code or my own code capturing under Windows.

The library has been a great help, and works great under Mac OS X 10.5.8 with my iSight camera. However, when running under Windows XP, Vista or 7, video capture fails - seemingly regardless of the camera used. I have tried both my code and the provided Java samples on my Macbook under Windows XP in Bootcamp (using both the inbuilt iSight camera and a separate USB camera), and have also tried my home PC running Windows 7 RC (with the same separate USB camera) and a friend's Windows Vista laptop (with an inbuilt Dell webcam). All exhibit the same problem - the window will open, but will just be blank, and the program will hang.

As best as I can tell the problem is that the cv.read() command hangs on the second loop, but I haven't had any luck figuring out why this is.
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #1 - Aug 11th, 2009, 3:29am
 
I have found a workaround to this issue by using the JMyron library, and then copying images into the OpenCV object.

It would be easier if I didn't have to do this though.
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #2 - Aug 11th, 2009, 1:29pm
 
i have the same issue going on here.

works fine on the mac, but on windows camera capture won´t run. just a fine black screen.
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #3 - Apr 13th, 2010, 3:10pm
 
If anyone has anything further on this problem, I'd love to hear it. I've been reading these forums for a week and I'm getting nowhere.

For example, is it absolutely necessary to use OpenCV 1.0, because the sample C exe's that come with that won't run on my Vista machine (well, for the webcam samples I just get grey windows)

The 1.1 pre 1a OpenCV version will run the C webcam samples, but doesn't appear to connect properly with Processing.

Running out of options here, so any help would be appreciated.
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #4 - Apr 15th, 2010, 6:40am
 
Hi guys, I also tried this code :

Code:
import processing.core.*;
import processing.video.*;
import hypermedia.video.OpenCV;

OpenCV cv = null;  // OpenCV object

// Initialise Objects
void setup() {
 size( 200, 200 );  // set frame size
 cv = new OpenCV( this ); // link OpenCV process to this PApplet
 cv.capture( width, height );   // start video stream
 println(Capture.list());
}

// Display the input camera stream in frame
void draw() {
  cv.read();
 image( cv.image(), 0, 0 );

}


But the frame stays black...whereas with this code :

Code:
import processing.video.*; 
Capture myCapture;

void setup()
{
 size(200, 200);
 myCapture = new Capture(this, width, height, 30);
}

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

void draw() {
 image(myCapture, 0, 0);
}


It works prefectly... Undecided

Edit : I finally find out how to make it.
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #5 - Apr 19th, 2010, 8:10pm
 
envy44 wrote on Apr 15th, 2010, 6:40am:
Edit : I finally find out how to make it.


Well, how did you make it

I'm having the same problem with Vista. I've tried everything but nothing works...
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #6 - May 24th, 2010, 10:44pm
 
Same here on Win7. envy44, would you please share how you get through it? Thanks a lot.
Re: OpenCV capture hang under Windows XP/Vista/7
Reply #7 - May 26th, 2010, 3:06am
 
Hi guys, sorry i didn't see that you've got issues. This is the way i've done it :

Code:
void setup() 
{
 size( 320,240 );    

 //to know the name of your camera device : println(Capture.list());
 myCapture = new Capture(this, width, height, "HP webcam-WDM", 30);

 cv = new OpenCV( this );
 
 cv.allocate(width,height);  
}

void draw()
{
//read the output image
 myCapture.read();
 cv.copy(myCapture);
 
 //put the image on the frame
 image( cv.image(), 0, 0 );

//your code below

}


So I create a Capture and OpenCv, and then I copy the capture's stream into the Opencv.

That's working perfectly like that. Hope it'll help you.  Wink
Page Index Toggle Pages: 1