42#ifndef __OPENCV_SALIENCY_SPECIALIZED_CLASSES_HPP__
43#define __OPENCV_SALIENCY_SPECIALIZED_CLASSES_HPP__
49#include "saliencyBaseClasses.hpp"
50#include "opencv2/core.hpp"
78 return makePtr<StaticSaliencySpectralResidual>();
81 CV_WRAP
bool computeSaliency( InputArray image,
OutputArray saliencyMap )
86 return computeSaliencyImpl( image, saliencyMap );
89 CV_WRAP
void read(
const FileNode& fn ) CV_OVERRIDE;
92 CV_WRAP
int getImageWidth()
const
96 CV_WRAP
inline void setImageWidth(
int val)
100 CV_WRAP
int getImageHeight()
const
104 CV_WRAP
void setImageHeight(
int val)
110 bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap ) CV_OVERRIDE;
111 CV_PROP_RW
int resImWidth;
112 CV_PROP_RW
int resImHeight;
130 return makePtr<StaticSaliencyFineGrained>();
133 CV_WRAP
bool computeSaliency( InputArray image,
OutputArray saliencyMap )
138 return computeSaliencyImpl( image, saliencyMap );
143 bool computeSaliencyImpl( InputArray image,
OutputArray saliencyMap ) CV_OVERRIDE;
146 void calcIntensityChannel(
Mat src,
Mat dst);
147 void copyImage(
Mat src,
Mat dst);
148 void getIntensityScaled(
Mat integralImage,
Mat gray,
Mat saliencyOn,
Mat saliencyOff,
int neighborhood);
149 float getMean(
Mat srcArg,
Point2i PixArg,
int neighbourhood,
int centerVal);
150 void mixScales(
Mat *saliencyOn,
Mat intensityOn,
Mat *saliencyOff,
Mat intensityOff,
const int numScales);
151 void mixOnOff(
Mat intensityOn,
Mat intensityOff,
Mat intensity);
152 void getIntensity(
Mat srcArg,
Mat dstArg,
Mat dstOnArg,
Mat dstOffArg,
bool generateOnOff);
177 return makePtr<MotionSaliencyBinWangApr2014>();
180 CV_WRAP
bool computeSaliency( InputArray image,
OutputArray saliencyMap )
185 return computeSaliencyImpl( image, saliencyMap );
193 CV_WRAP
void setImagesize(
int W,
int H );
199 CV_WRAP
int getImageWidth()
const
203 CV_WRAP
inline void setImageWidth(
int val)
207 CV_WRAP
int getImageHeight()
const
211 CV_WRAP
void setImageHeight(
int val)
230 bool fullResolutionDetection(
const Mat& image,
Mat& highResBFMask );
231 bool lowResolutionDetection(
const Mat& image,
Mat& lowResBFMask );
234 bool templateOrdering();
235 bool templateReplacement(
const Mat& finalBFMask,
const Mat& image );
238 bool activityControl(
const Mat& current_noisePixelsMask);
239 bool decisionThresholdAdaptation();
242 std::vector<Ptr<Mat> > backgroundModel;
245 Mat potentialBackground;
247 Mat epslonPixelsValue;
249 Mat activityPixelsValue;
258 bool activityControlFlag;
259 bool neighborhoodCheck;
261 CV_PROP_RW
int imageWidth;
262 CV_PROP_RW
int imageHeight;
277 float deltaINC, deltaDEC;
278 int epslonMIN, epslonMAX;
300 return makePtr<ObjectnessBING>();
303 CV_WRAP
bool computeSaliency( InputArray image,
OutputArray saliencyMap )
308 return computeSaliencyImpl( image, saliencyMap );
312 CV_WRAP
void write()
const;
320 CV_WRAP std::vector<float> getobjectnessValues();
326 CV_WRAP
void setTrainingPath(
const String& trainingPath );
335 CV_WRAP
void setBBResDir(
const String& resultsDir );
337 CV_WRAP
double getBase()
const
341 CV_WRAP
inline void setBase(
double val)
345 CV_WRAP
int getNSS()
const
349 CV_WRAP
void setNSS(
int val)
353 CV_WRAP
int getW()
const
357 CV_WRAP
void setW(
int val)
379 void update(
Mat &w );
384 float dot( int64_t tig1, int64_t tig2, int64_t tig4, int64_t tig8 );
385 void reconstruct(
Mat &w );
388 static const int NUM_COMP = 2;
389 static const int D = 64;
390 int64_t _bTIGs[NUM_COMP];
391 float _coeffs1[NUM_COMP];
394 float _coeffs2[NUM_COMP], _coeffs4[NUM_COMP], _coeffs8[NUM_COMP];
397 template<
typename VT,
typename ST>
403 void reserve(
int resSz );
404 void pushBack(
const VT& val,
const ST& structVal );
405 const VT& operator ()(
int i )
const;
406 const ST& operator [](
int i )
const;
407 VT& operator ()(
int i );
408 ST& operator [](
int i );
410 void sort(
bool descendOrder =
true );
411 const std::vector<ST> &getSortedStructVal();
412 std::vector<std::pair<VT, int> > getvalIdxes();
413 void append(
const ValStructVec<VT, ST> &newVals,
int startV = 0 );
415 std::vector<ST> structVals;
417 std::vector<std::pair<VT, int> > valIdxes;
422 std::vector<ST> sortedStructVals;
432 double _base, _logBase;
435 int _maxT, _minT, _numT;
438 static const char* _clrName[3];
441 std::string _modelName, _bbResDir, _trainingPath, _resultsDir;
443 std::vector<int> _svmSzIdxs;
450 std::vector<float> objectnessValues;
455 inline static float LoG(
float x,
float y,
float delta )
457 float d = - ( x * x + y * y ) / ( 2 * delta * delta );
458 return -1.0f / ( (float) ( CV_PI ) *
pow( delta, 4 ) ) * ( 1 + d ) *
exp( d );
462 static bool matRead(
const std::string& filename, Mat& M );
464 void setColorSpace(
int clr = MAXBGR );
467 int loadTrainedModel();
472 void getObjBndBoxes( Mat &img3u, ValStructVec<float, Vec4i> &valBoxes,
int numDetPerSize = 120 );
473 void getObjBndBoxesForSingleImage( Mat img, ValStructVec<float, Vec4i> &boxes,
int numDetPerSize );
477 int n = (int) _svmSzIdxs.size();
478 return n > 0 && _svmReW1f.size() == Size( 2, n ) && _svmFilter.size() == Size( _W, _W );
480 void predictBBoxSI( Mat &mag3u, ValStructVec<float, Vec4i> &valBoxes, std::vector<int> &sz,
int NUM_WIN_PSZ = 100,
bool fast =
true );
481 void predictBBoxSII( ValStructVec<float, Vec4i> &valBoxes,
const std::vector<int> &sz );
484 void gradientMag( Mat &imgBGR3u, Mat &mag1u );
486 static void gradientRGB( Mat &bgr3u, Mat &mag1u );
487 static void gradientGray( Mat &bgr3u, Mat &mag1u );
488 static void gradientHSV( Mat &bgr3u, Mat &mag1u );
489 static void gradientXY( Mat &x1i, Mat &y1i, Mat &mag1u );
491 static inline int bgrMaxDist(
const Vec3b &u,
const Vec3b &v )
493 int b =
abs( u[0] - v[0] ), g =
abs( u[1] - v[1] ), r =
abs( u[2] - v[2] );
497 static inline int vecDist3b(
const Vec3b &u,
const Vec3b &v )
499 return abs( u[0] - v[0] ) +
abs( u[1] - v[1] ) +
abs( u[2] - v[2] );
503 static void nonMaxSup( Mat &matchCost1f, ValStructVec<float, Point> &matchCost,
int NSS = 1,
int maxPoint = 50,
bool fast =
true );
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
File Storage Node class.
Definition: persistence.hpp:482
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...
Definition: persistence.hpp:304
n-dimensional dense array class
Definition: mat.hpp:802
the Fast Self-tuning Background Subtraction Algorithm from
Definition: saliencySpecializedClasses.hpp:170
bool computeSaliencyImpl(InputArray image, OutputArray saliencyMap) CV_OVERRIDE
Performs all the operations and calls all internal functions necessary for the accomplishment of the ...
Definition: saliencyBaseClasses.hpp:112
Objectness algorithms based on [3] [3] Cheng, Ming-Ming, et al. "BING: Binarized normed gradients for...
Definition: saliencySpecializedClasses.hpp:292
bool computeSaliencyImpl(InputArray image, OutputArray objectnessBoundingBox) CV_OVERRIDE
Performs all the operations and calls all internal functions necessary for the accomplishment of the ...
Definition: saliencyBaseClasses.hpp:121
the Fine Grained Saliency approach from
Definition: saliencySpecializedClasses.hpp:123
Definition: saliencyBaseClasses.hpp:86
the Spectral Residual approach from
Definition: saliencySpecializedClasses.hpp:70
void write(FileStorage &fs) const CV_OVERRIDE
Stores algorithm parameters in a file storage
CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element maximum of two arrays or an array and a scalar.
CV_EXPORTS_W void exp(InputArray src, OutputArray dst)
Calculates the exponent of every array element.
CV_EXPORTS_W void pow(InputArray src, double power, OutputArray dst)
Raises every array element to a power.
CV_EXPORTS_W void sort(InputArray src, OutputArray dst, int flags)
Sorts each row or each column of a matrix.
softfloat abs(softfloat a)
Absolute value
Definition: softfloat.hpp:444
CV_EXPORTS_W void matchTemplate(InputArray image, InputArray templ, OutputArray result, int method, InputArray mask=noArray())
Compares a template against overlapped image regions.
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: features2d.hpp:910
Definition: cvstd_wrapper.hpp:74