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
3e23bb6d
Commit
3e23bb6d
authored
Apr 02, 2012
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored videostab module and sample
parent
5fe49347
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
39 deletions
+24
-39
deblurring.hpp
modules/videostab/include/opencv2/videostab/deblurring.hpp
+0
-2
global_motion.hpp
...les/videostab/include/opencv2/videostab/global_motion.hpp
+1
-0
inpainting.hpp
modules/videostab/include/opencv2/videostab/inpainting.hpp
+0
-4
motion_stabilizing.hpp
...ideostab/include/opencv2/videostab/motion_stabilizing.hpp
+6
-0
stabilizer.hpp
modules/videostab/include/opencv2/videostab/stabilizer.hpp
+1
-1
inpainting.cpp
modules/videostab/src/inpainting.cpp
+0
-8
stabilizer.cpp
modules/videostab/src/stabilizer.cpp
+16
-24
videostab.cpp
samples/cpp/videostab.cpp
+0
-0
No files found.
modules/videostab/include/opencv2/videostab/deblurring.hpp
View file @
3e23bb6d
...
...
@@ -72,8 +72,6 @@ public:
virtual
void
setBlurrinessRates
(
const
std
::
vector
<
float
>
&
val
)
{
blurrinessRates_
=
&
val
;
}
virtual
const
std
::
vector
<
float
>&
blurrinessRates
()
const
{
return
*
blurrinessRates_
;
}
virtual
void
update
()
{}
virtual
void
deblur
(
int
idx
,
Mat
&
frame
)
=
0
;
protected
:
...
...
modules/videostab/include/opencv2/videostab/global_motion.hpp
View file @
3e23bb6d
...
...
@@ -72,6 +72,7 @@ struct CV_EXPORTS RansacParams
float
eps
;
// max outliers ratio
float
prob
;
// probability of success
RansacParams
()
:
size
(
0
),
thresh
(
0
),
eps
(
0
),
prob
(
0
)
{}
RansacParams
(
int
size
,
float
thresh
,
float
eps
,
float
prob
)
:
size
(
size
),
thresh
(
thresh
),
eps
(
eps
),
prob
(
prob
)
{}
...
...
modules/videostab/include/opencv2/videostab/inpainting.hpp
View file @
3e23bb6d
...
...
@@ -78,8 +78,6 @@ public:
virtual
void
setStabilizationMotions
(
const
std
::
vector
<
Mat
>
&
val
)
{
stabilizationMotions_
=
&
val
;
}
virtual
const
std
::
vector
<
Mat
>&
stabilizationMotions
()
const
{
return
*
stabilizationMotions_
;
}
virtual
void
update
()
{}
virtual
void
inpaint
(
int
idx
,
Mat
&
frame
,
Mat
&
mask
)
=
0
;
protected
:
...
...
@@ -108,8 +106,6 @@ public:
virtual
void
setStabilizedFrames
(
const
std
::
vector
<
Mat
>
&
val
);
virtual
void
setStabilizationMotions
(
const
std
::
vector
<
Mat
>
&
val
);
virtual
void
update
();
virtual
void
inpaint
(
int
idx
,
Mat
&
frame
,
Mat
&
mask
);
private
:
...
...
modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp
View file @
3e23bb6d
...
...
@@ -79,6 +79,12 @@ class CV_EXPORTS GaussianMotionFilter : public MotionFilterBase
{
public
:
GaussianMotionFilter
()
:
stdev_
(
-
1.
f
)
{}
GaussianMotionFilter
(
int
radius
,
float
stdev
=
-
1.
f
)
{
setRadius
(
radius
);
setStdev
(
stdev
);
update
();
}
void
setStdev
(
float
val
)
{
stdev_
=
val
;
}
float
stdev
()
const
{
return
stdev_
;
}
...
...
modules/videostab/include/opencv2/videostab/stabilizer.hpp
View file @
3e23bb6d
...
...
@@ -160,7 +160,7 @@ public:
void
setEstimateTrimRatio
(
bool
val
)
{
mustEstTrimRatio_
=
val
;
}
bool
mustEstimateTrimaRatio
()
const
{
return
mustEstTrimRatio_
;
}
virtual
void
reset
()
{
resetImpl
();
}
virtual
void
reset
()
;
virtual
Mat
nextFrame
();
// available after pre-pass, before it's empty
...
...
modules/videostab/src/inpainting.cpp
View file @
3e23bb6d
...
...
@@ -93,14 +93,6 @@ void InpaintingPipeline::setStabilizationMotions(const vector<Mat> &val)
}
void
InpaintingPipeline
::
update
()
{
for
(
size_t
i
=
0
;
i
<
inpainters_
.
size
();
++
i
)
inpainters_
[
i
]
->
update
();
InpainterBase
::
update
();
}
void
InpaintingPipeline
::
inpaint
(
int
idx
,
Mat
&
frame
,
Mat
&
mask
)
{
for
(
size_t
i
=
0
;
i
<
inpainters_
.
size
();
++
i
)
...
...
modules/videostab/src/stabilizer.cpp
View file @
3e23bb6d
...
...
@@ -70,12 +70,10 @@ void StabilizerBase::setUp(int cacheSize, const Mat &frame)
doInpainting_
=
dynamic_cast
<
NullInpainter
*>
(
inpainter
)
==
0
;
if
(
doInpainting_
)
{
inpainter_
->
setRadius
(
radius_
);
inpainter_
->
setFrames
(
frames_
);
inpainter_
->
setMotions
(
motions_
);
inpainter_
->
setStabilizedFrames
(
stabilizedFrames_
);
inpainter_
->
setStabilizationMotions
(
stabilizationMotions_
);
inpainter_
->
update
();
}
DeblurerBase
*
deblurer
=
static_cast
<
DeblurerBase
*>
(
deblurer_
);
...
...
@@ -86,11 +84,9 @@ void StabilizerBase::setUp(int cacheSize, const Mat &frame)
float
blurriness
=
calcBlurriness
(
frame
);
for
(
int
i
=
-
radius_
;
i
<=
0
;
++
i
)
at
(
i
,
blurrinessRates_
)
=
blurriness
;
deblurer_
->
setRadius
(
radius_
);
deblurer_
->
setFrames
(
frames_
);
deblurer_
->
setMotions
(
motions_
);
deblurer_
->
setBlurrinessRates
(
blurrinessRates_
);
deblurer_
->
update
();
}
log_
->
print
(
"processing frames"
);
...
...
@@ -242,7 +238,6 @@ void OnePassStabilizer::setUp(Mat &firstFrame)
at
(
0
,
frames_
)
=
firstFrame
;
motionFilter_
->
setRadius
(
radius_
);
motionFilter_
->
update
();
StabilizerBase
::
setUp
(
cacheSize
,
firstFrame
);
...
...
@@ -267,7 +262,22 @@ TwoPassStabilizer::TwoPassStabilizer()
{
setMotionStabilizer
(
new
GaussianMotionFilter
());
setEstimateTrimRatio
(
false
);
resetImpl
();
reset
();
}
void
TwoPassStabilizer
::
reset
()
{
isPrePassDone_
=
false
;
frameCount_
=
0
;
curPos_
=
-
1
;
curStabilizedPos_
=
-
1
;
frames_
.
clear
();
motions_
.
clear
();
stabilizedFrames_
.
clear
();
stabilizationMotions_
.
clear
();
doDeblurring_
=
false
;
doInpainting_
=
false
;
}
...
...
@@ -288,21 +298,6 @@ vector<Mat> TwoPassStabilizer::motions() const
}
void
TwoPassStabilizer
::
resetImpl
()
{
isPrePassDone_
=
false
;
frameCount_
=
0
;
curPos_
=
-
1
;
curStabilizedPos_
=
-
1
;
frames_
.
clear
();
motions_
.
clear
();
stabilizedFrames_
.
clear
();
stabilizationMotions_
.
clear
();
doDeblurring_
=
false
;
doInpainting_
=
false
;
}
void
TwoPassStabilizer
::
runPrePassIfNecessary
()
{
if
(
!
isPrePassDone_
)
...
...
@@ -335,10 +330,7 @@ void TwoPassStabilizer::runPrePassIfNecessary()
IMotionStabilizer
*
motionStabilizer
=
static_cast
<
IMotionStabilizer
*>
(
motionStabilizer_
);
MotionFilterBase
*
motionFilterBase
=
dynamic_cast
<
MotionFilterBase
*>
(
motionStabilizer
);
if
(
motionFilterBase
)
{
motionFilterBase
->
setRadius
(
radius_
);
motionFilterBase
->
update
();
}
stabilizationMotions_
.
resize
(
frameCount_
);
motionStabilizer_
->
stabilize
(
&
motions_
[
0
],
frameCount_
,
&
stabilizationMotions_
[
0
]);
...
...
samples/cpp/videostab.cpp
View file @
3e23bb6d
This diff is collapsed.
Click to expand it.
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