javacv-0.5-bin

所属分类:模式识别(视觉/语音等)
开发工具:Java
文件大小:11318KB
下载次数:66
上传日期:2013-05-13 10:39:58
上 传 者silentpluto
说明:  用java写的人脸识别程序,可以实现简单的识别功能,可以用于学习
(Using java to write face recognition procedures, you can achieve the simple identification feature, you can used for learning)

文件列表:
javacv-bin (0, 2013-04-07)
javacv-bin\LICENSE.txt (19355, 2012-04-15)
javacv-bin\samples (0, 2013-04-07)
javacv-bin\samples\BlackBalls.jpg (9358, 2012-10-06)
javacv-bin\samples\HoughLines.java (5275, 2012-10-28)
javacv-bin\samples\Rice.jpg (74611, 2012-10-06)
javacv-bin\samples\FaceRecognition.java (27267, 2013-01-26)
javacv-bin\samples\OpticalFlowTracker.java (3494, 2012-04-15)
javacv-bin\samples\FacePreview.java (11082, 2012-08-22)
javacv-bin\samples\RecordActivity.java (15956, 2013-01-13)
javacv-bin\samples\pic1.png (13160, 2012-04-15)
javacv-bin\samples\Shapes1.jpg (26766, 2012-10-06)
javacv-bin\samples\Blob2.jpg (9047, 2012-10-06)
javacv-bin\samples\image1.png (340, 2012-04-15)
javacv-bin\samples\Blob1.jpg (4731, 2012-10-06)
javacv-bin\samples\Blob3.jpg (14481, 2012-10-06)
javacv-bin\samples\image0.png (341, 2012-04-15)
javacv-bin\samples\FaceApplet.jnlp (478, 2012-05-26)
javacv-bin\samples\MotionDetector.java (4320, 2012-04-15)
javacv-bin\samples\FaceApplet.java (5228, 2012-05-30)
javacv-bin\samples\FaceApplet.html (677, 2012-05-25)
javacv-bin\samples\BlobDemo.java (11370, 2012-10-11)
javacv-bin\samples\Shapes2.jpg (17920, 2012-10-06)
javacv-bin\javacv-linux-x86_64.jar (1709874, 2013-04-07)
javacv-bin\javacv-windows-x86_64.jar (1602377, 2013-04-07)
javacv-bin\javacpp.jar (119676, 2013-04-07)
javacv-bin\javacv-windows-x86.jar (1245448, 2013-04-07)
javacv-bin\javacv.jar (1093839, 2013-04-07)
javacv-bin\javacv-linux-x86.jar (1630115, 2013-04-07)
javacv-bin\javacv-android-arm.jar (2557216, 2013-04-07)
javacv-bin\javacv-macosx-x86_64.jar (1639586, 2013-04-07)

