merged all the latest changes from 2.4 to trunk
This commit is contained in:
@@ -33,18 +33,16 @@ if (HAVE_CUDA)
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
|
||||
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/W4" "/W3" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408 /wd4251")
|
||||
|
||||
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/EHsc-" "/EHs" ${var} "${${var}}")
|
||||
endforeach()
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408")
|
||||
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/W4" "/W3" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
OCV_CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda})
|
||||
|
@@ -279,7 +279,7 @@ Class computing stereo correspondence using the constant space belief propagatio
|
||||
};
|
||||
|
||||
|
||||
The class implements algorithm described in [Yang2010]_. ``StereoConstantSpaceBP`` supports both local minimum and global minimum data cost initialization algortihms. For more details, see the paper mentioned above. By default, a local algorithm is used. To enable a global algorithm, set ``use_local_init_data_cost`` to ``false`` .
|
||||
The class implements algorithm described in [Yang2010]_. ``StereoConstantSpaceBP`` supports both local minimum and global minimum data cost initialization algorithms. For more details, see the paper mentioned above. By default, a local algorithm is used. To enable a global algorithm, set ``use_local_init_data_cost`` to ``false`` .
|
||||
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ Enables the :ocv:class:`gpu::StereoConstantSpaceBP` constructors.
|
||||
|
||||
For more details, see [Yang2010]_.
|
||||
|
||||
By default, ``StereoConstantSpaceBP`` uses floating-point arithmetics and the ``CV_32FC1`` type for messages. But it can also use fixed-point arithmetics and the ``CV_16SC1`` message type for better perfomance. To avoid an overflow in this case, the parameters must satisfy the following requirement:
|
||||
By default, ``StereoConstantSpaceBP`` uses floating-point arithmetics and the ``CV_32FC1`` type for messages. But it can also use fixed-point arithmetics and the ``CV_16SC1`` message type for better performance. To avoid an overflow in this case, the parameters must satisfy the following requirement:
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -359,7 +359,7 @@ gpu::DisparityBilateralFilter
|
||||
-----------------------------
|
||||
.. ocv:class:: gpu::DisparityBilateralFilter
|
||||
|
||||
Class refinining a disparity map using joint bilateral filtering. ::
|
||||
Class refining a disparity map using joint bilateral filtering. ::
|
||||
|
||||
class CV_EXPORTS DisparityBilateralFilter
|
||||
{
|
||||
|
@@ -172,7 +172,7 @@ Ensures that the size of a matrix is big enough and the matrix has a proper type
|
||||
|
||||
:param cols: Minimum desired number of columns.
|
||||
|
||||
:param size: Rows and coumns passed as a structure.
|
||||
:param size: Rows and columns passed as a structure.
|
||||
|
||||
:param type: Desired matrix type.
|
||||
|
||||
|
@@ -168,7 +168,7 @@ Constructor.
|
||||
|
||||
:param threshold: Threshold on difference between intensity of the central pixel and pixels on a circle around this pixel.
|
||||
|
||||
:param nonmaxSupression: If it is true, non-maximum supression is applied to detected corners (keypoints).
|
||||
:param nonmaxSupression: If it is true, non-maximum suppression is applied to detected corners (keypoints).
|
||||
|
||||
:param keypointsRatio: Inner buffer size for keypoints store is determined as (keypointsRatio * image_width * image_height).
|
||||
|
||||
@@ -188,7 +188,7 @@ Finds the keypoints using FAST detector.
|
||||
:param keypoints: The output vector of keypoints. Can be stored both in CPU and GPU memory. For GPU memory:
|
||||
|
||||
* keypoints.ptr<Vec2s>(LOCATION_ROW)[i] will contain location of i'th point
|
||||
* keypoints.ptr<float>(RESPONSE_ROW)[i] will contaion response of i'th point (if non-maximum supression is applied)
|
||||
* keypoints.ptr<float>(RESPONSE_ROW)[i] will contain response of i'th point (if non-maximum suppression is applied)
|
||||
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ Gets final array of keypoints.
|
||||
|
||||
:param keypoints: The output vector of keypoints.
|
||||
|
||||
The function performs nonmax supression if needed and returns final count of keypoints.
|
||||
The function performs non-max suppression if needed and returns final count of keypoints.
|
||||
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::matchSingl
|
||||
|
||||
gpu::BruteForceMatcher_GPU::knnMatch
|
||||
----------------------------------------
|
||||
Finds the k best matches for each descriptor from a query set with train descriptors.
|
||||
Finds the ``k`` best matches for each descriptor from a query set with train descriptors.
|
||||
|
||||
.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatch(const GpuMat& query, const GpuMat& train, std::vector< std::vector<DMatch> >&matches, int k, const GpuMat& mask = GpuMat(), bool compactResult = false)
|
||||
|
||||
@@ -551,7 +551,7 @@ Finds the k best matches for each descriptor from a query set with train descrip
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
The function returns detected k (or less if not possible) matches in the increasing order by distance.
|
||||
The function returns detected ``k`` (or less if not possible) matches in the increasing order by distance.
|
||||
|
||||
The third variant of the method stores the results in GPU memory.
|
||||
|
||||
|
@@ -109,7 +109,7 @@ By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary mem
|
||||
filter.release();
|
||||
|
||||
|
||||
``FilterEngine_GPU`` can process a rectangular sub-region of an image. By default, if ``roi == Rect(0,0,-1,-1)`` , ``FilterEngine_GPU`` processes the inner region of an image ( ``Rect(anchor.x, anchor.y, src_size.width - ksize.width, src_size.height - ksize.height)`` ) because some filters do not check whether indices are outside the image for better perfomance. See below to understand which filters support processing the whole image and which do not and identify image type limitations.
|
||||
``FilterEngine_GPU`` can process a rectangular sub-region of an image. By default, if ``roi == Rect(0,0,-1,-1)`` , ``FilterEngine_GPU`` processes the inner region of an image ( ``Rect(anchor.x, anchor.y, src_size.width - ksize.width, src_size.height - ksize.height)`` ) because some filters do not check whether indices are outside the image for better performance. See below to understand which filters support processing the whole image and which do not and identify image type limitations.
|
||||
|
||||
.. note:: The GPU filters do not support the in-place mode.
|
||||
|
||||
@@ -469,7 +469,7 @@ Creates a primitive column filter with the specified kernel.
|
||||
|
||||
.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
|
||||
|
||||
:param bufType: Inermediate buffer type with as many channels as ``dstType`` .
|
||||
:param bufType: Intermediate buffer type with as many channels as ``dstType`` .
|
||||
|
||||
:param dstType: Destination array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` destination types are supported.
|
||||
|
||||
@@ -581,7 +581,7 @@ Applies the generalized Sobel operator to an image.
|
||||
|
||||
:param dy: Derivative order in respect of y.
|
||||
|
||||
:param ksize: Size of the extended Sobel kernel. Possible valies are 1, 3, 5 or 7.
|
||||
:param ksize: Size of the extended Sobel kernel. Possible values are 1, 3, 5 or 7.
|
||||
|
||||
:param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. For details, see :ocv:func:`getDerivKernels` .
|
||||
|
||||
|
@@ -61,7 +61,7 @@ Performs a mean-shift segmentation of the source image and eliminates small segm
|
||||
|
||||
:param sr: Color window radius.
|
||||
|
||||
:param minsize: Minimum segment size. Smaller segements are merged.
|
||||
:param minsize: Minimum segment size. Smaller segments are merged.
|
||||
|
||||
:param criteria: Termination criteria. See :ocv:class:`TermCriteria`.
|
||||
|
||||
@@ -229,7 +229,7 @@ The source matrix should be continuous, otherwise reallocation and data copying
|
||||
|
||||
* If the source matrix is complex and the output is not specified as real, the destination matrix is complex and has the ``dft_size`` size and ``CV_32FC2`` type. The destination matrix contains a full result of the DFT (forward or inverse).
|
||||
|
||||
* If the source matrix is complex and the output is specified as real, the function assumes that its input is the result of the forward transform (see the next item). The destionation matrix has the ``dft_size`` size and ``CV_32FC1`` type. It contains the result of the inverse DFT.
|
||||
* If the source matrix is complex and the output is specified as real, the function assumes that its input is the result of the forward transform (see the next item). The destination matrix has the ``dft_size`` size and ``CV_32FC1`` type. It contains the result of the inverse DFT.
|
||||
|
||||
* If the source matrix is real (its type is ``CV_32FC1`` ), forward DFT is performed. The result of the DFT is packed into complex ( ``CV_32FC2`` ) matrix. So, the width of the destination matrix is ``dft_size.width / 2 + 1`` . But if the source is a single column, the height is reduced instead of the width.
|
||||
|
||||
@@ -392,7 +392,7 @@ Converts an image from one color space to another.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
3-channel color spaces (like ``HSV``, ``XYZ``, and so on) can be stored in a 4-channel image for better perfomance.
|
||||
3-channel color spaces (like ``HSV``, ``XYZ``, and so on) can be stored in a 4-channel image for better performance.
|
||||
|
||||
.. seealso:: :ocv:func:`cvtColor`
|
||||
|
||||
@@ -499,7 +499,7 @@ gpu::buildWarpAffineMaps
|
||||
------------------------
|
||||
Builds transformation maps for affine transformation.
|
||||
|
||||
.. ocv:function:: void buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null());
|
||||
.. ocv:function:: void buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null())
|
||||
|
||||
:param M: *2x3* transformation matrix.
|
||||
|
||||
@@ -543,7 +543,7 @@ gpu::buildWarpPerspectiveMaps
|
||||
-----------------------------
|
||||
Builds transformation maps for perspective transformation.
|
||||
|
||||
.. ocv:function:: void buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null());
|
||||
.. ocv:function:: void buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null())
|
||||
|
||||
:param M: *3x3* transformation matrix.
|
||||
|
||||
|
@@ -43,7 +43,7 @@ Utilizing Multiple GPUs
|
||||
-----------------------
|
||||
|
||||
In the current version, each of the OpenCV GPU algorithms can use only a single GPU. So, to utilize multiple GPUs, you have to manually distribute the work between GPUs.
|
||||
Switching active devie can be done using :ocv:func:`gpu::setDevice()' function. For more details please read Cuda C Programing Guid.
|
||||
Switching active devie can be done using :ocv:func:`gpu::setDevice()` function. For more details please read Cuda C Programing Guide.
|
||||
|
||||
While developing algorithms for multiple GPUs, note a data passing overhead. For primitive functions and small images, it can be significant, which may eliminate all the advantages of having multiple GPUs. But for high-level algorithms, consider using multi-GPU acceleration. For example, the Stereo Block Matching algorithm has been successfully parallelized using the following algorithm:
|
||||
|
||||
|
@@ -191,9 +191,9 @@ Computes polar angles of complex matrix elements.
|
||||
|
||||
:param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param angle: Destionation matrix of angles ( ``CV_32FC1`` ).
|
||||
:param angle: Destination matrix of angles ( ``CV_32FC1`` ).
|
||||
|
||||
:param angleInDegrees: Flag for angles that must be evaluated in degress.
|
||||
:param angleInDegrees: Flag for angles that must be evaluated in degrees.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
@@ -213,9 +213,9 @@ Converts Cartesian coordinates into polar.
|
||||
|
||||
:param magnitude: Destination matrix of float magnitudes ( ``CV_32FC1`` ).
|
||||
|
||||
:param angle: Destionation matrix of angles ( ``CV_32FC1`` ).
|
||||
:param angle: Destination matrix of angles ( ``CV_32FC1`` ).
|
||||
|
||||
:param angleInDegrees: Flag for angles that must be evaluated in degress.
|
||||
:param angleInDegrees: Flag for angles that must be evaluated in degrees.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
@@ -237,7 +237,7 @@ Converts polar coordinates into Cartesian.
|
||||
|
||||
:param y: Destination matrix of imaginary components ( ``CV_32FC1`` ).
|
||||
|
||||
:param angleInDegrees: Flag that indicates angles in degress.
|
||||
:param angleInDegrees: Flag that indicates angles in degrees.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
@@ -64,18 +64,18 @@
|
||||
/// \brief Model and solver parameters
|
||||
struct NCVBroxOpticalFlowDescriptor
|
||||
{
|
||||
/// flow smoothness
|
||||
Ncv32f alpha;
|
||||
/// gradient constancy importance
|
||||
Ncv32f gamma;
|
||||
/// pyramid scale factor
|
||||
Ncv32f scale_factor;
|
||||
/// number of lagged non-linearity iterations (inner loop)
|
||||
Ncv32u number_of_inner_iterations;
|
||||
/// number of warping iterations (number of pyramid levels)
|
||||
Ncv32u number_of_outer_iterations;
|
||||
/// number of linear system solver iterations
|
||||
Ncv32u number_of_solver_iterations;
|
||||
/// flow smoothness
|
||||
Ncv32f alpha;
|
||||
/// gradient constancy importance
|
||||
Ncv32f gamma;
|
||||
/// pyramid scale factor
|
||||
Ncv32f scale_factor;
|
||||
/// number of lagged non-linearity iterations (inner loop)
|
||||
Ncv32u number_of_inner_iterations;
|
||||
/// number of warping iterations (number of pyramid levels)
|
||||
Ncv32u number_of_outer_iterations;
|
||||
/// number of linear system solver iterations
|
||||
Ncv32u number_of_solver_iterations;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -93,11 +93,11 @@ struct NCVBroxOpticalFlowDescriptor
|
||||
|
||||
NCV_EXPORTS
|
||||
NCVStatus NCVBroxOpticalFlow(const NCVBroxOpticalFlowDescriptor desc,
|
||||
INCVMemAllocator &gpu_mem_allocator,
|
||||
const NCVMatrix<Ncv32f> &frame0,
|
||||
const NCVMatrix<Ncv32f> &frame1,
|
||||
NCVMatrix<Ncv32f> &u,
|
||||
NCVMatrix<Ncv32f> &v,
|
||||
cudaStream_t stream);
|
||||
INCVMemAllocator &gpu_mem_allocator,
|
||||
const NCVMatrix<Ncv32f> &frame0,
|
||||
const NCVMatrix<Ncv32f> &frame1,
|
||||
NCVMatrix<Ncv32f> &u,
|
||||
NCVMatrix<Ncv32f> &v,
|
||||
cudaStream_t stream);
|
||||
|
||||
#endif
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#define _ncvhaarobjectdetection_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <vector_types.h>
|
||||
#include "NCV.hpp"
|
||||
|
||||
|
||||
@@ -68,41 +69,43 @@
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
|
||||
struct HaarFeature64
|
||||
{
|
||||
uint2 _ui2;
|
||||
union
|
||||
{
|
||||
uint2 _ui2;
|
||||
struct {NcvRect8u__ _rect; Ncv32f _f;};
|
||||
};
|
||||
|
||||
|
||||
#define HaarFeature64_CreateCheck_MaxRectField 0xFF
|
||||
|
||||
__host__ NCVStatus setRect(Ncv32u rectX, Ncv32u rectY, Ncv32u rectWidth, Ncv32u rectHeight, Ncv32u /*clsWidth*/, Ncv32u /*clsHeight*/)
|
||||
{
|
||||
ncvAssertReturn(rectWidth <= HaarFeature64_CreateCheck_MaxRectField && rectHeight <= HaarFeature64_CreateCheck_MaxRectField, NCV_HAAR_TOO_LARGE_FEATURES);
|
||||
((NcvRect8u*)&(this->_ui2.x))->x = (Ncv8u)rectX;
|
||||
((NcvRect8u*)&(this->_ui2.x))->y = (Ncv8u)rectY;
|
||||
((NcvRect8u*)&(this->_ui2.x))->width = (Ncv8u)rectWidth;
|
||||
((NcvRect8u*)&(this->_ui2.x))->height = (Ncv8u)rectHeight;
|
||||
_rect = NcvRect8u(rectX,rectY,rectWidth,rectHeight);
|
||||
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ NCVStatus setWeight(Ncv32f weight)
|
||||
{
|
||||
((Ncv32f*)&(this->_ui2.y))[0] = weight;
|
||||
_f = weight;
|
||||
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__device__ __host__ void getRect(Ncv32u *rectX, Ncv32u *rectY, Ncv32u *rectWidth, Ncv32u *rectHeight)
|
||||
{
|
||||
NcvRect8u tmpRect = *(NcvRect8u*)(&this->_ui2.x);
|
||||
*rectX = tmpRect.x;
|
||||
*rectY = tmpRect.y;
|
||||
*rectWidth = tmpRect.width;
|
||||
*rectHeight = tmpRect.height;
|
||||
*rectX = _rect.x;
|
||||
*rectY = _rect.y;
|
||||
*rectWidth = _rect.width;
|
||||
*rectHeight = _rect.height;
|
||||
}
|
||||
|
||||
__device__ __host__ Ncv32f getWeight(void)
|
||||
{
|
||||
return *(Ncv32f*)(&this->_ui2.y);
|
||||
return _f;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -170,24 +173,28 @@ public:
|
||||
|
||||
|
||||
struct HaarClassifierNodeDescriptor32
|
||||
{
|
||||
union
|
||||
{
|
||||
uint1 _ui1;
|
||||
Ncv32f _f;
|
||||
};
|
||||
|
||||
__host__ NCVStatus create(Ncv32f leafValue)
|
||||
{
|
||||
*(Ncv32f *)&this->_ui1 = leafValue;
|
||||
_f = leafValue;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ NCVStatus create(Ncv32u offsetHaarClassifierNode)
|
||||
{
|
||||
this->_ui1.x = offsetHaarClassifierNode;
|
||||
_ui1.x = offsetHaarClassifierNode;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ Ncv32f getLeafValueHost(void)
|
||||
{
|
||||
return *(Ncv32f *)&this->_ui1.x;
|
||||
return _f;
|
||||
}
|
||||
|
||||
#ifdef __CUDACC__
|
||||
@@ -199,57 +206,67 @@ struct HaarClassifierNodeDescriptor32
|
||||
|
||||
__device__ __host__ Ncv32u getNextNodeOffset(void)
|
||||
{
|
||||
return this->_ui1.x;
|
||||
return _ui1.x;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct HaarClassifierNode128
|
||||
{
|
||||
union
|
||||
{
|
||||
uint4 _ui4;
|
||||
struct
|
||||
{
|
||||
HaarFeatureDescriptor32 _f;
|
||||
Ncv32f _t;
|
||||
HaarClassifierNodeDescriptor32 _nl;
|
||||
HaarClassifierNodeDescriptor32 _nr;
|
||||
};
|
||||
};
|
||||
|
||||
__host__ NCVStatus setFeatureDesc(HaarFeatureDescriptor32 f)
|
||||
{
|
||||
this->_ui4.x = *(Ncv32u *)&f;
|
||||
_f = f;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ NCVStatus setThreshold(Ncv32f t)
|
||||
{
|
||||
this->_ui4.y = *(Ncv32u *)&t;
|
||||
_t = t;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ NCVStatus setLeftNodeDesc(HaarClassifierNodeDescriptor32 nl)
|
||||
{
|
||||
this->_ui4.z = *(Ncv32u *)&nl;
|
||||
_nl = nl;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ NCVStatus setRightNodeDesc(HaarClassifierNodeDescriptor32 nr)
|
||||
{
|
||||
this->_ui4.w = *(Ncv32u *)&nr;
|
||||
_nr = nr;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
__host__ __device__ HaarFeatureDescriptor32 getFeatureDesc(void)
|
||||
{
|
||||
return *(HaarFeatureDescriptor32 *)&this->_ui4.x;
|
||||
return _f;
|
||||
}
|
||||
|
||||
__host__ __device__ Ncv32f getThreshold(void)
|
||||
{
|
||||
return *(Ncv32f*)&this->_ui4.y;
|
||||
return _t;
|
||||
}
|
||||
|
||||
__host__ __device__ HaarClassifierNodeDescriptor32 getLeftNodeDesc(void)
|
||||
{
|
||||
return *(HaarClassifierNodeDescriptor32 *)&this->_ui4.z;
|
||||
return _nl;
|
||||
}
|
||||
|
||||
__host__ __device__ HaarClassifierNodeDescriptor32 getRightNodeDesc(void)
|
||||
{
|
||||
return *(HaarClassifierNodeDescriptor32 *)&this->_ui4.w;
|
||||
return _nr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -260,11 +277,15 @@ struct HaarStage64
|
||||
#define HaarStage64_Interpret_MaskRootNodeOffset 0xFFFF0000
|
||||
#define HaarStage64_Interpret_ShiftRootNodeOffset 16
|
||||
|
||||
union
|
||||
{
|
||||
uint2 _ui2;
|
||||
struct {Ncv32f _t; Ncv32u _root;};
|
||||
};
|
||||
|
||||
__host__ NCVStatus setStageThreshold(Ncv32f t)
|
||||
{
|
||||
this->_ui2.x = *(Ncv32u *)&t;
|
||||
_t = t;
|
||||
return NCV_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -290,7 +311,7 @@ struct HaarStage64
|
||||
|
||||
__host__ __device__ Ncv32f getStageThreshold(void)
|
||||
{
|
||||
return *(Ncv32f*)&this->_ui2.x;
|
||||
return _t;
|
||||
}
|
||||
|
||||
__host__ __device__ Ncv32u getStartClassifierRootNodeOffset(void)
|
||||
@@ -304,14 +325,12 @@ struct HaarStage64
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
NCV_CT_ASSERT(sizeof(HaarFeature64) == 8);
|
||||
NCV_CT_ASSERT(sizeof(HaarFeatureDescriptor32) == 4);
|
||||
NCV_CT_ASSERT(sizeof(HaarClassifierNodeDescriptor32) == 4);
|
||||
NCV_CT_ASSERT(sizeof(HaarClassifierNode128) == 16);
|
||||
NCV_CT_ASSERT(sizeof(HaarStage64) == 8);
|
||||
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
// Classifier cascade descriptor
|
||||
|
@@ -134,15 +134,24 @@ typedef unsigned char Ncv8u;
|
||||
typedef float Ncv32f;
|
||||
typedef double Ncv64f;
|
||||
|
||||
|
||||
struct NcvRect8u
|
||||
struct NcvRect8u__
|
||||
{
|
||||
Ncv8u x;
|
||||
Ncv8u y;
|
||||
Ncv8u width;
|
||||
Ncv8u height;
|
||||
__host__ __device__ NcvRect8u() : x(0), y(0), width(0), height(0) {};
|
||||
__host__ __device__ NcvRect8u(Ncv8u x, Ncv8u y, Ncv8u width, Ncv8u height) : x(x), y(y), width(width), height(height) {}
|
||||
};
|
||||
|
||||
struct NcvRect8u : NcvRect8u__
|
||||
{
|
||||
__host__ __device__ NcvRect8u() {}
|
||||
__host__ __device__ NcvRect8u(Ncv8u x, Ncv8u y, Ncv8u width, Ncv8u height)
|
||||
{
|
||||
x = x;
|
||||
y = y;
|
||||
width = width;
|
||||
height = height;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@@ -33,9 +33,9 @@ private:
|
||||
TestRectStdDev& operator=(const TestRectStdDev&);
|
||||
|
||||
NCVTestSourceProvider<Ncv8u> &src;
|
||||
NcvRect32u rect;
|
||||
Ncv32u width;
|
||||
Ncv32u height;
|
||||
NcvRect32u rect;
|
||||
Ncv32f scaleFactor;
|
||||
|
||||
NcvBool bTextureCache;
|
||||
|
@@ -249,7 +249,7 @@ TEST_P(ProjectPoints, Accuracy)
|
||||
|
||||
for (size_t i = 0; i < dst_gold.size(); ++i)
|
||||
{
|
||||
cv::Point2f res = h_dst.at<cv::Point2f>(0, i);
|
||||
cv::Point2f res = h_dst.at<cv::Point2f>(0, (int)i);
|
||||
cv::Point2f res_gold = dst_gold[i];
|
||||
|
||||
ASSERT_LE(cv::norm(res_gold - res) / cv::norm(res_gold), 1e-3f);
|
||||
@@ -291,7 +291,7 @@ TEST_P(SolvePnPRansac, Accuracy)
|
||||
|
||||
cv::Mat rvec, tvec;
|
||||
std::vector<int> inliers;
|
||||
cv::gpu::solvePnPRansac(object, cv::Mat(1, image_vec.size(), CV_32FC2, &image_vec[0]),
|
||||
cv::gpu::solvePnPRansac(object, cv::Mat(1, (int)image_vec.size(), CV_32FC2, &image_vec[0]),
|
||||
camera_mat, cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)),
|
||||
rvec, tvec, false, 200, 2.f, 100, &inliers);
|
||||
|
||||
|
@@ -244,7 +244,7 @@ TEST_P(PyrLKOpticalFlow, Sparse)
|
||||
cv::goodFeaturesToTrack(gray_frame, pts, 1000, 0.01, 0.0);
|
||||
|
||||
cv::gpu::GpuMat d_pts;
|
||||
cv::Mat pts_mat(1, pts.size(), CV_32FC2, (void*)&pts[0]);
|
||||
cv::Mat pts_mat(1, (int)pts.size(), CV_32FC2, (void*)&pts[0]);
|
||||
d_pts.upload(pts_mat);
|
||||
|
||||
cv::gpu::PyrLKOpticalFlow pyrLK;
|
||||
|
@@ -195,7 +195,7 @@ Mat getMat(InputArray arr)
|
||||
return arr.getMat();
|
||||
}
|
||||
|
||||
double checkNorm(InputArray m1, const InputArray m2)
|
||||
double checkNorm(InputArray m1, InputArray m2)
|
||||
{
|
||||
return norm(getMat(m1), getMat(m2), NORM_INF);
|
||||
}
|
||||
|
Reference in New Issue
Block a user