Merge remote-tracking branch 'origin/2.4' into merge-2.4
Conflicts: .gitignore modules/contrib/src/detection_based_tracker.cpp modules/core/include/opencv2/core/core.hpp modules/core/include/opencv2/core/internal.hpp modules/core/src/gpumat.cpp modules/core/src/opengl.cpp modules/gpu/src/cuda/safe_call.hpp modules/highgui/src/cap.cpp modules/imgproc/include/opencv2/imgproc/imgproc.hpp modules/ocl/doc/image_processing.rst modules/ocl/include/opencv2/ocl/ocl.hpp modules/ocl/perf/perf_haar.cpp modules/ocl/src/haar.cpp modules/ocl/src/imgproc.cpp modules/ocl/src/kmeans.cpp modules/ocl/src/svm.cpp modules/ocl/test/test_objdetect.cpp samples/ocl/adaptive_bilateral_filter.cpp
This commit is contained in:
@@ -305,16 +305,13 @@ namespace cv
|
||||
void copyTo( oclMat &m, const oclMat &mask = oclMat()) const;
|
||||
|
||||
//! converts oclMatrix to another datatype with optional scalng. See cvConvertScale.
|
||||
//It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
|
||||
void convertTo( oclMat &m, int rtype, double alpha = 1, double beta = 0 ) const;
|
||||
|
||||
void assignTo( oclMat &m, int type = -1 ) const;
|
||||
|
||||
//! sets every oclMatrix element to s
|
||||
//It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
|
||||
oclMat& operator = (const Scalar &s);
|
||||
//! sets some of the oclMatrix elements to s, according to the mask
|
||||
//It supports 8UC1 8UC4 32SC1 32SC4 32FC1 32FC4
|
||||
oclMat& setTo(const Scalar &s, const oclMat &mask = oclMat());
|
||||
//! creates alternative oclMatrix header for the same data, with different
|
||||
// number of channels and/or different number of rows. see cvReshape.
|
||||
@@ -555,11 +552,12 @@ namespace cv
|
||||
CV_EXPORTS void bilateralFilter(const oclMat& src, oclMat& dst, int d, double sigmaColor, double sigmaSpace, int borderType=BORDER_DEFAULT);
|
||||
|
||||
//! Applies an adaptive bilateral filter to the input image
|
||||
// This is not truly a bilateral filter. Instead of using user provided fixed parameters,
|
||||
// the function calculates a constant at each window based on local standard deviation,
|
||||
// and use this constant to do filtering.
|
||||
// Unlike the usual bilateral filter that uses fixed value for sigmaColor,
|
||||
// the adaptive version calculates the local variance in he ksize neighborhood
|
||||
// and use this as sigmaColor, for the value filtering. However, the local standard deviation is
|
||||
// clamped to the maxSigmaColor.
|
||||
// supports 8UC1, 8UC3
|
||||
CV_EXPORTS void adaptiveBilateralFilter(const oclMat& src, oclMat& dst, Size ksize, double sigmaSpace, Point anchor = Point(-1, -1), int borderType=BORDER_DEFAULT);
|
||||
CV_EXPORTS void adaptiveBilateralFilter(const oclMat& src, oclMat& dst, Size ksize, double sigmaSpace, double maxSigmaColor=20.0, Point anchor = Point(-1, -1), int borderType=BORDER_DEFAULT);
|
||||
|
||||
//! computes exponent of each matrix element (dst = e**src)
|
||||
// supports only CV_32FC1, CV_64FC1 type
|
||||
@@ -650,6 +648,9 @@ namespace cv
|
||||
//! initializes a scaled identity matrix
|
||||
CV_EXPORTS void setIdentity(oclMat& src, const Scalar & val = Scalar(1));
|
||||
|
||||
//! fills the output array with repeated copies of the input array
|
||||
CV_EXPORTS void repeat(const oclMat & src, int ny, int nx, oclMat & dst);
|
||||
|
||||
//////////////////////////////// Filter Engine ////////////////////////////////
|
||||
|
||||
/*!
|
||||
@@ -898,7 +899,7 @@ namespace cv
|
||||
// supports NORM_L1 and NORM_L2 distType
|
||||
// if indices is provided, only the indexed rows will be calculated and their results are in the same
|
||||
// order of indices
|
||||
CV_EXPORTS void distanceToCenters(oclMat &dists, oclMat &labels, const oclMat &src, const oclMat ¢ers, int distType = NORM_L2SQR, const oclMat &indices = oclMat());
|
||||
CV_EXPORTS void distanceToCenters(const oclMat &src, const oclMat ¢ers, Mat &dists, Mat &labels, int distType = NORM_L2SQR);
|
||||
|
||||
//!Does k-means procedure on GPU
|
||||
// supports CV_32FC1/CV_32FC2/CV_32FC4 data type
|
||||
@@ -913,8 +914,8 @@ namespace cv
|
||||
{
|
||||
public:
|
||||
void detectMultiScale(oclMat &image, CV_OUT std::vector<cv::Rect>& faces,
|
||||
double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0,
|
||||
Size minSize = Size(), Size maxSize = Size());
|
||||
double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0,
|
||||
Size minSize = Size(), Size maxSize = Size());
|
||||
};
|
||||
|
||||
/////////////////////////////// Pyramid /////////////////////////////////////
|
||||
|
||||
@@ -39,16 +39,16 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#if !defined(DUMP_INFO_STDOUT) && !defined(DUMP_INFO_XML)
|
||||
#if !defined(DUMP_MESSAGE_STDOUT) && !defined(DUMP_PROPERTY_XML)
|
||||
#error Invalid usage
|
||||
#endif
|
||||
|
||||
#if !defined(DUMP_INFO_STDOUT)
|
||||
#define DUMP_INFO_STDOUT(...)
|
||||
#if !defined(DUMP_PROPERTY_XML)
|
||||
#define DUMP_PROPERTY_XML(...)
|
||||
#endif
|
||||
|
||||
#if !defined(DUMP_INFO_XML)
|
||||
#define DUMP_INFO_XML(...)
|
||||
#if !defined(DUMP_MESSAGE_STDOUT)
|
||||
#define DUMP_MESSAGE_STDOUT(...)
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
@@ -85,51 +85,70 @@ static void dumpOpenCLDevice()
|
||||
using namespace cv::ocl;
|
||||
try
|
||||
{
|
||||
cv::ocl::PlatformsInfo platforms;
|
||||
cv::ocl::getOpenCLPlatforms(platforms);
|
||||
DUMP_MESSAGE_STDOUT("OpenCL Platforms: ");
|
||||
const char* deviceTypeStr;
|
||||
for(unsigned int i=0; i < platforms.size(); i++)
|
||||
{
|
||||
DUMP_MESSAGE_STDOUT(" " << platforms.at(i)->platformName);
|
||||
const cv::ocl::DevicesInfo& devices = platforms.at(i)->devices;
|
||||
for(unsigned int j=0; j < devices.size(); j++)
|
||||
{
|
||||
const cv::ocl::DeviceInfo& current_device = *devices.at(j);
|
||||
deviceTypeStr = current_device.deviceType == CVCL_DEVICE_TYPE_CPU
|
||||
? ("CPU") : (current_device.deviceType == CVCL_DEVICE_TYPE_GPU ? "GPU" : "unknown");
|
||||
DUMP_MESSAGE_STDOUT( " " << deviceTypeStr << " : " << current_device.deviceName << " : " << current_device.deviceVersion );
|
||||
DUMP_PROPERTY_XML("cv_ocl_platform_"<< i<<"_device_"<<j, "(Platform=" << current_device.platform->platformName << ")(Type="
|
||||
<< deviceTypeStr <<")(Name="<< current_device.deviceName << ")(Version="<< current_device.deviceVersion<<")");
|
||||
}
|
||||
}
|
||||
DUMP_MESSAGE_STDOUT("Current OpenCL device: ");
|
||||
|
||||
const cv::ocl::DeviceInfo& deviceInfo = cv::ocl::Context::getContext()->getDeviceInfo();
|
||||
|
||||
const char* deviceTypeStr = deviceInfo.deviceType == CVCL_DEVICE_TYPE_CPU
|
||||
? "CPU" :
|
||||
(deviceInfo.deviceType == CVCL_DEVICE_TYPE_GPU ? "GPU" : "unknown");
|
||||
DUMP_INFO_STDOUT("Device type", deviceTypeStr);
|
||||
DUMP_INFO_XML("cv_ocl_deviceType", deviceTypeStr);
|
||||
DUMP_MESSAGE_STDOUT(" Platform = "<< deviceInfo.platform->platformName);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_platformName", deviceInfo.platform->platformName);
|
||||
|
||||
DUMP_INFO_STDOUT("Platform name", deviceInfo.platform->platformName);
|
||||
DUMP_INFO_XML("cv_ocl_platformName", deviceInfo.platform->platformName);
|
||||
deviceTypeStr = deviceInfo.deviceType == CVCL_DEVICE_TYPE_CPU
|
||||
? "CPU" : (deviceInfo.deviceType == CVCL_DEVICE_TYPE_GPU ? "GPU" : "unknown");
|
||||
DUMP_MESSAGE_STDOUT(" Type = "<< deviceTypeStr);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_deviceType", deviceTypeStr);
|
||||
|
||||
DUMP_INFO_STDOUT("Device name", deviceInfo.deviceName);
|
||||
DUMP_INFO_XML("cv_ocl_deviceName", deviceInfo.deviceName);
|
||||
DUMP_MESSAGE_STDOUT(" Name = "<< deviceInfo.deviceName);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_deviceName", deviceInfo.deviceName);
|
||||
|
||||
DUMP_INFO_STDOUT("Device version", deviceInfo.deviceVersion);
|
||||
DUMP_INFO_XML("cv_ocl_deviceVersion", deviceInfo.deviceVersion);
|
||||
DUMP_MESSAGE_STDOUT(" Version = " << deviceInfo.deviceVersion);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_deviceVersion", deviceInfo.deviceVersion);
|
||||
|
||||
DUMP_INFO_STDOUT("Compute units", deviceInfo.maxComputeUnits);
|
||||
DUMP_INFO_XML("cv_ocl_maxComputeUnits", deviceInfo.maxComputeUnits);
|
||||
DUMP_MESSAGE_STDOUT(" Compute units = "<< deviceInfo.maxComputeUnits);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_maxComputeUnits", deviceInfo.maxComputeUnits);
|
||||
|
||||
DUMP_INFO_STDOUT("Max work group size", deviceInfo.maxWorkGroupSize);
|
||||
DUMP_INFO_XML("cv_ocl_maxWorkGroupSize", deviceInfo.maxWorkGroupSize);
|
||||
DUMP_MESSAGE_STDOUT(" Max work group size = "<< deviceInfo.maxWorkGroupSize);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_maxWorkGroupSize", deviceInfo.maxWorkGroupSize);
|
||||
|
||||
std::string localMemorySizeStr = bytesToStringRepr(deviceInfo.localMemorySize);
|
||||
DUMP_INFO_STDOUT("Local memory size", localMemorySizeStr.c_str());
|
||||
DUMP_INFO_XML("cv_ocl_localMemorySize", deviceInfo.localMemorySize);
|
||||
DUMP_MESSAGE_STDOUT(" Local memory size = "<< localMemorySizeStr.c_str());
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_localMemorySize", deviceInfo.localMemorySize);
|
||||
|
||||
std::string maxMemAllocSizeStr = bytesToStringRepr(deviceInfo.maxMemAllocSize);
|
||||
DUMP_INFO_STDOUT("Max memory allocation size", maxMemAllocSizeStr.c_str());
|
||||
DUMP_INFO_XML("cv_ocl_maxMemAllocSize", deviceInfo.maxMemAllocSize);
|
||||
DUMP_MESSAGE_STDOUT(" Max memory allocation size = "<< maxMemAllocSizeStr.c_str());
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_maxMemAllocSize", deviceInfo.maxMemAllocSize);
|
||||
|
||||
const char* doubleSupportStr = deviceInfo.haveDoubleSupport ? "Yes" : "No";
|
||||
DUMP_INFO_STDOUT("Double support", doubleSupportStr);
|
||||
DUMP_INFO_XML("cv_ocl_haveDoubleSupport", deviceInfo.haveDoubleSupport);
|
||||
DUMP_MESSAGE_STDOUT(" Double support = "<< doubleSupportStr);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_haveDoubleSupport", deviceInfo.haveDoubleSupport);
|
||||
|
||||
const char* isUnifiedMemoryStr = deviceInfo.isUnifiedMemory ? "Yes" : "No";
|
||||
DUMP_INFO_STDOUT("Unified memory", isUnifiedMemoryStr);
|
||||
DUMP_INFO_XML("cv_ocl_isUnifiedMemory", deviceInfo.isUnifiedMemory);
|
||||
DUMP_MESSAGE_STDOUT(" Unified memory = "<< isUnifiedMemoryStr);
|
||||
DUMP_PROPERTY_XML("cv_ocl_current_isUnifiedMemory", deviceInfo.isUnifiedMemory);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
DUMP_INFO_STDOUT("OpenCL device", "not available");
|
||||
DUMP_INFO_XML("cv_ocl", "not available");
|
||||
DUMP_MESSAGE_STDOUT("OpenCL device not available");
|
||||
DUMP_PROPERTY_XML("cv_ocl", "not available");
|
||||
}
|
||||
}
|
||||
|
||||
#undef DUMP_INFO_STDOUT
|
||||
#undef DUMP_INFO_XML
|
||||
#undef DUMP_MESSAGE_STDOUT
|
||||
#undef DUMP_PROPERTY_XML
|
||||
|
||||
Reference in New Issue
Block a user