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
9ee87bd0
Commit
9ee87bd0
authored
Sep 28, 2012
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added parallel version of CvtColorLoop - main inner function of cvtColor
parent
c6e74119
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
11 deletions
+31
-11
color.cpp
modules/imgproc/src/color.cpp
+31
-11
No files found.
modules/imgproc/src/color.cpp
View file @
9ee87bd0
...
...
@@ -156,24 +156,44 @@ template<> struct ColorChannel<float>
///////////////////////////// Top-level template function ////////////////////////////////
template
<
class
Cvt
>
void
CvtColorLoop
(
const
Mat
&
srcmat
,
Mat
&
dstmat
,
const
Cvt
&
cvt
)
template
<
typename
Cvt
>
class
CvtColorLoop_Invoker
:
public
ParallelLoopBody
{
typedef
typename
Cvt
::
channel_type
_Tp
;
Size
sz
=
srcmat
.
size
();
const
uchar
*
src
=
srcmat
.
data
;
uchar
*
dst
=
dstmat
.
data
;
size_t
srcstep
=
srcmat
.
step
,
dststep
=
dstmat
.
step
;
public
:
if
(
srcmat
.
isContinuous
()
&&
dstmat
.
isContinuous
()
)
CvtColorLoop_Invoker
(
const
Mat
&
_src
,
Mat
&
_dst
,
const
Cvt
&
_cvt
)
:
ParallelLoopBody
(),
src
(
_src
),
dst
(
_dst
),
cvt
(
_cvt
)
{
sz
.
width
*=
sz
.
height
;
sz
.
height
=
1
;
}
for
(
;
sz
.
height
--
;
src
+=
srcstep
,
dst
+=
dststep
)
cvt
((
const
_Tp
*
)
src
,
(
_Tp
*
)
dst
,
sz
.
width
);
}
virtual
void
operator
()(
const
Range
&
range
)
const
{
int
i
=
range
.
start
;
const
uchar
*
yS
=
src
.
data
+
src
.
step
*
i
;
uchar
*
yD
=
dst
.
data
+
dst
.
step
*
i
;
for
(
;
i
<
range
.
end
;
++
i
,
yS
+=
src
.
step
,
yD
+=
dst
.
step
)
cvt
((
const
_Tp
*
)
yS
,
(
_Tp
*
)
yD
,
src
.
cols
);
}
private
:
const
Mat
src
;
Mat
dst
;
const
Cvt
cvt
;
CvtColorLoop_Invoker
(
const
CvtColorLoop_Invoker
&
);
const
CvtColorLoop_Invoker
&
operator
=
(
const
CvtColorLoop_Invoker
&
);
};
template
<
typename
Cvt
>
void
CvtColorLoop
(
const
Mat
&
src
,
Mat
&
dst
,
const
Cvt
&
cvt
)
{
Range
range
(
0
,
src
.
rows
);
CvtColorLoop_Invoker
<
Cvt
>
invoker
(
src
,
dst
,
cvt
);
parallel_for_
(
range
,
invoker
);
}
////////////////// Various 3/4-channel to 3/4-channel RGB transformations /////////////////
...
...
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