Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
eb9b5080
Commit
eb9b5080
authored
Jul 08, 2016
by
Vladislav Samsonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed binary file reading on Windows, math constants and OpenCL kernel
parent
75b3ea9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
12 deletions
+9
-12
learn_prior.py
modules/optflow/src/learn_prior.py
+1
-1
pcaflow.cpp
modules/optflow/src/pcaflow.cpp
+8
-11
No files found.
modules/optflow/src/learn_prior.py
View file @
eb9b5080
...
...
@@ -57,7 +57,7 @@ def find_flo(pp):
def
load_flo
(
flo
):
with
open
(
flo
)
as
f
:
with
open
(
flo
,
'rb'
)
as
f
:
magic
=
np
.
fromfile
(
f
,
np
.
float32
,
count
=
1
)[
0
]
if
202021.25
!=
magic
:
print
(
'Magic number incorrect. Invalid .flo file'
)
...
...
modules/optflow/src/pcaflow.cpp
View file @
eb9b5080
...
...
@@ -61,10 +61,6 @@ namespace optflow
namespace
{
#ifndef M_PI
const
float
M_PI
=
3.14159265358979323846
;
#endif
#ifndef M_SQRT2
const
float
M_SQRT2
=
1.41421356237309504880
;
#endif
...
...
@@ -98,14 +94,14 @@ inline void symOrtho( double a, double b, double &c, double &s, double &r )
else
if
(
std
::
abs
(
b
)
>
std
::
abs
(
a
)
)
{
const
double
tau
=
a
/
b
;
s
=
mathSign
(
b
)
/
sqrt
(
1
+
tau
*
tau
);
s
=
mathSign
(
b
)
/
s
td
::
s
qrt
(
1
+
tau
*
tau
);
c
=
s
*
tau
;
r
=
b
/
s
;
}
else
{
const
double
tau
=
b
/
a
;
c
=
mathSign
(
a
)
/
sqrt
(
1
+
tau
*
tau
);
c
=
mathSign
(
a
)
/
s
td
::
s
qrt
(
1
+
tau
*
tau
);
s
=
c
*
tau
;
r
=
a
/
c
;
}
...
...
@@ -200,7 +196,7 @@ inline void _cpu_fillDCTSampledPoints( float *row, const Point2f &p, const Size
for
(
int
n1
=
0
;
n1
<
basisSize
.
width
;
++
n1
)
for
(
int
n2
=
0
;
n2
<
basisSize
.
height
;
++
n2
)
row
[
n1
*
basisSize
.
height
+
n2
]
=
cosf
(
(
n1
*
M_PI
/
size
.
width
)
*
(
p
.
x
+
0.5
)
)
*
cosf
(
(
n2
*
M
_PI
/
size
.
height
)
*
(
p
.
y
+
0.5
)
);
cosf
(
(
n1
*
CV_PI
/
size
.
width
)
*
(
p
.
x
+
0.5
)
)
*
cosf
(
(
n2
*
CV
_PI
/
size
.
height
)
*
(
p
.
y
+
0.5
)
);
}
ocl
::
ProgramSource
_ocl_fillDCTSampledPointsSource
(
...
...
@@ -210,10 +206,11 @@ ocl::ProgramSource _ocl_fillDCTSampledPointsSource(
"const int n1 = get_global_id(1);"
"const int n2 = get_global_id(2);"
"if (i >= fs || n1 >= bsw || n2 >= bsh) return;"
"__global const float2* f =
features + (fstep * i + foff
);"
"__global float* a =
A + (Astep * i + Aoff + (n1 * bsh + n2) * 4
);"
"__global const float2* f =
(__global const float2*)(features + (fstep * i + foff)
);"
"__global float* a =
(__global float*)(A + (Astep * i + Aoff + (n1 * bsh + n2) * sizeof(float))
);"
"const float2 p = f[0];"
"a[0] = cos((n1 * M_PI / sw) * (p.x + 0.5)) * cos((n2 * M_PI / sh) * (p.y + 0.5));"
"const float pi = 3.14159265358979323846;"
"a[0] = cos((n1 * pi / sw) * (p.x + 0.5)) * cos((n2 * pi / sh) * (p.y + 0.5));"
"}"
);
void
applyCLAHE
(
UMat
&
img
,
float
claheClip
)
...
...
@@ -497,7 +494,7 @@ Ptr<DenseOpticalFlow> createOptFlow_PCAFlow() { return makePtr<OpticalFlowPCAFlo
PCAPrior
::
PCAPrior
(
const
char
*
pathToPrior
)
{
FILE
*
f
=
fopen
(
pathToPrior
,
"r"
);
FILE
*
f
=
fopen
(
pathToPrior
,
"r
b
"
);
CV_Assert
(
f
);
unsigned
n
=
0
,
m
=
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