error: variable cv::cuda::GpuMat has initializer but incomplete type
I'm trying to use the CUDA implementation for OpenCV on the NVidia TX1.
Using cv::Mat, the minimal example below works, but with cv::cuda::GpuMat it returns errors when comiling:
#include "ros/ros.h"
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <opencv2/imgproc/imgproc.hpp>
void imageCallback(const sensor_msgs::ImageConstPtr& original_image){
cv_bridge::CvImagePtr cv_ptr;
try {
cv_ptr = cv_bridge::toCvCopy(original_image);
} catch (cv_bridge::Exception& e) {
ROS_ERROR("test::main.cpp::cv_bridge exception: %s", e.what());
return;
}
cv::cuda::GpuMat yuvImage = cv_ptr->image;
cv::cuda::GpuMat rgbImage;
}
int main(int argc, char **argv){
ros::init(argc, argv, "test");
ros::NodeHandle n;
ros::Subscriber image_sub = n.subscribe("/camera/image_raw", 1, imageCallback);
ros::spin();
}
The errors I get with catkin build
are:
/home/wim/catkin-ws/src/test/src/test.cpp: In function ‘void imageCallback(const ImageConstPtr&)’:
/home/wim/catkin-ws/src/test/src/test.cpp:19:34: error: variable ‘cv::cuda::GpuMat yuvImage’ has initializer but incomplete type
cv::cuda::GpuMat yuvImage(tmpMat);
^
/home/wim/catkin-ws/src/test/src/test:20:19: error: aggregate ‘cv::cuda::GpuMat rgbImage’ has incomplete type and cannot be defined
cv::cuda::GpuMat rgbImage;
What am I doing wrong? The OpenCV4Tegra is installed and no other OpenCV version as far as I can see Should I include something more?
[edit]Here is my CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(test)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
cv_bridge
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_executable(test src/test.cpp)
add_dependencies(test ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gen$
target_link_libraries(test
${catkin_LIBRARIES}
)
[/edit]