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
07d15759
Commit
07d15759
authored
Jan 11, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tegra optimization for warpPerspective() and 2 new perf tests
parent
9260ad4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
perf_warp.cpp
modules/imgproc/perf/perf_warp.cpp
+73
-0
imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+5
-0
No files found.
modules/imgproc/perf/perf_warp.cpp
0 → 100644
View file @
07d15759
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
namespace
testing
;
CV_ENUM
(
BorderMode
,
BORDER_CONSTANT
,
BORDER_REPLICATE
);
CV_ENUM
(
InterType
,
INTER_NEAREST
,
INTER_LINEAR
);
typedef
TestBaseWithParam
<
tr1
::
tuple
<
Size
,
InterType
,
BorderMode
>
>
TestWarpAffine
;
typedef
TestBaseWithParam
<
tr1
::
tuple
<
Size
,
InterType
,
BorderMode
>
>
TestWarpPerspective
;
PERF_TEST_P
(
TestWarpAffine
,
WarpAffine
,
Combine
(
Values
(
szVGA
,
sz720p
,
sz1080p
),
ValuesIn
(
InterType
::
all
()
),
ValuesIn
(
BorderMode
::
all
()
)
)
)
{
Size
sz
;
int
borderMode
,
interType
;
tr1
::
tie
(
sz
,
borderMode
,
interType
)
=
GetParam
();
Mat
src
,
img
=
imread
(
getDataPath
(
"cv/shared/fruits.jpg"
));
cvtColor
(
img
,
src
,
COLOR_BGR2RGBA
,
4
);
Mat
warpMat
=
getRotationMatrix2D
(
Point2f
(
src
.
cols
/
2
,
src
.
rows
/
2
),
30
,
2.2
);
Mat
dst
(
sz
,
CV_8UC4
);
//declare.in(src).out(dst);
TEST_CYCLE
()
warpAffine
(
src
,
dst
,
warpMat
,
sz
,
interType
,
borderMode
,
Scalar
::
all
(
150
)
);
SANITY_CHECK
(
dst
);
}
PERF_TEST_P
(
TestWarpPerspective
,
WarpPerspective
,
Combine
(
Values
(
szVGA
,
sz720p
,
sz1080p
),
ValuesIn
(
InterType
::
all
()
),
ValuesIn
(
BorderMode
::
all
()
)
)
)
{
Size
sz
;
int
borderMode
,
interType
;
tr1
::
tie
(
sz
,
borderMode
,
interType
)
=
GetParam
();
Mat
src
,
img
=
imread
(
getDataPath
(
"cv/shared/fruits.jpg"
));
cvtColor
(
img
,
src
,
COLOR_BGR2RGBA
,
4
);
Mat
rotMat
=
getRotationMatrix2D
(
Point2f
(
src
.
cols
/
2
,
src
.
rows
/
2
),
30
,
2.2
);
Mat
warpMat
(
3
,
3
,
CV_64FC1
);
for
(
int
r
=
0
;
r
<
2
;
r
++
)
for
(
int
c
=
0
;
c
<
3
;
c
++
)
warpMat
.
at
<
double
>
(
r
,
c
)
=
rotMat
.
at
<
double
>
(
r
,
c
);
warpMat
.
at
<
double
>
(
2
,
0
)
=
.3
/
sz
.
width
;
warpMat
.
at
<
double
>
(
2
,
1
)
=
.3
/
sz
.
height
;
warpMat
.
at
<
double
>
(
2
,
2
)
=
1
;
Mat
dst
(
sz
,
CV_8UC4
);
//declare.in(src).out(dst);
TEST_CYCLE
()
warpPerspective
(
src
,
dst
,
warpMat
,
sz
,
interType
,
borderMode
,
Scalar
::
all
(
150
)
);
SANITY_CHECK
(
dst
);
}
modules/imgproc/src/imgwarp.cpp
View file @
07d15759
...
...
@@ -2977,6 +2977,11 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
if
(
!
(
flags
&
WARP_INVERSE_MAP
)
)
invert
(
matM
,
matM
);
#ifdef HAVE_TEGRA_OPTIMIZATION
if
(
tegra
::
warpPerspective
(
src
,
dst
,
M
,
interpolation
,
borderType
,
borderValue
)
)
return
;
#endif
int
x
,
y
,
x1
,
y1
,
width
=
dst
.
cols
,
height
=
dst
.
rows
;
int
bh0
=
std
::
min
(
BLOCK_SZ
/
2
,
height
);
...
...
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