Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
df852937
Commit
df852937
authored
Dec 20, 2010
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: moved gpu reduction-based functions into separated file
parent
1922e50f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
346 additions
and
75 deletions
+346
-75
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+74
-71
arithm.cpp
modules/gpu/src/arithm.cpp
+0
-0
element_operations.cu
modules/gpu/src/cuda/element_operations.cu
+123
-0
mathfunc.cu
modules/gpu/src/cuda/mathfunc.cu
+0
-0
matrix_reductions.cu
modules/gpu/src/cuda/matrix_reductions.cu
+0
-0
element_operations.cpp
modules/gpu/src/element_operations.cpp
+149
-4
matrix_reductions.cpp
modules/gpu/src/matrix_reductions.cpp
+0
-0
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
df852937
...
@@ -360,66 +360,17 @@ namespace cv
...
@@ -360,66 +360,17 @@ namespace cv
friend
struct
StreamAccessor
;
friend
struct
StreamAccessor
;
};
};
////////////////////////////// Arithmetics ///////////////////////////////////
////////////////////////////// Arithmetics ///////////////////////////////////
//! transposes the matrix
//! transposes the matrix
//! supports CV_8UC1, CV_8SC1, CV_8UC4, CV_8SC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32FC1 type
//! supports CV_8UC1, CV_8SC1, CV_8UC4, CV_8SC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32FC1 type
CV_EXPORTS
void
transpose
(
const
GpuMat
&
src1
,
GpuMat
&
dst
);
CV_EXPORTS
void
transpose
(
const
GpuMat
&
src1
,
GpuMat
&
dst
);
//! computes mean value and standard deviation of all or selected array elements
//! supports only CV_8UC1 type
CV_EXPORTS
void
meanStdDev
(
const
GpuMat
&
mtx
,
Scalar
&
mean
,
Scalar
&
stddev
);
//! computes norm of array
//! supports NORM_INF, NORM_L1, NORM_L2
//! supports only CV_8UC1 type
CV_EXPORTS
double
norm
(
const
GpuMat
&
src1
,
int
normType
=
NORM_L2
);
//! computes norm of the difference between two arrays
//! supports NORM_INF, NORM_L1, NORM_L2
//! supports only CV_8UC1 type
CV_EXPORTS
double
norm
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
int
normType
=
NORM_L2
);
//! reverses the order of the rows, columns or both in a matrix
//! reverses the order of the rows, columns or both in a matrix
//! supports CV_8UC1, CV_8UC4 types
//! supports CV_8UC1, CV_8UC4 types
CV_EXPORTS
void
flip
(
const
GpuMat
&
a
,
GpuMat
&
b
,
int
flipCode
);
CV_EXPORTS
void
flip
(
const
GpuMat
&
a
,
GpuMat
&
b
,
int
flipCode
);
//! computes sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sum
(
const
GpuMat
&
src
);
//! computes sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sum
(
const
GpuMat
&
src
,
GpuMat
&
buf
);
//! computes squared sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sqrSum
(
const
GpuMat
&
src
);
//! computes squared sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sqrSum
(
const
GpuMat
&
src
,
GpuMat
&
buf
);
//! finds global minimum and maximum array elements and returns their values
CV_EXPORTS
void
minMax
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
=
0
,
const
GpuMat
&
mask
=
GpuMat
());
//! finds global minimum and maximum array elements and returns their values
CV_EXPORTS
void
minMax
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
,
const
GpuMat
&
mask
,
GpuMat
&
buf
);
//! finds global minimum and maximum array elements and returns their values with locations
CV_EXPORTS
void
minMaxLoc
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
=
0
,
Point
*
minLoc
=
0
,
Point
*
maxLoc
=
0
,
const
GpuMat
&
mask
=
GpuMat
());
//! finds global minimum and maximum array elements and returns their values with locations
CV_EXPORTS
void
minMaxLoc
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
,
Point
*
minLoc
,
Point
*
maxLoc
,
const
GpuMat
&
mask
,
GpuMat
&
valbuf
,
GpuMat
&
locbuf
);
//! counts non-zero array elements
CV_EXPORTS
int
countNonZero
(
const
GpuMat
&
src
);
//! counts non-zero array elements
CV_EXPORTS
int
countNonZero
(
const
GpuMat
&
src
,
GpuMat
&
buf
);
//! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))
//! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))
//! destination array will have the depth type as lut and the same channels number as source
//! destination array will have the depth type as lut and the same channels number as source
//! supports CV_8UC1, CV_8UC3 types
//! supports CV_8UC1, CV_8UC3 types
...
@@ -487,25 +438,6 @@ namespace cv
...
@@ -487,25 +438,6 @@ namespace cv
//! async version
//! async version
CV_EXPORTS
void
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
,
const
Stream
&
stream
);
CV_EXPORTS
void
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
,
const
Stream
&
stream
);
//! computes per-element minimum of two arrays (dst = min(src1, src2))
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//! computes per-element minimum of array and scalar (dst = min(src1, src2))
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//! computes per-element maximum of two arrays (dst = max(src1, src2))
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//! computes per-element maximum of array and scalar (dst = max(src1, src2))
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//////////////////////////// Per-element operations ////////////////////////////////////
//////////////////////////// Per-element operations ////////////////////////////////////
...
@@ -576,6 +508,26 @@ namespace cv
...
@@ -576,6 +508,26 @@ namespace cv
//! async version
//! async version
CV_EXPORTS
void
bitwise_xor
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
const
Stream
&
stream
);
CV_EXPORTS
void
bitwise_xor
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
const
Stream
&
stream
);
//! computes per-element minimum of two arrays (dst = min(src1, src2))
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//! computes per-element minimum of array and scalar (dst = min(src1, src2))
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
min
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//! computes per-element maximum of two arrays (dst = max(src1, src2))
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
//! computes per-element maximum of array and scalar (dst = max(src1, src2))
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
);
//! Async version
CV_EXPORTS
void
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
);
////////////////////////////// Image processing //////////////////////////////
////////////////////////////// Image processing //////////////////////////////
...
@@ -663,15 +615,66 @@ namespace cv
...
@@ -663,15 +615,66 @@ namespace cv
//! computes Harris cornerness criteria at each image pixel
//! computes Harris cornerness criteria at each image pixel
CV_EXPORTS
void
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
void
cornerHarris
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
double
k
,
int
borderType
=
BORDER_REFLECT101
);
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
CV_EXPORTS
void
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
int
borderType
=
BORDER_REFLECT101
);
CV_EXPORTS
void
cornerMinEigenVal
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
blockSize
,
int
ksize
,
int
borderType
=
BORDER_REFLECT101
);
//! computes the proximity map for the raster template and the image where the template is searched for
//! computes the proximity map for the raster template and the image where the template is searched for
CV_EXPORTS
void
matchTemplate
(
const
GpuMat
&
image
,
const
GpuMat
&
templ
,
GpuMat
&
result
,
int
method
);
CV_EXPORTS
void
matchTemplate
(
const
GpuMat
&
image
,
const
GpuMat
&
templ
,
GpuMat
&
result
,
int
method
);
////////////////////////////// Matrix reductions //////////////////////////////
//! computes mean value and standard deviation of all or selected array elements
//! supports only CV_8UC1 type
CV_EXPORTS
void
meanStdDev
(
const
GpuMat
&
mtx
,
Scalar
&
mean
,
Scalar
&
stddev
);
//! computes norm of array
//! supports NORM_INF, NORM_L1, NORM_L2
//! supports only CV_8UC1 type
CV_EXPORTS
double
norm
(
const
GpuMat
&
src1
,
int
normType
=
NORM_L2
);
//! computes norm of the difference between two arrays
//! supports NORM_INF, NORM_L1, NORM_L2
//! supports only CV_8UC1 type
CV_EXPORTS
double
norm
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
int
normType
=
NORM_L2
);
//! computes sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sum
(
const
GpuMat
&
src
);
//! computes sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sum
(
const
GpuMat
&
src
,
GpuMat
&
buf
);
//! computes squared sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sqrSum
(
const
GpuMat
&
src
);
//! computes squared sum of array elements
//! supports only single channel images
CV_EXPORTS
Scalar
sqrSum
(
const
GpuMat
&
src
,
GpuMat
&
buf
);
//! finds global minimum and maximum array elements and returns their values
CV_EXPORTS
void
minMax
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
=
0
,
const
GpuMat
&
mask
=
GpuMat
());
//! finds global minimum and maximum array elements and returns their values
CV_EXPORTS
void
minMax
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
,
const
GpuMat
&
mask
,
GpuMat
&
buf
);
//! finds global minimum and maximum array elements and returns their values with locations
CV_EXPORTS
void
minMaxLoc
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
=
0
,
Point
*
minLoc
=
0
,
Point
*
maxLoc
=
0
,
const
GpuMat
&
mask
=
GpuMat
());
//! finds global minimum and maximum array elements and returns their values with locations
CV_EXPORTS
void
minMaxLoc
(
const
GpuMat
&
src
,
double
*
minVal
,
double
*
maxVal
,
Point
*
minLoc
,
Point
*
maxLoc
,
const
GpuMat
&
mask
,
GpuMat
&
valbuf
,
GpuMat
&
locbuf
);
//! counts non-zero array elements
CV_EXPORTS
int
countNonZero
(
const
GpuMat
&
src
);
//! counts non-zero array elements
CV_EXPORTS
int
countNonZero
(
const
GpuMat
&
src
,
GpuMat
&
buf
);
//////////////////////////////// Filter Engine ////////////////////////////////
//////////////////////////////// Filter Engine ////////////////////////////////
/*!
/*!
...
...
modules/gpu/src/arithm.cpp
View file @
df852937
This diff is collapsed.
Click to expand it.
modules/gpu/src/cuda/element_operations.cu
View file @
df852937
...
@@ -345,4 +345,127 @@ namespace cv { namespace gpu { namespace mathfunc
...
@@ -345,4 +345,127 @@ namespace cv { namespace gpu { namespace mathfunc
template void bitwiseMaskXorCaller<ushort>(int, int, int, const PtrStep, const PtrStep, const PtrStep, PtrStep, cudaStream_t);
template void bitwiseMaskXorCaller<ushort>(int, int, int, const PtrStep, const PtrStep, const PtrStep, PtrStep, cudaStream_t);
template void bitwiseMaskXorCaller<uint>(int, int, int, const PtrStep, const PtrStep, const PtrStep, PtrStep, cudaStream_t);
template void bitwiseMaskXorCaller<uint>(int, int, int, const PtrStep, const PtrStep, const PtrStep, PtrStep, cudaStream_t);
//////////////////////////////////////////////////////////////////////////
// min/max
struct MinOp
{
template <typename T>
__device__ T operator()(T a, T b)
{
return min(a, b);
}
__device__ float operator()(float a, float b)
{
return fmin(a, b);
}
__device__ double operator()(double a, double b)
{
return fmin(a, b);
}
};
struct MaxOp
{
template <typename T>
__device__ T operator()(T a, T b)
{
return max(a, b);
}
__device__ float operator()(float a, float b)
{
return fmax(a, b);
}
__device__ double operator()(double a, double b)
{
return fmax(a, b);
}
};
struct ScalarMinOp
{
double s;
explicit ScalarMinOp(double s_) : s(s_) {}
template <typename T>
__device__ T operator()(T a)
{
return saturate_cast<T>(fmin((double)a, s));
}
};
struct ScalarMaxOp
{
double s;
explicit ScalarMaxOp(double s_) : s(s_) {}
template <typename T>
__device__ T operator()(T a)
{
return saturate_cast<T>(fmax((double)a, s));
}
};
template <typename T>
void min_gpu(const DevMem2D_<T>& src1, const DevMem2D_<T>& src2, const DevMem2D_<T>& dst, cudaStream_t stream)
{
MinOp op;
transform(src1, src2, dst, op, stream);
}
template void min_gpu<uchar >(const DevMem2D& src1, const DevMem2D& src2, const DevMem2D& dst, cudaStream_t stream);
template void min_gpu<char >(const DevMem2D_<char>& src1, const DevMem2D_<char>& src2, const DevMem2D_<char>& dst, cudaStream_t stream);
template void min_gpu<ushort>(const DevMem2D_<ushort>& src1, const DevMem2D_<ushort>& src2, const DevMem2D_<ushort>& dst, cudaStream_t stream);
template void min_gpu<short >(const DevMem2D_<short>& src1, const DevMem2D_<short>& src2, const DevMem2D_<short>& dst, cudaStream_t stream);
template void min_gpu<int >(const DevMem2D_<int>& src1, const DevMem2D_<int>& src2, const DevMem2D_<int>& dst, cudaStream_t stream);
template void min_gpu<float >(const DevMem2D_<float>& src1, const DevMem2D_<float>& src2, const DevMem2D_<float>& dst, cudaStream_t stream);
template void min_gpu<double>(const DevMem2D_<double>& src1, const DevMem2D_<double>& src2, const DevMem2D_<double>& dst, cudaStream_t stream);
template <typename T>
void max_gpu(const DevMem2D_<T>& src1, const DevMem2D_<T>& src2, const DevMem2D_<T>& dst, cudaStream_t stream)
{
MaxOp op;
transform(src1, src2, dst, op, stream);
}
template void max_gpu<uchar >(const DevMem2D& src1, const DevMem2D& src2, const DevMem2D& dst, cudaStream_t stream);
template void max_gpu<char >(const DevMem2D_<char>& src1, const DevMem2D_<char>& src2, const DevMem2D_<char>& dst, cudaStream_t stream);
template void max_gpu<ushort>(const DevMem2D_<ushort>& src1, const DevMem2D_<ushort>& src2, const DevMem2D_<ushort>& dst, cudaStream_t stream);
template void max_gpu<short >(const DevMem2D_<short>& src1, const DevMem2D_<short>& src2, const DevMem2D_<short>& dst, cudaStream_t stream);
template void max_gpu<int >(const DevMem2D_<int>& src1, const DevMem2D_<int>& src2, const DevMem2D_<int>& dst, cudaStream_t stream);
template void max_gpu<float >(const DevMem2D_<float>& src1, const DevMem2D_<float>& src2, const DevMem2D_<float>& dst, cudaStream_t stream);
template void max_gpu<double>(const DevMem2D_<double>& src1, const DevMem2D_<double>& src2, const DevMem2D_<double>& dst, cudaStream_t stream);
template <typename T>
void min_gpu(const DevMem2D_<T>& src1, double src2, const DevMem2D_<T>& dst, cudaStream_t stream)
{
ScalarMinOp op(src2);
transform(src1, dst, op, stream);
}
template void min_gpu<uchar >(const DevMem2D& src1, double src2, const DevMem2D& dst, cudaStream_t stream);
template void min_gpu<char >(const DevMem2D_<char>& src1, double src2, const DevMem2D_<char>& dst, cudaStream_t stream);
template void min_gpu<ushort>(const DevMem2D_<ushort>& src1, double src2, const DevMem2D_<ushort>& dst, cudaStream_t stream);
template void min_gpu<short >(const DevMem2D_<short>& src1, double src2, const DevMem2D_<short>& dst, cudaStream_t stream);
template void min_gpu<int >(const DevMem2D_<int>& src1, double src2, const DevMem2D_<int>& dst, cudaStream_t stream);
template void min_gpu<float >(const DevMem2D_<float>& src1, double src2, const DevMem2D_<float>& dst, cudaStream_t stream);
template void min_gpu<double>(const DevMem2D_<double>& src1, double src2, const DevMem2D_<double>& dst, cudaStream_t stream);
template <typename T>
void max_gpu(const DevMem2D_<T>& src1, double src2, const DevMem2D_<T>& dst, cudaStream_t stream)
{
ScalarMaxOp op(src2);
transform(src1, dst, op, stream);
}
template void max_gpu<uchar >(const DevMem2D& src1, double src2, const DevMem2D& dst, cudaStream_t stream);
template void max_gpu<char >(const DevMem2D_<char>& src1, double src2, const DevMem2D_<char>& dst, cudaStream_t stream);
template void max_gpu<ushort>(const DevMem2D_<ushort>& src1, double src2, const DevMem2D_<ushort>& dst, cudaStream_t stream);
template void max_gpu<short >(const DevMem2D_<short>& src1, double src2, const DevMem2D_<short>& dst, cudaStream_t stream);
template void max_gpu<int >(const DevMem2D_<int>& src1, double src2, const DevMem2D_<int>& dst, cudaStream_t stream);
template void max_gpu<float >(const DevMem2D_<float>& src1, double src2, const DevMem2D_<float>& dst, cudaStream_t stream);
template void max_gpu<double>(const DevMem2D_<double>& src1, double src2, const DevMem2D_<double>& dst, cudaStream_t stream);
}}}
}}}
modules/gpu/src/cuda/mathfunc.cu
View file @
df852937
This diff is collapsed.
Click to expand it.
modules/gpu/src/cuda/matrix_reductions.cu
View file @
df852937
This diff is collapsed.
Click to expand it.
modules/gpu/src/element_operations.cpp
View file @
df852937
...
@@ -66,10 +66,14 @@ void cv::gpu::bitwise_and(const GpuMat&, const GpuMat&, GpuMat&, const GpuMat&)
...
@@ -66,10 +66,14 @@ void cv::gpu::bitwise_and(const GpuMat&, const GpuMat&, GpuMat&, const GpuMat&)
void
cv
::
gpu
::
bitwise_and
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_and
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_xor
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_xor
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_xor
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
bitwise_xor
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
cv
::
gpu
::
GpuMat
cv
::
gpu
::
operator
~
(
const
GpuMat
&
)
{
throw_nogpu
();
return
GpuMat
();
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
)
{
throw_nogpu
();
}
cv
::
gpu
::
GpuMat
cv
::
gpu
::
operator
|
(
const
GpuMat
&
,
const
GpuMat
&
)
{
throw_nogpu
();
return
GpuMat
();
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
cv
::
gpu
::
GpuMat
cv
::
gpu
::
operator
&
(
const
GpuMat
&
,
const
GpuMat
&
)
{
throw_nogpu
();
return
GpuMat
();
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
,
double
,
GpuMat
&
)
{
throw_nogpu
();
}
cv
::
gpu
::
GpuMat
cv
::
gpu
::
operator
^
(
const
GpuMat
&
,
const
GpuMat
&
)
{
throw_nogpu
();
return
GpuMat
();
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
,
double
,
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
,
double
,
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
,
double
,
GpuMat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
#else
#else
...
@@ -574,4 +578,144 @@ void cv::gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
...
@@ -574,4 +578,144 @@ void cv::gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
::
bitwiseXorCaller
(
src1
,
src2
,
dst
,
mask
,
StreamAccessor
::
getStream
(
stream
));
::
bitwiseXorCaller
(
src1
,
src2
,
dst
,
mask
,
StreamAccessor
::
getStream
(
stream
));
}
}
//////////////////////////////////////////////////////////////////////////////
// Minimum and maximum operations
namespace
cv
{
namespace
gpu
{
namespace
mathfunc
{
template
<
typename
T
>
void
min_gpu
(
const
DevMem2D_
<
T
>&
src1
,
const
DevMem2D_
<
T
>&
src2
,
const
DevMem2D_
<
T
>&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
max_gpu
(
const
DevMem2D_
<
T
>&
src1
,
const
DevMem2D_
<
T
>&
src2
,
const
DevMem2D_
<
T
>&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
min_gpu
(
const
DevMem2D_
<
T
>&
src1
,
double
src2
,
const
DevMem2D_
<
T
>&
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
max_gpu
(
const
DevMem2D_
<
T
>&
src1
,
double
src2
,
const
DevMem2D_
<
T
>&
dst
,
cudaStream_t
stream
);
}}}
namespace
{
template
<
typename
T
>
void
min_caller
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
)
{
CV_Assert
(
src1
.
size
()
==
src2
.
size
()
&&
src1
.
type
()
==
src2
.
type
());
dst
.
create
(
src1
.
size
(),
src1
.
type
());
mathfunc
::
min_gpu
<
T
>
(
src1
.
reshape
(
1
),
src2
.
reshape
(
1
),
dst
.
reshape
(
1
),
stream
);
}
template
<
typename
T
>
void
min_caller
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
)
{
dst
.
create
(
src1
.
size
(),
src1
.
type
());
mathfunc
::
min_gpu
<
T
>
(
src1
.
reshape
(
1
),
src2
,
dst
.
reshape
(
1
),
stream
);
}
template
<
typename
T
>
void
max_caller
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
)
{
CV_Assert
(
src1
.
size
()
==
src2
.
size
()
&&
src1
.
type
()
==
src2
.
type
());
dst
.
create
(
src1
.
size
(),
src1
.
type
());
mathfunc
::
max_gpu
<
T
>
(
src1
.
reshape
(
1
),
src2
.
reshape
(
1
),
dst
.
reshape
(
1
),
stream
);
}
template
<
typename
T
>
void
max_caller
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
)
{
dst
.
create
(
src1
.
size
(),
src1
.
type
());
mathfunc
::
max_gpu
<
T
>
(
src1
.
reshape
(
1
),
src2
,
dst
.
reshape
(
1
),
stream
);
}
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
min_caller
<
uchar
>
,
min_caller
<
char
>
,
min_caller
<
ushort
>
,
min_caller
<
short
>
,
min_caller
<
int
>
,
min_caller
<
float
>
,
min_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
0
);
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
min_caller
<
uchar
>
,
min_caller
<
char
>
,
min_caller
<
ushort
>
,
min_caller
<
short
>
,
min_caller
<
int
>
,
min_caller
<
float
>
,
min_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
min_caller
<
uchar
>
,
min_caller
<
char
>
,
min_caller
<
ushort
>
,
min_caller
<
short
>
,
min_caller
<
int
>
,
min_caller
<
float
>
,
min_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
0
);
}
void
cv
::
gpu
::
min
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
min_caller
<
uchar
>
,
min_caller
<
char
>
,
min_caller
<
ushort
>
,
min_caller
<
short
>
,
min_caller
<
int
>
,
min_caller
<
float
>
,
min_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
max_caller
<
uchar
>
,
max_caller
<
char
>
,
max_caller
<
ushort
>
,
max_caller
<
short
>
,
max_caller
<
int
>
,
max_caller
<
float
>
,
max_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
0
);
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
max_caller
<
uchar
>
,
max_caller
<
char
>
,
max_caller
<
ushort
>
,
max_caller
<
short
>
,
max_caller
<
int
>
,
max_caller
<
float
>
,
max_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
max_caller
<
uchar
>
,
max_caller
<
char
>
,
max_caller
<
ushort
>
,
max_caller
<
short
>
,
max_caller
<
int
>
,
max_caller
<
float
>
,
max_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
0
);
}
void
cv
::
gpu
::
max
(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
const
Stream
&
stream
)
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src1
,
double
src2
,
GpuMat
&
dst
,
cudaStream_t
stream
);
static
const
func_t
funcs
[]
=
{
max_caller
<
uchar
>
,
max_caller
<
char
>
,
max_caller
<
ushort
>
,
max_caller
<
short
>
,
max_caller
<
int
>
,
max_caller
<
float
>
,
max_caller
<
double
>
};
funcs
[
src1
.
depth
()](
src1
,
src2
,
dst
,
StreamAccessor
::
getStream
(
stream
));
}
#endif
#endif
\ No newline at end of file
modules/gpu/src/matrix_reductions.cpp
View file @
df852937
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment