Closed GoogleCodeExporter closed 8 years ago
So, if `cvCreateCameraCapture(-1)` works in C++, does it work in Java too, or
not?
Original comment by samuel.a...@gmail.com
on 31 Aug 2012 at 1:20
In the following method the try block will complete:
public static void tryThis() {
try {
CvCapture capture = cvCreateCameraCapture(-1);
IplImage iplImage = cvQueryFrame(capture);
cvSaveImage("tryThisJ.jpg", iplImage);
} catch (Exception e) {
String exp = e.toString();
System.out.println(e.toString());
}
}
But, the IplImage (iplImage) is null.
With a c++ implementation:
void tryThisC() {
try {
CvCapture *capture = cvCreateCameraCapture(-1);
IplImage *iplImage = cvQueryFrame(capture);
cvSaveImage("trythisC.jpg", iplImage);
cvReleaseCapture(&capture);
cvReleaseImage(&iplImage);
} catch (Exception e) {
cout << e.err;
}
}
the error "VIDIOC_QUERYMENU: Invalid argument" appears in the output console,
but the try block completes, creating an image that is a valid capture from the
webcam. Note that, with the webcam unplugged, the c++ method will behave
exactly like the java implementation... completing the try block and collecting
a null image.
Original comment by trapperj...@haunted-river.net
on 31 Aug 2012 at 1:56
You are obviously using two different versions of OpenCV. If you use the same
version for C++ and Java, they will behave the same.
Original comment by samuel.a...@gmail.com
on 31 Aug 2012 at 2:13
Sorry I'm so dunderheaded, but there is only one opencv on this machine (at
/usr/local/include/opencv).
I'm guessing that I have to rebuild javacv from source on my machine, but this
is a huge guess at my skill level.
Original comment by trapperj...@haunted-river.net
on 31 Aug 2012 at 5:30
No need to rebuild. You should simply make sure to uninstall any old version of
OpenCV. When you execute your C++ code, it's probably using the old version,
which works better for some reason. You can try to recompile JavaCV against
that old version of OpenCV if it works better for you, yes, I suppose...
Original comment by samuel.a...@gmail.com
on 1 Sep 2012 at 1:28
BTW, if you are certain you do not have any other versions of OpenCV on your
machine, how did you confirm that fact?
Original comment by samuel.a...@gmail.com
on 1 Sep 2012 at 4:28
OK, I fixed it by:
1) Created a new partition and installed Mint Maya (32 bit)
2) Followed the instructions at "A Comprehensive Guide to Installing and
Configuring OpenCV 2.4.1 on Ubuntu" (hxxp://
http://www.ozbotz.org/opencv-installation/)
I'm sorry I was zoned out about the "other versions" notion. I originally came
to that conclusion, erroneously, by checking whether is showed as installed in
my synaptic package manager (it wasn't). Later, I noticed that my java programs
were using a library from an earlier version. How it got there, I don't know.
Anyway, it's fixed. Many thanks to the team for this resource.
Original comment by trapperj...@haunted-river.net
on 2 Sep 2012 at 7:10
Original issue reported on code.google.com by
trapperj...@haunted-river.net
on 30 Aug 2012 at 4:57