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
5e2bcacb
Commit
5e2bcacb
authored
Mar 21, 2012
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some warnings
parent
fa4977df
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
21 deletions
+29
-21
global_motion.hpp
...les/videostab/include/opencv2/videostab/global_motion.hpp
+1
-1
log.hpp
modules/videostab/include/opencv2/videostab/log.hpp
+1
-1
deblurring.cpp
modules/videostab/src/deblurring.cpp
+7
-5
global_motion.cpp
modules/videostab/src/global_motion.cpp
+9
-9
inpainting.cpp
modules/videostab/src/inpainting.cpp
+8
-2
stabilizer.cpp
modules/videostab/src/stabilizer.cpp
+3
-3
No files found.
modules/videostab/include/opencv2/videostab/global_motion.hpp
View file @
5e2bcacb
...
@@ -64,7 +64,7 @@ CV_EXPORTS Mat estimateGlobalMotionLeastSquares(
...
@@ -64,7 +64,7 @@ CV_EXPORTS Mat estimateGlobalMotionLeastSquares(
const
std
::
vector
<
Point2f
>
&
points0
,
const
std
::
vector
<
Point2f
>
&
points1
,
const
std
::
vector
<
Point2f
>
&
points0
,
const
std
::
vector
<
Point2f
>
&
points1
,
int
model
=
AFFINE
,
float
*
rmse
=
0
);
int
model
=
AFFINE
,
float
*
rmse
=
0
);
CV_EXPORTS
struct
RansacParams
struct
CV_EXPORTS
RansacParams
{
{
int
size
;
// subset size
int
size
;
// subset size
float
thresh
;
// max error to classify as inlier
float
thresh
;
// max error to classify as inlier
...
...
modules/videostab/include/opencv2/videostab/log.hpp
View file @
5e2bcacb
...
@@ -60,7 +60,7 @@ public:
...
@@ -60,7 +60,7 @@ public:
class
CV_EXPORTS
NullLog
:
public
ILog
class
CV_EXPORTS
NullLog
:
public
ILog
{
{
public
:
public
:
virtual
void
print
(
const
char
*/
*
format
*/
,
...)
{}
virtual
void
print
(
const
char
*
/*format*/
,
...)
{}
};
};
class
CV_EXPORTS
LogToStdout
:
public
ILog
class
CV_EXPORTS
LogToStdout
:
public
ILog
...
...
modules/videostab/src/deblurring.cpp
View file @
5e2bcacb
...
@@ -59,13 +59,13 @@ float calcBlurriness(const Mat &frame)
...
@@ -59,13 +59,13 @@ float calcBlurriness(const Mat &frame)
double
normGx
=
norm
(
Gx
);
double
normGx
=
norm
(
Gx
);
double
normGy
=
norm
(
Gx
);
double
normGy
=
norm
(
Gx
);
double
sumSq
=
normGx
*
normGx
+
normGy
*
normGy
;
double
sumSq
=
normGx
*
normGx
+
normGy
*
normGy
;
return
1.
f
/
(
sumSq
/
frame
.
size
().
area
()
+
1e-6
);
return
1.
f
/
(
sumSq
/
frame
.
size
().
area
()
+
1e-6
f
);
}
}
WeightingDeblurer
::
WeightingDeblurer
()
WeightingDeblurer
::
WeightingDeblurer
()
{
{
setSensitivity
(
0.1
);
setSensitivity
(
0.1
f
);
}
}
...
@@ -102,8 +102,8 @@ void WeightingDeblurer::deblur(int idx, Mat &frame)
...
@@ -102,8 +102,8 @@ void WeightingDeblurer::deblur(int idx, Mat &frame)
{
{
for
(
int
x
=
0
;
x
<
frame
.
cols
;
++
x
)
for
(
int
x
=
0
;
x
<
frame
.
cols
;
++
x
)
{
{
int
x1
=
M
(
0
,
0
)
*
x
+
M
(
0
,
1
)
*
y
+
M
(
0
,
2
);
int
x1
=
static_cast
<
int
>
(
M
(
0
,
0
)
*
x
+
M
(
0
,
1
)
*
y
+
M
(
0
,
2
)
);
int
y1
=
M
(
1
,
0
)
*
x
+
M
(
1
,
1
)
*
y
+
M
(
1
,
2
);
int
y1
=
static_cast
<
int
>
(
M
(
1
,
0
)
*
x
+
M
(
1
,
1
)
*
y
+
M
(
1
,
2
)
);
if
(
x1
>=
0
&&
x1
<
neighbor
.
cols
&&
y1
>=
0
&&
y1
<
neighbor
.
rows
)
if
(
x1
>=
0
&&
x1
<
neighbor
.
cols
&&
y1
>=
0
&&
y1
<
neighbor
.
rows
)
{
{
...
@@ -127,7 +127,9 @@ void WeightingDeblurer::deblur(int idx, Mat &frame)
...
@@ -127,7 +127,9 @@ void WeightingDeblurer::deblur(int idx, Mat &frame)
{
{
float
wSumInv
=
1.
f
/
wSum_
(
y
,
x
);
float
wSumInv
=
1.
f
/
wSum_
(
y
,
x
);
frame
.
at
<
Point3_
<
uchar
>
>
(
y
,
x
)
=
Point3_
<
uchar
>
(
frame
.
at
<
Point3_
<
uchar
>
>
(
y
,
x
)
=
Point3_
<
uchar
>
(
bSum_
(
y
,
x
)
*
wSumInv
,
gSum_
(
y
,
x
)
*
wSumInv
,
rSum_
(
y
,
x
)
*
wSumInv
);
static_cast
<
uchar
>
(
bSum_
(
y
,
x
)
*
wSumInv
),
static_cast
<
uchar
>
(
gSum_
(
y
,
x
)
*
wSumInv
),
static_cast
<
uchar
>
(
rSum_
(
y
,
x
)
*
wSumInv
));
}
}
}
}
}
}
...
...
modules/videostab/src/global_motion.cpp
View file @
5e2bcacb
...
@@ -97,7 +97,7 @@ static Mat estimateGlobMotionLeastSquaresTranslationAndScale(
...
@@ -97,7 +97,7 @@ static Mat estimateGlobMotionLeastSquaresTranslationAndScale(
solve
(
A
,
b
,
sol
,
DECOMP_SVD
);
solve
(
A
,
b
,
sol
,
DECOMP_SVD
);
if
(
rmse
)
if
(
rmse
)
*
rmse
=
norm
(
A
*
sol
,
b
,
NORM_L2
)
/
sqrt
(
(
double
)
npoints
);
*
rmse
=
norm
(
A
*
sol
,
b
,
NORM_L2
)
/
sqrt
(
static_cast
<
float
>
(
npoints
)
);
Mat_
<
float
>
M
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
Mat_
<
float
>
M
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
M
(
0
,
0
)
=
M
(
1
,
1
)
=
sol
(
0
,
0
);
M
(
0
,
0
)
=
M
(
1
,
1
)
=
sol
(
0
,
0
);
...
@@ -130,7 +130,7 @@ static Mat estimateGlobMotionLeastSquaresAffine(
...
@@ -130,7 +130,7 @@ static Mat estimateGlobMotionLeastSquaresAffine(
solve
(
A
,
b
,
sol
,
DECOMP_SVD
);
solve
(
A
,
b
,
sol
,
DECOMP_SVD
);
if
(
rmse
)
if
(
rmse
)
*
rmse
=
norm
(
A
*
sol
,
b
,
NORM_L2
)
/
sqrt
(
(
double
)
npoints
);
*
rmse
=
norm
(
A
*
sol
,
b
,
NORM_L2
)
/
sqrt
(
static_cast
<
float
>
(
npoints
)
);
Mat_
<
float
>
M
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
Mat_
<
float
>
M
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
for
(
int
i
=
0
,
k
=
0
;
i
<
2
;
++
i
)
for
(
int
i
=
0
,
k
=
0
;
i
<
2
;
++
i
)
...
@@ -314,9 +314,9 @@ Mat getMotion(int from, int to, const vector<Mat> &motions)
...
@@ -314,9 +314,9 @@ Mat getMotion(int from, int to, const vector<Mat> &motions)
static
inline
int
areaSign
(
Point2f
a
,
Point2f
b
,
Point2f
c
)
static
inline
int
areaSign
(
Point2f
a
,
Point2f
b
,
Point2f
c
)
{
{
float
area
=
(
b
-
a
).
cross
(
c
-
a
);
double
area
=
(
b
-
a
).
cross
(
c
-
a
);
if
(
area
<
-
1e-5
f
)
return
-
1
;
if
(
area
<
-
1e-5
)
return
-
1
;
if
(
area
>
1e-5
f
)
return
1
;
if
(
area
>
1e-5
)
return
1
;
return
0
;
return
0
;
}
}
...
@@ -378,8 +378,8 @@ Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio)
...
@@ -378,8 +378,8 @@ Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio)
{
{
CV_Assert
(
M
.
size
()
==
Size
(
3
,
3
)
&&
M
.
type
()
==
CV_32F
);
CV_Assert
(
M
.
size
()
==
Size
(
3
,
3
)
&&
M
.
type
()
==
CV_32F
);
const
float
w
=
s
ize
.
width
;
const
float
w
=
s
tatic_cast
<
float
>
(
size
.
width
)
;
const
float
h
=
s
ize
.
height
;
const
float
h
=
s
tatic_cast
<
float
>
(
size
.
height
)
;
const
float
dx
=
floor
(
w
*
trimRatio
);
const
float
dx
=
floor
(
w
*
trimRatio
);
const
float
dy
=
floor
(
h
*
trimRatio
);
const
float
dy
=
floor
(
h
*
trimRatio
);
const
float
srcM
[
6
]
=
const
float
srcM
[
6
]
=
...
@@ -414,8 +414,8 @@ float estimateOptimalTrimRatio(const Mat &M, Size size)
...
@@ -414,8 +414,8 @@ float estimateOptimalTrimRatio(const Mat &M, Size size)
{
{
CV_Assert
(
M
.
size
()
==
Size
(
3
,
3
)
&&
M
.
type
()
==
CV_32F
);
CV_Assert
(
M
.
size
()
==
Size
(
3
,
3
)
&&
M
.
type
()
==
CV_32F
);
const
float
w
=
s
ize
.
width
;
const
float
w
=
s
tatic_cast
<
float
>
(
size
.
width
)
;
const
float
h
=
s
ize
.
height
;
const
float
h
=
s
tatic_cast
<
float
>
(
size
.
height
)
;
Mat_
<
float
>
M_
(
M
);
Mat_
<
float
>
M_
(
M
);
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
...
...
modules/videostab/src/inpainting.cpp
View file @
5e2bcacb
...
@@ -175,7 +175,10 @@ void ConsistentMosaicInpainter::inpaint(int idx, Mat &frame, Mat &mask)
...
@@ -175,7 +175,10 @@ void ConsistentMosaicInpainter::inpaint(int idx, Mat &frame, Mat &mask)
c2
=
(
c2
+
pixels
[
nh
].
color
.
y
)
/
2
;
c2
=
(
c2
+
pixels
[
nh
].
color
.
y
)
/
2
;
c3
=
(
c3
+
pixels
[
nh
].
color
.
z
)
/
2
;
c3
=
(
c3
+
pixels
[
nh
].
color
.
z
)
/
2
;
}
}
frame_
(
y
,
x
)
=
Point3_
<
uchar
>
(
c1
,
c2
,
c3
);
frame_
(
y
,
x
)
=
Point3_
<
uchar
>
(
static_cast
<
uchar
>
(
c1
),
static_cast
<
uchar
>
(
c2
),
static_cast
<
uchar
>
(
c3
));
mask_
(
y
,
x
)
=
255
;
mask_
(
y
,
x
)
=
255
;
}
}
}
}
...
@@ -379,7 +382,10 @@ public:
...
@@ -379,7 +382,10 @@ public:
}
}
float
wSumInv
=
1.
f
/
wSum
;
float
wSumInv
=
1.
f
/
wSum
;
frame
(
y
,
x
)
=
Point3_
<
uchar
>
(
c1
*
wSumInv
,
c2
*
wSumInv
,
c3
*
wSumInv
);
frame
(
y
,
x
)
=
Point3_
<
uchar
>
(
static_cast
<
uchar
>
(
c1
*
wSumInv
),
static_cast
<
uchar
>
(
c2
*
wSumInv
),
static_cast
<
uchar
>
(
c3
*
wSumInv
));
mask
(
y
,
x
)
=
255
;
mask
(
y
,
x
)
=
255
;
}
}
...
...
modules/videostab/src/stabilizer.cpp
View file @
5e2bcacb
...
@@ -54,7 +54,7 @@ Stabilizer::Stabilizer()
...
@@ -54,7 +54,7 @@ Stabilizer::Stabilizer()
{
{
setFrameSource
(
new
NullFrameSource
());
setFrameSource
(
new
NullFrameSource
());
setMotionEstimator
(
new
PyrLkRobustMotionEstimator
());
setMotionEstimator
(
new
PyrLkRobustMotionEstimator
());
setMotionFilter
(
new
GaussianMotionFilter
(
15
,
sqrt
(
15.
0
)));
setMotionFilter
(
new
GaussianMotionFilter
(
15
,
sqrt
(
15.
f
)));
setDeblurer
(
new
NullDeblurer
());
setDeblurer
(
new
NullDeblurer
());
setInpainter
(
new
NullInpainter
());
setInpainter
(
new
NullInpainter
());
setEstimateTrimRatio
(
true
);
setEstimateTrimRatio
(
true
);
...
@@ -101,8 +101,8 @@ Mat Stabilizer::nextFrame()
...
@@ -101,8 +101,8 @@ Mat Stabilizer::nextFrame()
return
Mat
();
// frame source is empty
return
Mat
();
// frame source is empty
const
Mat
&
stabilizedFrame
=
at
(
curStabilizedPos_
,
stabilizedFrames_
);
const
Mat
&
stabilizedFrame
=
at
(
curStabilizedPos_
,
stabilizedFrames_
);
int
dx
=
floor
(
trimRatio_
*
stabilizedFrame
.
cols
);
int
dx
=
static_cast
<
int
>
(
floor
(
trimRatio_
*
stabilizedFrame
.
cols
)
);
int
dy
=
floor
(
trimRatio_
*
stabilizedFrame
.
rows
);
int
dy
=
static_cast
<
int
>
(
floor
(
trimRatio_
*
stabilizedFrame
.
rows
)
);
return
stabilizedFrame
(
Rect
(
dx
,
dy
,
stabilizedFrame
.
cols
-
2
*
dx
,
stabilizedFrame
.
rows
-
2
*
dy
));
return
stabilizedFrame
(
Rect
(
dx
,
dy
,
stabilizedFrame
.
cols
-
2
*
dx
,
stabilizedFrame
.
rows
-
2
*
dy
));
}
}
...
...
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