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
c909a210
Commit
c909a210
authored
Jan 31, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Jan 31, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2219 from ilya-lavrenov:createHanningWindow
parents
25d2ab8a
41bc5808
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
perf_phasecorr.cpp
modules/imgproc/perf/perf_phasecorr.cpp
+22
-0
phasecorr.cpp
modules/imgproc/src/phasecorr.cpp
+12
-12
No files found.
modules/imgproc/perf/perf_phasecorr.cpp
0 → 100644
View file @
c909a210
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
namespace
testing
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
typedef
TestBaseWithParam
<
Size
>
CreateHanningWindowFixture
;
PERF_TEST_P
(
CreateHanningWindowFixture
,
CreateHanningWindow
,
Values
(
szVGA
,
sz1080p
))
{
const
Size
size
=
GetParam
();
Mat
dst
(
size
,
CV_32FC1
);
declare
.
in
(
dst
,
WARMUP_RNG
).
out
(
dst
);
TEST_CYCLE
()
cv
::
createHanningWindow
(
dst
,
size
,
CV_32FC1
);
SANITY_CHECK
(
dst
,
1e-6
,
ERROR_RELATIVE
);
}
modules/imgproc/src/phasecorr.cpp
View file @
c909a210
...
...
@@ -576,20 +576,23 @@ void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type)
_dst
.
create
(
winSize
,
type
);
Mat
dst
=
_dst
.
getMat
();
int
rows
=
dst
.
rows
;
int
cols
=
dst
.
cols
;
int
rows
=
dst
.
rows
,
cols
=
dst
.
cols
;
AutoBuffer
<
double
>
_wc
(
cols
);
double
*
const
wc
=
(
double
*
)
_wc
;
double
coeff0
=
2.0
*
CV_PI
/
(
double
)(
cols
-
1
),
coeff1
=
2.0
f
*
CV_PI
/
(
double
)(
rows
-
1
);
for
(
int
j
=
0
;
j
<
cols
;
j
++
)
wc
[
j
]
=
0.5
*
(
1.0
-
cos
(
coeff0
*
j
));
if
(
dst
.
depth
()
==
CV_32F
)
{
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
float
*
dstData
=
dst
.
ptr
<
float
>
(
i
);
double
wr
=
0.5
*
(
1.0
f
-
cos
(
2.0
f
*
CV_PI
*
(
double
)
i
/
(
double
)(
rows
-
1
)
));
double
wr
=
0.5
*
(
1.0
-
cos
(
coeff1
*
i
));
for
(
int
j
=
0
;
j
<
cols
;
j
++
)
{
double
wc
=
0.5
*
(
1.0
f
-
cos
(
2.0
f
*
CV_PI
*
(
double
)
j
/
(
double
)(
cols
-
1
)));
dstData
[
j
]
=
(
float
)(
wr
*
wc
);
}
dstData
[
j
]
=
(
float
)(
wr
*
wc
[
j
]);
}
}
else
...
...
@@ -597,12 +600,9 @@ void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type)
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
double
*
dstData
=
dst
.
ptr
<
double
>
(
i
);
double
wr
=
0.5
*
(
1.0
-
cos
(
2.0
*
CV_PI
*
(
double
)
i
/
(
double
)(
rows
-
1
)
));
double
wr
=
0.5
*
(
1.0
-
cos
(
coeff1
*
i
));
for
(
int
j
=
0
;
j
<
cols
;
j
++
)
{
double
wc
=
0.5
*
(
1.0
-
cos
(
2.0
*
CV_PI
*
(
double
)
j
/
(
double
)(
cols
-
1
)));
dstData
[
j
]
=
wr
*
wc
;
}
dstData
[
j
]
=
wr
*
wc
[
j
];
}
}
...
...
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