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
6c1de21a
Commit
6c1de21a
authored
Jan 22, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in gpu::transformSmart with mask
parent
cec641fb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
matrix_operations.cu
modules/core/src/cuda/matrix_operations.cu
+13
-8
gpumat.cpp
modules/core/src/gpumat.cpp
+5
-2
transform_detail.hpp
...es/gpu/src/opencv2/gpu/device/detail/transform_detail.hpp
+2
-2
No files found.
modules/core/src/cuda/matrix_operations.cu
View file @
6c1de21a
...
...
@@ -59,27 +59,32 @@ namespace cv { namespace gpu { namespace device
////////////////////////////////// CopyTo /////////////////////////////////
///////////////////////////////////////////////////////////////////////////
template <typename T> void copyToWithMask(DevMem2Db src, DevMem2Db dst,
DevMem2Db mask, int channels
, cudaStream_t stream)
template <typename T> void copyToWithMask(DevMem2Db src, DevMem2Db dst,
int cn, DevMem2Db mask, bool colorMask
, cudaStream_t stream)
{
cv::gpu::device::transform((DevMem2D_<T>)src, (DevMem2D_<T>)dst, identity<T>(), SingleMaskChannels(mask, channels), stream);
if (colorMask)
cv::gpu::device::transform((DevMem2D_<T>)src, (DevMem2D_<T>)dst, identity<T>(), SingleMask(mask), stream);
else
cv::gpu::device::transform((DevMem2D_<T>)src, (DevMem2D_<T>)dst, identity<T>(), SingleMaskChannels(mask, cn), stream);
}
void copyToWithMask_gpu(DevMem2Db src, DevMem2Db dst, int
depth, int channels, DevMem2Db m
ask, cudaStream_t stream)
void copyToWithMask_gpu(DevMem2Db src, DevMem2Db dst, int
elemSize1, int cn, DevMem2Db mask, bool colorM
ask, cudaStream_t stream)
{
typedef void (*func_t)(DevMem2Db src, DevMem2Db dst,
DevMem2Db mask, int channels
, cudaStream_t stream);
typedef void (*func_t)(DevMem2Db src, DevMem2Db dst,
int cn, DevMem2Db mask, bool colorMask
, cudaStream_t stream);
static func_t tab[] =
{
0,
copyToWithMask<unsigned char>,
copyToWithMask<signed char>,
copyToWithMask<unsigned short>,
copyToWithMask<short>
,
0
,
copyToWithMask<int>,
copyToWithMask<float>,
0,
0,
0,
copyToWithMask<double>
};
tab[
depth](src, dst, mask, channels
, stream);
tab[
elemSize1](src, dst, cn, mask, colorMask
, stream);
}
///////////////////////////////////////////////////////////////////////////
...
...
modules/core/src/gpumat.cpp
View file @
6c1de21a
...
...
@@ -348,7 +348,7 @@ namespace
namespace
cv
{
namespace
gpu
{
namespace
device
{
void
copyToWithMask_gpu
(
DevMem2Db
src
,
DevMem2Db
dst
,
int
depth
,
int
channels
,
DevMem2Db
m
ask
,
cudaStream_t
stream
);
void
copyToWithMask_gpu
(
DevMem2Db
src
,
DevMem2Db
dst
,
int
elemSize1
,
int
cn
,
DevMem2Db
mask
,
bool
colorM
ask
,
cudaStream_t
stream
);
template
<
typename
T
>
void
set_to_gpu
(
DevMem2Db
mat
,
const
T
*
scalar
,
int
channels
,
cudaStream_t
stream
);
...
...
@@ -405,7 +405,10 @@ namespace cv { namespace gpu
{
CV_EXPORTS
void
copyWithMask
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
mask
,
cudaStream_t
stream
=
0
)
{
cv
::
gpu
::
device
::
copyToWithMask_gpu
(
src
.
reshape
(
1
),
dst
.
reshape
(
1
),
src
.
depth
(),
src
.
channels
(),
mask
,
stream
);
CV_Assert
(
src
.
size
()
==
dst
.
size
()
&&
src
.
type
()
==
dst
.
type
());
CV_Assert
(
src
.
size
()
==
mask
.
size
()
&&
mask
.
depth
()
==
CV_8U
&&
(
mask
.
channels
()
==
1
||
mask
.
channels
()
==
src
.
channels
()));
cv
::
gpu
::
device
::
copyToWithMask_gpu
(
src
.
reshape
(
1
),
dst
.
reshape
(
1
),
src
.
elemSize1
(),
src
.
channels
(),
mask
.
reshape
(
1
),
mask
.
channels
()
!=
1
,
stream
);
}
CV_EXPORTS
void
convertTo
(
const
GpuMat
&
src
,
GpuMat
&
dst
)
...
...
modules/gpu/src/opencv2/gpu/device/detail/transform_detail.hpp
View file @
6c1de21a
...
...
@@ -221,7 +221,7 @@ namespace cv { namespace gpu { namespace device
if
(
x_shifted
+
ft
::
smart_shift
-
1
<
src_
.
cols
)
{
const
read_type
src_n_el
=
((
const
read_type
*
)
src
)[
x
];
write_type
dst_n_el
;
write_type
dst_n_el
=
((
const
write_type
*
)
dst
)[
x
]
;
OpUnroller
<
ft
::
smart_shift
>::
unroll
(
src_n_el
,
dst_n_el
,
mask
,
op
,
x_shifted
,
y
);
...
...
@@ -273,7 +273,7 @@ namespace cv { namespace gpu { namespace device
{
const
read_type1
src1_n_el
=
((
const
read_type1
*
)
src1
)[
x
];
const
read_type2
src2_n_el
=
((
const
read_type2
*
)
src2
)[
x
];
write_type
dst_n_el
;
write_type
dst_n_el
=
((
const
write_type
*
)
dst
)[
x
]
;
OpUnroller
<
ft
::
smart_shift
>::
unroll
(
src1_n_el
,
src2_n_el
,
dst_n_el
,
mask
,
op
,
x_shifted
,
y
);
...
...
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