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
5efadcb3
Commit
5efadcb3
authored
Feb 10, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6042 from Dmitry-Me:reduceVariablesScope
parents
8ac96eec
bf604f17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
19 deletions
+13
-19
ptsetreg.cpp
modules/calib3d/src/ptsetreg.cpp
+4
-4
motion_stabilizing.cpp
modules/videostab/src/motion_stabilizing.cpp
+1
-2
outlier_rejection.cpp
modules/videostab/src/outlier_rejection.cpp
+8
-13
No files found.
modules/calib3d/src/ptsetreg.cpp
View file @
5efadcb3
...
...
@@ -206,7 +206,7 @@ public:
for
(
iter
=
0
;
iter
<
niters
;
iter
++
)
{
int
i
,
goodCount
,
nmodels
;
int
i
,
nmodels
;
if
(
count
>
modelPoints
)
{
bool
found
=
getSubset
(
m1
,
m2
,
ms1
,
ms2
,
rng
,
10000
);
...
...
@@ -227,7 +227,7 @@ public:
for
(
i
=
0
;
i
<
nmodels
;
i
++
)
{
Mat
model_i
=
model
.
rowRange
(
i
*
modelSize
.
height
,
(
i
+
1
)
*
modelSize
.
height
);
goodCount
=
findInliers
(
m1
,
m2
,
model_i
,
err
,
mask
,
threshold
);
int
goodCount
=
findInliers
(
m1
,
m2
,
model_i
,
err
,
mask
,
threshold
);
if
(
goodCount
>
MAX
(
maxGoodCount
,
modelPoints
-
1
)
)
{
...
...
@@ -284,7 +284,7 @@ public:
int
d1
=
m1
.
channels
()
>
1
?
m1
.
channels
()
:
m1
.
cols
;
int
d2
=
m2
.
channels
()
>
1
?
m2
.
channels
()
:
m2
.
cols
;
int
count
=
m1
.
checkVector
(
d1
),
count2
=
m2
.
checkVector
(
d2
);
double
minMedian
=
DBL_MAX
,
sigma
;
double
minMedian
=
DBL_MAX
;
RNG
rng
((
uint64
)
-
1
);
...
...
@@ -359,7 +359,7 @@ public:
if
(
minMedian
<
DBL_MAX
)
{
sigma
=
2.5
*
1.4826
*
(
1
+
5.
/
(
count
-
modelPoints
))
*
std
::
sqrt
(
minMedian
);
double
sigma
=
2.5
*
1.4826
*
(
1
+
5.
/
(
count
-
modelPoints
))
*
std
::
sqrt
(
minMedian
);
sigma
=
MAX
(
sigma
,
0.001
);
count
=
findInliers
(
m1
,
m2
,
bestModel
,
err
,
mask
,
sigma
);
...
...
modules/videostab/src/motion_stabilizing.cpp
View file @
5efadcb3
...
...
@@ -602,13 +602,12 @@ static inline bool isGoodMotion(const float M[], float w, float h, float dx, flo
{
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
Point2f
Mpt
[
4
];
float
z
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
Mpt
[
i
].
x
=
M
[
0
]
*
pt
[
i
].
x
+
M
[
1
]
*
pt
[
i
].
y
+
M
[
2
];
Mpt
[
i
].
y
=
M
[
3
]
*
pt
[
i
].
x
+
M
[
4
]
*
pt
[
i
].
y
+
M
[
5
];
z
=
M
[
6
]
*
pt
[
i
].
x
+
M
[
7
]
*
pt
[
i
].
y
+
M
[
8
];
float
z
=
M
[
6
]
*
pt
[
i
].
x
+
M
[
7
]
*
pt
[
i
].
y
+
M
[
8
];
Mpt
[
i
].
x
/=
z
;
Mpt
[
i
].
y
/=
z
;
}
...
...
modules/videostab/src/outlier_rejection.cpp
View file @
5efadcb3
...
...
@@ -84,16 +84,14 @@ void TranslationBasedLocalOutlierRejector::process(
Size
ncells
((
frameSize
.
width
+
cellSize_
.
width
-
1
)
/
cellSize_
.
width
,
(
frameSize
.
height
+
cellSize_
.
height
-
1
)
/
cellSize_
.
height
);
int
cx
,
cy
;
// fill grid cells
grid_
.
assign
(
ncells
.
area
(),
Cell
());
for
(
int
i
=
0
;
i
<
npoints
;
++
i
)
{
cx
=
std
::
min
(
cvRound
(
points0_
[
i
].
x
/
cellSize_
.
width
),
ncells
.
width
-
1
);
cy
=
std
::
min
(
cvRound
(
points0_
[
i
].
y
/
cellSize_
.
height
),
ncells
.
height
-
1
);
int
cx
=
std
::
min
(
cvRound
(
points0_
[
i
].
x
/
cellSize_
.
width
),
ncells
.
width
-
1
);
int
cy
=
std
::
min
(
cvRound
(
points0_
[
i
].
y
/
cellSize_
.
height
),
ncells
.
height
-
1
);
grid_
[
cy
*
ncells
.
width
+
cx
].
push_back
(
i
);
}
...
...
@@ -101,19 +99,16 @@ void TranslationBasedLocalOutlierRejector::process(
RNG
rng
(
0
);
int
niters
=
ransacParams_
.
niters
();
int
ninliers
,
ninliersMax
;
std
::
vector
<
int
>
inliers
;
float
dx
,
dy
,
dxBest
,
dyBest
;
float
x1
,
y1
;
int
idx
;
for
(
size_t
ci
=
0
;
ci
<
grid_
.
size
();
++
ci
)
{
// estimate translation model at the current cell using RANSAC
float
x1
,
y1
;
const
Cell
&
cell
=
grid_
[
ci
];
ninliersMax
=
0
;
dxBest
=
dyBest
=
0.
f
;
int
ninliers
,
ninliersMax
=
0
;
float
dxBest
=
0.
f
,
dyBest
=
0.
f
;
// find the best hypothesis
...
...
@@ -121,9 +116,9 @@ void TranslationBasedLocalOutlierRejector::process(
{
for
(
int
iter
=
0
;
iter
<
niters
;
++
iter
)
{
idx
=
cell
[
static_cast
<
unsigned
>
(
rng
)
%
cell
.
size
()];
dx
=
points1_
[
idx
].
x
-
points0_
[
idx
].
x
;
dy
=
points1_
[
idx
].
y
-
points0_
[
idx
].
y
;
i
nt
i
dx
=
cell
[
static_cast
<
unsigned
>
(
rng
)
%
cell
.
size
()];
float
dx
=
points1_
[
idx
].
x
-
points0_
[
idx
].
x
;
float
dy
=
points1_
[
idx
].
y
-
points0_
[
idx
].
y
;
ninliers
=
0
;
for
(
size_t
i
=
0
;
i
<
cell
.
size
();
++
i
)
...
...
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