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
222303f2
Commit
222303f2
authored
Sep 21, 2012
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt
parent
a8ba2d7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+12
-10
test_imgwarp.cpp
modules/imgproc/test/test_imgwarp.cpp
+7
-4
No files found.
modules/imgproc/src/imgwarp.cpp
View file @
222303f2
...
...
@@ -1423,7 +1423,7 @@ public:
dsize
.
width
*=
cn
;
AutoBuffer
<
WT
>
_buffer
(
dsize
.
width
*
2
);
WT
*
buf
=
_buffer
,
*
sum
=
buf
+
dsize
.
width
;
int
k
,
sy
,
dx
,
cur_dy
=
0
;
int
k
=
-
1000
,
sy
=
-
1000
,
dx
=
-
1000
,
cur_dy
=
-
100
0
;
WT
scale_y
=
(
WT
)
scale_y_
;
CV_Assert
(
cn
<=
4
);
...
...
@@ -1567,7 +1567,8 @@ public:
T
*
D
=
(
T
*
)(
dst
.
data
+
dst
.
step
*
cur_dy
);
if
(
fabs
(
beta
)
<
1e-3
)
{
if
(
cur_dy
>=
dsize
.
height
)
return
;
if
(
cur_dy
>=
dsize
.
height
)
return
;
for
(
dx
=
0
;
dx
<
dsize
.
width
;
dx
++
)
{
D
[
dx
]
=
saturate_cast
<
T
>
((
sum
[
dx
]
+
buf
[
dx
])
/
min
(
scale_y
,
src
.
rows
-
cur_dy
*
scale_y
));
...
...
@@ -1614,19 +1615,23 @@ private:
resizeArea_Invoker
&
operator
=
(
const
resizeArea_Invoker
&
);
};
template
<
typename
T
,
typename
WT
>
template
<
typename
T
,
typename
WT
>
static
void
resizeArea_
(
const
Mat
&
src
,
Mat
&
dst
,
const
DecimateAlpha
*
xofs
,
int
xofs_count
,
double
scale_y_
)
{
#ifdef HAVE_TBB
Size
ssize
=
src
.
size
(),
dsize
=
dst
.
size
();
AutoBuffer
<
int
>
_yofs
(
2
*
ssize
.
height
);
int
*
yofs
=
_yofs
,
*
cur_dy_ofs
=
_yofs
+
ssize
.
height
;
int
index
=
0
,
cur_dy
=
0
,
sy
;
int
index
=
0
,
cur_dy
=
0
;
// cur_dy_ofs - dy for the current sy
// yofs - a starting row for calculating a band according to the current sy
for
(
sy
=
0
;
sy
<
ssize
.
height
;
sy
++
)
for
(
int
sy
=
0
;
sy
<
ssize
.
height
;
sy
++
)
{
bool
reset
=
false
;
cur_dy_ofs
[
sy
]
=
cur_dy
;
yofs
[
sy
]
=
index
;
if
((
cur_dy
+
1
)
*
scale_y_
<=
sy
+
1
||
sy
==
ssize
.
height
-
1
)
{
WT
beta
=
(
WT
)
std
::
max
(
sy
+
1
-
(
cur_dy
+
1
)
*
scale_y_
,
0.
);
...
...
@@ -1634,13 +1639,10 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in
{
if
(
cur_dy
>=
dsize
.
height
)
break
;
reset
=
true
;
index
=
sy
+
1
;
}
cur_dy
++
;
}
yofs
[
sy
]
=
index
;
if
(
reset
)
index
=
sy
+
1
;
}
#endif
...
...
modules/imgproc/test/test_imgwarp.cpp
View file @
222303f2
...
...
@@ -1491,18 +1491,21 @@ TEST(Imgproc_resize_area, regression)
};
cv
::
Mat
src
(
16
,
16
,
CV_16UC1
,
input_data
);
cv
::
Mat
expected
(
5
,
5
,
CV_16UC1
,
expected_data
);
cv
::
Mat
expected
(
5
,
5
,
CV_16UC1
,
expected_data
);
cv
::
Mat
actual
(
expected
.
size
(),
expected
.
type
());
cv
::
resize
(
src
,
actual
,
cv
::
Size
(),
0.3
,
0.3
,
INTER_AREA
);
ASSERT_EQ
(
actual
.
type
(),
expected
.
type
());
ASSERT_EQ
(
actual
.
size
(),
expected
.
size
());
Mat
diff
;
absdiff
(
actual
,
expected
,
diff
);
Mat
one_channel_diff
=
diff
.
reshape
(
1
);
std
::
cout
<<
"Abs diff:"
<<
std
::
endl
<<
diff
<<
std
::
endl
;
Mat
one_channel_diff
=
diff
;
//.reshape(1);
int
elem_diff
=
1
;
float
elem_diff
=
1.0
f
;
Size
dsize
=
actual
.
size
();
bool
next
=
true
;
for
(
int
dy
=
0
;
dy
<
dsize
.
height
&&
next
;
++
dy
)
...
...
@@ -1527,7 +1530,7 @@ TEST(Imgproc_resize_area, regression)
}
}
ASSERT_EQ
(
norm
(
one_channel_diff
,
cv
::
NORM_INF
),
0
);
ASSERT_EQ
(
norm
(
one_channel_diff
,
cv
::
NORM_INF
),
0
);
}
...
...
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