1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merging in master

This commit is contained in:
Erik Karlsson
2015-03-09 22:00:58 +01:00
554 changed files with 372881 additions and 5741 deletions
@@ -1047,14 +1047,14 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
return;
}
CameraHandler* handler=*ppcameraHandler;
// delayed resolution setup to exclude errors during other parameres setup on the fly
// without camera restart
if (((*ppcameraHandler)->width != 0) && ((*ppcameraHandler)->height != 0))
(*ppcameraHandler)->params->setPreviewSize((*ppcameraHandler)->width, (*ppcameraHandler)->height);
if ((handler->width != 0) && (handler->height != 0))
handler->params->setPreviewSize(handler->width, handler->height);
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) \
|| defined(ANDROID_r4_3_0) || defined(ANDROID_r4_4_0)
CameraHandler* handler=*ppcameraHandler;
handler->camera->stopPreview();
handler->camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
@@ -1066,7 +1066,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
return;
}
handler->camera->setParameters((*ppcameraHandler)->params->flatten());
handler->camera->setParameters(handler->params->flatten());
status_t bufferStatus;
# if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
@@ -1107,7 +1107,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
LOGD("Preview started successfully");
}
#else
CameraHandler* previousCameraHandler=*ppcameraHandler;
CameraHandler* previousCameraHandler=handler;
CameraCallback cameraCallback=previousCameraHandler->cameraCallback;
void* userData=previousCameraHandler->userData;
int cameraId=previousCameraHandler->cameraId;
@@ -1117,7 +1117,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect");
LOGD("CameraHandler::applyProperties(): before initCameraConnect");
CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, (*ppcameraHandler)->params);
handler=initCameraConnect(cameraCallback, cameraId, userData, handler->params);
LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler);
if (handler == NULL) {
LOGE("ERROR in applyProperties --- cannot reinit camera");
@@ -309,13 +309,13 @@ cv::String CameraWrapperConnector::getPathLibFolder()
const char* libName=dl_info.dli_fname;
while( ((*libName)=='/') || ((*libName)=='.') )
libName++;
libName++;
char lineBuf[2048];
FILE* file = fopen("/proc/self/smaps", "rt");
if(file)
{
char lineBuf[2048];
while (fgets(lineBuf, sizeof lineBuf, file) != NULL)
{
//verify that line ends with library name
+1 -1
View File
@@ -1,2 +1,2 @@
set(the_description "Camera Calibration and 3D Reconstruction")
ocv_define_module(calib3d opencv_imgproc opencv_features2d)
ocv_define_module(calib3d opencv_imgproc opencv_features2d WRAP java python)
+3 -3
View File
@@ -66,10 +66,10 @@ void drawPoints(const std::vector<Point2f> &points, Mat &outImage, int radius =
}
#endif
void CirclesGridClusterFinder::hierarchicalClustering(const std::vector<Point2f> points, const Size &patternSz, std::vector<Point2f> &patternPoints)
void CirclesGridClusterFinder::hierarchicalClustering(const std::vector<Point2f> &points, const Size &patternSz, std::vector<Point2f> &patternPoints)
{
#ifdef HAVE_TEGRA_OPTIMIZATION
if(tegra::hierarchicalClustering(points, patternSz, patternPoints))
if(tegra::useTegra() && tegra::hierarchicalClustering(points, patternSz, patternPoints))
return;
#endif
int j, n = (int)points.size();
@@ -135,7 +135,7 @@ void CirclesGridClusterFinder::hierarchicalClustering(const std::vector<Point2f>
}
}
void CirclesGridClusterFinder::findGrid(const std::vector<cv::Point2f> points, cv::Size _patternSize, std::vector<Point2f>& centers)
void CirclesGridClusterFinder::findGrid(const std::vector<cv::Point2f> &points, cv::Size _patternSize, std::vector<Point2f>& centers)
{
patternSize = _patternSize;
centers.clear();
+2 -2
View File
@@ -62,10 +62,10 @@ public:
squareSize = 1.0f;
maxRectifiedDistance = (float)(squareSize / 2.0);
}
void findGrid(const std::vector<cv::Point2f> points, cv::Size patternSize, std::vector<cv::Point2f>& centers);
void findGrid(const std::vector<cv::Point2f> &points, cv::Size patternSize, std::vector<cv::Point2f>& centers);
//cluster 2d points by geometric coordinates
void hierarchicalClustering(const std::vector<cv::Point2f> points, const cv::Size &patternSize, std::vector<cv::Point2f> &patternPoints);
void hierarchicalClustering(const std::vector<cv::Point2f> &points, const cv::Size &patternSize, std::vector<cv::Point2f> &patternPoints);
private:
void findCorners(const std::vector<cv::Point2f> &hull2f, std::vector<cv::Point2f> &corners);
void findOutsideCorners(const std::vector<cv::Point2f> &corners, std::vector<cv::Point2f> &outsideCorners);
+3 -3
View File
@@ -504,7 +504,7 @@ private:
H[n1][n1 - 1] = 0.0;
H[n1][n1] = 1.0;
for (int i = n1 - 2; i >= 0; i--) {
double ra, sa, vr, vi;
double ra, sa;
ra = 0.0;
sa = 0.0;
for (int j = l; j <= n1; j++) {
@@ -529,8 +529,8 @@ private:
x = H[i][i + 1];
y = H[i + 1][i];
vr = (d[i] - p) * (d[i] - p) + e[i] * e[i] - q * q;
vi = (d[i] - p) * 2.0 * q;
double vr = (d[i] - p) * (d[i] - p) + e[i] * e[i] - q * q;
double vi = (d[i] - p) * 2.0 * q;
if (vr == 0.0 && vi == 0.0) {
vr = eps * norm * (std::abs(w) + std::abs(q) + std::abs(x)
+ std::abs(y) + std::abs(z));
+5 -5
View File
@@ -872,8 +872,8 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO
if ((flags & CALIB_FIX_INTRINSIC))
{
internal::CalibrateExtrinsics(objectPoints, imagePoints1, intrinsicLeft, check_cond, thresh_cond, rvecs1, tvecs1);
internal::CalibrateExtrinsics(objectPoints, imagePoints2, intrinsicRight, check_cond, thresh_cond, rvecs2, tvecs2);
cv::internal::CalibrateExtrinsics(objectPoints, imagePoints1, intrinsicLeft, check_cond, thresh_cond, rvecs1, tvecs1);
cv::internal::CalibrateExtrinsics(objectPoints, imagePoints2, intrinsicRight, check_cond, thresh_cond, rvecs2, tvecs2);
}
intrinsicLeft.isEstimate[0] = flags & CALIB_FIX_INTRINSIC ? 0 : 1;
@@ -918,8 +918,8 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO
om_ref.reshape(3, 1).copyTo(om_list.col(image_idx));
T_ref.reshape(3, 1).copyTo(T_list.col(image_idx));
}
cv::Vec3d omcur = internal::median3d(om_list);
cv::Vec3d Tcur = internal::median3d(T_list);
cv::Vec3d omcur = cv::internal::median3d(om_list);
cv::Vec3d Tcur = cv::internal::median3d(T_list);
cv::Mat J = cv::Mat::zeros(4 * n_points * n_images, 18 + 6 * (n_images + 1), CV_64FC1),
e = cv::Mat::zeros(4 * n_points * n_images, 1, CV_64FC1), Jkk, ekk;
@@ -961,7 +961,7 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO
jacobians.col(14).copyTo(Jkk.col(4).rowRange(0, 2 * n_points));
//right camera jacobian
internal::compose_motion(rvec, tvec, omcur, Tcur, omr, Tr, domrdomckk, domrdTckk, domrdom, domrdT, dTrdomckk, dTrdTckk, dTrdom, dTrdT);
cv::internal::compose_motion(rvec, tvec, omcur, Tcur, omr, Tr, domrdomckk, domrdTckk, domrdom, domrdT, dTrdomckk, dTrdTckk, dTrdom, dTrdT);
rvec = cv::Mat(rvecs2[image_idx]);
tvec = cv::Mat(tvecs2[image_idx]);
-9
View File
@@ -200,8 +200,6 @@ public:
void setCallback(const Ptr<LMSolver::Callback>& _cb) { cb = _cb; }
AlgorithmInfo* info() const;
Ptr<LMSolver::Callback> cb;
double epsx;
@@ -211,15 +209,8 @@ public:
};
CV_INIT_ALGORITHM(LMSolverImpl, "LMSolver",
obj.info()->addParam(obj, "epsx", obj.epsx);
obj.info()->addParam(obj, "epsf", obj.epsf);
obj.info()->addParam(obj, "maxIters", obj.maxIters);
obj.info()->addParam(obj, "printInterval", obj.printInterval))
Ptr<LMSolver> createLMSolver(const Ptr<LMSolver::Callback>& cb, int maxIters)
{
CV_Assert( !LMSolverImpl_info_auto.name().empty() );
return makePtr<LMSolverImpl>(cb, maxIters);
}
+11 -11
View File
@@ -116,7 +116,7 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
{
int i, j, k;
int count = 0, converged = 0;
float inorm, jnorm, invInorm, invJnorm, invScale, scale = 0, inv_Z = 0;
float scale = 0, inv_Z = 0;
float diff = (float)criteria.epsilon;
/* Check bad arguments */
@@ -195,16 +195,18 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
}
}
inorm = rotation[0] /*[0][0]*/ * rotation[0] /*[0][0]*/ +
float inorm =
rotation[0] /*[0][0]*/ * rotation[0] /*[0][0]*/ +
rotation[1] /*[0][1]*/ * rotation[1] /*[0][1]*/ +
rotation[2] /*[0][2]*/ * rotation[2] /*[0][2]*/;
jnorm = rotation[3] /*[1][0]*/ * rotation[3] /*[1][0]*/ +
float jnorm =
rotation[3] /*[1][0]*/ * rotation[3] /*[1][0]*/ +
rotation[4] /*[1][1]*/ * rotation[4] /*[1][1]*/ +
rotation[5] /*[1][2]*/ * rotation[5] /*[1][2]*/;
invInorm = cvInvSqrt( inorm );
invJnorm = cvInvSqrt( jnorm );
const float invInorm = cvInvSqrt( inorm );
const float invJnorm = cvInvSqrt( jnorm );
inorm *= invInorm;
jnorm *= invJnorm;
@@ -234,7 +236,7 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
converged = ((criteria.type & CV_TERMCRIT_EPS) && (diff < criteria.epsilon));
converged |= ((criteria.type & CV_TERMCRIT_ITER) && (count == criteria.max_iter));
}
invScale = 1 / scale;
const float invScale = 1 / scale;
translation[0] = imagePoints[0].x * invScale;
translation[1] = imagePoints[0].y * invScale;
translation[2] = 1 / inv_Z;
@@ -266,8 +268,6 @@ static CvStatus icvReleasePOSITObject( CvPOSITObject ** ppObject )
void
icvPseudoInverse3D( float *a, float *b, int n, int method )
{
int k;
if( method == 0 )
{
float ata00 = 0;
@@ -276,8 +276,8 @@ icvPseudoInverse3D( float *a, float *b, int n, int method )
float ata01 = 0;
float ata02 = 0;
float ata12 = 0;
float det = 0;
int k;
/* compute matrix ata = transpose(a) * a */
for( k = 0; k < n; k++ )
{
@@ -295,7 +295,6 @@ icvPseudoInverse3D( float *a, float *b, int n, int method )
}
/* inverse matrix ata */
{
float inv_det;
float p00 = ata11 * ata22 - ata12 * ata12;
float p01 = -(ata01 * ata22 - ata12 * ata02);
float p02 = ata12 * ata01 - ata11 * ata02;
@@ -304,11 +303,12 @@ icvPseudoInverse3D( float *a, float *b, int n, int method )
float p12 = -(ata00 * ata12 - ata01 * ata02);
float p22 = ata00 * ata11 - ata01 * ata01;
float det = 0;
det += ata00 * p00;
det += ata01 * p01;
det += ata02 * p02;
inv_det = 1 / det;
const float inv_det = 1 / det;
/* compute resultant matrix */
for( k = 0; k < n; k++ )
-16
View File
@@ -256,8 +256,6 @@ public:
void setCallback(const Ptr<PointSetRegistrator::Callback>& _cb) { cb = _cb; }
AlgorithmInfo* info() const;
Ptr<PointSetRegistrator::Callback> cb;
int modelPoints;
bool checkPartialSubsets;
@@ -378,25 +376,12 @@ public:
return result;
}
AlgorithmInfo* info() const;
};
CV_INIT_ALGORITHM(RANSACPointSetRegistrator, "PointSetRegistrator.RANSAC",
obj.info()->addParam(obj, "threshold", obj.threshold);
obj.info()->addParam(obj, "confidence", obj.confidence);
obj.info()->addParam(obj, "maxIters", obj.maxIters))
CV_INIT_ALGORITHM(LMeDSPointSetRegistrator, "PointSetRegistrator.LMeDS",
obj.info()->addParam(obj, "confidence", obj.confidence);
obj.info()->addParam(obj, "maxIters", obj.maxIters))
Ptr<PointSetRegistrator> createRANSACPointSetRegistrator(const Ptr<PointSetRegistrator::Callback>& _cb,
int _modelPoints, double _threshold,
double _confidence, int _maxIters)
{
CV_Assert( !RANSACPointSetRegistrator_info_auto.name().empty() );
return Ptr<PointSetRegistrator>(
new RANSACPointSetRegistrator(_cb, _modelPoints, _threshold, _confidence, _maxIters));
}
@@ -405,7 +390,6 @@ Ptr<PointSetRegistrator> createRANSACPointSetRegistrator(const Ptr<PointSetRegis
Ptr<PointSetRegistrator> createLMeDSPointSetRegistrator(const Ptr<PointSetRegistrator::Callback>& _cb,
int _modelPoints, double _confidence, int _maxIters)
{
CV_Assert( !LMeDSPointSetRegistrator_info_auto.name().empty() );
return Ptr<PointSetRegistrator>(
new LMeDSPointSetRegistrator(_cb, _modelPoints, _confidence, _maxIters));
}
-2
View File
@@ -1010,8 +1010,6 @@ public:
disp.convertTo(disp0, disp0.type(), 1./(1 << DISPARITY_SHIFT), 0);
}
AlgorithmInfo* info() const { return 0; }
int getMinDisparity() const { return params.minDisparity; }
void setMinDisparity(int minDisparity) { params.minDisparity = minDisparity; }
-2
View File
@@ -865,8 +865,6 @@ public:
StereoMatcher::DISP_SCALE*params.speckleRange, buffer);
}
AlgorithmInfo* info() const { return 0; }
int getMinDisparity() const { return params.minDisparity; }
void setMinDisparity(int minDisparity) { params.minDisparity = minDisparity; }
+8 -7
View File
@@ -1,11 +1,12 @@
set(the_description "The Core Functionality")
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev)
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}"
OPTIONAL opencv_cudev
WRAP java python)
if(HAVE_WINRT_CX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
if(HAVE_WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"")
set(extra_libs "")
if(WINRT AND CMAKE_SYSTEM_NAME MATCHES WindowsStore AND CMAKE_SYSTEM_VERSION MATCHES "8.0")
list(APPEND extra_libs ole32.lib)
endif()
if(HAVE_CUDA)
@@ -22,7 +23,7 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS})
ocv_create_module()
ocv_create_module(${extra_libs})
ocv_add_accuracy_tests()
ocv_add_perf_tests()
+74 -322
View File
@@ -545,8 +545,31 @@ The function returns the number of non-zero elements in src :
*/
CV_EXPORTS_W int countNonZero( InputArray src );
/** @brief returns the list of locations of non-zero pixels
@todo document
/** @brief Returns the list of locations of non-zero pixels
Given a binary matrix (likely returned from an operation such
as threshold(), compare(), >, ==, etc, return all of
the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y)
For example:
@code{.cpp}
cv::Mat binaryImage; // input, binary image
cv::Mat locations; // output, locations of non-zero pixels
cv::findNonZero(binaryImage, locations);
// access pixel coordinates
Point pnt = locations.at<Point>(i);
@endcode
or
@code{.cpp}
cv::Mat binaryImage; // input, binary image
vector<Point> locations; // output, locations of non-zero pixels
cv::findNonZero(binaryImage, locations);
// access pixel coordinates
Point pnt = locations[i];
@endcode
@param src single-channel array (type CV_8UC1)
@param idx the output array, type of cv::Mat or std::vector<Point>, corresponding to non-zero indices in the input
*/
CV_EXPORTS_W void findNonZero( InputArray src, OutputArray idx );
@@ -2745,8 +2768,6 @@ public:
//////////////////////////////////////// Algorithm ////////////////////////////////////
class CV_EXPORTS Algorithm;
class CV_EXPORTS AlgorithmInfo;
struct CV_EXPORTS AlgorithmInfoData;
template<typename _Tp> struct ParamType {};
@@ -2759,32 +2780,13 @@ matching, graph-cut etc.), background subtraction (which can be done using mixtu
models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
etc.).
The class provides the following features for all derived classes:
- so called "virtual constructor". That is, each Algorithm derivative is registered at program
start and you can get the list of registered algorithms and create instance of a particular
algorithm by its name (see Algorithm::create). If you plan to add your own algorithms, it is
good practice to add a unique prefix to your algorithms to distinguish them from other
algorithms.
- setting/retrieving algorithm parameters by name. If you used video capturing functionality
from OpenCV videoio module, you are probably familar with cvSetCaptureProperty(),
cvGetCaptureProperty(), VideoCapture::set() and VideoCapture::get(). Algorithm provides
similar method where instead of integer id's you specify the parameter names as text strings.
See Algorithm::set and Algorithm::get for details.
- reading and writing parameters from/to XML or YAML files. Every Algorithm derivative can store
all its parameters and then read them back. There is no need to re-implement it each time.
Here is example of SIFT use in your application via Algorithm interface:
@code
#include "opencv2/opencv.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv::xfeatures2d;
...
Ptr<Feature2D> sift = SIFT::create();
FileStorage fs("sift_params.xml", FileStorage::READ);
if( fs.isOpened() ) // if we have file with parameters, read them
{
@@ -2794,323 +2796,73 @@ Here is example of SIFT use in your application via Algorithm interface:
else // else modify the parameters and store them; user can later edit the file to use different parameters
{
sift->setContrastThreshold(0.01f); // lower the contrast threshold, compared to the default value
{
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
sift->write(fs);
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
sift->write(fs);
}
}
Mat image = imread("myimage.png", 0), descriptors;
vector<KeyPoint> keypoints;
sift->detectAndCompute(image, noArray(), keypoints, descriptors);
@endcode
Creating Own Algorithms
-----------------------
If you want to make your own algorithm, derived from Algorithm, you should basically follow a few
conventions and add a little semi-standard piece of code to your class:
- Make a class and specify Algorithm as its base class.
- The algorithm parameters should be the class members. See Algorithm::get() for the list of
possible types of the parameters.
- Add public virtual method `AlgorithmInfo* info() const;` to your class.
- Add constructor function, AlgorithmInfo instance and implement the info() method. The simplest
way is to take <https://github.com/Itseez/opencv/tree/master/modules/ml/src/ml_init.cpp> as
the reference and modify it according to the list of your parameters.
- Add some public function (e.g. `initModule_<mymodule>()`) that calls info() of your algorithm
and put it into the same source file as info() implementation. This is to force C++ linker to
include this object file into the target application. See Algorithm::create() for details.
*/
class CV_EXPORTS_W Algorithm
{
public:
Algorithm();
virtual ~Algorithm();
/**Returns the algorithm name*/
String name() const;
/** @brief returns the algorithm parameter
The method returns value of the particular parameter. Since the compiler can not deduce the
type of the returned parameter, you should specify it explicitly in angle brackets. Here are
the allowed forms of get:
- myalgo.get\<int\>("param_name")
- myalgo.get\<double\>("param_name")
- myalgo.get\<bool\>("param_name")
- myalgo.get\<String\>("param_name")
- myalgo.get\<Mat\>("param_name")
- myalgo.get\<vector\<Mat\> \>("param_name")
- myalgo.get\<Algorithm\>("param_name") (it returns Ptr\<Algorithm\>).
In some cases the actual type of the parameter can be cast to the specified type, e.g. integer
parameter can be cast to double, bool can be cast to int. But "dangerous" transformations
(string\<-\>number, double-\>int, 1x1 Mat\<-\>number, ...) are not performed and the method
will throw an exception. In the case of Mat or vector\<Mat\> parameters the method does not
clone the matrix data, so do not modify the matrices. Use Algorithm::set instead - slower, but
more safe.
@param name The parameter name.
*/
template<typename _Tp> typename ParamType<_Tp>::member_type get(const String& name) const;
/** @overload */
template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* name) const;
CV_WRAP int getInt(const String& name) const;
CV_WRAP double getDouble(const String& name) const;
CV_WRAP bool getBool(const String& name) const;
CV_WRAP String getString(const String& name) const;
CV_WRAP Mat getMat(const String& name) const;
CV_WRAP std::vector<Mat> getMatVector(const String& name) const;
CV_WRAP Ptr<Algorithm> getAlgorithm(const String& name) const;
/** @brief Sets the algorithm parameter
The method sets value of the particular parameter. Some of the algorithm
parameters may be declared as read-only. If you try to set such a
parameter, you will get exception with the corresponding error message.
@param name The parameter name.
@param value The parameter value.
*/
void set(const String& name, int value);
void set(const String& name, double value);
void set(const String& name, bool value);
void set(const String& name, const String& value);
void set(const String& name, const Mat& value);
void set(const String& name, const std::vector<Mat>& value);
void set(const String& name, const Ptr<Algorithm>& value);
template<typename _Tp> void set(const String& name, const Ptr<_Tp>& value);
CV_WRAP void setInt(const String& name, int value);
CV_WRAP void setDouble(const String& name, double value);
CV_WRAP void setBool(const String& name, bool value);
CV_WRAP void setString(const String& name, const String& value);
CV_WRAP void setMat(const String& name, const Mat& value);
CV_WRAP void setMatVector(const String& name, const std::vector<Mat>& value);
CV_WRAP void setAlgorithm(const String& name, const Ptr<Algorithm>& value);
template<typename _Tp> void setAlgorithm(const String& name, const Ptr<_Tp>& value);
void set(const char* name, int value);
void set(const char* name, double value);
void set(const char* name, bool value);
void set(const char* name, const String& value);
void set(const char* name, const Mat& value);
void set(const char* name, const std::vector<Mat>& value);
void set(const char* name, const Ptr<Algorithm>& value);
template<typename _Tp> void set(const char* name, const Ptr<_Tp>& value);
void setInt(const char* name, int value);
void setDouble(const char* name, double value);
void setBool(const char* name, bool value);
void setString(const char* name, const String& value);
void setMat(const char* name, const Mat& value);
void setMatVector(const char* name, const std::vector<Mat>& value);
void setAlgorithm(const char* name, const Ptr<Algorithm>& value);
template<typename _Tp> void setAlgorithm(const char* name, const Ptr<_Tp>& value);
CV_WRAP String paramHelp(const String& name) const;
int paramType(const char* name) const;
CV_WRAP int paramType(const String& name) const;
CV_WRAP void getParams(CV_OUT std::vector<String>& names) const;
/** @brief Stores algorithm parameters in a file storage
The method stores all the algorithm parameters (in alphabetic order) to
the file storage. The method is virtual. If you define your own
Algorithm derivative, your can override the method and store some extra
information. However, it's rarely needed. Here are some examples:
- SIFT feature detector (from xfeatures2d module). The class only
stores algorithm parameters and no keypoints or their descriptors.
Therefore, it's enough to store the algorithm parameters, which is
what Algorithm::write() does. Therefore, there is no dedicated
SIFT::write().
- Background subtractor (from video module). It has the algorithm
parameters and also it has the current background model. However,
the background model is not stored. First, it's rather big. Then,
if you have stored the background model, it would likely become
irrelevant on the next run (because of shifted camera, changed
background, different lighting etc.). Therefore,
BackgroundSubtractorMOG and BackgroundSubtractorMOG2 also rely on
the standard Algorithm::write() to store just the algorithm
parameters.
- Expectation Maximization (from ml module). The algorithm finds
mixture of gaussians that approximates user data best of all. In
this case the model may be re-used on the next run to test new
data against the trained statistical model. So EM needs to store
the model. However, since the model is described by a few
parameters that are available as read-only algorithm parameters
(i.e. they are available via EM::get()), EM also relies on
Algorithm::write() to store both EM parameters and the model
(represented by read-only algorithm parameters).
@param fs File storage.
*/
virtual void write(FileStorage& fs) const;
/** @brief Reads algorithm parameters from a file storage
The method reads all the algorithm parameters from the specified node of
a file storage. Similarly to Algorithm::write(), if you implement an
algorithm that needs to read some extra data and/or re-compute some
internal data, you may override the method.
@param fn File node of the file storage.
*/
virtual void read(const FileNode& fn);
typedef Algorithm* (*Constructor)(void);
typedef int (Algorithm::*Getter)() const;
typedef void (Algorithm::*Setter)(int);
/** @brief Returns the list of registered algorithms
This static method returns the list of registered algorithms in
alphabetical order. Here is how to use it :
@code{.cpp}
vector<String> algorithms;
Algorithm::getList(algorithms);
cout << "Algorithms: " << algorithms.size() << endl;
for (size_t i=0; i < algorithms.size(); i++)
cout << algorithms[i] << endl;
@endcode
@param algorithms The output vector of algorithm names.
*/
CV_WRAP static void getList(CV_OUT std::vector<String>& algorithms);
CV_WRAP static Ptr<Algorithm> _create(const String& name);
/** @brief Creates algorithm instance by name
This static method creates a new instance of the specified algorithm. If
there is no such algorithm, the method will silently return a null
pointer. Also, you should specify the particular Algorithm subclass as
_Tp (or simply Algorithm if you do not know it at that point). :
@code{.cpp}
Ptr<BackgroundSubtractor> bgfg = Algorithm::create<BackgroundSubtractor>("BackgroundSubtractor.MOG2");
@endcode
@note This is important note about seemingly mysterious behavior of
Algorithm::create() when it returns NULL while it should not. The reason
is simple - Algorithm::create() resides in OpenCV's core module and the
algorithms are implemented in other modules. If you create algorithms
dynamically, C++ linker may decide to throw away the modules where the
actual algorithms are implemented, since you do not call any functions
from the modules. To avoid this problem, you need to call
initModule_\<modulename\>(); somewhere in the beginning of the program
before Algorithm::create(). For example, call initModule_xfeatures2d()
in order to use SURF/SIFT, call initModule_ml() to use expectation
maximization etc.
@param name The algorithm name, one of the names returned by Algorithm::getList().
*/
template<typename _Tp> static Ptr<_Tp> create(const String& name);
virtual AlgorithmInfo* info() const /* TODO: make it = 0;*/ { return 0; }
};
/** @todo document */
class CV_EXPORTS AlgorithmInfo
{
public:
friend class Algorithm;
AlgorithmInfo(const String& name, Algorithm::Constructor create);
~AlgorithmInfo();
void get(const Algorithm* algo, const char* name, int argType, void* value) const;
void addParam_(Algorithm& algo, const char* name, int argType,
void* value, bool readOnly,
Algorithm::Getter getter, Algorithm::Setter setter,
const String& help=String());
String paramHelp(const char* name) const;
int paramType(const char* name) const;
void getParams(std::vector<String>& names) const;
Algorithm();
virtual ~Algorithm();
void write(const Algorithm* algo, FileStorage& fs) const;
void read(Algorithm* algo, const FileNode& fn) const;
String name() const;
/** @brief Stores algorithm parameters in a file storage
*/
virtual void write(FileStorage& fs) const { (void)fs; }
void addParam(Algorithm& algo, const char* name,
int& value, bool readOnly=false,
int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(int)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
bool& value, bool readOnly=false,
int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(int)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
double& value, bool readOnly=false,
double (Algorithm::*getter)()=0,
void (Algorithm::*setter)(double)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
String& value, bool readOnly=false,
String (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const String&)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
Mat& value, bool readOnly=false,
Mat (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Mat&)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
std::vector<Mat>& value, bool readOnly=false,
std::vector<Mat> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const std::vector<Mat>&)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
Ptr<Algorithm>& value, bool readOnly=false,
Ptr<Algorithm> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<Algorithm>&)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
float& value, bool readOnly=false,
float (Algorithm::*getter)()=0,
void (Algorithm::*setter)(float)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
unsigned int& value, bool readOnly=false,
unsigned int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(unsigned int)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
uint64& value, bool readOnly=false,
uint64 (Algorithm::*getter)()=0,
void (Algorithm::*setter)(uint64)=0,
const String& help=String());
void addParam(Algorithm& algo, const char* name,
uchar& value, bool readOnly=false,
uchar (Algorithm::*getter)()=0,
void (Algorithm::*setter)(uchar)=0,
const String& help=String());
template<typename _Tp, typename _Base> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const String& help=String());
template<typename _Tp> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const String& help=String());
protected:
AlgorithmInfoData* data;
void set(Algorithm* algo, const char* name, int argType,
const void* value, bool force=false) const;
/** @brief Reads algorithm parameters from a file storage
*/
virtual void read(const FileNode& fn) { (void)fn; }
};
/** @todo document */
struct CV_EXPORTS Param
{
enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7, UNSIGNED_INT=8, UINT64=9, UCHAR=11 };
// define properties
Param();
Param(int _type, bool _readonly, int _offset,
Algorithm::Getter _getter=0,
Algorithm::Setter _setter=0,
const String& _help=String());
int type;
int offset;
bool readonly;
Algorithm::Getter getter;
Algorithm::Setter setter;
String help;
#define CV_PURE_PROPERTY(type, name) \
CV_WRAP virtual type get##name() const = 0; \
CV_WRAP virtual void set##name(type val) = 0;
#define CV_PURE_PROPERTY_S(type, name) \
CV_WRAP virtual type get##name() const = 0; \
CV_WRAP virtual void set##name(const type & val) = 0;
#define CV_PURE_PROPERTY_RO(type, name) \
CV_WRAP virtual type get##name() const = 0;
// basic property implementation
#define CV_IMPL_PROPERTY_RO(type, name, member) \
inline type get##name() const { return member; }
#define CV_HELP_IMPL_PROPERTY(r_type, w_type, name, member) \
CV_IMPL_PROPERTY_RO(r_type, name, member) \
inline void set##name(w_type val) { member = val; }
#define CV_HELP_WRAP_PROPERTY(r_type, w_type, name, internal_name, internal_obj) \
r_type get##name() const { return internal_obj.get##internal_name(); } \
void set##name(w_type val) { internal_obj.set##internal_name(val); }
#define CV_IMPL_PROPERTY(type, name, member) CV_HELP_IMPL_PROPERTY(type, type, name, member)
#define CV_IMPL_PROPERTY_S(type, name, member) CV_HELP_IMPL_PROPERTY(type, const type &, name, member)
#define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, type, name, internal_name, internal_obj)
#define CV_WRAP_PROPERTY_S(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, const type &, name, internal_name, internal_obj)
#define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
#define CV_WRAP_SAME_PROPERTY_S(type, name, internal_obj) CV_WRAP_PROPERTY_S(type, name, name, internal_obj)
struct Param {
enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7,
UNSIGNED_INT=8, UINT64=9, UCHAR=11 };
};
template<> struct ParamType<bool>
{
typedef bool const_param_type;
+1 -1
View File
@@ -191,7 +191,7 @@
# include "arm_neon.h"
# define CV_NEON 1
# define CPU_HAS_NEON_FEATURE (true)
#elif defined(__ARM_NEON__)
#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
# include <arm_neon.h>
# define CV_NEON 1
#endif
+5 -5
View File
@@ -817,7 +817,7 @@ Vec<_Tp, n> Matx<_Tp, m, n>::solve(const Vec<_Tp, m>& rhs, int method) const
template<typename _Tp, int m> static inline
double determinant(const Matx<_Tp, m, m>& a)
{
return internal::Matx_DetOp<_Tp, m>()(a);
return cv::internal::Matx_DetOp<_Tp, m>()(a);
}
template<typename _Tp, int m, int n> static inline
@@ -960,25 +960,25 @@ Vec<_Tp, cn> Vec<_Tp, cn>::mul(const Vec<_Tp, cn>& v) const
template<> inline
Vec<float, 2> Vec<float, 2>::conj() const
{
return internal::conjugate(*this);
return cv::internal::conjugate(*this);
}
template<> inline
Vec<double, 2> Vec<double, 2>::conj() const
{
return internal::conjugate(*this);
return cv::internal::conjugate(*this);
}
template<> inline
Vec<float, 4> Vec<float, 4>::conj() const
{
return internal::conjugate(*this);
return cv::internal::conjugate(*this);
}
template<> inline
Vec<double, 4> Vec<double, 4>::conj() const
{
return internal::conjugate(*this);
return cv::internal::conjugate(*this);
}
template<typename _Tp, int cn> inline
@@ -184,6 +184,7 @@ public:
// After fix restore code in arithm.cpp: ocl_compare()
inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
int maxClockFrequency() const;
int maxComputeUnits() const;
@@ -193,7 +193,7 @@ Matx<_Tp, n, m> Matx<_Tp, m, n>::inv(int method, bool *p_is_ok /*= NULL*/) const
Matx<_Tp, n, m> b;
bool ok;
if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
ok = internal::Matx_FastInvOp<_Tp, m>()(*this, b, method);
ok = cv::internal::Matx_FastInvOp<_Tp, m>()(*this, b, method);
else
{
Mat A(*this, false), B(b, false);
@@ -209,7 +209,7 @@ Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) c
Matx<_Tp, n, l> x;
bool ok;
if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
ok = internal::Matx_FastSolveOp<_Tp, m, l>()(*this, rhs, x, method);
ok = cv::internal::Matx_FastSolveOp<_Tp, m, l>()(*this, rhs, x, method);
else
{
Mat A(*this, false), B(rhs, false), X(x, false);
@@ -412,84 +412,6 @@ int print(const Matx<_Tp, m, n>& matx, FILE* stream = stdout)
return print(Formatter::get()->format(cv::Mat(matx)), stream);
}
////////////////////////////////////////// Algorithm //////////////////////////////////////////
template<typename _Tp> inline
Ptr<_Tp> Algorithm::create(const String& name)
{
return _create(name).dynamicCast<_Tp>();
}
template<typename _Tp> inline
void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template dynamicCast<cv::Algorithm>();
if (!algo_ptr) {
CV_Error( Error::StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set");
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
}
template<typename _Tp> inline
void Algorithm::set(const String& _name, const Ptr<_Tp>& value)
{
this->set<_Tp>(_name.c_str(), value);
}
template<typename _Tp> inline
void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
if (!algo_ptr) {
CV_Error( Error::StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set");
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
}
template<typename _Tp> inline
void Algorithm::setAlgorithm(const String& _name, const Ptr<_Tp>& value)
{
this->set<_Tp>(_name.c_str(), value);
}
template<typename _Tp> inline
typename ParamType<_Tp>::member_type Algorithm::get(const String& _name) const
{
typename ParamType<_Tp>::member_type value;
info()->get(this, _name.c_str(), ParamType<_Tp>::type, &value);
return value;
}
template<typename _Tp> inline
typename ParamType<_Tp>::member_type Algorithm::get(const char* _name) const
{
typename ParamType<_Tp>::member_type value;
info()->get(this, _name, ParamType<_Tp>::type, &value);
return value;
}
template<typename _Tp, typename _Base> inline
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, Ptr<_Tp>& value, bool readOnly,
Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const String& help)
{
//TODO: static assert: _Tp inherits from _Base
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
template<typename _Tp> inline
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, Ptr<_Tp>& value, bool readOnly,
Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const String& help)
{
//TODO: static assert: _Tp inherits from Algorithm
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
//! @endcond
/****************************************************************************************\
@@ -914,7 +914,7 @@ void write(FileStorage& fs, const Range& r )
template<typename _Tp> static inline
void write( FileStorage& fs, const std::vector<_Tp>& vec )
{
internal::VecWriterProxy<_Tp, DataType<_Tp>::fmt != 0> w(&fs);
cv::internal::VecWriterProxy<_Tp, DataType<_Tp>::fmt != 0> w(&fs);
w(vec);
}
@@ -922,63 +922,63 @@ void write( FileStorage& fs, const std::vector<_Tp>& vec )
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Point_<_Tp>& pt )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, pt);
}
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Point3_<_Tp>& pt )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, pt);
}
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Size_<_Tp>& sz )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, sz);
}
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Complex<_Tp>& c )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, c);
}
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Rect_<_Tp>& r )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, r);
}
template<typename _Tp, int cn> static inline
void write(FileStorage& fs, const String& name, const Vec<_Tp, cn>& v )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, v);
}
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Scalar_<_Tp>& s )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, s);
}
static inline
void write(FileStorage& fs, const String& name, const Range& r )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, r);
}
template<typename _Tp> static inline
void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec )
{
internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
write(fs, vec);
}
@@ -1030,7 +1030,7 @@ void read(const FileNode& node, short& value, short default_value)
template<typename _Tp> static inline
void read( FileNodeIterator& it, std::vector<_Tp>& vec, size_t maxCount = (size_t)INT_MAX )
{
internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
r(vec, maxCount);
}
@@ -1101,7 +1101,7 @@ FileNodeIterator& operator >> (FileNodeIterator& it, _Tp& value)
template<typename _Tp> static inline
FileNodeIterator& operator >> (FileNodeIterator& it, std::vector<_Tp>& vec)
{
internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
r(vec, (size_t)INT_MAX);
return it;
}
+9 -34
View File
@@ -129,40 +129,6 @@ namespace cv
CV_EXPORTS const char* currentParallelFramework();
} //namespace cv
#define CV_INIT_ALGORITHM(classname, algname, memberinit) \
static inline ::cv::Algorithm* create##classname##_hidden() \
{ \
return new classname; \
} \
\
static inline ::cv::Ptr< ::cv::Algorithm> create##classname##_ptr_hidden() \
{ \
return ::cv::makePtr<classname>(); \
} \
\
static inline ::cv::AlgorithmInfo& classname##_info() \
{ \
static ::cv::AlgorithmInfo classname##_info_var(algname, create##classname##_hidden); \
return classname##_info_var; \
} \
\
static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
\
::cv::AlgorithmInfo* classname::info() const \
{ \
static volatile bool initialized = false; \
\
if( !initialized ) \
{ \
initialized = true; \
classname obj; \
memberinit; \
} \
return &classname##_info(); \
}
/****************************************************************************************\
* Common declarations *
\****************************************************************************************/
@@ -303,6 +269,15 @@ typedef enum CvStatus
}
CvStatus;
#ifdef HAVE_TEGRA_OPTIMIZATION
namespace tegra {
CV_EXPORTS bool useTegra();
CV_EXPORTS void setUseTegra(bool flag);
}
#endif
//! @endcond
#endif // __OPENCV_CORE_PRIVATE_HPP__
@@ -1,4 +1,4 @@
include/opencv2/core/base.hpp
include/opencv2/core.hpp
include/opencv2/core/utility.hpp
../java/generator/src/cpp/core_manual.hpp
misc/java/src/cpp/core_manual.hpp
@@ -1,6 +1,6 @@
#define LOG_TAG "org.opencv.core.Core"
#include "common.h"
#include "core_manual.hpp"
#include "opencv2/core/utility.hpp"
static int quietCallback( int, const char*, const char*, const char*, int, void* )
@@ -8,10 +8,14 @@ static int quietCallback( int, const char*, const char*, const char*, int, void*
return 0;
}
void cv::setErrorVerbosity(bool verbose)
namespace cv {
void setErrorVerbosity(bool verbose)
{
if(verbose)
cv::redirectError(0);
else
cv::redirectError((cv::ErrorCallback)quietCallback);
}
}
File diff suppressed because it is too large Load Diff
+41 -38
View File
@@ -2256,51 +2256,54 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst,
InputArray mask, int dtype )
{
#ifdef HAVE_TEGRA_OPTIMIZATION
int kind1 = _src1.kind(), kind2 = _src2.kind();
Mat src1 = _src1.getMat(), src2 = _src2.getMat();
bool src1Scalar = checkScalar(src1, _src2.type(), kind1, kind2);
bool src2Scalar = checkScalar(src2, _src1.type(), kind2, kind1);
if (!src1Scalar && !src2Scalar &&
src1.depth() == CV_8U && src2.type() == src1.type() &&
src1.dims == 2 && src2.size() == src1.size() &&
mask.empty())
if (tegra::useTegra())
{
if (dtype < 0)
int kind1 = _src1.kind(), kind2 = _src2.kind();
Mat src1 = _src1.getMat(), src2 = _src2.getMat();
bool src1Scalar = checkScalar(src1, _src2.type(), kind1, kind2);
bool src2Scalar = checkScalar(src2, _src1.type(), kind2, kind1);
if (!src1Scalar && !src2Scalar &&
src1.depth() == CV_8U && src2.type() == src1.type() &&
src1.dims == 2 && src2.size() == src1.size() &&
mask.empty())
{
if (_dst.fixedType())
if (dtype < 0)
{
dtype = _dst.depth();
if (_dst.fixedType())
{
dtype = _dst.depth();
}
else
{
dtype = src1.depth();
}
}
else
{
dtype = src1.depth();
}
}
dtype = CV_MAT_DEPTH(dtype);
dtype = CV_MAT_DEPTH(dtype);
if (!_dst.fixedType() || dtype == _dst.depth())
{
_dst.create(src1.size(), CV_MAKE_TYPE(dtype, src1.channels()));
if (!_dst.fixedType() || dtype == _dst.depth())
{
_dst.create(src1.size(), CV_MAKE_TYPE(dtype, src1.channels()));
if (dtype == CV_16S)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u16s(src1, src2, dst))
return;
}
else if (dtype == CV_32F)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u32f(src1, src2, dst))
return;
}
else if (dtype == CV_8S)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u8s(src1, src2, dst))
return;
if (dtype == CV_16S)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u16s(src1, src2, dst))
return;
}
else if (dtype == CV_32F)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u32f(src1, src2, dst))
return;
}
else if (dtype == CV_8S)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u8s(src1, src2, dst))
return;
}
}
}
}
+18 -14
View File
@@ -504,7 +504,7 @@ cvInitNArrayIterator( int count, CvArr** arrs,
CV_IMPL int cvNextNArraySlice( CvNArrayIterator* iterator )
{
assert( iterator != 0 );
int i, dims, size = 0;
int i, dims;
for( dims = iterator->dims; dims > 0; dims-- )
{
@@ -514,7 +514,7 @@ CV_IMPL int cvNextNArraySlice( CvNArrayIterator* iterator )
if( --iterator->stack[dims-1] > 0 )
break;
size = iterator->hdr[0]->dim[dims-1].size;
const int size = iterator->hdr[0]->dim[dims-1].size;
for( i = 0; i < iterator->count; i++ )
iterator->ptr[i] -= (size_t)size*iterator->hdr[i]->dim[dims-1].step;
@@ -856,7 +856,6 @@ cvCreateData( CvArr* arr )
else if( CV_IS_MATND_HDR( arr ))
{
CvMatND* mat = (CvMatND*)arr;
int i;
size_t total_size = CV_ELEM_SIZE(mat->type);
if( mat->dim[0].size == 0 )
@@ -872,6 +871,7 @@ cvCreateData( CvArr* arr )
}
else
{
int i;
for( i = mat->dims - 1; i >= 0; i-- )
{
size_t size = (size_t)mat->dim[i].step*mat->dim[i].size;
@@ -1055,16 +1055,19 @@ cvGetRawData( const CvArr* arr, uchar** data, int* step, CvSize* roi_size )
if( roi_size || step )
{
int i, size1 = mat->dim[0].size, size2 = 1;
if( mat->dims > 2 )
for( i = 1; i < mat->dims; i++ )
size1 *= mat->dim[i].size;
else
size2 = mat->dim[1].size;
if( roi_size )
{
int size1 = mat->dim[0].size, size2 = 1;
if( mat->dims > 2 )
{
int i;
for( i = 1; i < mat->dims; i++ )
size1 *= mat->dim[i].size;
}
else
size2 = mat->dim[1].size;
roi_size->width = size2;
roi_size->height = size1;
}
@@ -2458,7 +2461,6 @@ cvGetMat( const CvArr* array, CvMat* mat,
else if( allowND && CV_IS_MATND_HDR(src) )
{
CvMatND* matnd = (CvMatND*)src;
int i;
int size1 = matnd->dim[0].size, size2 = 1;
if( !src->data.ptr )
@@ -2468,8 +2470,11 @@ cvGetMat( const CvArr* array, CvMat* mat,
CV_Error( CV_StsBadArg, "Only continuous nD arrays are supported here" );
if( matnd->dims > 2 )
{
int i;
for( i = 1; i < matnd->dims; i++ )
size2 *= matnd->dim[i].size;
}
else
size2 = matnd->dims == 1 ? 1 : matnd->dim[1].size;
@@ -2785,7 +2790,6 @@ cvGetImage( const CvArr* array, IplImage* img )
{
IplImage* result = 0;
const IplImage* src = (const IplImage*)array;
int depth;
if( !img )
CV_Error( CV_StsNullPtr, "" );
@@ -2800,7 +2804,7 @@ cvGetImage( const CvArr* array, IplImage* img )
if( mat->data.ptr == 0 )
CV_Error( CV_StsNullPtr, "" );
depth = cvIplDepth(mat->type);
int depth = cvIplDepth(mat->type);
cvInitImageHeader( img, cvSize(mat->cols, mat->rows),
depth, CV_MAT_CN(mat->type) );
+1 -2
View File
@@ -136,7 +136,6 @@ namespace cv
dprintf(("d first time\n"));print_matrix(d);
dprintf(("r\n"));print_matrix(r);
double beta=0;
for(int count=0;count<_termcrit.maxCount;count++){
minimizeOnTheLine(_Function,proxy_x,d,minimizeOnTheLine_buf1,minimizeOnTheLine_buf2);
r.copyTo(r_old);
@@ -147,7 +146,7 @@ namespace cv
break;
}
r_norm_sq=r_norm_sq*r_norm_sq;
beta=MAX(0.0,(r_norm_sq-r.dot(r_old))/r_norm_sq);
double beta=MAX(0.0,(r_norm_sq-r.dot(r_old))/r_norm_sq);
d=r+beta*d;
}
+4 -4
View File
@@ -115,10 +115,10 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
}
}
#elif CV_NEON
uint8x16_t v_zero = vdupq_n_u8(0);
uint8x16_t v_one = vdupq_n_u8(1);
for( ; x <= size.width - 16; x += 16 )
{
uint8x16_t v_mask = vcgtq_u8(vld1q_u8(mask + x), v_zero);
uint8x16_t v_mask = vcgeq_u8(vld1q_u8(mask + x), v_one);
uint8x16_t v_dst = vld1q_u8(dst + x), v_src = vld1q_u8(src + x);
vst1q_u8(dst + x, vbslq_u8(v_mask, v_src, v_dst));
}
@@ -165,10 +165,10 @@ copyMask_<ushort>(const uchar* _src, size_t sstep, const uchar* mask, size_t mst
}
}
#elif CV_NEON
uint8x8_t v_zero = vdup_n_u8(0);
uint8x8_t v_one = vdup_n_u8(1);
for( ; x <= size.width - 8; x += 8 )
{
uint8x8_t v_mask = vcgt_u8(vld1_u8(mask + x), v_zero);
uint8x8_t v_mask = vcge_u8(vld1_u8(mask + x), v_one);
uint8x8x2_t v_mask2 = vzip_u8(v_mask, v_mask);
uint16x8_t v_mask_res = vreinterpretq_u16_u8(vcombine_u8(v_mask2.val[0], v_mask2.val[1]));
+5 -5
View File
@@ -56,14 +56,14 @@ namespace
struct DIR
{
#ifdef HAVE_WINRT
#ifdef WINRT
WIN32_FIND_DATAW data;
#else
WIN32_FIND_DATA data;
#endif
HANDLE handle;
dirent ent;
#ifdef HAVE_WINRT
#ifdef WINRT
DIR() { }
~DIR()
{
@@ -77,7 +77,7 @@ namespace
{
DIR* dir = new DIR;
dir->ent.d_name = 0;
#ifdef HAVE_WINRT
#ifdef WINRT
cv::String full_path = cv::String(path) + "\\*";
wchar_t wfull_path[MAX_PATH];
size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH);
@@ -99,7 +99,7 @@ namespace
dirent* readdir(DIR* dir)
{
#ifdef HAVE_WINRT
#ifdef WINRT
if (dir->ent.d_name != 0)
{
if (::FindNextFileW(dir->handle, &dir->data) != TRUE)
@@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir)
else
{
WIN32_FILE_ATTRIBUTE_DATA all_attrs;
#ifdef HAVE_WINRT
#ifdef WINRT
wchar_t wpath[MAX_PATH];
size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
+1 -2
View File
@@ -180,10 +180,9 @@ public:
const int K = centers.rows;
const int dims = centers.cols;
const float *sample;
for( int i = begin; i<end; ++i)
{
sample = data.ptr<float>(i);
const float *sample = data.ptr<float>(i);
int k_best = 0;
double min_dist = DBL_MAX;
+1 -1
View File
@@ -127,7 +127,7 @@ static void FastAtan2_32f(const float *Y, const float *X, float *angle, int len,
float scale = angleInDegrees ? 1 : (float)(CV_PI/180);
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::FastAtan2_32f(Y, X, angle, len, scale))
if (tegra::useTegra() && tegra::FastAtan2_32f(Y, X, angle, len, scale))
return;
#endif
+4 -1
View File
@@ -205,9 +205,12 @@ public:
void deallocate(UMatData* u) const
{
if(!u)
return;
CV_Assert(u->urefcount >= 0);
CV_Assert(u->refcount >= 0);
if(u && u->refcount == 0)
if(u->refcount == 0)
{
if( !(u->flags & UMatData::USER_ALLOCATED) )
{
+11 -3
View File
@@ -64,7 +64,15 @@
// TODO Move to some common place
static bool getBoolParameter(const char* name, bool defaultValue)
{
/*
* If your system doesn't support getenv(), define NO_GETENV to disable
* this feature.
*/
#ifdef NO_GETENV
const char* envValue = NULL;
#else
const char* envValue = getenv(name);
#endif
if (envValue == NULL)
{
return defaultValue;
@@ -85,7 +93,7 @@ static bool getBoolParameter(const char* name, bool defaultValue)
// TODO Move to some common place
static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue)
{
#ifdef HAVE_WINRT
#ifdef NO_GETENV
const char* envValue = NULL;
#else
const char* envValue = getenv(name);
@@ -728,7 +736,7 @@ static void* initOpenCLAndLoad(const char* funcname)
static HMODULE handle = 0;
if (!handle)
{
#ifndef HAVE_WINRT
#ifndef WINRT
if(!initialized)
{
handle = LoadLibraryA("OpenCL.dll");
@@ -2231,7 +2239,7 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
return true;
}
#ifdef HAVE_WINRT
#ifdef WINRT
static cl_device_id selectOpenCLDevice()
{
return NULL;
+2 -2
View File
@@ -69,7 +69,7 @@
#define HAVE_GCD
#endif
#if defined _MSC_VER && _MSC_VER >= 1600
#if defined _MSC_VER && _MSC_VER >= 1600 && !defined(WINRT)
#define HAVE_CONCURRENCY
#endif
@@ -458,7 +458,7 @@ int cv::getNumberOfCPUs(void)
{
#if defined WIN32 || defined _WIN32
SYSTEM_INFO sysinfo;
#if defined(_M_ARM) || defined(_M_X64) || defined(HAVE_WINRT)
#if defined(_M_ARM) || defined(_M_X64) || defined(WINRT)
GetNativeSystemInfo( &sysinfo );
#else
GetSystemInfo( &sysinfo );
+1 -1
View File
@@ -5548,7 +5548,7 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat )
void write(FileStorage& fs, const String& objname, const std::vector<KeyPoint>& keypoints)
{
internal::WriteStructContext ws(fs, objname, CV_NODE_SEQ + CV_NODE_FLOW);
cv::internal::WriteStructContext ws(fs, objname, CV_NODE_SEQ + CV_NODE_FLOW);
int i, npoints = (int)keypoints.size();
for( i = 0; i < npoints; i++ )
+6
View File
@@ -236,6 +236,9 @@ struct CoreTLSData
{
CoreTLSData() : device(0), useOpenCL(-1), useIPP(-1), useCollection(false)
{
#ifdef HAVE_TEGRA_OPTIMIZATION
useTegra = -1;
#endif
#ifdef CV_COLLECT_IMPL_DATA
implFlags = 0;
#endif
@@ -246,6 +249,9 @@ struct CoreTLSData
ocl::Queue oclQueue;
int useOpenCL; // 1 - use, 0 - do not use, -1 - auto/not initialized
int useIPP; // 1 - use, 0 - do not use, -1 - auto/not initialized
#ifdef HAVE_TEGRA_OPTIMIZATION
int useTegra; // 1 - use, 0 - do not use, -1 - auto/not initialized
#endif
bool useCollection; // enable/disable impl data collection
#ifdef CV_COLLECT_IMPL_DATA
+20 -2
View File
@@ -517,9 +517,11 @@ static const uchar * initPopcountTable()
unsigned int j = 0u;
#if CV_POPCNT
if (checkHardwareSupport(CV_CPU_POPCNT))
{
for( ; j < 256u; j++ )
tab[j] = (uchar)(8 - _mm_popcnt_u32(j));
#else
}
#endif
for( ; j < 256u; j++ )
{
int val = 0;
@@ -527,7 +529,6 @@ static const uchar * initPopcountTable()
val += (j & mask) == 0;
tab[j] = (uchar)val;
}
#endif
initialized = true;
}
@@ -2113,6 +2114,12 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
int ddepth = -1, bool absValues = false, InputArray _src2 = noArray(), double * maxVal2 = NULL)
{
const ocl::Device & dev = ocl::Device::getDefault();
#ifdef ANDROID
if (dev.isNVidia())
return false;
#endif
bool doubleSupport = dev.doubleFPConfig() > 0, haveMask = !_mask.empty(),
haveSrc2 = _src2.kind() != _InputArray::NONE;
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type),
@@ -2884,6 +2891,12 @@ static NormDiffFunc getNormDiffFunc(int normType, int depth)
static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double & result )
{
const ocl::Device & d = ocl::Device::getDefault();
#ifdef ANDROID
if (d.isNVidia())
return false;
#endif
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
bool doubleSupport = d.doubleFPConfig() > 0,
haveMask = _mask.kind() != _InputArray::NONE;
@@ -3249,6 +3262,11 @@ namespace cv {
static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result )
{
#ifdef ANDROID
if (ocl::Device::getDefault().isNVidia())
return false;
#endif
Scalar sc1, sc2;
int type = _src1.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
bool relative = (normType & NORM_RELATIVE) != 0;
+53 -17
View File
@@ -109,7 +109,7 @@
#endif
#endif
#ifdef HAVE_WINRT
#ifdef WINRT
#include <wrl/client.h>
#ifndef __cplusplus_winrt
#include <windows.storage.h>
@@ -159,7 +159,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]),
UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7]));
return prefix + std::wstring(guidStr);
return prefix.append(std::wstring(guidStr));
}
#endif
@@ -319,14 +319,17 @@ struct HWFeatures
}
#if defined ANDROID || defined __linux__
#ifdef __aarch64__
f.have[CV_CPU_NEON] = true;
#else
int cpufile = open("/proc/self/auxv", O_RDONLY);
if (cpufile >= 0)
{
Elf32_auxv_t auxv;
const size_t size_auxv_t = sizeof(Elf32_auxv_t);
const size_t size_auxv_t = sizeof(auxv);
while (read(cpufile, &auxv, sizeof(Elf32_auxv_t)) == size_auxv_t)
while ((size_t)read(cpufile, &auxv, size_auxv_t) == size_auxv_t)
{
if (auxv.a_type == AT_HWCAP)
{
@@ -337,7 +340,8 @@ struct HWFeatures
close(cpufile);
}
#elif (defined __clang__ || defined __APPLE__) && defined __ARM_NEON__
#endif
#elif (defined __clang__ || defined __APPLE__) && (defined __ARM_NEON__ || (defined __ARM_NEON && defined __aarch64__))
f.have[CV_CPU_NEON] = true;
#endif
@@ -385,6 +389,12 @@ void setUseOptimized( bool flag )
useOptimizedFlag = flag;
currentFeatures = flag ? &featuresEnabled : &featuresDisabled;
USE_SSE2 = currentFeatures->have[CV_CPU_SSE2];
ipp::setUseIPP(flag);
ocl::setUseOpenCL(flag);
#ifdef HAVE_TEGRA_OPTIMIZATION
::tegra::setUseTegra(flag);
#endif
}
bool useOptimized(void)
@@ -532,24 +542,20 @@ String format( const char* fmt, ... )
String tempfile( const char* suffix )
{
String fname;
#ifndef HAVE_WINRT
#ifndef WINRT
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif
#if defined WIN32 || defined _WIN32
#ifdef HAVE_WINRT
#ifdef WINRT
RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir = L"";
const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str();
if (opencv_temp_dir)
temp_dir = std::wstring(opencv_temp_dir);
std::wstring temp_dir = GetTempPathWinRT();
std::wstring temp_file;
temp_file = GetTempFileNameWinRT(L"ocv");
std::wstring temp_file = GetTempFileNameWinRT(L"ocv");
if (temp_file.empty())
return String();
temp_file = temp_dir + std::wstring(L"\\") + temp_file;
temp_file = temp_dir.append(std::wstring(L"\\")).append(temp_file);
DeleteFileW(temp_file.c_str());
char aname[MAX_PATH];
@@ -945,7 +951,7 @@ public:
#pragma warning(disable:4505) // unreferenced local function has been removed
#endif
#ifdef HAVE_WINRT
#ifdef WINRT
// using C++11 thread attribute for local thread data
static __declspec( thread ) TLSStorage* g_tlsdata = NULL;
@@ -996,10 +1002,10 @@ public:
}
return d;
}
#endif //HAVE_WINRT
#endif //WINRT
#if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
#ifdef HAVE_WINRT
#ifdef WINRT
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
#endif
@@ -1259,4 +1265,34 @@ void setUseIPP(bool flag)
} // namespace cv
#ifdef HAVE_TEGRA_OPTIMIZATION
namespace tegra {
bool useTegra()
{
cv::CoreTLSData* data = cv::getCoreTlsData().get();
if (data->useTegra < 0)
{
const char* pTegraEnv = getenv("OPENCV_TEGRA");
if (pTegraEnv && (cv::String(pTegraEnv) == "disabled"))
data->useTegra = false;
else
data->useTegra = true;
}
return (data->useTegra > 0);
}
void setUseTegra(bool flag)
{
cv::CoreTLSData* data = cv::getCoreTlsData().get();
data->useTegra = flag;
}
} // namespace tegra
#endif
/* End of file. */
+4
View File
@@ -331,7 +331,11 @@ OCL_TEST_P(Mul, Mat_Scale)
OCL_OFF(cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]));
OCL_ON(cv::multiply(usrc1_roi, usrc2_roi, udst1_roi, val[0]));
#ifdef ANDROID
Near(udst1_roi.depth() >= CV_32F ? 2e-1 : 1);
#else
Near(udst1_roi.depth() >= CV_32F ? 1e-3 : 1);
#endif
}
}
-10
View File
@@ -7,14 +7,4 @@
#include "test_precomp.hpp"
#ifndef HAVE_CUDA
CV_TEST_MAIN("cv")
#else
#include "opencv2/ts/cuda_test.hpp"
CV_CUDA_TEST_MAIN("cv")
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaarithm)
endif()
+2 -2
View File
@@ -134,7 +134,7 @@ void cv::cuda::minMax(InputArray _src, double* minVal, double* maxVal, InputArra
*maxVal = vals[1];
}
namespace cv { namespace cuda { namespace internal {
namespace cv { namespace cuda { namespace device {
void findMaxAbs(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream);
@@ -155,7 +155,7 @@ namespace
}
}
void cv::cuda::internal::findMaxAbs(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream)
void cv::cuda::device::findMaxAbs(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream)
{
typedef void (*func_t)(const GpuMat& _src, const GpuMat& mask, GpuMat& _dst, Stream& stream);
static const func_t funcs[] =
+2 -2
View File
@@ -128,7 +128,7 @@ double cv::cuda::norm(InputArray _src1, InputArray _src2, int normType)
return val;
}
namespace cv { namespace cuda { namespace internal {
namespace cv { namespace cuda { namespace device {
void normL2(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _mask, Stream& stream);
@@ -158,7 +158,7 @@ namespace
}
}
void cv::cuda::internal::normL2(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream)
void cv::cuda::device::normL2(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream)
{
typedef void (*func_t)(const GpuMat& _src, const GpuMat& mask, GpuMat& _dst, Stream& stream);
static const func_t funcs[] =
+3 -3
View File
@@ -84,7 +84,7 @@ void cv::cuda::sqrIntegral(InputArray, OutputArray, Stream&) { throw_no_cuda();
////////////////////////////////////////////////////////////////////////
// norm
namespace cv { namespace cuda { namespace internal {
namespace cv { namespace cuda { namespace device {
void normL2(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _mask, Stream& stream);
@@ -106,11 +106,11 @@ void cv::cuda::calcNorm(InputArray _src, OutputArray dst, int normType, InputArr
}
else if (normType == NORM_L2)
{
internal::normL2(src_single_channel, dst, mask, stream);
cv::cuda::device::normL2(src_single_channel, dst, mask, stream);
}
else // NORM_INF
{
internal::findMaxAbs(src_single_channel, dst, mask, stream);
cv::cuda::device::findMaxAbs(src_single_channel, dst, mask, stream);
}
}
@@ -40,7 +40,7 @@
//
//M*/
#include "../test_precomp.hpp"
#include "test_precomp.hpp"
#ifdef HAVE_CUDA
@@ -40,7 +40,7 @@
//
//M*/
#include "../test_precomp.hpp"
#include "test_precomp.hpp"
#ifdef HAVE_CUDA
@@ -40,7 +40,7 @@
//
//M*/
#include "../test_precomp.hpp"
#include "test_precomp.hpp"
#if defined(HAVE_CUDA) && defined(HAVE_OPENGL)
@@ -40,7 +40,7 @@
//
//M*/
#include "../test_precomp.hpp"
#include "test_precomp.hpp"
#ifdef HAVE_CUDA
+1 -1
View File
@@ -1,4 +1,4 @@
if(IOS OR APPLE OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
if(IOS OR APPLE OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudacodec)
endif()
+1 -1
View File
@@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudafeatures2d)
endif()
+1 -1
View File
@@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudafilters)
endif()
+1 -1
View File
@@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaimgproc)
endif()
-7
View File
@@ -140,8 +140,6 @@ namespace
public:
CLAHE_Impl(double clipLimit = 40.0, int tilesX = 8, int tilesY = 8);
cv::AlgorithmInfo* info() const;
void apply(cv::InputArray src, cv::OutputArray dst);
void apply(InputArray src, OutputArray dst, Stream& stream);
@@ -167,11 +165,6 @@ namespace
{
}
CV_INIT_ALGORITHM(CLAHE_Impl, "CLAHE_CUDA",
obj.info()->addParam(obj, "clipLimit", obj.clipLimit_);
obj.info()->addParam(obj, "tilesX", obj.tilesX_);
obj.info()->addParam(obj, "tilesY", obj.tilesY_))
void CLAHE_Impl::apply(cv::InputArray _src, cv::OutputArray _dst)
{
apply(_src, _dst, Stream::Null());
@@ -52,7 +52,7 @@ namespace
~FpuControl();
private:
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__) && !defined(__aarch64__)
fpu_control_t fpu_oldcw, fpu_cw;
#elif defined(_WIN32) && !defined(_WIN64)
unsigned int fpu_oldcw, fpu_cw;
@@ -61,7 +61,7 @@ namespace
FpuControl::FpuControl()
{
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__) && !defined(__aarch64__)
_FPU_GETCW(fpu_oldcw);
fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_DOUBLE & ~_FPU_SINGLE) | _FPU_SINGLE;
_FPU_SETCW(fpu_cw);
@@ -74,7 +74,7 @@ namespace
FpuControl::~FpuControl()
{
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__) && !defined(__aarch64__)
_FPU_SETCW(fpu_oldcw);
#elif defined(_WIN32) && !defined(_WIN64)
_controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
+1 -1
View File
@@ -51,7 +51,7 @@
#ifndef __OPENCV_TEST_PRECOMP_HPP__
#define __OPENCV_TEST_PRECOMP_HPP__
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__) && !defined(__aarch64__)
#include <fpu_control.h>
#endif
@@ -207,7 +207,7 @@ public:
@param filename Name of the file from which the classifier is loaded. Only the old haar classifier
(trained by the haar training application) and NVIDIA's nvbin are supported for HAAR and only new
type of OpenCV XML cascade supported for LBP.
type of OpenCV XML cascade supported for LBP. The working haar models can be found at opencv_folder/data/haarcascades_cuda/
*/
static Ptr<CascadeClassifier> create(const String& filename);
/** @overload
+1 -1
View File
@@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaoptflow)
endif()

Some files were not shown because too many files have changed in this diff Show More