=JavaCV=
==Introduction==
JavaCV first provides wrappers to commonly used libraries by researchers in the field of computer vision: [http://opencv.org/ OpenCV], [http://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].
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...
==Required Software== To use JavaCV, you will need to download and install the following software:
And please make sure your Java and OpenCV have the same bitness: 32-bit and 64-bit modules do not mix under any circumstances. Further, although not always required, some functionality of JavaCV also relies on:
Finally, because we are dealing with native code, bugs can easily crash the virtual machine. Luckily, Java provides some tools to help us debug under those circumstances:
==Build Instructions== To rebuild the source code, please note that the project files were created for:
Once installed, 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.
==Quick Start for OpenCV and FFmpeg==
Simply put all the JAR files of JavaCV (javacpp.jar
, javacv.jar
, and javacv-*.jar
), of OpenCV (opencv-*.jar
), and of FFmpeg (ffmpeg-*.jar
) somewhere in your CLASSPATH. Here are some more specific instructions for common cases:
NetBeans (Java SE 6 or 7):
Eclipse (Java SE 6 or 7):
Eclipse (Android 2.2 or newer):
javacpp.jar
and javacv.jar
into the newly created "libs" folder.*.so
files from javacv-android-arm.jar
, opencv-2.4.8-android-arm.jar
, and ffmpeg-2.1.1-android-arm.jar
directly into the newly created "libs/armeabi" folder, without creating any of the subdirectories found in the JAR files.javacpp.jar
and javacv.jar
from the newly created "libs" folder.Or point your build 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].)
After that, the wrapper classes for OpenCV and FFmpeg can automatically access all of their C/C++ APIs:
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/2.4/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, 64, 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==
FFmpegFrameRecorder
not refreshing the resampler when the format of samples changes (issue #465)ObjectFinder
not working with recent versions of OpenCV, especially on Android (issue #214)FrameRecorder.gopSize
property to let users set a desired GOP size instead of the default one of 12FFmpegFrameGrabber
now takes into account calls to setPixelFormat()
(issue #429), but does not enforce itFrame.audioChannels
field for resampling purposes in FFmpegFrameRecorder
(issue #388)FFmpegFrameRecorder
, fixed audio encoding with the Vorbis codec (issue #428) and the WebM container (issue #435), and other audio related thingsallocateArray()
constructors to CameraParams
and MatchesInfo
(issue #421)opencv_ocl
module as dependencyFFmpegFrameGrabber.setTimestamp()
(issue #417)stopRecording()
and onDestroy()
methods of the RecordActivity
sample, thanks to Jacob DuronFFmpegFrameGrabber.setTimestamp()
to its previous behavior (issue #413)samples/FaceApplet.jnlp
to make it work with JDK/JRE 7u45===January 6, 2014 version 0.7===
freenect
to reflect the latest changes of OpenKinect's master branchvideoInput
to reflect the latest changes in the "update2013" branchFrame.opaque
field to give access to the raw AVFrame
in the case of FFmpegFrameGrabber
(issue #399)FFmpegFrameGrabber.grabKeyFrame()
method to grab key frames (I-frames) directly (issue #312)VideoInputFrameGrabber
now uses 640x480 as default image size to prevent "videoInput.getPixels() Error: Could not get pixels."FFmpegFrameGrabber.setTimestamp()
not working for streams with audio (issue #398)haarcascade_frontalface_alt.xml
file getting downloaded by the Demo
class (issue #402)Frame.sampleRate
field to allow audio samples to be resampled by FFmpegFrameRecorder
(issue #388)IPCameraFrameGrabber
from Greg Perry (issue #384)FFmpegFrameGrabber
and FFmpegFrameRecorder
(issue #377)MotionDetector.java
sample file (issue #372)videoCodecName
and audioCodecName
properties to allow users of FFmpegFrameRecorder
to use codecs such as "libx264rgb" (issue #369)===September 15, 2013 version 0.6===
FFmpegFrameGrabber.getFrameNumber()
MarkerDetector.draw()
FFmpegFrameGrabber.getTimestamp()
not returning values for audio frames (issue #328)Frame.keyFrame
field returned by FFmpegFrameGrabber.grabFrame()
to know when a grabbed frame is a key frame or not (issue #312)samples/RecordActivity.java
that would happen when trying to record a frame with an invalid timestamp (issue #313)FFmpegFrameRecorder
throwing an Exception
FFmpegFrameGrabber
not returning the last few frames of video streams (issue #315)FrameRecorder.record(Buffer[] samples)
to a cleaner record(Buffer ... samples)
(issue #303)FFmpegFrameRecorder
not flushing buffers on stop()
(issue #302)===April 7, 2013 version 0.5===
FFmpegFrameRecorder.setVideoOption()
and setAudioOption()
generalize the way to set arbitrary codec options, such as "profile", "preset", "tune", etc. used by the x264 codecFFmpegFrameRecorder
for protocols like RTPFFmpegFrameGrabber
and FFmpegFrameRecorder
, as required by newer versions of FFmpeg for at least MP3 and AACFFmpegFrameRecorder
by making it use the closest supported frame rate for the given codec instead of failingvideoQuality
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===
CanvasFrame.waitKey(-1)
does not wait anymore and returns the last KeyEvent
dispatched since the last call to itFaceRecognition.java
sample (issue #276)Sobel()
, Scharr()
, Laplacian()
, and Canny()
from opencv_imgproc
whose equivalent functions in the C API have missing parametersOpenKinectFrameGrabber
with setDepthFormat()
and setVideoFormat()
methods to be able to set both formats independently (issue #273)Blender.blend()
having its @OutputMat
incorrectly annotated as @InputMat
(issue #272)RecordActivity.java
Android sample from Shawn Van Every and Qianliang Zhangallocate()
methods for FunctionPointer
in AVIOContext
and others, which prevented these FFmpeg callbacks from functioningFrameGrabber.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
togethercvQueryHistValue_1D()
and other functions that use a raw CvArr
objectCanvasFrame
===November 4, 2012 version 0.3===
Algorithm.getMat()
and HOGDescriptor.getDefaultPeopleDetector()
returning null
instead of the expected datacv::Ptr
IplImage
, CvMat
, CvBGCodeBookModel
, etc. its memory content now gets zeroed out, giving OpenCV a better chance of displaying an error message instead of crashingStringVector
and MatVector
new convenient bulk constructors and put()
methods taking arrays of String
, IplImage
, CvMat
, etc.Blobs
module from David Grossman and the corresponding BlobDemo
sampleopencv_core.partition()
function (issue #144)@Adapter
annotations to more concise ones like @StdVector
as allowed by new capabilities of JavaCPPFFmpegFrameGrabber.getLengthInFrames()
and OpenCVFrameGrabber.getLengthInTime()
(issue #231 and issue #236)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)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===
javacv-linux-arm.jar
build thanks to Jeremy Nicola (issue #184)pom.xml
make it easier to build JavaCV from source (issue #202), calling mvn package
now succeeds with only OpenCV and a C++ compiler for JavaCPPPointer.limit
property of JavaCPP can now be used to get the size
of an output parameter, and to specify the maximum size
on input as wellFFmpegFrameGrabber
(call grabFrame()
instead of grab()
) and FFmpegFrameRecorder
(call setAudioChannels()
before start()
, and record(Frame)
instead of record(IplImage)
) (issue #160)FFmpegFrameRecorder
settings to H.263, MPEG-4, etc. codecs and fixed H.264 encoding with libx264 (issue #160)FaceApplet
sampleFlannBasedMatcher
constructor, FaceRecognizer.train()
, and Stitcher.stitch()/composePanorama()
(issue #211)CanvasFrame
sometimes blanking out under Windows and maybe Linux (issue #212)===May 27, 2012 version 0.1===
libopencv_core.so.2.4
, libopencv_core.2.4.dylib
, opencv_core240.dll
, etc. from Java resources placed inside the com.googlecode.javacv.cpp.<platform.name>
package (i.e.: under the /com/googlecode/javacv/cpp/<platform.name>/
directory of a JAR file in the classpath) (issue #146)FaceApplet
sample to demonstrate [http://code.google.com/p/javacv/wiki/HowToMakeAnApplet How to use JavaCV in an applet]IplImage.asCvMat()
and CvMat.asIplImage()
conversion methodsOpenCVFrameGrabber
, opencv_contrib
, opencv_legacy
, and opencv_stitching
===May 12, 2012===
pom.xml
file for Maven support and changed the directory structure of the source code to match Maven's standard directory layoutbuild.xml
or pom.xml
(issue #146)CvANN_MLP.create()
cvCalcCovarMatrixEx()
, cvEigenDecomposite()
, and cvEigenProjection()
taking an IplImage[]
as argument for convenienceVideoInputFrameGrabber.start()
now accepts a connection
argument such as VI_COMPOSITE
to support analog cameras and what notFaceRecognition
sample (issue #188)CvAttrList
===March 29, 2012===
position()
methods to KDTree.Node
, DefaultRngAuto
, CvAffinePose
, KeyPoint
, BaseKeypoint
, ReferenceTrees
, DMatch
, *.Params
, CvFuzzy*
, Octree.Node
, CvDefParam
, Cv*Blob*
, Cv*Track*
, CvDrawShape
, CvVectors
, CvParamGrid
, Cv*Params
, CvSVM*
, CvPair16u32s
, CvDTree*
CvTrainTestSplit
, CvMLData
, FeatureEvaluator
, and *DataMatrixCode
IplImage.createFrom()
, copyFrom()
, copyTo()
, getBufferedImage()
by providing a flipChannels
parameter, whose effect was previously mistakenly forced onto four-channel images of byte values only (issue #163)CvMat.get()/put()
(issue #167)IplImage
, we may now specify the pixel format of the data when calling FFmpegFrameRecorder.record()
, but otherwise when IplImage.nChannels == 2
, it assumes PIX_FMT_NV21
, allowing for easy and efficient encoding of data captured from the camera on Android (issue #160), image objects we can also convert to RGB using cvCvtColor()
with CV_YUV420sp2BGR
FFmpegFrameGrabber
(issue #162) and added getLengthInFrames()
and getLengthInTime()
methods to query the duration of streams, when knownIplImage.clone()
and create*Compatible()
with cloning of their BufferedImage
to make it easier to keep color components in the right order (issue #163)FrameGrabber
and FrameRecorder
a bit to accommodate new createDefault(...)
and create(String className, ...)
factory methods, offering to users an easier selection method to work around limitations of some APIs (issue #70)GNImageAligner
, ProCamTransformer
, etc. to support alignment of only the projector display on textureless surface planesSettings
properties to reflect better their meanings===February 18, 2012===
GLCanvasFrame
to show OpenGL renderbuffers on screen, plus a new factory method JavaCVCL.createCLGLImageFrom()
to create compatible ones from IplImage
objects, as well as more user-friendly getGLContext()
, getGL()
and getGL2()
methodsCanvasFrame
, and JavaCV.createCLImage()
and createIplImage()
, also appending From
to their names createPinnedBuffer()
and createPinnedIplImage()
factory methods in JavaCVCL
to allocate page-locked memory for faster CPU<->GPU transfers, but it does not seem to work for OpenCL image objects, only linear buffer objects :(GNImageAlignerCL
and ProjectorDevice
(its useOpenGL
property) to support fully OpenCL and OpenGL accelerationParallel
a bit so that we may set the number of threads it uses via its static numThreads
property or the "com.googlecode.javacv.numthreads" system property, which defaults to Parallel.getNumCores() = Runtime.getRuntime().availableProcessors()
JavaCV
, while adding boundingRect()
, functionally similar to cvBoundingRect
, but better adapted to compute a properly aligned and padded ROIallocate()
inside opencv_flann
ObjectFinder
with a Settings.useFLANN
property to let it use FLANN via OpenCVHandMouse
CanvasFrame
, FrameGrabber
, FrameRecorder
, and ProjectiveDevice
objects now throw Exception
objects of a nested class instead of the too generic java.lang.Exception
onecvkernels.multiWarpColorTransform()
, modifying ImageTransformer
classes, from GNImageAligner
into cvkernels
, which now also supports other image types than float
Settings
properties here and there to correct typos and reflect better their meaningsfreenect
to reflect the latest changes of OpenKinect's master branchIplImage.timestamp
to FrameGrabber
, also adding a frameNumber
property, both allowing to seek within streams tootriggerFlushSize
property from CameraDevice
and FrameGrabber
, instead relying on the numBuffers
property to decide the required size of a buffer flushFFmpegFrameGrabber.getFrameRate()
and getTimestamp()
(issue #151)BufferRing
class for convenient circular rings of large buffers that require manual release of resources, such as OpenCL memoryFrameGrabber
, including restart()
, flush()
, and delayedGrab()
(to be used in conjunction with getDelayedTime()
and getDelayedImage()
)cvLoadImageBGRA()
and cvLoadImageRGBA()
methods into opencv_highgui
to load color images compatible with OpenCL more easilyJavaCvErrorCallback
now outputs messages to Logger
instead of System.err
VI_COM_MULTI_THREADED
for videoInput
, allowing it to run on multiple threads if needed===January 8, 2012===
/usr/local/lib/
, /opt/local/lib/
, and C:\opencv\
, even when they are not part of the system configuration or PATH (issue #127)set()
and fill()
methods to put()
inside CvPoint*
classes, for better naming consistencyFrameGrabber.ColorMode
to ImageMode
and its BGR
value to COLOR
to reflect the fact that a FrameGrabber
instance can return color images in some arbitrary format, but added a new pixelFormat
property to let users know or specify the exact pixel format desired, such as PIX_FMT_BGR24
, etc. in the case of FFmpegFrameGrabber
FFmpegFrameGrabber.start()
, the format
, imageWidth
, imageHeight
, and frameRate
properties switch to their effective valuesFrameGrabber.sensorPattern
property to obtain the Bayer filter layout of raw data from DC1394FrameGrabber
and FlyCaptureFrameGrabber
KDTree
, Index
, and HOGDescriptor
some functions with FloatPointer
and IntPointer
arguments that were mistakenly removed when OpenCV switched to using cv::InputArray
and cv::OutputArray
parameter types (issue #134)ProjectiveGainBiasTransformer
to ProjectiveColorTransformer
JavaCVCL
, GNImageAlignerCL
, ProjectiveTransformerCL
, ProjectiveColorTransformerCL
, and ProCamTransformerCL
with some other related filesParallel.numCores
to the more conventional Parallel.NUM_CORES
FaceRecognition.java
sample from Stephen L. ReedLoader.load()
(issue #142)Loader.load()
in JavaCPP make JavaCV work on Android 4.0PS3EyeFrameGrabber
from Jiri Masa can now grab images using the SDK from Code Laboratories===October 1, 2011===
DC1394FrameGrabber
and FlyCaptureFrameGrabber
to behave as expected with all Bayer/Raw/Mono/RGB/YUV cameras modes (within the limits of libdc1394 and PGR FlyCapture) (issue #91)IplImage.copyFrom()
and createFrom()
with BufferedImage
objects of SinglePixelPackedSampleModel
(issue #102)std::vector
objects as output parameters now work on Windows Vista and Windows 7 as well===August 20, 2011===
cv::Mat
or cv::OutputArray
returned with a size 0 now correctly sets CvArr.address = 0
IplImage.createFrom()
and copyFrom()
when called on objects returned by BufferedImage.getSubimage()
CvRNG
OpenCVFrameGrabber
now detects when CV_CAP_PROP_POS_MSEC is broken and gives up calling cvGetCaptureProperty()
OpenKinectFrameGrabber.grabDepth()
and grabVideo()
methods to capture "depth" and "video" simultaneously, regardless of the mode===July 5, 2011===
OpenKinectFrameGrabber
, which can now also capture depth images when setFormat("depth")
is called before start()
CvMatArray
and IplImageArray
as well as histogram related functionsFFmpegFrameGrabber
, and FFmpegFrameRecorder
now works on Android alsoopencv_flann.Index.knnSearch()
, that require a MatAdapter
or an ArrayAdapter
for output===June 10, 2011===
freenect
wrapper and corresponding OpenKinectFrameGrabber
to capture from Microsoft's Kinect stereo camera using OpenKinect===May 11, 2011===
CvMat
object pooling in favor of more efficient ThreadLocal
objects created by CvMat.createThreadLocal()
Marker.getCenter()
back to the centroid, because it has better noise averaging properties and gives in practice more accurate results than the actual centerOpenCVFrameGrabber.start()
to wait for cvRetrieveFrame()
to return something else than null
under Mac OS XvideoInputLib
wrapper and corresponding VideoInputFrameGrabber
to capture using DirectShow, useful under Windows 7 where OpenCV and FFmpeg can fail to capture using Video for Windows (issue #58)GeometricCalibrator
now reports the maximum errors in addition to the average (RMS) errors===April 7, 2011===
format
property to CameraDevice
, FrameGrabber
, and FrameRecorder
, mostly useful for FFmpegFrameGrabber
, where interesting values include "dv1394", "mjpeg", "video4linux2", "vfwcap", and "x11grab"OpenCVFrameRecorder
now uses CV_FOURCC_PROMPT
under Windows as default since CV_FOURCC_DEFAULT
crashes (issue #49)UnsatisfiedLinkError
(issue #54), but some corner cases may require a call to Loader.load()
on the class one wishes to useJavaCV.hysteresisThreshold()
featureHandMouse
functionality, which depends on the image alignment frameworkProjectiveDevice.distort()
, which mistakenly undistorted images insteadHoughLines
sample thanks to Jeremy Nicola===February 19, 2011===
FFmpegFrameGrabber
having it call avpicture_deinterlace()
(issue #38)FlyCaptureFrameGrabber
, but this is going to require more careful debugging===December 2, 2010===
CanvasFrame
in the hope to make it behave better outside the EDTFrameGrabber
objects, when start()
may not have been calledCvStereoBMState
and related functionscvkernels
===November 4, 2010===
com.googlecode.javacv
, which makes more sense now that JavaCV has been well anchored at Google Code for more than a year, piggybacking on the unique and easy-to-remember domain nameavutil
, avcodec
, avformat
, avdevice
, avfilter
, postprocess
, and swscale
, eliminating the need of the separate FFmpeg-Java packageCanvasFrame
now redraws its Canvas
after the user resizes the Frame
Error
thrown when calling CanvasFrame.showImage()
from the EDTDC1394FrameGrabber
so that a "Failed to initialize libdc1394" does not crash the JVMFFmpegFrameGrabber
does not crash anymore when forgetting to call start()
before a grab()
or trigger()
FrameGrabber
now selects the default grabber a bit betterGNImageAligner
, ProjectiveTransformer
, ProjectiveGainBiasTransformer
, and ProCamTransformer
...JavaCV
more methods related to transformation of planes: perspectiveTransform()
, getPlaneParameters()
, getPerspectiveTransform()
, and HtoRt()
, as well as ProjectiveDevice.getFrontoParallelH()
autoSynch
flag to all Structure
classes of cxcore
, cv
, and cvaux
, which you may set to false
prior to the return of things like big and heavy CvSeq
to make them load faster and to avoid stack overflows, but accessing fields will then require manual calls to readField()
and writeField()
(issue #10 and #14)ByValue
subclasses to CvSeq
, CvSet
, CvContourTree
, and CvChain
... Any others missing?Exception
thrown from cvCreateHist()
under JNA 3.2.7 (issue #26)CvMat.put()
, which now supports setting submatricesIplImage
the support of BufferedImage
, especially those using a DirectColorModel
(issue #23)cvkernels
when color transformation X
is null
===July 30, 2010===
CanvasFrame
for some video driversFFmpegFrameGrabber
now supports other input formats (devices), such as x11grab
that can be used for screencastingJavaCV.median()
function, and JavaCV.fractalTriangleWave()
now respects image ROIcvaux
deltaScale
and tryToFixPlane
to GNImageAligner.Settings
(the first used in ImageTransformer.Parameters
as increment, randomly selected forward or backward, for finite difference), which sometimes help to jump over local minima===May 30, 2010===
CvMemStorage.clearMem()
method, use cvClearMemStorage()
Test2
class that did not work under Windowscvkernels
transformer
at the bordersCanvasFrame
constructors and added a gamma
argument used by showImage(IplImage)
CanvasFrame
now lets users resize the frame, while displayed images are stretched to fit the new sizeCanvasFrame.acquireGraphics()
to createGraphics()
for consistencyFlyCaptureFrameGrabber
cannot set fastest speed, it now safely fails by setting any supported speedParallel.loop()
method that can use more threads than the number of CPU cores detectednumThreads
property to GNImageAligner
and fixed a few minor inconsistencies as wellJava.HnToRt()
, and added a few norm()
and randn()
methodsfloat[]
and double[]
arguments in cvaux
and cv
, added complementary FloatBuffer
and DoubleBuffer
declarationscvaux
CvRNG
CvScalar.getVal()
and CvIntScalar.getVal()
, which simply return the val
field, convenient for Scala where val
is a reserved wordIplImage
from a Pointer
IplImage
gets converted to a BufferedImage.TYPE_CUSTOM
CvArr.PointerByReference
a bit more consistent and general===April 16, 2010===
IplImage
, FrameGrabber
, and CanvasFrame
to get better default behavior of gamma correctioncv.CvHistogram
and related histogram functionsCameraDevice.Settings.triggerFlushSize
now defaults to 5 (only affects OpenCVFrameGrabber
and FFmpegFrameGrabber
)LMImageAligner
by GNImageAligner
, a more appropriate name for Gauss-Newton with lineSearch
ProjectiveDevice.Settings
===April 8, 2010===
===April 5, 2010===
clone()
methods to avoid the need to castfullScreen
argument from CanvasFrame
constructors, which will now switch to full-screen mode only when a screenNumber
is explicitly passedFrameGrabber.ColorMode.GRAYSCALE
to GRAY
FFmpegFrameGrabber
and FFmpegFrameRecorder
FFmpegFrameGrabber
can now resize images===March 21, 2010===
cvkernels
, JavaCV.fractalTriangleWave()
, ImageAligner
, LMImageAligner
, ImageTransformer
, ProjectiveTransformer
, ProjectiveGainBiasTransformer
, ProCamTransformer
, and ReflectanceInitializer
CameraDevice.Settings
has a new deviceFile
property (used by a FrameGrabber
), which brings up a file dialog for some PropertyEditor
sCameraSettings
, ProjectorSettings
, and FrameGrabber.PropertyEditor
from the procamcalib
packageCameraDevice.Settings
and FrameGrabber
a triggerFlushSize
property to indicate the number of buffers to flush on trigger()
to compensate for cheap cameras that keep old images in memory indefinitelyCameraDevice.Settings.deviceNumber
to Integer
so we may set it to null
CanvasFrame.showImage()
methods a bittriggerMode
DC1394FrameGrabber
now tries to use a real software trigger and only falls back to one-shot mode on errorIplImage.PointerByReference()
and CvImgObsInfo.PointerByReference()
CvPoint.fillArray()
methods to reuse preallocated arrays and changed createArray()
a bit as wellIplImage.copy*()
methods, including new support for ROIs and subimages, which affects create*()
and getBufferedImage()
methods as wellMarker
to support different size and spacing in X and YSettings
to ObjectFinder
ProjectiveDevice
and ProCamColorCalibrator
with OpenCV 1.1pre1ProjectiveDevice.Settings
into ProjectiveDevice.CalibrationSettings
(for applications like ProCamCalib) and ProjectiveDevice.CalibratedSettings
(for applications like ProCamTracker)gamma
to responseGamma
in ProjectiveDevice
, and moved previous nominalDistance
parameter to Settings
ProjectiveDevice.rescale()
to rescale calibration parameters when switching a device to a new image sizeProjectiveDevice.undistort()
and distort()
can now useFixedPointMaps
of OpenCVProjectiveDevice
and its subclasses now throw new Exception()
if the parameterFile
cannot be read===February 13, 2010===
devicePath
setting to CameraDevice
that works with FFmpegFrameGrabber
, OpenCVFrameGrabber
, and other FrameGrabber
with a String constructorcvFindHomography()
, cvFindExtrinsicCameraParams2()
, cvReprojectImageTo3D()
, cvSaveImage()
, and cvRetrieveFrame()
to version specific classes since their number of arguments differ with the version of OpenCVCvMat.put(CvMat mat)
to work better even when the matrices are not actually compatibleIplImage
factory methods createCompatible(IplImage image)
, createIfNotCompatible(IplImage image, IplImage template)
, and createFrom(BufferedImage image)
distortionCoeffs
corruption that might occur in ProjectiveDevice
===January 3, 2010===
cvaux
module of OpenCVFrameRecorder
class and a OpenCVFrameRecorder
classjava -jar javacv.jar
now displays version information===December 22, 2009===
CanvasFrame
from getting stuck in a maximized windowsetAutoWrite(false)
from cxcore
now that the bug appears fixed in JNAFFmpegFrameGrabber
and FFmpegFrameRecorder
to easily record live footage and grab back offline into JavaCV===November 24, 2009===
CvPoint*
, CvSize*
, CvRect
, CvTermCriteria
, CvSlice
, and CvAttrList
ProjectiveDevice
FlyCaptureFrameGrabber
CvHaarFeature
Structure CvIntScalar
factory methods to match with CvScalar
IplImage
highgui.CV_FOURCC()
method that takes chars as parameterMarkedPlane.drawMarkers()
to Marker.draw()
for better code reuseMarkedPlane.getTotalWarp()
with a "useCenters" parameterMarkerDetector.binarizationKWhiteMarkers
to 1.0 and ProjectorDevice.brightnessBackground
to 0.0MarkerDetector
Marker.getCenter()
now computes the actual physical center instead of the centroidOpenCVFrameGrabber.getDeviceDescriptions()
now throws UnsupportedOperationException
OpenCVFrameGrabber
to grab frames from video filesProjectiveDevice.getRectifyingHomography()
methodJavaCvErrorCallback
to easily catch errors of OpenCV in Java===October 19, 2009===
CvMatPool
to the CvMat.take()
and .pool()
methodsProCamColorCalibrator
)DC1394FrameGrabber
to handle more conversion use cases automaticallyCvIntScalar
to mirror CvScalar
===October 14, 2009===
cv.v20
can access everything from the cv
module of OpenCV 2.0CvPoint*
ObjectFinder
to plug the memory leak===October 2, 2009===
ProjectiveDevice
Structure
or PointerByReference
cv.java
a few missing functions related to calibrationCvPoint*
, CvScalar
, CvRect
, CvBox2D
, CvMat
, IplImage
, CvMemStorage
, CvSeq
, and CvSeqBlock
CvMatPool
to MarkedPlane
and Marker
distort()
methods to ProjectiveDevice
===August 27, 2009===
IplImage
now flips the buffer on copy if necessaryCvSURFPoint
and CvConvexityDefect
CvMat
===August 26, 2009===
get*Buffer()
functions to IplImage
IplImage
and ProjectiveDevice
ProjectiveDevices
CanvasFrame.waitKey()
now only checks KeyEvent.KEY_PRESSED
CvMatPool
to avoid recreating matricesCvScalar
functions to cxcore
===August 19, 2009===
import static
for relief from namespace hellDC1394FrameGrabber
===August 11, 2009=== Initial release
Copyright (C) 2009-2014 Samuel Audet samuel.audet@gmail.com Project site: http://code.google.com/p/javacv/
Licensed under the GNU General Public License version 2 (GPLv2) with Classpath exception. Please refer to LICENSE.txt or http://www.gnu.org/licenses/ for details.