Commit f3cada31 authored by jaco's avatar jaco

BING code refined

parent b7696377
...@@ -50,12 +50,6 @@ ...@@ -50,12 +50,6 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
//TODO delete
//#define SALIENCY_DEBUG true
#ifdef SALIENCY_DEBUG
#include <opencv2/highgui.hpp>
#endif
namespace cv namespace cv
{ {
...@@ -68,13 +62,6 @@ namespace cv ...@@ -68,13 +62,6 @@ namespace cv
class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
{ {
public: public:
/*struct CV_EXPORTS Params
{
Params();
Size resizedImageSize;
void read( const FileNode& fn );
void write( FileStorage& fs ) const;
}; */
//StaticSaliencySpectralResidual( const StaticSaliencySpectralResidual::Params &parameters = StaticSaliencySpectralResidual::Params() ); //StaticSaliencySpectralResidual( const StaticSaliencySpectralResidual::Params &parameters = StaticSaliencySpectralResidual::Params() );
StaticSaliencySpectralResidual(); StaticSaliencySpectralResidual();
...@@ -91,11 +78,8 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency ...@@ -91,11 +78,8 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
protected: protected:
bool computeSaliencyImpl( const InputArray src, OutputArray dst ); bool computeSaliencyImpl( const InputArray src, OutputArray dst );
AlgorithmInfo* info() const; AlgorithmInfo* info() const;CV_PROP_RW
CV_PROP_RW Ptr<Size> resizedImageSize; Ptr<Size> resizedImageSize;
private:
//Params params;
}; };
...@@ -109,12 +93,6 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency ...@@ -109,12 +93,6 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency
{ {
public: public:
/* struct CV_EXPORTS Params
{
Params();
void read( const FileNode& fn );
void write( FileStorage& fs ) const;
}; */
//MotionSaliencyPBAS( const MotionSaliencyPBAS::Params &parameters = MotionSaliencyPBAS::Params() ); //MotionSaliencyPBAS( const MotionSaliencyPBAS::Params &parameters = MotionSaliencyPBAS::Params() );
MotionSaliencyPBAS(); MotionSaliencyPBAS();
...@@ -127,8 +105,6 @@ class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency ...@@ -127,8 +105,6 @@ class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency
bool computeSaliencyImpl( const InputArray src, OutputArray dst ); bool computeSaliencyImpl( const InputArray src, OutputArray dst );
AlgorithmInfo* info() const; AlgorithmInfo* info() const;
private:
//Params params;
}; };
/************************************ Specific Objectness Specialized Classes ************************************/ /************************************ Specific Objectness Specialized Classes ************************************/
...@@ -148,72 +124,94 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness ...@@ -148,72 +124,94 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness
void write() const; void write() const;
// Load trained model. // Load trained model.
int loadTrainedModel(std::string modelName = ""); // Return -1, 0, or 1 if partial, none, or all loaded int loadTrainedModel( std::string modelName = "" ); // Return -1, 0, or 1 if partial, none, or all loaded
// Get potential bounding boxes, each of which is represented by a Vec4i for (minX, minY, maxX, maxY). // Get potential bounding boxes, each of which is represented by a Vec4i for (minX, minY, maxX, maxY).
// The trained model should be prepared before calling this function: loadTrainedModel() or trainStageI() + trainStageII(). // The trained model should be prepared before calling this function: loadTrainedModel() or trainStageI() + trainStageII().
// Use numDet to control the final number of proposed bounding boxes, and number of per size (scale and aspect ratio) // Use numDet to control the final number of proposed bounding boxes, and number of per size (scale and aspect ratio)
void getObjBndBoxes(CMat &img3u, ValStructVec<float, Vec4i> &valBoxes, int numDetPerSize = 120); void getObjBndBoxes( CMat &img3u, ValStructVec<float, Vec4i> &valBoxes, int numDetPerSize = 120 );
void getObjBndBoxesForSingleImage(Mat img, ValStructVec<float, Vec4i> &boxes, int numDetPerSize); void getObjBndBoxesForSingleImage( Mat img, ValStructVec<float, Vec4i> &boxes, int numDetPerSize );
vector<float> getobjectnessValues(); vector<float> getobjectnessValues();
void setColorSpace(int clr = MAXBGR); void setColorSpace( int clr = MAXBGR );
void setTrainingPath(string trainingPath); void setTrainingPath( string trainingPath );
void setBBResDir(string resultsDir); void setBBResDir( string resultsDir );
// Read matrix from binary file // Read matrix from binary file
static bool matRead( const std::string& filename, Mat& M); static bool matRead( const std::string& filename, Mat& M );
enum {MAXBGR, HSV, G}; enum
{
inline static float LoG(float x, float y, float delta) {float d = -(x*x+y*y)/(2*delta*delta); return -1.0f/((float)(CV_PI)*pow(delta, 4)) * (1+d)*exp(d);} // Laplacian of Gaussian MAXBGR,
HSV,
G
};
inline static float LoG( float x, float y, float delta )
{
float d = - ( x * x + y * y ) / ( 2 * delta * delta );
return -1.0f / ( (float) ( CV_PI ) * pow( delta, 4 ) ) * ( 1 + d ) * exp( d );
} // Laplacian of Gaussian
protected: protected:
bool computeSaliencyImpl( const InputArray src, OutputArray dst ); bool computeSaliencyImpl( const InputArray src, OutputArray dst );
AlgorithmInfo* info() const; AlgorithmInfo* info() const;
private: // Parameters private:
double _base, _logBase; // base for window size quantization // Parameters
int _W; // As described in the paper: #Size, Size(_W, _H) of feature window. double _base, _logBase; // base for window size quantization
int _NSS; // Size for non-maximal suppress int _W; // As described in the paper: #Size, Size(_W, _H) of feature window.
int _maxT, _minT, _numT; // The minimal and maximal dimensions of the template int _NSS; // Size for non-maximal suppress
int _maxT, _minT, _numT; // The minimal and maximal dimensions of the template
int _Clr; //
static const char* _clrName[3];
// Names and paths to read model and to store results
std:: string _modelName, _bbResDir, _trainingPath, _resultsDir;
vecI _svmSzIdxs; // Indexes of active size. It's equal to _svmFilters.size() and _svmReW1f.rows
Mat _svmFilter; // Filters learned at stage I, each is a _H by _W CV_32F matrix
FilterTIG _tigF; // TIG filter
Mat _svmReW1f; // Re-weight parameters learned at stage II.
// List of the rectangles' objectness value, in the same order as
// the vector<Vec4i> objectnessBoundingBox returned by the algorithm (in computeSaliencyImpl function)
vector<float> objectnessValues;
//vector<Vec4i> objectnessBoundingBox;
private: // Help functions
bool filtersLoaded() {int n = _svmSzIdxs.size(); return n > 0 && _svmReW1f.size() == Size(2, n) && _svmFilter.size() == Size(_W, _W);} int _Clr; //
void predictBBoxSI(CMat &mag3u, ValStructVec<float, Vec4i> &valBoxes, vecI &sz, int NUM_WIN_PSZ = 100, bool fast = true); static const char* _clrName[3];
void predictBBoxSII(ValStructVec<float, Vec4i> &valBoxes, const vecI &sz);
// Calculate the image gradient: center option as in VLFeat // Names and paths to read model and to store results
void gradientMag(CMat &imgBGR3u, Mat &mag1u); std::string _modelName, _bbResDir, _trainingPath, _resultsDir;
static void gradientRGB(CMat &bgr3u, Mat &mag1u); vecI _svmSzIdxs; // Indexes of active size. It's equal to _svmFilters.size() and _svmReW1f.rows
static void gradientGray(CMat &bgr3u, Mat &mag1u); Mat _svmFilter; // Filters learned at stage I, each is a _H by _W CV_32F matrix
static void gradientHSV(CMat &bgr3u, Mat &mag1u); FilterTIG _tigF; // TIG filter
static void gradientXY(CMat &x1i, CMat &y1i, Mat &mag1u); Mat _svmReW1f; // Re-weight parameters learned at stage II.
static inline int bgrMaxDist(const Vec3b &u, const Vec3b &v) {int b = abs(u[0]-v[0]), g = abs(u[1]-v[1]), r = abs(u[2]-v[2]); b = max(b,g); return max(b,r);} // List of the rectangles' objectness value, in the same order as
static inline int vecDist3b(const Vec3b &u, const Vec3b &v) {return abs(u[0]-v[0]) + abs(u[1]-v[1]) + abs(u[2]-v[2]);} // the vector<Vec4i> objectnessBoundingBox returned by the algorithm (in computeSaliencyImpl function)
vector<float> objectnessValues;
//vector<Vec4i> objectnessBoundingBox;
//Non-maximal suppress private:
static void nonMaxSup(CMat &matchCost1f, ValStructVec<float, Point> &matchCost, int NSS = 1, int maxPoint = 50, bool fast = true); // Help functions
bool filtersLoaded()
{
int n = _svmSzIdxs.size();
return n > 0 && _svmReW1f.size() == Size( 2, n ) && _svmFilter.size() == Size( _W, _W );
}
void predictBBoxSI( CMat &mag3u, ValStructVec<float, Vec4i> &valBoxes, vecI &sz, int NUM_WIN_PSZ = 100, bool fast = true );
void predictBBoxSII( ValStructVec<float, Vec4i> &valBoxes, const vecI &sz );
// Calculate the image gradient: center option as in VLFeat
void gradientMag( CMat &imgBGR3u, Mat &mag1u );
static void gradientRGB( CMat &bgr3u, Mat &mag1u );
static void gradientGray( CMat &bgr3u, Mat &mag1u );
static void gradientHSV( CMat &bgr3u, Mat &mag1u );
static void gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u );
static inline int bgrMaxDist( const Vec3b &u, const Vec3b &v )
{
int b = abs( u[0] - v[0] ), g = abs( u[1] - v[1] ), r = abs( u[2] - v[2] );
b = max( b, g );
return max( b, r );
}
static inline int vecDist3b( const Vec3b &u, const Vec3b &v )
{
return abs( u[0] - v[0] ) + abs( u[1] - v[1] ) + abs( u[2] - v[2] );
}
//Non-maximal suppress
static void nonMaxSup( CMat &matchCost1f, ValStructVec<float, Point> &matchCost, int NSS = 1, int maxPoint = 50, bool fast = true );
}; };
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <opencv2/core/utility.hpp> #include <opencv2/core/utility.hpp>
#include <opencv2/saliency.hpp> #include <opencv2/saliency.hpp>
#include <opencv2/highgui.hpp> #include <opencv2/highgui.hpp>
...@@ -63,8 +104,6 @@ int main( int argc, char** argv ) ...@@ -63,8 +104,6 @@ int main( int argc, char** argv )
Mat binaryMap; Mat binaryMap;
Mat image; Mat image;
Mat image2=imread("/home/puja/src/BING_beta2_linux/VOC2007/oneVideoJpeg4Test/0011.jpg");
cap >> frame; cap >> frame;
if( frame.empty() ) if( frame.empty() )
{ {
...@@ -104,7 +143,7 @@ int main( int argc, char** argv ) ...@@ -104,7 +143,7 @@ int main( int argc, char** argv )
saliencyAlgorithm.dynamicCast<ObjectnessBING>()->setTrainingPath( training_path ); saliencyAlgorithm.dynamicCast<ObjectnessBING>()->setTrainingPath( training_path );
saliencyAlgorithm.dynamicCast<ObjectnessBING>()->setBBResDir(training_path + "/Results" ); saliencyAlgorithm.dynamicCast<ObjectnessBING>()->setBBResDir(training_path + "/Results" );
if( saliencyAlgorithm->computeSaliency( image2, saliencyMap ) ) if( saliencyAlgorithm->computeSaliency( image, saliencyMap ) )
{ {
std::cout << "-----------------OBJECTNESS-----------" << std::endl; std::cout << "-----------------OBJECTNESS-----------" << std::endl;
std::cout << "OBJECTNESS BOUNDING BOX VECTOR SIZE" << saliencyMap.size() << std::endl; std::cout << "OBJECTNESS BOUNDING BOX VECTOR SIZE" << saliencyMap.size() << std::endl;
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "kyheader.h" #include "kyheader.h"
#include "CmFile.h" #include "CmFile.h"
...@@ -55,8 +96,8 @@ int CmFile::GetNames(CStr& rootFolder, CStr &fileW, vecS &names) ...@@ -55,8 +96,8 @@ int CmFile::GetNames(CStr& rootFolder, CStr &fileW, vecS &names)
int subNum = CmFile::GetSubFolders(rootFolder, subFolders);// int subNum = CmFile::GetSubFolders(rootFolder, subFolders);//
for (int i = 0; i < subNum; i++){ for (int i = 0; i < subNum; i++){
subFolders[i] += "/"; subFolders[i] += "/";
int subNum = GetNames(rootFolder + subFolders[i], fileW, tmpNames); int subNum_ = GetNames(rootFolder + subFolders[i], fileW, tmpNames);
for (int j = 0; j < subNum; j++) for (int j = 0; j < subNum_; j++)
names.push_back(subFolders[i] + tmpNames[j]); names.push_back(subFolders[i] + tmpNames[j]);
} }
return (int)names.size(); return (int)names.size();
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once #pragma once
#ifdef _WIN32 #ifdef _WIN32
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "kyheader.h" #include "kyheader.h"
#include "CmShow.h" #include "CmShow.h"
#include "opencv2/core.hpp" #include "opencv2/core.hpp"
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once #pragma once
class CmShow class CmShow
{ {
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once #pragma once
#ifndef CMTIMER_H #ifndef CMTIMER_H
#define CMTIMER_H #define CMTIMER_H
...@@ -58,7 +99,7 @@ void CmTimer::Stop() ...@@ -58,7 +99,7 @@ void CmTimer::Stop()
void CmTimer::Reset() void CmTimer::Reset()
{ {
if (is_started) { if (is_started) {
printf("CmTimer '%s'is started during reset request.\n Only reset cumulative time.\n"); printf("CmTimer '%s'is started during reset request.\n Only reset cumulative time.\n", title.c_str());
return; return;
} }
cumulative_clock = 0; cumulative_clock = 0;
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "kyheader.h" #include "kyheader.h"
#include "FilterTIG.h" #include "FilterTIG.h"
#include "CmShow.h" #include "CmShow.h"
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once #pragma once
#include "kyheader.h" #include "kyheader.h"
class FilterTIG class FilterTIG
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once #pragma once
/************************************************************************/ /************************************************************************/
...@@ -74,7 +115,7 @@ void ValStructVec<VT, ST>::append( const ValStructVec<VT, ST> &newVals, int star ...@@ -74,7 +115,7 @@ void ValStructVec<VT, ST>::append( const ValStructVec<VT, ST> &newVals, int star
{ {
int newValsSize = newVals.size(); int newValsSize = newVals.size();
for ( int i = 0; i < newValsSize; i++ ) for ( int i = 0; i < newValsSize; i++ )
pushBack( (float) ( ( i + 300 ) * startV )/*newVals(i)*/, newVals[i] ); pushBack( (float) ( ( i + 300 ) * startV ), newVals[i] );
} }
template<typename VT, typename ST> template<typename VT, typename ST>
...@@ -101,16 +142,3 @@ vector<pair<VT, int> > ValStructVec<VT, ST>::getvalIdxes() ...@@ -101,16 +142,3 @@ vector<pair<VT, int> > ValStructVec<VT, ST>::getvalIdxes()
return valIdxes; return valIdxes;
} }
/*
void valStructVecDemo()
{
ValStructVec<int, string> sVals;
sVals.pushBack(3, "String 3");
sVals.pushBack(5, "String 5");
sVals.pushBack(4, "String 4");
sVals.pushBack(1, "String 1");
sVals.sort(false);
for (int i = 0; i < sVals.size(); i++)
printf("%d, %s\n", sVals(i), _S(sVals[i]));
}
*/
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef KYHEADER_H #ifndef KYHEADER_H
#define KYHEADER_H #define KYHEADER_H
...@@ -13,8 +54,6 @@ ...@@ -13,8 +54,6 @@
#include <fstream> #include <fstream>
#include <omp.h> #include <omp.h>
// TODO: reference additional headers your program requires here // TODO: reference additional headers your program requires here
//#include "LibLinear/linear.h" //#include "LibLinear/linear.h"
//#include <opencv2/opencv.hpp> //#include <opencv2/opencv.hpp>
...@@ -51,7 +90,12 @@ typedef std::vector<Mat> vecM; ...@@ -51,7 +90,12 @@ typedef std::vector<Mat> vecM;
typedef std::vector<float> vecF; typedef std::vector<float> vecF;
typedef std::vector<double> vecD; typedef std::vector<double> vecD;
enum{CV_FLIP_BOTH = -1, CV_FLIP_VERTICAL = 0, CV_FLIP_HORIZONTAL = 1}; enum
{
CV_FLIP_BOTH = -1,
CV_FLIP_VERTICAL = 0,
CV_FLIP_HORIZONTAL = 1
};
#define _S(str) ((str).c_str()) #define _S(str) ((str).c_str())
#define CHK_IND(p) ((p).x >= 0 && (p).x < _w && (p).y >= 0 && (p).y < _h) #define CHK_IND(p) ((p).x >= 0 && (p).x < _w && (p).y >= 0 && (p).y < _h)
#define CV_Assert_(expr, args) \ #define CV_Assert_(expr, args) \
...@@ -66,155 +110,169 @@ using namespace std; ...@@ -66,155 +110,169 @@ using namespace std;
// Return -1 if not in the list // Return -1 if not in the list
template<typename T> template<typename T>
static inline int findFromList(const T &word, const vector<T> &strList) { static inline int findFromList( const T &word, const vector<T> &strList )
//TODO delete test code {
//cout << "\n\n" << "word" <<" "<< word << endl; //TODO delete test code
for(int i=0; i<strList.size(); i++) { //cout << "\n\n" << "word" <<" "<< word << endl;
//cout <<"test word:"<< word << " " << endl; for ( int i = 0; i < strList.size(); i++ )
//cout << "Size w " << word.size() << " Size L "<< strList[i].size() << endl; {
} //cout <<"test word:"<< word << " " << endl;
//cout << "Size w " << word.size() << " Size L "<< strList[i].size() << endl;
vector<String>::iterator it = std::find(strList.begin(),strList.end(), word); }
if (it == strList.end())
{ vector<String>::iterator it = std::find( strList.begin(), strList.end(), word );
return -1; if( it == strList.end() )
} else {
{ return -1;
vector<String>::iterator index = std::distance(strList.begin(), it); }
//cout << "index" <<" "<< index << endl; else
return index; {
} vector<String>::iterator index = std::distance( strList.begin(), it );
} //cout << "index" <<" "<< index << endl;
/*template<typename T> return index;
static inline int findFromList(const string &word, const vector<T> &strList) {
//for(int i=0; i<strList.size(); i++){
//cout <<"element: " <<strList[i]<<" "<<word << endl;
//if (std::strcmp(word.c_str(),strList[i].c_str())==0) return i;
} }
return -1;
} }
*/ /*template<typename T>
static inline int findFromList(const string &word, const vector<T> &strList) {
//for(int i=0; i<strList.size(); i++){
//cout <<"element: " <<strList[i]<<" "<<word << endl;
//if (std::strcmp(word.c_str(),strList[i].c_str())==0) return i;
}
template<typename T> inline T sqr(T x) { return x * x; } // out of range risk for T = byte, ... return -1;
template<class T, int D> inline T vecSqrDist(const Vec<T, D> &v1, const Vec<T, D> &v2) {T s = 0; for (int i=0; i<D; i++) s += sqr(v1[i] - v2[i]); return s;} // out of range risk for T = byte, ... }
template<class T, int D> inline T vecDist(const Vec<T, D> &v1, const Vec<T, D> &v2) { return sqrt(vecSqrDist(v1, v2)); } // out of range risk for T = byte, ... */
inline Rect Vec4i2Rect(Vec4i &v){return Rect(Point(v[0] - 1, v[1] - 1), Point(v[2], v[3])); } template<typename T> inline T sqr( T x )
{
return x * x;
} // out of range risk for T = byte, ...
template<class T, int D> inline T vecSqrDist( const Vec<T, D> &v1, const Vec<T, D> &v2 )
{
T s = 0;
for ( int i = 0; i < D; i++ )
s += sqr( v1[i] - v2[i] );
return s;
} // out of range risk for T = byte, ...
template<class T, int D> inline T vecDist( const Vec<T, D> &v1, const Vec<T, D> &v2 )
{
return sqrt( vecSqrDist( v1, v2 ) );
} // out of range risk for T = byte, ...
inline Rect Vec4i2Rect( Vec4i &v )
{
return Rect( Point( v[0] - 1, v[1] - 1 ), Point( v[2], v[3] ) );
}
#ifdef __WIN32 #ifdef __WIN32
#define INT64 long long #define INT64 long long
#else #else
#define INT64 long #define INT64 long
typedef unsigned long UINT64; typedef unsigned long UINT64;
#endif #endif
///// /*
#if (_MSC_VER >= 1500) #if (_MSC_VER >= 1500)
# include <intrin.h> # include <intrin.h>
# define POPCNT(x) __popcnt(x) # define POPCNT(x) __popcnt(x)
# define POPCNT64(x) __popcnt64(x) # define POPCNT64(x) __popcnt64(x)
#endif #endif
*/
#if defined(__GNUC__) #if defined(__GNUC__)
# define POPCNT(x) __builtin_popcount(x) # define POPCNT(x) __builtin_popcount(x)
# define POPCNT64(x) __builtin_popcountll(x) # define POPCNT64(x) __builtin_popcountll(x)
#endif #endif
inline int popcnt64(register uint64_t u) inline int popcnt64( register uint64_t u )
{ {
u = (u & 0x5555555555555555) + ((u >> 1) & 0x5555555555555555); u = ( u & 0x5555555555555555 ) + ( ( u >> 1 ) & 0x5555555555555555 );
u = (u & 0x3333333333333333) + ((u >> 2) & 0x3333333333333333); u = ( u & 0x3333333333333333 ) + ( ( u >> 2 ) & 0x3333333333333333 );
u = (u & 0x0f0f0f0f0f0f0f0f) + ((u >> 4) & 0x0f0f0f0f0f0f0f0f); u = ( u & 0x0f0f0f0f0f0f0f0f ) + ( ( u >> 4 ) & 0x0f0f0f0f0f0f0f0f );
u = (u & 0x00ff00ff00ff00ff) + ((u >> 8) & 0x00ff00ff00ff00ff); u = ( u & 0x00ff00ff00ff00ff ) + ( ( u >> 8 ) & 0x00ff00ff00ff00ff );
u = (u & 0x0000ffff0000ffff) + ((u >>16) & 0x0000ffff0000ffff); u = ( u & 0x0000ffff0000ffff ) + ( ( u >> 16 ) & 0x0000ffff0000ffff );
u = (u & 0x00000000ffffffff) + ((u >>32) & 0x00000000ffffffff); u = ( u & 0x00000000ffffffff ) + ( ( u >> 32 ) & 0x00000000ffffffff );
return u; return u;
} }
inline int popcnt(register uint32_t u) inline int popcnt( register uint32_t u )
{ {
u = (u & 0x55555555) + ((u >> 1) & 0x55555555); u = ( u & 0x55555555 ) + ( ( u >> 1 ) & 0x55555555 );
u = (u & 0x33333333) + ((u >> 2) & 0x33333333); u = ( u & 0x33333333 ) + ( ( u >> 2 ) & 0x33333333 );
u = (u & 0x0f0f0f0f) + ((u >> 4) & 0x0f0f0f0f); u = ( u & 0x0f0f0f0f ) + ( ( u >> 4 ) & 0x0f0f0f0f );
u = (u & 0x00ff00ff) + ((u >> 8) & 0x00ff00ff); u = ( u & 0x00ff00ff ) + ( ( u >> 8 ) & 0x00ff00ff );
u = (u & 0x0000ffff) + ((u >>16) & 0x0000ffff); u = ( u & 0x0000ffff ) + ( ( u >> 16 ) & 0x0000ffff );
return u; return u;
} }
inline int popcnt64_nibble(register uint64_t u) inline int popcnt64_nibble( register uint64_t u )
{ {
static const uint8_t Table[] = { static const uint8_t Table[] =
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
};
int c = 0;
int c = 0; while ( u )
while (u) {
{ c += Table[u & 0xf];
c += Table[u & 0xf]; u >>= 4;
u >>= 4; }
} return c;
return c;
} }
inline int popcnt_nibble(register uint32_t u) inline int popcnt_nibble( register uint32_t u )
{ {
static const uint8_t Table[] = { static const uint8_t Table[] =
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
};
int c = 0;
int c = 0; while ( u )
while (u) {
{ c += Table[u & 0xf];
c += Table[u & 0xf]; u >>= 4;
u >>= 4; }
} return c;
return c;
} }
inline int popcnt64_byte(register uint64_t u) inline int popcnt64_byte( register uint64_t u )
{ {
#define B2(k) k, k+1, k+1, k+2 #define B2(k) k, k+1, k+1, k+2
#define B4(k) B2(k), B2(k+1), B2(k+1), B2(k+2) #define B4(k) B2(k), B2(k+1), B2(k+1), B2(k+2)
#define B6(k) B4(k), B4(k+1), B4(k+1), B4(k+2) #define B6(k) B4(k), B4(k+1), B4(k+1), B4(k+2)
static const uint8_t Table[] = { static const uint8_t Table[] =
B6(0), B6(1), B6(1), B6(2) { B6( 0 ), B6( 1 ), B6( 1 ), B6( 2 ) };
};
#undef B6 #undef B6
#undef B4 #undef B4
#undef B2 #undef B2
int c = 0; int c = 0;
while (u) while ( u )
{ {
c += Table[u & 0xff]; c += Table[u & 0xff];
u >>= 8; u >>= 8;
} }
return c; return c;
} }
inline int popcnt_byte(register uint32_t u) inline int popcnt_byte( register uint32_t u )
{ {
#define B2(k) k, k+1, k+1, k+2 #define B2(k) k, k+1, k+1, k+2
#define B4(k) B2(k), B2(k+1), B2(k+1), B2(k+2) #define B4(k) B2(k), B2(k+1), B2(k+1), B2(k+2)
#define B6(k) B4(k), B4(k+1), B4(k+1), B4(k+2) #define B6(k) B4(k), B4(k+1), B4(k+1), B4(k+2)
static const uint8_t Table[] = { static const uint8_t Table[] =
B6(0), B6(1), B6(1), B6(2) { B6( 0 ), B6( 1 ), B6( 1 ), B6( 2 ) };
};
#undef B6 #undef B6
#undef B4 #undef B4
#undef B2 #undef B2
int c = 0; int c = 0;
while (u) while ( u )
{ {
c += Table[u & 0xff]; c += Table[u & 0xff];
u >>= 8; u >>= 8;
} }
return c; return c;
} }
///// /////
#include "CmTimer.h" #include "CmTimer.h"
#include "CmFile.h" #include "CmFile.h"
......
...@@ -48,14 +48,5 @@ namespace cv ...@@ -48,14 +48,5 @@ namespace cv
* Motion Saliency * Motion Saliency
*/ */
/**
* Parameters
*/
//MotionSaliency::Params::Params()
//{
//
//}
}/* namespace cv */ }/* namespace cv */
...@@ -48,25 +48,6 @@ namespace cv ...@@ -48,25 +48,6 @@ namespace cv
* PBAS Motion Saliency * PBAS Motion Saliency
*/ */
/**
* Parameters
MotionSaliencyPBAS::Params::Params()
{
}
void MotionSaliencyPBAS::Params::read( const cv::FileNode& fn )
{
//resizedImageSize=Size(fn["resizedImageSize"]);
}
void MotionSaliencyPBAS::Params::write( cv::FileStorage& fs ) const
{
//fs << "resizedImageSize" << resizedImageSize;
} */
MotionSaliencyPBAS::MotionSaliencyPBAS() MotionSaliencyPBAS::MotionSaliencyPBAS()
{ {
className = "PBAS"; className = "PBAS";
...@@ -77,17 +58,17 @@ MotionSaliencyPBAS::~MotionSaliencyPBAS() ...@@ -77,17 +58,17 @@ MotionSaliencyPBAS::~MotionSaliencyPBAS()
} }
void MotionSaliencyPBAS::read( const cv::FileNode& /*fn*/ ) void MotionSaliencyPBAS::read( const cv::FileNode& /*fn*/)
{ {
//params.read( fn ); //params.read( fn );
} }
void MotionSaliencyPBAS::write( cv::FileStorage& /*fs*/ ) const void MotionSaliencyPBAS::write( cv::FileStorage& /*fs*/) const
{ {
//params.write( fs ); //params.write( fs );
} }
bool MotionSaliencyPBAS::computeSaliencyImpl( const InputArray /*src*/, OutputArray /*dst*/ ) bool MotionSaliencyPBAS::computeSaliencyImpl( const InputArray /*src*/, OutputArray /*dst*/)
{ {
return true; return true;
......
...@@ -48,14 +48,5 @@ namespace cv ...@@ -48,14 +48,5 @@ namespace cv
* Objectness * Objectness
*/ */
/**
* Parameters
*/
//Objectness::Params::Params()
//{
//
//}
}/* namespace cv */ }/* namespace cv */
...@@ -45,15 +45,18 @@ ...@@ -45,15 +45,18 @@
namespace cv namespace cv
{ {
CV_INIT_ALGORITHM( StaticSaliencySpectralResidual, "SALIENCY.SPECTRAL_RESIDUAL", CV_INIT_ALGORITHM(
obj.info()->addParam(obj, "resizedImageSize", obj.resizedImageSize, false, reinterpret_cast<SizeGetter>(&StaticSaliencySpectralResidual::getWsize), reinterpret_cast<SizeSetter>(&StaticSaliencySpectralResidual::setWsize))); StaticSaliencySpectralResidual,
"SALIENCY.SPECTRAL_RESIDUAL",
obj.info()->addParam( obj, "resizedImageSize", obj.resizedImageSize, false,
reinterpret_cast<SizeGetter>( &StaticSaliencySpectralResidual::getWsize ),
reinterpret_cast<SizeSetter>( &StaticSaliencySpectralResidual::setWsize ) ) );
CV_INIT_ALGORITHM( MotionSaliencyPBAS, "SALIENCY.PBAS",); CV_INIT_ALGORITHM( MotionSaliencyPBAS, "SALIENCY.PBAS", );
CV_INIT_ALGORITHM( ObjectnessBING, "SALIENCY.BING", CV_INIT_ALGORITHM(
obj.info()->addParam(obj, "_base", obj._base); ObjectnessBING, "SALIENCY.BING",
obj.info()->addParam(obj, "_NSS", obj._NSS); obj.info()->addParam(obj, "_base", obj._base); obj.info()->addParam(obj, "_NSS", obj._NSS); obj.info()->addParam(obj, "_W", obj._W) );
obj.info()->addParam(obj, "_W", obj._W));
bool initModule_saliency( void ) bool initModule_saliency( void )
{ {
......
...@@ -48,14 +48,6 @@ namespace cv ...@@ -48,14 +48,6 @@ namespace cv
* StaticSaliency * StaticSaliency
*/ */
/**
* Parameters
StaticSaliency::Params::Params()
{
} */
bool StaticSaliency::computeBinaryMap( const Mat& saliencyMap, Mat& BinaryMap ) bool StaticSaliency::computeBinaryMap( const Mat& saliencyMap, Mat& BinaryMap )
{ {
......
...@@ -48,38 +48,19 @@ namespace cv ...@@ -48,38 +48,19 @@ namespace cv
* SaliencySpectralResidual * SaliencySpectralResidual
*/ */
/** cv::Ptr<Size> StaticSaliencySpectralResidual::getWsize()
* Parameters
StaticSaliencySpectralResidual::Params::Params()
{
resizedImageSize=Size(64,64);
}
void StaticSaliencySpectralResidual::Params::read( const cv::FileNode& fn )
{ {
//resizedImageSize=Size(fn["resizedImageSize"]); return resizedImageSize;
} }
void StaticSaliencySpectralResidual::setWsize( const cv::Ptr<Size>& newSize )
void StaticSaliencySpectralResidual::Params::write( cv::FileStorage& fs ) const
{ {
//fs << "resizedImageSize" << resizedImageSize;
} */
cv::Ptr<Size> StaticSaliencySpectralResidual::getWsize(){
return resizedImageSize;
}
void StaticSaliencySpectralResidual::setWsize(const cv::Ptr<Size>& newSize){
resizedImageSize = newSize; resizedImageSize = newSize;
} }
StaticSaliencySpectralResidual::StaticSaliencySpectralResidual() StaticSaliencySpectralResidual::StaticSaliencySpectralResidual()
{ {
className = "SPECTRAL_RESIDUAL"; className = "SPECTRAL_RESIDUAL";
resizedImageSize=Ptr<Size>(new Size(64,64)); resizedImageSize = Ptr<Size>( new Size( 64, 64 ) );
} }
StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual() StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual()
...@@ -87,12 +68,12 @@ StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual() ...@@ -87,12 +68,12 @@ StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual()
} }
void StaticSaliencySpectralResidual::read( const cv::FileNode& fn ) void StaticSaliencySpectralResidual::read( const cv::FileNode& /*fn*/ )
{ {
//params.read( fn ); //params.read( fn );
} }
void StaticSaliencySpectralResidual::write( cv::FileStorage& fs ) const void StaticSaliencySpectralResidual::write( cv::FileStorage& /*fs*/ ) const
{ {
//params.write( fs ); //params.write( fs );
} }
...@@ -101,7 +82,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image ...@@ -101,7 +82,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
{ {
Mat grayTemp, grayDown; Mat grayTemp, grayDown;
std::vector<Mat> mv; std::vector<Mat> mv;
Mat realImage(*resizedImageSize, CV_64F ); Mat realImage( *resizedImageSize, CV_64F );
Mat imaginaryImage( *resizedImageSize, CV_64F ); Mat imaginaryImage( *resizedImageSize, CV_64F );
imaginaryImage.setTo( 0 ); imaginaryImage.setTo( 0 );
Mat combinedImage( *resizedImageSize, CV_64FC2 ); Mat combinedImage( *resizedImageSize, CV_64FC2 );
...@@ -159,7 +140,6 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image ...@@ -159,7 +140,6 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
imshow( "Saliency Map Interna", saliencyMap ); imshow( "Saliency Map Interna", saliencyMap );
#endif #endif
return true; return true;
} }
......
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