System setup:

I currently have Windows XP on VirtualBox running on Fedora 13 ( Just to make things hard :P )

I have a Logitech C600 webcam - and with virtual box I can send the device (marked as Unknown Device 046D:0807 [0009]) to Windows.

I have tested it with the motempl.exe... The initial behavior is as expected.  A window comes up, the camera turns on, and it looks correct,  HOWEVER, when the dos terminal is closed or Ctrl-C entered to quit the program.. The next time it starts, windows ask which USB device I want to use - it has a dropdown of the camera - but when selected IT DOES NOT WORK..  

It will not work until a reboot of windows....  so, something in the releasing of resources possibly is messing things up...

 

Now, I will try the javacv sample MotionDetector.class

I dropped it in the myrobotlab-0003/lib directory with all the jars from javacv

cd to the directory and used the following command line

WHAT A PITA - FINALLY GOT IT TO WORK USING THE FOLLOWING EXPLICIT PATHS

Y:\myrobotlab-0003\lib>java -classpath ".;Y:\myrobotlab-0003\lib\javacpp.jar;Y:\myrobotlab-0003\lib\javacv.jar;Y:\myrobotlab-0003\lib\javacv-windows-x86.jar" MotionDetector
 
 
Has the same behavior of only working once (before a reboot is needed) 

ReBooting :P...
 
 
Wikipedia has a good (and necessarily long) article about the complexity of the classpath here 
 
 
Caveat 1: -  Currently I have a copy of the OpenCV binaries (binaries downloaded from OpenCV site) in my system32 directory (YUCK)
 
Moved the MotionDetector.class to y:\myrobotlab-0003
cd  y:\myrobotlab-0003
 
Trying the following command line...
java -Djava.library.path="./bin" -cp ".;lib/*" MotionDetector
 
Works!
 
 

ReBooting :P
 
Removed all opencv libraries from system32 directory ...
 

 
Trying the following command line...
java -Djava.library.path="./bin" -cp ".;lib/*" MotionDetector
 
YAY - Works - so now no more copying native libraries (at least for xp) into system32 Yay !
 

Trying again gives me the error 
 
Exception in thread "main" java.lang.Exception: cvCreateCameraCapture() Error: Could not create camera capture.
        at com.googlecode.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:99)
        at MotionDetector.main(MotionDetector.java:23)
 
As I stated before - even the motempl.exe does not work (does not give error info, but just exists I assume for the same reason - no valid CameraCapture)
 

 

ReBooting :P
 
Trying command line
 
Y:\myrobotlab-0003>java -Djava.library.path="./bin"  -cp "myrobotlab.jar;lib/*" org.myrobotlab.service.Invoker -service Invoker services GUIService gui > log.txt
 
Camera activity light comes on - but no Images !  Yarrg
 
Shutting down and trying motmpl.exe - give same issue of "Camera Source Dialog"
 
 
ReBooting :P
 

Running the JavaCV sample MotionDetector in Eclipse on Fedora works fine - however there is an error being logged to the console
HIGHGUI ERROR: V4L2: getting property #0 is not supported
 
I'll look into this later... now I want to see differences between MotionDetector.java and my OpenCV.java
 
That was easy ... No OpenCVFrameGrabber in OpenCV.java
 
I have a CvCapture object...
When a camera is activated :
capture = cvCreateCameraCapture(index);
 
MotionDetector has a 
 OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
 
checking google....
Found this excerpt:
 
 

Comment 17 by project member samuel.a...@gmail.comMay 10 (2 days ago)
		Fixed in latest release:
 * New `videoInputLib` wrapper and corresponding `VideoInputFrameGrabber` to capture using DirectShow, useful under Windows 7 where OpenCV and FFmpeg can fail to capture using Video for Windows

Use VideoInputFrameGrabber instead of OpenCVFrameGrabber.
 
 
Heck, I was using cvCreateCameraCapture ... I guess I'm soooo behind the times...
 
Hah couldn't find VideoInputFrameGrabber Ah haa ! - he just released it yesterday :D
 
Hmm... get

UnsatisfiedLinkError: no jnivideoInputLib in java.library.path  exception - is there a binary I'm missing... 
Ah hah - grepping through the binaries - it's only available for windows-x86 and windows-x86-64   
It be nice to know a design strategy for supporting multiple platforms.. I could put logic in which switches
 
Going for OpenCVFrameGrabber as a lowest common denominator
 
 
That works in Fedora 13 Linux - but still getting
HIGHGUI ERROR: V4L2: getting property #0 is not supported
written to the console ... trying now in windows
 
No GO :(
 
Root cause of the OpticalFlowTracker sample not working is it not opening the png files because of 
libpng warning: Application was compiled with png.h from libpng-1.4.3
libpng warning: Application  is  running with png.c from libpng-1.2.44
 
apparently, I have some libpng contention to deal with... 
 
Sample runs fine when I convert to jpgs
 
 

This one liner loads everything in Linux - which means the b.sh can be reduced considerably ! Thanks Wikipedia ! 

http://en.wikipedia.org/wiki/Classpath_(Java)

 

java -Djava.library.path="./bin" -classpath ".:myrobotlab.jar:./lib/*" org.myrobotlab.servicenvoker -service Invoker services GUIService gui
 
add -d32 to force 32 bit mode
 

Yay current build works on a windows machine thanks to Patrick Mccabe testing

hp mini netbook 110-3510nr