Now I start to conquer Java for robotic stuffs.
I am used to use opencv, so I find Javacv is a nice interface to wrap opencv.
After download and install the javacv, I try to run a sample: "MotionDetector.java".
But it gives me some errors like:
HIGHGUI ERROR V4L2
The solution is commenting following lines in the OpenCVFrameGrabber.java:
cvSetCaptureProperty(capture, CV_CAP_PROP_CONVERT_RGB, colorMode == ColorMode.BGR ? 1 : 0);
Now it works, but it return BGR image instead the RGB image.
I don't think it's a good idea to use CV_CAP_PROP_CONVERT_RGB in the above line, because the Opencv users are used to use BGR. If they don't check the source, they will never know the function "grab()" return a RGB image.
Now recompile it using command "ant" and copy the generated ./dist/javacv.jar to the CLASSPATH.