Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

First, I'd include

#include <opencv2/nonfree/nonfree.hpp>

Second you need to initialize the non-free module:

cv::initModule_nonfree();

First, I'd include

#include <opencv2/nonfree/nonfree.hpp>

Second you need to initialize the non-free module:

cv::initModule_nonfree();

edit Maybe the following CMakeLists.txt helps you building it (afaik the pkg-config file is still broken in the current opencv-version):

project(Test)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
find_package( OpenCV REQUIRED )
if( OpenCV_FOUND )
list( APPEND ThirdParty_LIBS ${OpenCV_LIBS} )
    include_directories( ${OpenCV_INCLUDE_DIRS} )
endif( OpenCV_FOUND )

set(${PROJECT_NAME}_SRC test.cpp)
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_SRC})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})