BoofCV vs. OpenCV

From BoofCV
Jump to navigationJump to search

Comparison of BoofCV and OpenCV

By far the most popular and used computer vision library at this time is OpenCV. OpenCV was released in 1999 as an Intel Research initiative and is currently maintained by Willow Garage who is actively developing the library. Originally written in C, OpenCV now has much of its code written in C++ with wrappers for other libraries such as Python.

In some respects parts of BoofCV's design are in response to perceived weaknesses in OpenCV's design. Several of these improvements are listed below.


Documentation in OpenCV has improved considerably, but its quality is still variable and the newer algorithms often require digging through the code to figure out what really happens. To highlight this problem consider the heavily used cv::Mat class and the Mat::at(i0,i1) function used to access the value of an element/pixel. Looking at the header file you see the following:

    //! the same as above, with the pointer dereferencing
    template<typename _Tp> _Tp& at(int i0=0);
    template<typename _Tp> const _Tp& at(int i0=0) const;
    template<typename _Tp> _Tp& at(int i0, int i1);
    template<typename _Tp> const _Tp& at(int i0, int i1) const;

So does i0 or i1 refer to the row or column in the image? It doesn't say! In images the standard order is column then row, while for matrices it is row then column. Since cv::Mat can represent both, there are no de-facto standards to use.

In contrast consider the equivalent function in BoofCV:

	 * Returns the value of the specified pixel.
	 * @param x pixel coordinate.
	 * @param y pixel coordinate.
	 * @return an intensity value.
	public float get(int x, int y) {

At the time of this writing almost all functions/algorithms in BoofCV are well documented, with the exception of the Factories. That's not to say there isn't any ambiguity, if you find a place where documentation is lacking please post a bug report.

Strong Typing

In OpenCV its input objects often are generic types, such as cv::Mat, which prevent type checking at compile time. Using generic types in this fashion can also prevent the user from figure out what type of data is stored in the object, leading to some frustration and wasted time. BoofCV provide many functions with strong typing and makes heavy use of Java generics in its code to provide some degree of compile time type checking.

Efficient Design

Browser Runnable

Easier to Compile

Cross Platform