routingEngine->subscribeToProperty(VehicleProperty::VehicleSpeed, this);
routingEngine->subscribeToProperty(VehicleProperty::Latitude, this);
routingEngine->subscribeToProperty(VehicleProperty::Longitude, this);
+ routingEngine->subscribeToProperty(VehicleProperty::ExteriorBrightness, this);
supportedChanged(engine->supported());
}
message(STATUS "no opencv ocl headers found (ocl.hpp). no opencl support")
endif(ocl)
+find_path(cuda gpu.hpp PATH_SUFFIXES opencv/gpu opencv2/gpu DOC "opencv cuda headers")
+
+if(cuda)
+ message(STATUS "found opencv cuda headers. enabling cuda support. ${cuda}")
+ add_definitions(-DCUDA)
+else(cuda)
+ message(STATUS "no opencv cuda headers found. no cuda support")
+endif(cuda)
+
include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${OpenCV_INCLUDE_DIRS})
set(opencvluxplugin_headers opencvluxplugin.h)
#include <opencv/ocl/ocl.hpp>
#endif
+#ifdef CUDA
+#include <opencv2/gpu/gpu.hpp>
+#endif
+
using namespace std;
#include "debugout.h"
shared->threaded = false;
shared->kinect = false;
shared->useOpenCl = false;
+ shared->useCuda = false;
shared->fps=30;
device="0";
shared->useOpenCl = config["opencl"] == "true";
}
+ if(config.find("cuda") != config.end())
+ {
+ shared->useCuda = config["cuda"] == "true";
+ }
+
#ifdef OPENCL
- if(useOpenCl)
+ if(shared->useOpenCl)
{
std::vector<cv::ocl::Info> info;
cv::ocl::getDevice(info);
}
#endif
+#ifdef CUDA
+ if(shared->useCuda)
+ {
+ int devices = cv::gpu::getCudaEnabledDeviceCount();
+ DebugOut()<<"There are "<<devices<<" CUDA devices on this system"<<endl;
+ if(devices)
+ {
+ DebugOut()<<"We will use 0 as the default device"<<endl;
+ cv::gpu::DeviceInfo info(0);
+ DebugOut()<<"Cuda Device Name: "<<info.name()<<endl;
+ DebugOut()<<"Version: "<<info.majorVersion()<<"major"<<info.minorVersion()<<"minor"<<endl;
+ DebugOut()<<"Streaming processor count: "<<info.multiProcessorCount()<<endl;
+ cv::gpu::setDevice(0);
+ }
+ else
+ {
+ DebugOut(DebugOut::Warning)<<"No CUDA device found. Disabling CUDA."<<endl;
+ shared->useCuda = false;
+ }
+ }
+#endif
+
}
{
PropertyList props;
props.push_back(VehicleProperty::ExteriorBrightness);
-
return props;
}
cv::ocl::meanStdDev(qImg, avgPixelIntensity, stdDev);
#endif
}
+ else if(shared->useCuda)
+ {
+#ifdef CUDA
+ cv::gpu::GpuMat src(qImg), dest;
+ cv::gpu::cvtColor(src, dest, CV_BGR2GRAY);
+ cv::Scalar stdDev;
+ try
+ {
+
+ cv::gpu::meanStdDev(dest, avgPixelIntensity, stdDev);
+ }
+ catch(...)
+ {
+ DebugOut(DebugOut::Error)<<"CUDA pixel intensity calculation failed."<<endl;
+ }
+
+#endif
+ }
else
{
avgPixelIntensity = cv::mean(qImg);