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
98c8ecf8
Commit
98c8ecf8
authored
Jul 22, 2010
by
Andrey Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified kernel setto(), added double type, code has been improved
parent
3f5dd5f1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
110 deletions
+18
-110
cuda_shared.hpp
modules/gpu/src/cuda/cuda_shared.hpp
+2
-2
matrix_operations.cu
modules/gpu/src/cuda/matrix_operations.cu
+0
-0
matrix_operations.cpp
modules/gpu/src/matrix_operations.cpp
+4
-4
operator_set_to.cpp
tests/gpu/src/operator_set_to.cpp
+12
-104
No files found.
modules/gpu/src/cuda/cuda_shared.hpp
View file @
98c8ecf8
...
...
@@ -61,8 +61,8 @@ namespace cv
{
static
inline
int
divUp
(
int
a
,
int
b
)
{
return
(
a
%
b
==
0
)
?
a
/
b
:
a
/
b
+
1
;
}
extern
"C"
void
set_to_without_mask
(
const
DevMem2D
&
mat
,
const
double
*
scalar
,
int
depth
,
int
channels
);
extern
"C"
void
set_to_with_mask
(
const
DevMem2D
&
mat
,
const
double
*
scalar
,
const
DevMem2D
&
mask
,
int
depth
,
int
channels
);
extern
"C"
void
set_to_without_mask
(
const
DevMem2D
&
mat
,
int
depth
,
const
double
*
scalar
,
int
channels
);
extern
"C"
void
set_to_with_mask
(
const
DevMem2D
&
mat
,
int
depth
,
const
double
*
scalar
,
const
DevMem2D
&
mask
,
int
channels
);
extern
"C"
void
convert_to
(
const
DevMem2D
&
src
,
int
sdepth
,
DevMem2D
dst
,
int
ddepth
,
size_t
width
,
size_t
height
,
double
alpha
,
double
beta
);
}
...
...
modules/gpu/src/cuda/matrix_operations.cu
View file @
98c8ecf8
This diff is collapsed.
Click to expand it.
modules/gpu/src/matrix_operations.cpp
View file @
98c8ecf8
...
...
@@ -126,14 +126,14 @@ void cv::gpu::GpuMat::convertTo( GpuMat& dst, int rtype, double alpha, double be
const
GpuMat
*
psrc
=
this
;
if
(
sdepth
!=
ddepth
&&
psrc
==
&
dst
)
psrc
=
&
(
temp
=
*
this
);
dst
.
create
(
size
(),
rtype
);
impl
::
convert_to
(
*
psrc
,
sdepth
,
dst
,
ddepth
,
psrc
->
cols
*
psrc
->
channels
(),
psrc
->
rows
,
alpha
,
beta
);
}
GpuMat
&
GpuMat
::
operator
=
(
const
Scalar
&
s
)
{
cv
::
gpu
::
impl
::
set_to_without_mask
(
*
this
,
s
.
val
,
this
->
elemSize1
()
,
this
->
channels
());
cv
::
gpu
::
impl
::
set_to_without_mask
(
*
this
,
this
->
depth
(),
s
.
val
,
this
->
channels
());
return
*
this
;
}
...
...
@@ -145,11 +145,11 @@ GpuMat& GpuMat::setTo(const Scalar& s, const GpuMat& mask)
if
(
mask
.
empty
())
{
cv
::
gpu
::
impl
::
set_to_without_mask
(
*
this
,
s
.
val
,
this
->
elemSize1
()
,
this
->
channels
());
cv
::
gpu
::
impl
::
set_to_without_mask
(
*
this
,
this
->
depth
(),
s
.
val
,
this
->
channels
());
}
else
{
cv
::
gpu
::
impl
::
set_to_with_mask
(
*
this
,
s
.
val
,
mask
,
this
->
elemSize1
()
,
this
->
channels
());
cv
::
gpu
::
impl
::
set_to_with_mask
(
*
this
,
this
->
depth
(),
s
.
val
,
mask
,
this
->
channels
());
}
return
*
this
;
...
...
tests/gpu/src/operator_set_to.cpp
View file @
98c8ecf8
...
...
@@ -24,19 +24,6 @@ class CV_GpuMatOpSetTo : public CvTest
bool
compare_matrix
(
cv
::
Mat
&
cpumat
,
gpu
::
GpuMat
&
gpumat
);
bool
test_cv_8u_c1
();
bool
test_cv_8u_c2
();
bool
test_cv_8u_c3
();
bool
test_cv_8u_c4
();
bool
test_cv_16u_c4
();
bool
test_cv_32f_c1
();
bool
test_cv_32f_c2
();
bool
test_cv_32f_c3
();
bool
test_cv_32f_c4
();
private
:
int
rows
;
int
cols
;
...
...
@@ -45,13 +32,13 @@ class CV_GpuMatOpSetTo : public CvTest
CV_GpuMatOpSetTo
::
CV_GpuMatOpSetTo
()
:
CvTest
(
"GpuMatOperatorSetTo"
,
"setTo"
)
{
rows
=
129
;
cols
=
12
7
;
rows
=
256
;
cols
=
12
4
;
s
.
val
[
0
]
=
12
8
.0
;
s
.
val
[
1
]
=
12
8
.0
;
s
.
val
[
2
]
=
12
8
.0
;
s
.
val
[
3
]
=
12
8
.0
;
s
.
val
[
0
]
=
12
7
.0
;
s
.
val
[
1
]
=
12
7
.0
;
s
.
val
[
2
]
=
12
7
.0
;
s
.
val
[
3
]
=
12
7
.0
;
//#define PRINT_MATRIX
}
...
...
@@ -99,95 +86,16 @@ bool CV_GpuMatOpSetTo::compare_matrix(cv::Mat & cpumat, gpu::GpuMat & gpumat)
}
}
bool
CV_GpuMatOpSetTo
::
test_cv_8u_c1
()
{
Mat
cpumat
(
rows
,
cols
,
CV_8U
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_8u_c2
()
{
Mat
cpumat
(
rows
,
cols
,
CV_8UC2
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_8u_c3
()
{
Mat
cpumat
(
rows
,
cols
,
CV_8UC3
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_8u_c4
()
{
Mat
cpumat
(
rows
,
cols
,
CV_8UC4
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_16u_c4
()
{
Mat
cpumat
(
rows
,
cols
,
CV_16UC4
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_32f_c1
()
{
Mat
cpumat
(
rows
,
cols
,
CV_32F
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_32f_c2
()
{
Mat
cpumat
(
rows
,
cols
,
CV_32FC2
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_32f_c3
()
{
Mat
cpumat
(
rows
,
cols
,
CV_32FC3
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
bool
CV_GpuMatOpSetTo
::
test_cv_32f_c4
()
{
Mat
cpumat
(
rows
,
cols
,
CV_32FC4
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
return
compare_matrix
(
cpumat
,
gpumat
);
}
void
CV_GpuMatOpSetTo
::
run
(
int
/* start_from */
)
{
bool
is_test_good
=
true
;
is_test_good
&=
test_cv_8u_c1
();
is_test_good
&=
test_cv_8u_c2
();
is_test_good
&=
test_cv_8u_c3
();
is_test_good
&=
test_cv_8u_c4
();
is_test_good
&=
test_cv_16u_c4
();
is_test_good
&=
test_cv_32f_c1
();
is_test_good
&=
test_cv_32f_c2
();
is_test_good
&=
test_cv_32f_c3
();
is_test_good
&=
test_cv_32f_c4
();
for
(
int
i
=
0
;
i
<
7
;
i
++
)
{
Mat
cpumat
(
rows
,
cols
,
i
,
Scalar
::
all
(
0
));
GpuMat
gpumat
(
cpumat
);
is_test_good
&=
compare_matrix
(
cpumat
,
gpumat
);
}
if
(
is_test_good
==
true
)
ts
->
set_failed_test_info
(
CvTS
::
OK
);
...
...
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