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
cb76d00f
Commit
cb76d00f
authored
Oct 14, 2014
by
Adrien BAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
precalculate indices
parent
41945068
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
20 deletions
+24
-20
seamless_cloning_impl.cpp
modules/photo/src/seamless_cloning_impl.cpp
+24
-20
No files found.
modules/photo/src/seamless_cloning_impl.cpp
View file @
cb76d00f
...
...
@@ -343,9 +343,10 @@ void Cloning::evaluate(const Mat &I, const Mat &wmask, const Mat &cloned)
void
Cloning
::
normalClone
(
const
Mat
&
destination
,
const
Mat
&
patch
,
const
Mat
&
binaryMask
,
Mat
&
cloned
,
int
flag
)
{
int
w
=
destination
.
cols
;
int
h
=
destination
.
rows
;
int
channel
=
destination
.
channels
();
const
int
w
=
destination
.
cols
;
const
int
h
=
destination
.
rows
;
const
int
channel
=
destination
.
channels
();
const
int
n_elem_in_line
=
w
*
channel
;
computeDerivatives
(
destination
,
patch
,
binaryMask
);
...
...
@@ -357,6 +358,10 @@ void Cloning::normalClone(const Mat &destination, const Mat &patch, const Mat &b
break
;
case
MIXED_CLONE
:
{
AutoBuffer
<
int
>
maskIndices
(
n_elem_in_line
);
for
(
int
i
=
0
;
i
<
n_elem_in_line
;
++
i
)
maskIndices
[
i
]
=
i
/
channel
;
for
(
int
i
=
0
;
i
<
h
;
i
++
)
{
...
...
@@ -366,28 +371,27 @@ void Cloning::normalClone(const Mat &destination, const Mat &patch, const Mat &b
const
float
*
destinationYLinePtr
=
destinationGradientY
.
ptr
<
float
>
(
i
);
const
float
*
binaryMaskLinePtr
=
binaryMaskFloat
.
ptr
<
float
>
(
i
);
for
(
int
j
=
0
;
j
<
w
;
j
++
)
for
(
int
j
=
0
;
j
<
n_elem_in_line
;
j
++
)
{
for
(
int
c
=
0
;
c
<
channel
;
++
c
)
int
maskIndex
=
maskIndices
[
j
];
if
(
abs
(
patchXLinePtr
[
j
]
-
patchYLinePtr
[
j
])
>
abs
(
destinationXLinePtr
[
j
]
-
destinationYLinePtr
[
j
]))
{
patchXLinePtr
[
j
]
*=
binaryMaskLinePtr
[
maskIndex
];
patchYLinePtr
[
j
]
*=
binaryMaskLinePtr
[
maskIndex
];
}
else
{
if
(
abs
(
patchXLinePtr
[
j
*
channel
+
c
]
-
patchYLinePtr
[
j
*
channel
+
c
])
>
abs
(
destinationXLinePtr
[
j
*
channel
+
c
]
-
destinationYLinePtr
[
j
*
channel
+
c
]))
{
patchXLinePtr
[
j
*
channel
+
c
]
*=
binaryMaskLinePtr
[
j
];
patchYLinePtr
[
j
*
channel
+
c
]
*=
binaryMaskLinePtr
[
j
];
}
else
{
patchXLinePtr
[
j
*
channel
+
c
]
=
destinationXLinePtr
[
j
*
channel
+
c
]
*
binaryMaskLinePtr
[
j
];
patchGradientY
.
ptr
<
float
>
(
i
)[
j
*
channel
+
c
]
=
destinationYLinePtr
[
j
*
channel
+
c
]
*
binaryMaskLinePtr
[
j
];
}
patchXLinePtr
[
j
]
=
destinationXLinePtr
[
j
]
*
binaryMaskLinePtr
[
maskIndex
];
patchYLinePtr
[
j
]
=
destinationYLinePtr
[
j
]
*
binaryMaskLinePtr
[
maskIndex
];
}
}
}
break
;
}
break
;
case
MONOCHROME_TRANSFER
:
Mat
gray
=
Mat
(
patch
.
size
(),
CV_8UC1
);
...
...
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