=JavaCV= ==Introduction== JavaCV first provides wrappers to commonly used libraries by researchers in the field of computer vision: [http://opencv.willowgarage.com/ OpenCV], [http://www.ffmpeg.org/ FFmpeg], [http://damien.douxchamps.net/ieee1394/libdc1394/ libdc1394], [http://www.ptgrey.com/products/pgrflycapture/ PGR FlyCapture], [http://openkinect.org/ OpenKinect], [http://muonics.net/school/spring05/videoInput/ videoInput], and [http://studierstube.icg.tugraz.at/handheld_ar/artoolkitplus.php ARToolKitPlus]. The classes found under the `com.googlecode.javacv.cpp` package namespace expose their complete APIs. Moreover, utility classes make their functionality easier to use on the Java platform, including Android. JavaCV also comes with hardware accelerated full-screen image display (`CanvasFrame` and `GLCanvasFrame`), easy-to-use methods to execute code in parallel on multiple cores (`Parallel`), user-friendly geometric and color calibration of cameras and projectors (`GeometricCalibrator`, `ProCamGeometricCalibrator`, `ProCamColorCalibrator`), detection and matching of feature points (`ObjectFinder`), a set of classes that implement direct image alignment of projector-camera systems (mainly `GNImageAligner`, `ProjectiveTransformer`, `ProjectiveColorTransformer`, `ProCamTransformer`, and `ReflectanceInitializer`), a blob analysis package (`Blobs`), as well as miscellaneous functionality in the `JavaCV` class. Some of these classes also have an OpenCL and OpenGL counterpart, their names ending with `CL` or starting with `GL`, i.e.: `JavaCVCL`, `GLCanvasFrame`, etc. To learn how to use the API, since documentation currently lacks, please refer to the [#Quick_Start_for_OpenCV_and_FFmpeg] section below as well as the [http://code.google.com/p/javacv/source/browse/samples/ sample programs], including two for Android (`FacePreview.java` and `RecordActivity.java`), also found in the `samples` directory. You may also find it useful to refer to the source code of [http://code.google.com/p/javacv/source/browse?repo=procamcalib ProCamCalib] and [http://code.google.com/p/javacv/source/browse?repo=procamtracker ProCamTracker] as well as [http://code.google.com/p/javacv/source/browse?repo=examples Examples ported from OpenCV2 Cookbook] and the associated [http://code.google.com/p/javacv/wiki/OpenCV2_Cookbook_Examples Wiki pages]. ==Required Software== To use JavaCV, you will need to download and install the following software: * An implementation of Java SE 6 or 7 * OpenJDK http://openjdk.java.net/install/ or * Sun JDK http://www.oracle.com/technetwork/java/javase/downloads/ or * IBM JDK http://www.ibm.com/developerworks/java/jdk/ or * Java SE for Mac OS X http://developer.apple.com/java/ etc. * OpenCV 2.4.5 http://sourceforge.net/projects/opencvlibrary/files/ * Precompiled and prepackaged CPPJARs for Linux, Mac OS X, Windows, and Android: * http://code.google.com/p/javacv/downloads/list And please make sure your Java and OpenCV have the same bitness: *32-bit and ***-bit modules do not mix under any circumstances*. Further, although not always required, some functionality of JavaCV also relies on: * FFmpeg 1.2.x http://ffmpeg.org/download.html * Precompiled and prepackaged CPPJARs for Linux, Mac OS X, Windows, and Android: * http://code.google.com/p/javacv/downloads/list * libdc1394 2.1.x or 2.2.x http://sourceforge.net/projects/libdc1394/files/ * PGR FlyCapture 1.7~2.3 (Windows only) http://www.ptgrey.com/products/pgrflycapture/ * OpenKinect http://openkinect.org/ * CL Eye Platform SDK (Windows only) http://codelaboratories.com/downloads/ * Android SDK API 8 or newer http://developer.android.com/sdk/ * JOCL and JOGL from JogAmp http://jogamp.org/ * ARToolKitPlus 2.1.1t http://code.google.com/p/javacv/downloads/list To modify the source code, please note that the project files were created for: * Maven 2 or 3 http://maven.apache.org/download.html * JavaCPP 0.5 http://code.google.com/p/javacpp/ To rebuild, simply call the usual `mvn install` command for both JavaCPP and JavaCV. By default, all the dependencies listed above are NOT required, except for OpenCV and a C++ compiler for JavaCPP, whose command line options can be passed via the `javacpp.options` Maven property, such as [http://code.google.com/p/javacpp/#Instructions_for_Android those required for Android]. Please refer to the comments inside the `pom.xml` file for further details. Please keep me informed of any updates or fixes you make to the code so that I may integrate them into the next release. Thank you! And feel free to ask questions on [http://groups.google.com/group/javacv the mailing list] if you encounter any problems with the software! I am sure it is far from perfect... ==Quick Start for OpenCV and FFmpeg== First, put all the JAR files of JavaCV (`javacpp.jar`, `javacv.jar`, and `javacv-*.jar`), of OpenCV (`opencv-2.4.5*.jar`), and of FFmpeg (`ffmpeg-1.2*.jar`) somewhere in your CLASSPATH. Or point your `pom.xml` file to the Maven repository http://maven2.javacv.googlecode.com/git/, and make sure that the library files of OpenCV and FFmpeg (`*.so`, `*.dylib`, or `*.dll`) can be found either in their default installation directories or in the system library PATH, which under Windows includes the current working directory. (For answers to problems frequently encountered with OpenCV on the Windows platform, please refer to [http://code.google.com/p/javacv/wiki/Windows7AndOpenCV Common issues with OpenCV under Windows 7].) Here are some more specific instructions for common cases: NetBeans (Java SE 6 or 7): # In the Projects window, right-click the Libraries node of your project, and select "Add JAR/Folder...". # Locate the JAR files, select them, and click OK. Eclipse (Java SE 6 or 7): # Navigate to Project > Properties > Java Build Path > Libraries and click "Add External JARs...". # Locate the JAR files, select them, and click OK. Eclipse (Android 2.2 or newer): # Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/ # Go to File > New > Folder, select your project as parent folder, type "libs/armeabi" as Folder name, and click Finish. # Copy `javacpp.jar` and `javacv.jar` into the newly created "libs" folder. # Extract all the `*.so` files from `javacv-android-arm.jar`, `opencv-2.4.5-android-arm.jar`, and `ffmpeg-1.2-android-arm.jar` directly into the newly created "libs/armeabi" folder, without creating any of the subdirectories found in the JAR files. # Navigate to Project > Properties > Java Build Path > Libraries and click "Add JARs...". # Select both `javacpp.jar` and `javacv.jar` from the newly created "libs" folder. After that, the wrapper classes for OpenCV and FFmpeg can automatically access all of their C/C++ APIs: * [http://docs.opencv.org/ OpenCV documentation] * [http://ffmpeg.org/doxygen/ FFmpeg documentation] The class definitions are basically ports to Java of the original header files in C, plus the missing functionality exposed only by the C++ API of OpenCV, and I deliberately decided to keep as much of the original syntax as possible. For example, here is a method that tries to load an image file, smooth it, and save it back to disk: {{{ import static com.googlecode.javacv.cpp.opencv_core.*; import static com.googlecode.javacv.cpp.opencv_imgproc.*; import static com.googlecode.javacv.cpp.opencv_highgui.*; public class Smoother { public static void smooth(String filename) { IplImage image = cvLoadImage(filename); if (image != null) { cvSmooth(image, image, CV_GAUSSIAN, 3); cvSaveImage(filename, image); cvReleaseImage(image); } } } }}} JavaCV also comes with helper classes and methods on top of OpenCV and FFmpeg to facilitate their integration to the Java platform. Here is a small demo program demonstrating the most frequently useful parts: {{{ import java.io.File; import java.net.URL; import com.googlecode.javacpp.Loader; import com.googlecode.javacv.*; import com.googlecode.javacv.cpp.*; import static com.googlecode.javacv.cpp.opencv_core.*; import static com.googlecode.javacv.cpp.opencv_imgproc.*; import static com.googlecode.javacv.cpp.opencv_calib3d.*; import static com.googlecode.javacv.cpp.opencv_objdetect.*; public class Demo { public static void main(String[] args) throws Exception { String classifierName = null; if (args.length > 0) { classifierName = args[0]; } else { URL url = new URL("https://raw.github.com/Itseez/opencv/master/data/haarcascades/haarcascade_frontalface_alt.xml"); File file = Loader.extractResource(url, null, "classifier", ".xml"); file.deleteOnExit(); classifierName = file.getAbsolutePath(); } // Preload the opencv_objdetect module to work around a known bug. Loader.load(opencv_objdetect.class); // We can "cast" Pointer objects by instantiating a new object of the desired class. CvHaarClassifierCascade classifier = new CvHaarClassifierCascade(cvLoad(classifierName)); if (classifier.isNull()) { System.err.println("Error loading classifier file \"" + classifierName + "\"."); System.exit(1); } // The available FrameGrabber classes include OpenCVFrameGrabber (opencv_highgui), // DC1394FrameGrabber, FlyCaptureFrameGrabber, OpenKinectFrameGrabber, // PS3EyeFrameGrabber, VideoInputFrameGrabber, and FFmpegFrameGrabber. FrameGrabber grabber = FrameGrabber.createDefault(0); grabber.start(); // FAQ about IplImage: // - For custom raw processing of data, getByteBuffer() returns an NIO direct // buffer wrapped around the memory pointed by imageData, and under Android we can // also use that Buffer with Bitmap.copyPixelsFromBuffer() and copyPixelsToBuffer(). // - To get a BufferedImage from an IplImage, we may call getBufferedImage(). // - The createFrom() factory method can construct an IplImage from a BufferedImage. // - There are also a few copy*() methods for BufferedImage<->IplImage data transfers. IplImage grabbedImage = grabber.grab(); int width = grabbedImage.width(); int height = grabbedImage.height(); IplImage grayImage = IplImage.create(width, height, IPL_DEPTH_8U, 1); IplImage rotatedImage = grabbedImage.clone(); // Objects allocated with a create*() or clone() factory method are automatically released // by the garbage collector, but may still be explicitly released by calling release(). // You shall NOT call cvReleaseImage(), cvReleaseMemStorage(), etc. on objects allocated this way. CvMemStorage storage = CvMemStorage.create(); // The OpenCVFrameRecorder class simply uses the CvVideoWriter of opencv_highgui, // but FFmpegFrameRecorder also exists as a more versatile alternative. FrameRecorder recorder = FrameRecorder.createDefault("output.avi", width, height); recorder.start(); // CanvasFrame is a JFrame containing a Canvas component, which is hardware accelerated. // It can also switch into full-screen mode when called with a screenNumber. // We should also specify the relative monitor/camera response for proper gamma correction. CanvasFrame frame = new CanvasFrame("Some Title", CanvasFrame.getDefaultGamma()/grabber.getGamma()); // Let's create some random 3D rotation... CvMat randomR = CvMat.create(3, 3), randomAxis = CvMat.create(3, 1); // We can easily and efficiently access the elements of CvMat objects // with the set of get() and put() methods. randomAxis.put((Math.random()-0.5)/4, (Math.random()-0.5)/4, (Math.random()-0.5)/4); cvRodrigues2(randomAxis, randomR, null); double f = (width + height)/2.0; randomR.put(0, 2, randomR.get(0, 2)*f); randomR.put(1, 2, randomR.get(1, 2)*f); randomR.put(2, 0, randomR.get(2, 0)/f); randomR.put(2, 1, randomR.get(2, 1)/f); System.out.println(randomR); // We can allocate native arrays using constructors taking an integer as argument. CvPoint hatPoints = new CvPoint(3); while (frame.isVisible() && (grabbedImage = grabber.grab()) != null) { cvClearMemStorage(storage); // Let's try to detect some faces! but we need a grayscale image... cvCvtColor(grabbedImage, grayImage, CV_BGR2GRAY); CvSeq faces = cvHaarDetectObjects(grayImage, classifier, storage, 1.1, 3, CV_HAAR_DO_CANNY_PRUNING); int total = faces.total(); for (int i = 0; i < total; i++) { CvRect r = new CvRect(cvGetSeqElem(faces, i)); int x = r.x(), y = r.y(), w = r.width(), h = r.height(); cvRectangle(grabbedImage, cvPoint(x, y), cvPoint(x+w, y+h), CvScalar.RED, 1, CV_AA, 0); // To access or pass as argument the elements of a native array, call position() before. hatPoints.position(0).x(x-w/10) .y(y-h/10); hatPoints.position(1).x(x+w*11/10).y(y-h/10); hatPoints.position(2).x(x+w/2) .y(y-h/2); cvFillConvexPoly(grabbedImage, hatPoints.position(0), 3, CvScalar.GREEN, CV_AA, 0); } // Let's find some contours! but first some thresholding... cvThreshold(grayImage, grayImage, ***, 255, CV_THRESH_BINARY); // To check if an output argument is null we may call either isNull() or equals(null). CvSeq contour = new CvSeq(null); cvFindContours(grayImage, storage, contour, Loader.sizeof(CvContour.class), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE); while (contour != null && !contour.isNull()) { if (contour.elem_size() > 0) { CvSeq points = cvApproxPoly(contour, Loader.sizeof(CvContour.class), storage, CV_POLY_APPROX_DP, cvContourPerimeter(contour)*0.02, 0); cvDrawContours(grabbedImage, points, CvScalar.BLUE, CvScalar.BLUE, -1, 1, CV_AA); } contour = contour.h_next(); } cvWarpPerspective(grabbedImage, rotatedImage, randomR); frame.showImage(rotatedImage); recorder.record(rotatedImage); } frame.dispose(); recorder.stop(); grabber.stop(); } } }}} ==Acknowledgments== This project was conceived at the Okutomi & Tanaka Laboratory, Tokyo Institute of Technology, where I was supported for my doctoral research program by a generous scholarship from the Ministry of Education, Culture, Sports, Science and Technology (MEXT) of the Japanese Government. I extend my gratitude further to all who have reported bugs, donated code, or made suggestions for improvements! ==Changes== ===April 7, 2013 version 0.5=== * Upgraded support to OpenCV 2.4.5 * Upgraded supported FFmpeg API to the 1.2 release branch * New methods `FFmpegFrameRecorder.setVideoOption()` and `setAudioOption()` generalize the way to set arbitrary codec options, such as "profile", "preset", "tune", etc. used by the x2*** codec * Included better format guessing inside `FFmpegFrameRecorder` for protocols like RTP * Added support for planar audio formats to `FFmpegFrameGrabber` and `FFmpegFrameRecorder`, as required by newer versions of FFmpeg for at least MP3 and AAC * Enhanced `FFmpegFrameRecorder` by making it use the closest supported frame rate for the given codec instead of failing * To support variable bitrate (VBR) encoding, appended new `videoQuality` and `audioQuality` properties to `FFmpegFrameRecorder`, which usually have an effective range of [0, 51] and overrides the `videoBitrate` and `audioBitrate` properties ===March 3, 2013 version 0.4=== * Upgraded support to OpenCV 2.4.4 * `CanvasFrame.waitKey(-1)` does not wait anymore and returns the last `KeyEvent` dispatched since the last call to it * Upgraded supported FFmpeg API to the 1.1 release branch * Fixed bug in `FaceRecognition.java` sample (issue #276) * Included `Sobel()`, `Scharr()`, `Laplacian()`, and `Canny()` from `opencv_imgproc` whose equivalent functions in the C API have missing parameters * Extended `OpenKinectFrameGrabber` with `setDepthFormat()` and `setVideoFormat()` methods to be able to set both formats independently (issue #273) * Fixed `Blender.blend()` having its `@OutputMat` incorrectly annotated as `@InputMat` (issue #272) * Added new `RecordActivity.java` Android sample from Shawn Van Every and Qianliang Zhang * Added missing `allocate()` methods for `FunctionPointer` in `AVIOContext` and others, which prevented these FFmpeg callbacks from functioning * Fixed infinite loop in `FrameGrabber.Array.grab()` (as used by ProCamCalib in the case of stereo cameras, issue #262) when `FrameGrabber.getTimestamp()` returns an invalid negative value (as with `opencv_highgui`) or when using different types of (unsynchronized) `FrameGrabber` together * Fixed `cvQueryHistValue_1D()` and other functions that use a raw `CvArr` object * Fixed problem when subclassing `CanvasFrame` ===November 4, 2012 version 0.3=== * Upgraded support to OpenCV 2.4.3 (issue #233) * Fixed functions like `Algorithm.getMat()` and `HOGDescriptor.getDefaultPeopleDetector()` returning `null` instead of the expected data * Implemented better, more transparent, handling of `cv::Ptr` * When allocating an empty `IplImage`, `CvMat`, `CvBGCodeBookModel`, etc. its memory content now gets zeroed out, giving OpenCV a better chance of displaying an error message instead of crashing * Upgraded supported FFmpeg API to the 1.0 release branch * Appended to `StringVector` and `MatVector` new convenient bulk constructors and `put()` methods taking arrays of `String`, `IplImage`, `CvMat`, etc. * Included new `Blobs` module from David Grossman and the corresponding `BlobDemo` sample * Added missing `opencv_core.partition()` function (issue #144) * Fixed up the samples a bit (issue #229 and issue #230) * Switched the majority of `@Adapter` annotations to more concise ones like `@StdVector` as allowed by new capabilities of JavaCPP * Fixed `FFmpegFrameGrabber.getLengthInFrames()` and `OpenCVFrameGrabber.getLengthInTime()` (issue #231 and issue #236) * Enhanced `FFmpegFrameRecorder` to support conversion between audio sample formats (for the experimental AAC encoder among other things) and to let two different threads call `record(samples)` and `record(image)` simultaneously, plus a couple of other features like `setFrameNumber()`, which lets users skip image frames (achieving variable frame rate) * Added a `javacpp.skip` property to `pom.xml`, such that a command like `mvn package -Pall -Djavacpp.skip=true` only recompiles the Java source files, but also added `platform.root` and `compiler.path` properties, which map directly to JavaCPP's for convenience ===July 21, 2012 version 0.2=== * Provided new `javacv-linux-arm.jar` build thanks to Jeremy Nicola (issue #184) * Additional default properties inside `pom.xml` make it easier to build JavaCV from source (issue #202), calling `mvn package` now succeeds with only OpenCV and a C++ compiler ... ...

近期下载者

相关文件


收藏者