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
e7e00201
Commit
e7e00201
authored
May 02, 2014
by
Ievgen Khvedchenia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabled parallel processing of the nld_step_scalar function
parent
9fc90f40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
12 deletions
+43
-12
nldiffusion_functions.cpp
modules/features2d/src/kaze/nldiffusion_functions.cpp
+43
-12
No files found.
modules/features2d/src/kaze/nldiffusion_functions.cpp
View file @
e7e00201
...
...
@@ -290,6 +290,48 @@ namespace cv {
}
}
class
Nld_Step_Scalar_Invoker
:
public
cv
::
ParallelLoopBody
{
public
:
Nld_Step_Scalar_Invoker
(
cv
::
Mat
&
Ld
,
const
cv
::
Mat
&
c
,
cv
::
Mat
&
Lstep
,
float
_stepsize
)
:
_Ld
(
&
Ld
)
,
_c
(
&
c
)
,
_Lstep
(
&
Lstep
)
,
stepsize
(
_stepsize
)
{
}
virtual
~
Nld_Step_Scalar_Invoker
()
{
}
void
operator
()(
const
cv
::
Range
&
range
)
const
{
cv
::
Mat
&
Ld
=
*
_Ld
;
const
cv
::
Mat
&
c
=
*
_c
;
cv
::
Mat
&
Lstep
=
*
_Lstep
;
for
(
int
i
=
range
.
start
;
i
<
range
.
end
;
i
++
)
{
for
(
int
j
=
1
;
j
<
Lstep
.
cols
-
1
;
j
++
)
{
float
xpos
=
((
*
(
c
.
ptr
<
float
>
(
i
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
i
)
+
j
+
1
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
+
1
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
)));
float
xneg
=
((
*
(
c
.
ptr
<
float
>
(
i
)
+
j
-
1
))
+
(
*
(
c
.
ptr
<
float
>
(
i
)
+
j
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
-
1
)));
float
ypos
=
((
*
(
c
.
ptr
<
float
>
(
i
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
i
+
1
)
+
j
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
+
1
)
+
j
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
)));
float
yneg
=
((
*
(
c
.
ptr
<
float
>
(
i
-
1
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
i
)
+
j
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
-
1
)
+
j
)));
*
(
Lstep
.
ptr
<
float
>
(
i
)
+
j
)
=
0.5
f
*
stepsize
*
(
xpos
-
xneg
+
ypos
-
yneg
);
}
}
}
private
:
cv
::
Mat
*
_Ld
;
const
cv
::
Mat
*
_c
;
cv
::
Mat
*
_Lstep
;
float
stepsize
;
};
/* ************************************************************************* */
/**
* @brief This function performs a scalar non-linear diffusion step
...
...
@@ -303,18 +345,7 @@ namespace cv {
*/
void
nld_step_scalar
(
cv
::
Mat
&
Ld
,
const
cv
::
Mat
&
c
,
cv
::
Mat
&
Lstep
,
float
stepsize
)
{
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic)
#endif
for
(
int
i
=
1
;
i
<
Lstep
.
rows
-
1
;
i
++
)
{
for
(
int
j
=
1
;
j
<
Lstep
.
cols
-
1
;
j
++
)
{
float
xpos
=
((
*
(
c
.
ptr
<
float
>
(
i
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
i
)
+
j
+
1
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
+
1
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
)));
float
xneg
=
((
*
(
c
.
ptr
<
float
>
(
i
)
+
j
-
1
))
+
(
*
(
c
.
ptr
<
float
>
(
i
)
+
j
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
-
1
)));
float
ypos
=
((
*
(
c
.
ptr
<
float
>
(
i
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
i
+
1
)
+
j
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
+
1
)
+
j
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
)));
float
yneg
=
((
*
(
c
.
ptr
<
float
>
(
i
-
1
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
i
)
+
j
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
i
)
+
j
))
-
(
*
(
Ld
.
ptr
<
float
>
(
i
-
1
)
+
j
)));
*
(
Lstep
.
ptr
<
float
>
(
i
)
+
j
)
=
0.5
f
*
stepsize
*
(
xpos
-
xneg
+
ypos
-
yneg
);
}
}
cv
::
parallel_for_
(
cv
::
Range
(
1
,
Lstep
.
rows
-
1
),
Nld_Step_Scalar_Invoker
(
Ld
,
c
,
Lstep
,
stepsize
));
for
(
int
j
=
1
;
j
<
Lstep
.
cols
-
1
;
j
++
)
{
float
xpos
=
((
*
(
c
.
ptr
<
float
>
(
0
)
+
j
))
+
(
*
(
c
.
ptr
<
float
>
(
0
)
+
j
+
1
)))
*
((
*
(
Ld
.
ptr
<
float
>
(
0
)
+
j
+
1
))
-
(
*
(
Ld
.
ptr
<
float
>
(
0
)
+
j
)));
...
...
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