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
0c50d082
Commit
0c50d082
authored
Apr 25, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched to Input/Output Array in transpose/flip operations
parent
3d8ca010
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
17 deletions
+23
-17
gpuarithm.hpp
modules/gpuarithm/include/opencv2/gpuarithm.hpp
+6
-6
core.cpp
modules/gpuarithm/src/core.cpp
+13
-7
driver_api_multi.cpp
samples/gpu/driver_api_multi.cpp
+2
-2
multi.cpp
samples/gpu/multi.cpp
+2
-2
No files found.
modules/gpuarithm/include/opencv2/gpuarithm.hpp
View file @
0c50d082
...
@@ -170,17 +170,17 @@ CV_EXPORTS void merge(const std::vector<GpuMat>& src, OutputArray dst, Stream& s
...
@@ -170,17 +170,17 @@ CV_EXPORTS void merge(const std::vector<GpuMat>& src, OutputArray dst, Stream& s
CV_EXPORTS
void
split
(
InputArray
src
,
GpuMat
*
dst
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
split
(
InputArray
src
,
GpuMat
*
dst
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
split
(
InputArray
src
,
std
::
vector
<
GpuMat
>&
dst
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
split
(
InputArray
src
,
std
::
vector
<
GpuMat
>&
dst
,
Stream
&
stream
=
Stream
::
Null
());
//! implements generalized matrix product algorithm GEMM from BLAS
CV_EXPORTS
void
gemm
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
double
alpha
,
const
GpuMat
&
src3
,
double
beta
,
GpuMat
&
dst
,
int
flags
=
0
,
Stream
&
stream
=
Stream
::
Null
());
//! transposes the matrix
//! transposes the matrix
//! supports matrix with element size = 1, 4 and 8 bytes (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc)
//! supports matrix with element size = 1, 4 and 8 bytes (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc)
CV_EXPORTS
void
transpose
(
const
GpuMat
&
src1
,
GpuMat
&
dst
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
transpose
(
InputArray
src1
,
OutputArray
dst
,
Stream
&
stream
=
Stream
::
Null
());
//! 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 1, 3 and 4 channels images with CV_8U, CV_16U, CV_32S or CV_32F depth
//! supports 1, 3 and 4 channels images with CV_8U, CV_16U, CV_32S or CV_32F depth
CV_EXPORTS
void
flip
(
const
GpuMat
&
a
,
GpuMat
&
b
,
int
flipCode
,
Stream
&
stream
=
Stream
::
Null
());
CV_EXPORTS
void
flip
(
InputArray
src
,
OutputArray
dst
,
int
flipCode
,
Stream
&
stream
=
Stream
::
Null
());
//! implements generalized matrix product algorithm GEMM from BLAS
CV_EXPORTS
void
gemm
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
double
alpha
,
const
GpuMat
&
src3
,
double
beta
,
GpuMat
&
dst
,
int
flags
=
0
,
Stream
&
stream
=
Stream
::
Null
());
//! 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
...
...
modules/gpuarithm/src/core.cpp
View file @
0c50d082
...
@@ -53,9 +53,9 @@ void cv::gpu::merge(const std::vector<GpuMat>&, OutputArray, Stream&) { throw_no
...
@@ -53,9 +53,9 @@ void cv::gpu::merge(const std::vector<GpuMat>&, OutputArray, Stream&) { throw_no
void
cv
::
gpu
::
split
(
InputArray
,
GpuMat
*
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
split
(
InputArray
,
GpuMat
*
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
split
(
InputArray
,
std
::
vector
<
GpuMat
>&
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
split
(
InputArray
,
std
::
vector
<
GpuMat
>&
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
transpose
(
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
transpose
(
InputArray
,
OutputArray
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
flip
(
const
GpuMat
&
,
GpuMat
&
,
int
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
flip
(
InputArray
,
OutputArray
,
int
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
LUT
(
const
GpuMat
&
,
const
Mat
&
,
GpuMat
&
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
LUT
(
const
GpuMat
&
,
const
Mat
&
,
GpuMat
&
,
Stream
&
)
{
throw_no_cuda
();
}
...
@@ -182,13 +182,16 @@ namespace arithm
...
@@ -182,13 +182,16 @@ namespace arithm
template
<
typename
T
>
void
transpose
(
PtrStepSz
<
T
>
src
,
PtrStepSz
<
T
>
dst
,
cudaStream_t
stream
);
template
<
typename
T
>
void
transpose
(
PtrStepSz
<
T
>
src
,
PtrStepSz
<
T
>
dst
,
cudaStream_t
stream
);
}
}
void
cv
::
gpu
::
transpose
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
Stream
&
s
)
void
cv
::
gpu
::
transpose
(
InputArray
_src
,
OutputArray
_dst
,
Stream
&
_stream
)
{
{
GpuMat
src
=
_src
.
getGpuMat
();
CV_Assert
(
src
.
elemSize
()
==
1
||
src
.
elemSize
()
==
4
||
src
.
elemSize
()
==
8
);
CV_Assert
(
src
.
elemSize
()
==
1
||
src
.
elemSize
()
==
4
||
src
.
elemSize
()
==
8
);
dst
.
create
(
src
.
cols
,
src
.
rows
,
src
.
type
()
);
_dst
.
create
(
src
.
cols
,
src
.
rows
,
src
.
type
()
);
GpuMat
dst
=
_dst
.
getGpuMat
();
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
_stream
);
if
(
src
.
elemSize
()
==
1
)
if
(
src
.
elemSize
()
==
1
)
{
{
...
@@ -260,7 +263,7 @@ namespace
...
@@ -260,7 +263,7 @@ namespace
};
};
}
}
void
cv
::
gpu
::
flip
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
flipCode
,
Stream
&
stream
)
void
cv
::
gpu
::
flip
(
InputArray
_src
,
OutputArray
_
dst
,
int
flipCode
,
Stream
&
stream
)
{
{
typedef
void
(
*
func_t
)(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
flipCode
,
cudaStream_t
stream
);
typedef
void
(
*
func_t
)(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
flipCode
,
cudaStream_t
stream
);
static
const
func_t
funcs
[
6
][
4
]
=
static
const
func_t
funcs
[
6
][
4
]
=
...
@@ -273,10 +276,13 @@ void cv::gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode, Stream& stream)
...
@@ -273,10 +276,13 @@ void cv::gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode, Stream& stream)
{
NppMirror
<
CV_32F
,
nppiMirror_32f_C1R
>::
call
,
0
,
NppMirror
<
CV_32F
,
nppiMirror_32f_C3R
>::
call
,
NppMirror
<
CV_32F
,
nppiMirror_32f_C4R
>::
call
}
{
NppMirror
<
CV_32F
,
nppiMirror_32f_C1R
>::
call
,
0
,
NppMirror
<
CV_32F
,
nppiMirror_32f_C3R
>::
call
,
NppMirror
<
CV_32F
,
nppiMirror_32f_C4R
>::
call
}
};
};
GpuMat
src
=
_src
.
getGpuMat
();
CV_Assert
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_16U
||
src
.
depth
()
==
CV_32S
||
src
.
depth
()
==
CV_32F
);
CV_Assert
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_16U
||
src
.
depth
()
==
CV_32S
||
src
.
depth
()
==
CV_32F
);
CV_Assert
(
src
.
channels
()
==
1
||
src
.
channels
()
==
3
||
src
.
channels
()
==
4
);
CV_Assert
(
src
.
channels
()
==
1
||
src
.
channels
()
==
3
||
src
.
channels
()
==
4
);
dst
.
create
(
src
.
size
(),
src
.
type
());
_dst
.
create
(
src
.
size
(),
src
.
type
());
GpuMat
dst
=
_dst
.
getGpuMat
();
funcs
[
src
.
depth
()][
src
.
channels
()
-
1
](
src
,
dst
,
flipCode
,
StreamAccessor
::
getStream
(
stream
));
funcs
[
src
.
depth
()][
src
.
channels
()
-
1
](
src
,
dst
,
flipCode
,
StreamAccessor
::
getStream
(
stream
));
}
}
...
...
samples/gpu/driver_api_multi.cpp
View file @
0c50d082
...
@@ -130,12 +130,12 @@ void Worker::operator()(int device_id) const
...
@@ -130,12 +130,12 @@ void Worker::operator()(int device_id) const
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
0
,
1
);
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
0
,
1
);
// CPU works
// CPU works
transpose
(
src
,
dst
);
cv
::
transpose
(
src
,
dst
);
// GPU works
// GPU works
GpuMat
d_src
(
src
);
GpuMat
d_src
(
src
);
GpuMat
d_dst
;
GpuMat
d_dst
;
transpose
(
d_src
,
d_dst
);
gpu
::
transpose
(
d_src
,
d_dst
);
// Check results
// Check results
bool
passed
=
norm
(
dst
-
Mat
(
d_dst
),
NORM_INF
)
<
1e-3
;
bool
passed
=
norm
(
dst
-
Mat
(
d_dst
),
NORM_INF
)
<
1e-3
;
...
...
samples/gpu/multi.cpp
View file @
0c50d082
...
@@ -87,12 +87,12 @@ void Worker::operator()(int device_id) const
...
@@ -87,12 +87,12 @@ void Worker::operator()(int device_id) const
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
0
,
1
);
rng
.
fill
(
src
,
RNG
::
UNIFORM
,
0
,
1
);
// CPU works
// CPU works
transpose
(
src
,
dst
);
cv
::
transpose
(
src
,
dst
);
// GPU works
// GPU works
GpuMat
d_src
(
src
);
GpuMat
d_src
(
src
);
GpuMat
d_dst
;
GpuMat
d_dst
;
transpose
(
d_src
,
d_dst
);
gpu
::
transpose
(
d_src
,
d_dst
);
// Check results
// Check results
bool
passed
=
norm
(
dst
-
Mat
(
d_dst
),
NORM_INF
)
<
1e-3
;
bool
passed
=
norm
(
dst
-
Mat
(
d_dst
),
NORM_INF
)
<
1e-3
;
...
...
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