Commit 88bae7be authored by jaco's avatar jaco

SuBSENSE porting: compiling errors fixed

parent 00d9ef42
set(the_description "Saliency API")
ocv_define_module(saliency opencv_imgproc opencv_highgui)
ocv_define_module(saliency opencv_imgproc opencv_highgui opencv_features2d)
......@@ -81,11 +81,11 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
StaticSaliencySpectralResidual();
~StaticSaliencySpectralResidual();
typedef Ptr<Size> (cv::Algorithm::*SizeGetter)();
typedef void (cv::Algorithm::*SizeSetter)( const cv::Ptr<Size> & );
typedef Ptr<Size> (Algorithm::*SizeGetter)();
typedef void (Algorithm::*SizeSetter)( const Ptr<Size> & );
Ptr<Size> getWsize();
void setWsize( const cv::Ptr<Size> &arrPtr );
void setWsize( const Ptr<Size> &arrPtr );
void read( const FileNode& fn );
void write( FileStorage& fs ) const;
......@@ -99,28 +99,6 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
/************************************ Specific Motion Saliency Specialized Classes ************************************/
/**
* \brief Saliency based on algorithms described in [2]
* [2] Hofmann, Martin, Philipp Tiefenbacher, and Gerhard Rigoll. "Background segmentation with feedback: The pixel-based adaptive segmenter."
* Computer Vision and Pattern Recognition Workshops (CVPRW), 2012 IEEE Computer Society Conference on. IEEE, 2012.
*/
class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency
{
public:
//MotionSaliencyPBAS( const MotionSaliencyPBAS::Params &parameters = MotionSaliencyPBAS::Params() );
MotionSaliencyPBAS();
~MotionSaliencyPBAS();
void read( const FileNode& fn );
void write( FileStorage& fs ) const;
protected:
bool computeSaliencyImpl( const InputArray src, OutputArray dst );
AlgorithmInfo* info() const;
};
/*!
Self-Balanced Sensitivity segmenTER (SuBSENSE) foreground-background segmentation algorithm.
......@@ -147,13 +125,13 @@ class CV_EXPORTS_W MotionSaliencySuBSENSE : public BackgroundSubtractorLBSP, pub
virtual ~MotionSaliencySuBSENSE();
//! (re)initiaization method; needs to be called before starting background subtraction (note: also reinitializes the keypoints vector)
virtual void initialize( const cv::Mat& oInitImg, const std::vector<cv::KeyPoint>& voKeyPoints );
virtual void initialize( const Mat& oInitImg, const std::vector<KeyPoint>& voKeyPoints );
//! refreshes all samples based on the last analyzed frame
virtual void refreshModel( float fSamplesRefreshFrac );
//! primary model update function; the learning param is used to override the internal learning thresholds (ignored when <= 0)
virtual void operator()( cv::InputArray image, cv::OutputArray fgmask, double learningRateOverride = 0 );
virtual void operator()( InputArray image, OutputArray fgmask, double learningRateOverride = 0 );
//! returns a copy of the latest reconstructed background image
void getBackgroundImage( cv::OutputArray backgroundImage ) const;
void getBackgroundImage( OutputArray backgroundImage ) const;
//! turns automatic model reset on or off
void setAutomaticModelReset( bool );
......@@ -195,43 +173,43 @@ class CV_EXPORTS_W MotionSaliencySuBSENSE : public BackgroundSubtractorLBSP, pub
std::vector<Mat> m_voBGColorSamples;
//! per-pixel update rates ('T(x)' in PBAS, which contains pixel-level 'sigmas', as referred to in ViBe)
cv::Mat m_oUpdateRateFrame;
Mat m_oUpdateRateFrame;
//! per-pixel distance thresholds (equivalent to 'R(x)' in PBAS, but used as a relative value to determine both intensity and descriptor variation thresholds)
cv::Mat m_oDistThresholdFrame;
Mat m_oDistThresholdFrame;
//! per-pixel distance variation modulators ('v(x)', relative value used to modulate 'R(x)' and 'T(x)' variations)
cv::Mat m_oVariationModulatorFrame;
Mat m_oVariationModulatorFrame;
//! per-pixel mean distances between consecutive frames ('D_last(x)', used to detect ghosts and high variation regions in the sequence)
cv::Mat m_oMeanLastDistFrame;
Mat m_oMeanLastDistFrame;
//! per-pixel mean minimal distances from the model ('D_min(x)' in PBAS, used to control variation magnitude and direction of 'T(x)' and 'R(x)')
cv::Mat m_oMeanMinDistFrame_LT, m_oMeanMinDistFrame_ST;
Mat m_oMeanMinDistFrame_LT, m_oMeanMinDistFrame_ST;
//! per-pixel mean downsampled distances between consecutive frames (used to analyze camera movement and control max learning rates globally)
cv::Mat m_oMeanDownSampledLastDistFrame_LT, m_oMeanDownSampledLastDistFrame_ST;
Mat m_oMeanDownSampledLastDistFrame_LT, m_oMeanDownSampledLastDistFrame_ST;
//! per-pixel mean raw segmentation results
cv::Mat m_oMeanRawSegmResFrame_LT, m_oMeanRawSegmResFrame_ST;
Mat m_oMeanRawSegmResFrame_LT, m_oMeanRawSegmResFrame_ST;
//! per-pixel mean final segmentation results
cv::Mat m_oMeanFinalSegmResFrame_LT, m_oMeanFinalSegmResFrame_ST;
Mat m_oMeanFinalSegmResFrame_LT, m_oMeanFinalSegmResFrame_ST;
//! a lookup map used to keep track of unstable regions (based on segm. noise & local dist. thresholds)
cv::Mat m_oUnstableRegionMask;
Mat m_oUnstableRegionMask;
//! per-pixel blink detection results ('Z(x)')
cv::Mat m_oBlinksFrame;
Mat m_oBlinksFrame;
//! pre-allocated matrix used to downsample (1/8) the input frame when needed
cv::Mat m_oDownSampledColorFrame;
Mat m_oDownSampledColorFrame;
//! copy of previously used pixel intensities used to calculate 'D_last(x)'
cv::Mat m_oLastColorFrame;
Mat m_oLastColorFrame;
//! copy of previously used descriptors used to calculate 'D_last(x)'
cv::Mat m_oLastDescFrame;
Mat m_oLastDescFrame;
//! the foreground mask generated by the method at [t-1] (without post-proc, used for blinking px detection)
cv::Mat m_oRawFGMask_last;
Mat m_oRawFGMask_last;
//! the foreground mask generated by the method at [t-1] (with post-proc)
cv::Mat m_oFGMask_last;
Mat m_oFGMask_last;
//! pre-allocated CV_8UC1 matrices used to speed up morph ops
cv::Mat m_oFGMask_PreFlood;
cv::Mat m_oFGMask_FloodedHoles;
cv::Mat m_oFGMask_last_dilated;
cv::Mat m_oFGMask_last_dilated_inverted;
cv::Mat m_oRawFGBlinkMask_curr;
cv::Mat m_oRawFGBlinkMask_last;
Mat m_oFGMask_PreFlood;
Mat m_oFGMask_FloodedHoles;
Mat m_oFGMask_last_dilated;
Mat m_oFGMask_last_dilated_inverted;
Mat m_oRawFGBlinkMask_curr;
Mat m_oRawFGBlinkMask_last;
};
......
......@@ -13,7 +13,7 @@
This algorithm is currently NOT thread-safe.
*/
class BackgroundSubtractorLBSP : public cv::BackgroundSubtractor {
class BackgroundSubtractorLBSP /* : public cv::BackgroundSubtractor */ {
public:
//! full constructor
BackgroundSubtractorLBSP(float fRelLBSPThreshold, size_t nDescDistThreshold, size_t nLBSPThresholdOffset=0);
......
......@@ -52,7 +52,7 @@ CV_INIT_ALGORITHM(
reinterpret_cast<SizeGetter>( &StaticSaliencySpectralResidual::getWsize ),
reinterpret_cast<SizeSetter>( &StaticSaliencySpectralResidual::setWsize ) ) );
CV_INIT_ALGORITHM( MotionSaliencyPBAS, "SALIENCY.PBAS", );
CV_INIT_ALGORITHM( MotionSaliencySuBSENSE, "SALIENCY.SuBSENSE", );
CV_INIT_ALGORITHM(
ObjectnessBING, "SALIENCY.BING",
......@@ -62,7 +62,7 @@ bool initModule_saliency( void )
{
bool all = true;
all &= !StaticSaliencySpectralResidual_info_auto.name().empty();
all &= !MotionSaliencyPBAS_info_auto.name().empty();
all &= !MotionSaliencySuBSENSE_info_auto.name().empty();
all &= !ObjectnessBING_info_auto.name().empty();
return all;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment