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
aa61e796
Commit
aa61e796
authored
Sep 27, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15600 from alalek:imgproc_pyramid_fix_indexing
parents
25dee838
f81e401c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
pyramids.cpp
modules/imgproc/src/pyramids.cpp
+20
-18
No files found.
modules/imgproc/src/pyramids.cpp
View file @
aa61e796
...
...
@@ -741,13 +741,13 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
CV_Assert
(
ssize
.
width
>
0
&&
ssize
.
height
>
0
&&
std
::
abs
(
dsize
.
width
*
2
-
ssize
.
width
)
<=
2
&&
std
::
abs
(
dsize
.
height
*
2
-
ssize
.
height
)
<=
2
);
int
k
,
x
,
sy0
=
-
PD_SZ
/
2
,
sy
=
sy0
,
width0
=
std
::
min
((
ssize
.
width
-
PD_SZ
/
2
-
1
)
/
2
+
1
,
dsize
.
width
);
int
sy0
=
-
PD_SZ
/
2
,
sy
=
sy0
,
width0
=
std
::
min
((
ssize
.
width
-
PD_SZ
/
2
-
1
)
/
2
+
1
,
dsize
.
width
);
for
(
x
=
0
;
x
<=
PD_SZ
+
1
;
x
++
)
for
(
int
x
=
0
;
x
<=
PD_SZ
+
1
;
x
++
)
{
int
sx0
=
borderInterpolate
(
x
-
PD_SZ
/
2
,
ssize
.
width
,
borderType
)
*
cn
;
int
sx1
=
borderInterpolate
(
x
+
width0
*
2
-
PD_SZ
/
2
,
ssize
.
width
,
borderType
)
*
cn
;
for
(
k
=
0
;
k
<
cn
;
k
++
)
for
(
int
k
=
0
;
k
<
cn
;
k
++
)
{
tabL
[
x
*
cn
+
k
]
=
sx0
+
k
;
tabR
[
x
*
cn
+
k
]
=
sx1
+
k
;
...
...
@@ -758,10 +758,10 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
dsize
.
width
*=
cn
;
width0
*=
cn
;
for
(
x
=
0
;
x
<
dsize
.
width
;
x
++
)
for
(
int
x
=
0
;
x
<
dsize
.
width
;
x
++
)
tabM
[
x
]
=
(
x
/
cn
)
*
2
*
cn
+
x
%
cn
;
for
(
int
y
=
0
;
y
<
dsize
.
height
;
y
++
)
for
(
int
y
=
0
;
y
<
dsize
.
height
;
y
++
)
{
T
*
dst
=
_dst
.
ptr
<
T
>
(
y
);
WT
*
row0
,
*
row1
,
*
row2
,
*
row3
,
*
row4
;
...
...
@@ -772,15 +772,13 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
WT
*
row
=
buf
+
((
sy
-
sy0
)
%
PD_SZ
)
*
bufstep
;
int
_sy
=
borderInterpolate
(
sy
,
ssize
.
height
,
borderType
);
const
T
*
src
=
_src
.
ptr
<
T
>
(
_sy
);
int
limit
=
cn
;
const
int
*
tab
=
tabL
;
for
(
x
=
0
;;)
{
for
(
;
x
<
limit
;
x
++
)
do
{
int
x
=
0
;
for
(
;
x
<
cn
;
x
++
)
{
row
[
x
]
=
src
[
tab
[
x
+
cn
*
2
]]
*
6
+
(
src
[
tab
[
x
+
cn
]]
+
src
[
tab
[
x
+
cn
*
3
]])
*
4
+
src
[
tab
[
x
]]
+
src
[
tab
[
x
+
cn
*
4
]];
row
[
x
]
=
src
[
tab
L
[
x
+
cn
*
2
]]
*
6
+
(
src
[
tabL
[
x
+
cn
]]
+
src
[
tabL
[
x
+
cn
*
3
]])
*
4
+
src
[
tab
L
[
x
]]
+
src
[
tabL
[
x
+
cn
*
4
]];
}
if
(
x
==
dsize
.
width
)
...
...
@@ -840,18 +838,22 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
}
}
limit
=
dsize
.
width
;
tab
=
tabR
-
x
;
}
// tabR
for
(
int
x_
=
0
;
x
<
dsize
.
width
;
x
++
,
x_
++
)
{
row
[
x
]
=
src
[
tabR
[
x_
+
cn
*
2
]]
*
6
+
(
src
[
tabR
[
x_
+
cn
]]
+
src
[
tabR
[
x_
+
cn
*
3
]])
*
4
+
src
[
tabR
[
x_
]]
+
src
[
tabR
[
x_
+
cn
*
4
]];
}
}
while
(
0
);
}
// do vertical convolution and decimation and write the result to the destination image
for
(
k
=
0
;
k
<
PD_SZ
;
k
++
)
for
(
int
k
=
0
;
k
<
PD_SZ
;
k
++
)
rows
[
k
]
=
buf
+
((
y
*
2
-
PD_SZ
/
2
+
k
-
sy0
)
%
PD_SZ
)
*
bufstep
;
row0
=
rows
[
0
];
row1
=
rows
[
1
];
row2
=
rows
[
2
];
row3
=
rows
[
3
];
row4
=
rows
[
4
];
x
=
PyrDownVecV
<
WT
,
T
>
(
rows
,
dst
,
dsize
.
width
);
for
(
;
x
<
dsize
.
width
;
x
++
)
int
x
=
PyrDownVecV
<
WT
,
T
>
(
rows
,
dst
,
dsize
.
width
);
for
(
;
x
<
dsize
.
width
;
x
++
)
dst
[
x
]
=
castOp
(
row2
[
x
]
*
6
+
(
row1
[
x
]
+
row3
[
x
])
*
4
+
row0
[
x
]
+
row4
[
x
]);
}
}
...
...
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