jloyd / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

OpenCVFrameGrabber.start() returns null #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new Javacv project
2. Copy and paste the following code,

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;

import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FFmpegFrameGrabber;
import com.googlecode.javacv.FrameGrabber;
import com.googlecode.javacv.OpenCVFrameGrabber;

public class Face {

    public Face() {}

    public static void main(String[] args) throws Exception {   
            OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
        grabber.start();
    }

}

3. Compile and run

What is the expected output? What do you see instead?
The expected output is that there is no error output, but instead I see the 
following,

     "OpenCVFrameGrabber.java:98 cvCreateCameraCapture() Error: Could not create camera capture."

What version of the product are you using? On what operating system?
I am using windows 7, Opencv 2.1, with java 1.6 and the latest javacv build.

Please provide any additional information below.
This is for displaying the webcam frames through a CanvasFrame object and 
eventually doing facial detection and recognition. 

I have looked over the source code for OpenCVFrameGrabber, and I have tried 
passing in '0' as the deviceNumber and CV_CAP_ALL and various any integers, but 
they all result in the same issue. 

Moreover, I am using the same OpenCV 2.1 in VC++, and I am able to access the 
webcam through "cvCreateCameraCapture(0)" and display the frames through 
cvShowImage().

Please respond asap, and I really appreciate all your help!

Original issue reported on code.google.com by jack.nan...@gmail.com on 20 Mar 2011 at 5:44

GoogleCodeExporter commented 9 years ago
First, JavaCV does not support OpenCV 2.1. 

Second, it is known that OpenCV has issues capturing under Windows 7, which is 
a problem totally unrelated to JavaCV:
http://groups.google.com/group/javacv/browse_thread/thread/418cec93c72143a7/fc17
e84fedaa77f2#38847e69646e50f2
Either downgrade to Windows XP, ask the OpenCV guys to fix this, or use 
something else to capture images

Original comment by samuel.a...@gmail.com on 20 Mar 2011 at 5:48

GoogleCodeExporter commented 9 years ago
Hi, I've posted a new issue 58, where I have now switched to xp and opencv 2.2, 
but I am still seeing the same issue.

I apologize for the troubles, and thank you for all the help!

Original comment by jack.nan...@gmail.com on 20 Mar 2011 at 7:19

GoogleCodeExporter commented 9 years ago
Hi all,
I searched and read a lot comments and tips about setting Path or PATH to make 
OpenCV could be used with JavaCV and nothing. In my opinion it's impossible to 
use it on Windows machines. You may not agree but prove it to me - then I 
belive.
I think it will be less mess to write program in C and than port it to another 
system with less troubleshooting.

Original comment by marekbar...@googlemail.com on 22 Nov 2011 at 8:05

GoogleCodeExporter commented 9 years ago
FYI:
Common issues with OpenCV under Windows 7
http://code.google.com/p/javacv/wiki/Windows7AndOpenCV

Original comment by samuel.a...@gmail.com on 23 Nov 2011 at 12:30