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
8af62cd6
Commit
8af62cd6
authored
Mar 21, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bgsegm: apply CV_OVERRIDE/CV_FINAL
parent
06de0544
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
69 deletions
+69
-69
bgsegm.hpp
modules/bgsegm/include/opencv2/bgsegm.hpp
+6
-6
bgfg_gaussmix.cpp
modules/bgsegm/src/bgfg_gaussmix.cpp
+13
-13
bgfg_gmg.cpp
modules/bgsegm/src/bgfg_gmg.cpp
+26
-26
bgfg_gsoc.cpp
modules/bgsegm/src/bgfg_gsoc.cpp
+10
-10
bgfg_subcnt.cpp
modules/bgsegm/src/bgfg_subcnt.cpp
+14
-14
No files found.
modules/bgsegm/include/opencv2/bgsegm.hpp
View file @
8af62cd6
...
...
@@ -196,8 +196,8 @@ class CV_EXPORTS_W BackgroundSubtractorCNT : public BackgroundSubtractor
{
public
:
// BackgroundSubtractor interface
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1
)
=
0
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
=
0
;
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1
)
CV_OVERRIDE
=
0
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
=
0
;
/** @brief Returns number of frames with same pixel color to consider stable.
*/
...
...
@@ -255,9 +255,9 @@ class CV_EXPORTS_W BackgroundSubtractorGSOC : public BackgroundSubtractor
{
public
:
// BackgroundSubtractor interface
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1
)
=
0
;
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1
)
CV_OVERRIDE
=
0
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
=
0
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
=
0
;
};
/** @brief Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at @cite LGuo2016
...
...
@@ -266,9 +266,9 @@ class CV_EXPORTS_W BackgroundSubtractorLSBP : public BackgroundSubtractor
{
public
:
// BackgroundSubtractor interface
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1
)
=
0
;
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1
)
CV_OVERRIDE
=
0
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
=
0
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
=
0
;
};
/** @brief This is for calculation of the LSBP descriptors.
...
...
modules/bgsegm/src/bgfg_gaussmix.cpp
View file @
8af62cd6
...
...
@@ -69,7 +69,7 @@ static const double defaultVarThreshold = 2.5*2.5;
static
const
double
defaultNoiseSigma
=
30
*
0.5
;
static
const
double
defaultInitialWeight
=
0.05
;
class
BackgroundSubtractorMOGImpl
:
public
BackgroundSubtractorMOG
class
BackgroundSubtractorMOGImpl
CV_FINAL
:
public
BackgroundSubtractorMOG
{
public
:
//! the default constructor
...
...
@@ -102,7 +102,7 @@ public:
}
//! the update operator
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=
0
);
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=
0
)
CV_OVERRIDE
;
//! re-initiaization method
virtual
void
initialize
(
Size
_frameSize
,
int
_frameType
)
...
...
@@ -122,24 +122,24 @@ public:
bgmodel
=
Scalar
::
all
(
0
);
}
virtual
void
getBackgroundImage
(
OutputArray
)
const
virtual
void
getBackgroundImage
(
OutputArray
)
const
CV_OVERRIDE
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
}
virtual
int
getHistory
()
const
{
return
history
;
}
virtual
void
setHistory
(
int
_nframes
)
{
history
=
_nframes
;
}
virtual
int
getHistory
()
const
CV_OVERRIDE
{
return
history
;
}
virtual
void
setHistory
(
int
_nframes
)
CV_OVERRIDE
{
history
=
_nframes
;
}
virtual
int
getNMixtures
()
const
{
return
nmixtures
;
}
virtual
void
setNMixtures
(
int
nmix
)
{
nmixtures
=
nmix
;
}
virtual
int
getNMixtures
()
const
CV_OVERRIDE
{
return
nmixtures
;
}
virtual
void
setNMixtures
(
int
nmix
)
CV_OVERRIDE
{
nmixtures
=
nmix
;
}
virtual
double
getBackgroundRatio
()
const
{
return
backgroundRatio
;
}
virtual
void
setBackgroundRatio
(
double
_backgroundRatio
)
{
backgroundRatio
=
_backgroundRatio
;
}
virtual
double
getBackgroundRatio
()
const
CV_OVERRIDE
{
return
backgroundRatio
;
}
virtual
void
setBackgroundRatio
(
double
_backgroundRatio
)
CV_OVERRIDE
{
backgroundRatio
=
_backgroundRatio
;
}
virtual
double
getNoiseSigma
()
const
{
return
noiseSigma
;
}
virtual
void
setNoiseSigma
(
double
_noiseSigma
)
{
noiseSigma
=
_noiseSigma
;
}
virtual
double
getNoiseSigma
()
const
CV_OVERRIDE
{
return
noiseSigma
;
}
virtual
void
setNoiseSigma
(
double
_noiseSigma
)
CV_OVERRIDE
{
noiseSigma
=
_noiseSigma
;
}
virtual
void
write
(
FileStorage
&
fs
)
const
virtual
void
write
(
FileStorage
&
fs
)
const
CV_OVERRIDE
{
fs
<<
"name"
<<
name_
<<
"history"
<<
history
...
...
@@ -148,7 +148,7 @@ public:
<<
"noiseSigma"
<<
noiseSigma
;
}
virtual
void
read
(
const
FileNode
&
fn
)
virtual
void
read
(
const
FileNode
&
fn
)
CV_OVERRIDE
{
CV_Assert
(
(
String
)
fn
[
"name"
]
==
name_
);
history
=
(
int
)
fn
[
"history"
];
...
...
modules/bgsegm/src/bgfg_gmg.cpp
View file @
8af62cd6
...
...
@@ -57,7 +57,7 @@ namespace cv
namespace
bgsegm
{
class
BackgroundSubtractorGMGImpl
:
public
BackgroundSubtractorGMG
class
BackgroundSubtractorGMGImpl
CV_FINAL
:
public
BackgroundSubtractorGMG
{
public
:
BackgroundSubtractorGMGImpl
()
...
...
@@ -96,49 +96,49 @@ public:
* @param image Input image
* @param fgmask Output mask image representing foreground and background pixels
*/
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1.0
);
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=-
1.0
)
CV_OVERRIDE
;
/**
* Releases all inner buffers.
*/
void
release
();
virtual
int
getMaxFeatures
()
const
{
return
maxFeatures
;
}
virtual
void
setMaxFeatures
(
int
_maxFeatures
)
{
maxFeatures
=
_maxFeatures
;
}
virtual
int
getMaxFeatures
()
const
CV_OVERRIDE
{
return
maxFeatures
;
}
virtual
void
setMaxFeatures
(
int
_maxFeatures
)
CV_OVERRIDE
{
maxFeatures
=
_maxFeatures
;
}
virtual
double
getDefaultLearningRate
()
const
{
return
learningRate
;
}
virtual
void
setDefaultLearningRate
(
double
lr
)
{
learningRate
=
lr
;
}
virtual
double
getDefaultLearningRate
()
const
CV_OVERRIDE
{
return
learningRate
;
}
virtual
void
setDefaultLearningRate
(
double
lr
)
CV_OVERRIDE
{
learningRate
=
lr
;
}
virtual
int
getNumFrames
()
const
{
return
numInitializationFrames
;
}
virtual
void
setNumFrames
(
int
nframes
)
{
numInitializationFrames
=
nframes
;
}
virtual
int
getNumFrames
()
const
CV_OVERRIDE
{
return
numInitializationFrames
;
}
virtual
void
setNumFrames
(
int
nframes
)
CV_OVERRIDE
{
numInitializationFrames
=
nframes
;
}
virtual
int
getQuantizationLevels
()
const
{
return
quantizationLevels
;
}
virtual
void
setQuantizationLevels
(
int
nlevels
)
{
quantizationLevels
=
nlevels
;
}
virtual
int
getQuantizationLevels
()
const
CV_OVERRIDE
{
return
quantizationLevels
;
}
virtual
void
setQuantizationLevels
(
int
nlevels
)
CV_OVERRIDE
{
quantizationLevels
=
nlevels
;
}
virtual
double
getBackgroundPrior
()
const
{
return
backgroundPrior
;
}
virtual
void
setBackgroundPrior
(
double
bgprior
)
{
backgroundPrior
=
bgprior
;
}
virtual
double
getBackgroundPrior
()
const
CV_OVERRIDE
{
return
backgroundPrior
;
}
virtual
void
setBackgroundPrior
(
double
bgprior
)
CV_OVERRIDE
{
backgroundPrior
=
bgprior
;
}
virtual
int
getSmoothingRadius
()
const
{
return
smoothingRadius
;
}
virtual
void
setSmoothingRadius
(
int
radius
)
{
smoothingRadius
=
radius
;
}
virtual
int
getSmoothingRadius
()
const
CV_OVERRIDE
{
return
smoothingRadius
;
}
virtual
void
setSmoothingRadius
(
int
radius
)
CV_OVERRIDE
{
smoothingRadius
=
radius
;
}
virtual
double
getDecisionThreshold
()
const
{
return
decisionThreshold
;
}
virtual
void
setDecisionThreshold
(
double
thresh
)
{
decisionThreshold
=
thresh
;
}
virtual
double
getDecisionThreshold
()
const
CV_OVERRIDE
{
return
decisionThreshold
;
}
virtual
void
setDecisionThreshold
(
double
thresh
)
CV_OVERRIDE
{
decisionThreshold
=
thresh
;
}
virtual
bool
getUpdateBackgroundModel
()
const
{
return
updateBackgroundModel
;
}
virtual
void
setUpdateBackgroundModel
(
bool
update
)
{
updateBackgroundModel
=
update
;
}
virtual
bool
getUpdateBackgroundModel
()
const
CV_OVERRIDE
{
return
updateBackgroundModel
;
}
virtual
void
setUpdateBackgroundModel
(
bool
update
)
CV_OVERRIDE
{
updateBackgroundModel
=
update
;
}
virtual
double
getMinVal
()
const
{
return
minVal_
;
}
virtual
void
setMinVal
(
double
val
)
{
minVal_
=
val
;
}
virtual
double
getMinVal
()
const
CV_OVERRIDE
{
return
minVal_
;
}
virtual
void
setMinVal
(
double
val
)
CV_OVERRIDE
{
minVal_
=
val
;
}
virtual
double
getMaxVal
()
const
{
return
maxVal_
;
}
virtual
void
setMaxVal
(
double
val
)
{
maxVal_
=
val
;
}
virtual
double
getMaxVal
()
const
CV_OVERRIDE
{
return
maxVal_
;
}
virtual
void
setMaxVal
(
double
val
)
CV_OVERRIDE
{
maxVal_
=
val
;
}
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
{
backgroundImage
.
release
();
}
virtual
void
write
(
FileStorage
&
fs
)
const
virtual
void
write
(
FileStorage
&
fs
)
const
CV_OVERRIDE
{
fs
<<
"name"
<<
name_
<<
"maxFeatures"
<<
maxFeatures
...
...
@@ -152,7 +152,7 @@ public:
// we do not save minVal_ & maxVal_, since they depend on the image type.
}
virtual
void
read
(
const
FileNode
&
fn
)
virtual
void
read
(
const
FileNode
&
fn
)
CV_OVERRIDE
{
CV_Assert
(
(
String
)
fn
[
"name"
]
==
name_
);
maxFeatures
=
(
int
)
fn
[
"maxFeatures"
];
...
...
@@ -323,7 +323,7 @@ public:
{
}
void
operator
()
(
const
Range
&
range
)
const
;
void
operator
()
(
const
Range
&
range
)
const
CV_OVERRIDE
;
private
:
Mat
frame_
;
...
...
modules/bgsegm/src/bgfg_gsoc.cpp
View file @
8af62cd6
...
...
@@ -364,7 +364,7 @@ private:
public
:
ParallelLocalSVDValues
(
const
Size
&
_sz
,
Mat
&
_localSVDValues
,
const
Mat
&
_frameGray
)
:
sz
(
_sz
),
localSVDValues
(
_localSVDValues
),
frameGray
(
_frameGray
)
{};
void
operator
()(
const
Range
&
range
)
const
{
void
operator
()(
const
Range
&
range
)
const
CV_OVERRIDE
{
for
(
int
i
=
range
.
start
;
i
<
range
.
end
;
++
i
)
for
(
int
j
=
1
;
j
<
sz
.
width
-
1
;
++
j
)
{
localSVDValues
.
at
<
float
>
(
i
,
j
)
=
localSVD
(
...
...
@@ -387,7 +387,7 @@ private:
public
:
ParallelFromLocalSVDValues
(
const
Size
&
_sz
,
Mat
&
_desc
,
const
Mat
&
_localSVDValues
,
const
Point2i
*
_LSBPSamplePoints
)
:
sz
(
_sz
),
desc
(
_desc
),
localSVDValues
(
_localSVDValues
),
LSBPSamplePoints
(
_LSBPSamplePoints
)
{};
void
operator
()(
const
Range
&
range
)
const
{
void
operator
()(
const
Range
&
range
)
const
CV_OVERRIDE
{
for
(
int
index
=
range
.
start
;
index
<
range
.
end
;
++
index
)
{
const
int
i
=
index
/
sz
.
width
,
j
=
index
%
sz
.
width
;
int
&
descVal
=
desc
.
at
<
int
>
(
i
,
j
);
...
...
@@ -455,7 +455,7 @@ void BackgroundSubtractorLSBPDesc::compute(OutputArray desc, const Mat& frame, c
computeFromLocalSVDValues
(
desc
,
localSVDValues
,
LSBPSamplePoints
);
}
class
BackgroundSubtractorGSOCImpl
:
public
BackgroundSubtractorGSOC
{
class
BackgroundSubtractorGSOCImpl
CV_FINAL
:
public
BackgroundSubtractorGSOC
{
private
:
Ptr
<
BackgroundModelGSOC
>
backgroundModel
;
Ptr
<
BackgroundModelGSOC
>
backgroundModelPrev
;
...
...
@@ -492,14 +492,14 @@ public:
float
noiseRemovalThresholdFacBG
,
float
noiseRemovalThresholdFacFG
);
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=
-
1
);
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=
-
1
)
CV_OVERRIDE
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
;
friend
class
ParallelGSOC
;
};
class
BackgroundSubtractorLSBPImpl
:
public
BackgroundSubtractorLSBP
{
class
BackgroundSubtractorLSBPImpl
CV_FINAL
:
public
BackgroundSubtractorLSBP
{
private
:
Ptr
<
BackgroundModelLSBP
>
backgroundModel
;
Ptr
<
BackgroundModelLSBP
>
backgroundModelPrev
;
...
...
@@ -540,9 +540,9 @@ public:
int
minCount
);
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=
-
1
);
CV_WRAP
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
=
-
1
)
CV_OVERRIDE
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
;
CV_WRAP
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
;
friend
class
ParallelLSBP
;
};
...
...
@@ -561,7 +561,7 @@ public:
ParallelGSOC
(
const
Size
&
_sz
,
BackgroundSubtractorGSOCImpl
*
_bgs
,
const
Mat
&
_frame
,
double
_learningRate
,
Mat
&
_fgMask
)
:
sz
(
_sz
),
bgs
(
_bgs
),
frame
(
_frame
),
learningRate
(
_learningRate
),
fgMask
(
_fgMask
)
{};
void
operator
()(
const
Range
&
range
)
const
{
void
operator
()(
const
Range
&
range
)
const
CV_OVERRIDE
{
BackgroundModelGSOC
*
backgroundModel
=
bgs
->
backgroundModel
.
get
();
Mat
&
distMovingAvg
=
bgs
->
distMovingAvg
;
...
...
@@ -621,7 +621,7 @@ public:
ParallelLSBP
(
const
Size
&
_sz
,
BackgroundSubtractorLSBPImpl
*
_bgs
,
const
Mat
&
_frame
,
double
_learningRate
,
const
Mat
&
_LSBPDesc
,
Mat
&
_fgMask
)
:
sz
(
_sz
),
bgs
(
_bgs
),
frame
(
_frame
),
learningRate
(
_learningRate
),
LSBPDesc
(
_LSBPDesc
),
fgMask
(
_fgMask
)
{};
void
operator
()(
const
Range
&
range
)
const
{
void
operator
()(
const
Range
&
range
)
const
CV_OVERRIDE
{
BackgroundModelLSBP
*
backgroundModel
=
bgs
->
backgroundModel
.
get
();
Mat
&
T
=
bgs
->
T
;
Mat
&
R
=
bgs
->
R
;
...
...
modules/bgsegm/src/bgfg_subcnt.cpp
View file @
8af62cd6
...
...
@@ -50,7 +50,7 @@ namespace cv
namespace
bgsegm
{
class
BackgroundSubtractorCNTImpl
:
public
BackgroundSubtractorCNT
class
BackgroundSubtractorCNTImpl
CV_FINAL
:
public
BackgroundSubtractorCNT
{
public
:
...
...
@@ -60,20 +60,20 @@ public:
bool
isParallel
);
// BackgroundSubtractor interface
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
);
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
;
virtual
void
apply
(
InputArray
image
,
OutputArray
fgmask
,
double
learningRate
)
CV_OVERRIDE
;
virtual
void
getBackgroundImage
(
OutputArray
backgroundImage
)
const
CV_OVERRIDE
;
int
getMinPixelStability
()
const
;
void
setMinPixelStability
(
int
value
);
int
getMinPixelStability
()
const
CV_OVERRIDE
;
void
setMinPixelStability
(
int
value
)
CV_OVERRIDE
;
int
getMaxPixelStability
()
const
;
void
setMaxPixelStability
(
int
value
);
int
getMaxPixelStability
()
const
CV_OVERRIDE
;
void
setMaxPixelStability
(
int
value
)
CV_OVERRIDE
;
bool
getUseHistory
()
const
;
void
setUseHistory
(
bool
value
);
bool
getUseHistory
()
const
CV_OVERRIDE
;
void
setUseHistory
(
bool
value
)
CV_OVERRIDE
;
bool
getIsParallel
()
const
;
void
setIsParallel
(
bool
value
);
bool
getIsParallel
()
const
CV_OVERRIDE
;
void
setIsParallel
(
bool
value
)
CV_OVERRIDE
;
//! the destructor
virtual
~
BackgroundSubtractorCNTImpl
()
{}
...
...
@@ -185,7 +185,7 @@ struct BGSubtractPixel : public CNTFunctor
//! the destructor
virtual
~
BGSubtractPixel
()
{}
void
operator
()(
Vec4i
&
vec
,
uchar
currColor
,
uchar
prevColor
,
uchar
&
fgMaskPixelRef
)
void
operator
()(
Vec4i
&
vec
,
uchar
currColor
,
uchar
prevColor
,
uchar
&
fgMaskPixelRef
)
CV_OVERRIDE
{
int
&
stabilityRef
=
vec
[
0
];
int
&
bgImgRef
=
vec
[
3
];
...
...
@@ -248,7 +248,7 @@ struct BGSubtractPixelWithHistory : public CNTFunctor
}
}
void
operator
()(
Vec4i
&
vec
,
uchar
currColor
,
uchar
prevColor
,
uchar
&
fgMaskPixelRef
)
void
operator
()(
Vec4i
&
vec
,
uchar
currColor
,
uchar
prevColor
,
uchar
&
fgMaskPixelRef
)
CV_OVERRIDE
{
int
&
stabilityRef
=
vec
[
0
];
int
&
historyColorRef
=
vec
[
1
];
...
...
@@ -316,7 +316,7 @@ public:
}
// Iterate rows
void
operator
()(
const
Range
&
range
)
const
void
operator
()(
const
Range
&
range
)
const
CV_OVERRIDE
{
for
(
int
r
=
range
.
start
;
r
<
range
.
end
;
++
r
)
{
...
...
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