Commit 02aa9155 authored by jaco's avatar jaco

Pull Request mandatory changes

parent 3eb81b72
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -47,7 +47,10 @@ ...@@ -47,7 +47,10 @@
namespace cv namespace cv
{ {
CV_EXPORTS bool initModule_saliency(void); namespace saliency
{
CV_EXPORTS bool initModule_saliency( void );
}
} }
#endif //__OPENCV_SALIENCY_HPP__ #endif //__OPENCV_SALIENCY_HPP__
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
namespace cv namespace cv
{ {
namespace saliency
{
/************************************ Saliency Base Class ************************************/ /************************************ Saliency Base Class ************************************/
...@@ -117,6 +119,7 @@ class CV_EXPORTS Objectness : public virtual Saliency ...@@ -117,6 +119,7 @@ class CV_EXPORTS Objectness : public virtual Saliency
}; };
} /* namespace saliency */
} /* namespace cv */ } /* namespace cv */
#endif #endif
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -42,15 +42,17 @@ ...@@ -42,15 +42,17 @@
#ifndef __OPENCV_SALIENCY_SPECIALIZED_CLASSES_HPP__ #ifndef __OPENCV_SALIENCY_SPECIALIZED_CLASSES_HPP__
#define __OPENCV_SALIENCY_SPECIALIZED_CLASSES_HPP__ #define __OPENCV_SALIENCY_SPECIALIZED_CLASSES_HPP__
#include "kyheader.h" #include "src/kyheader.hpp"
#include "ValStructVec.h" #include "src/ValStructVec.hpp"
#include "FilterTIG.h" #include "src/FilterTIG.hpp"
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <iostream> #include <iostream>
namespace cv namespace cv
{ {
namespace saliency
{
/************************************ Specific Static Saliency Specialized Classes ************************************/ /************************************ Specific Static Saliency Specialized Classes ************************************/
...@@ -66,12 +68,6 @@ class CV_EXPORTS StaticSaliencySpectralResidual : public StaticSaliency ...@@ -66,12 +68,6 @@ class CV_EXPORTS StaticSaliencySpectralResidual : public StaticSaliency
StaticSaliencySpectralResidual(); StaticSaliencySpectralResidual();
~StaticSaliencySpectralResidual(); ~StaticSaliencySpectralResidual();
//typedef Ptr<Size> (Algorithm::*SizeGetter)();
//typedef void (Algorithm::*SizeSetter)( const Ptr<Size> & );
//Ptr<Size> getWsize();
//void setWsize( const Ptr<Size> &newSize );
void read( const FileNode& fn ); void read( const FileNode& fn );
void write( FileStorage& fs ) const; void write( FileStorage& fs ) const;
...@@ -100,12 +96,6 @@ class CV_EXPORTS MotionSaliencyBinWangApr2014 : public MotionSaliency ...@@ -100,12 +96,6 @@ class CV_EXPORTS MotionSaliencyBinWangApr2014 : public MotionSaliency
MotionSaliencyBinWangApr2014(); MotionSaliencyBinWangApr2014();
~MotionSaliencyBinWangApr2014(); ~MotionSaliencyBinWangApr2014();
/*typedef Ptr<Size> (Algorithm::*SizeGetter)();
typedef void (Algorithm::*SizeSetter)( const Ptr<Size> & );
Ptr<Size> getWsize();
void setWsize( const Ptr<Size> &newSize ); */
void setImagesize( int W, int H ); void setImagesize( int W, int H );
bool init(); bool init();
...@@ -274,6 +264,7 @@ class CV_EXPORTS ObjectnessBING : public Objectness ...@@ -274,6 +264,7 @@ class CV_EXPORTS ObjectnessBING : public Objectness
}; };
} /* namespace saliency */
} /* namespace cv */ } /* namespace cv */
#endif #endif
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,7 +39,13 @@ ...@@ -39,7 +39,13 @@
// //
//M*/ //M*/
#include "CmFile.h" #include "precomp.hpp"
#include "CmFile.hpp"
namespace cv
{
namespace saliency
{
bool CmFile::MkDir( CStr &_path ) bool CmFile::MkDir( CStr &_path )
{ {
...@@ -74,3 +80,6 @@ bool CmFile::MkDir( CStr &_path ) ...@@ -74,3 +80,6 @@ bool CmFile::MkDir( CStr &_path )
return true; return true;
#endif #endif
} }
} // namespace saliency
} // namespace cv
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
// //
//M*/ //M*/
#pragma once #ifndef __OPENCV_CM_FILE_HPP__
#define __OPENCV_CM_FILE_HPP__
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
...@@ -48,10 +49,20 @@ ...@@ -48,10 +49,20 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include "opencv2/saliency/kyheader.h" #include "src/kyheader.hpp"
#endif #endif
namespace cv
{
namespace saliency
{
struct CmFile struct CmFile
{ {
static bool MkDir(CStr& path); static bool MkDir(CStr& path);
}; };
}
}
#endif
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,88 +39,96 @@ ...@@ -39,88 +39,96 @@
// //
//M*/ //M*/
#include "CmShow.h" #include "precomp.hpp"
#include "CmShow.hpp"
#include "opencv2/core.hpp" #include "opencv2/core.hpp"
#include <opencv2/highgui.hpp> #include <opencv2/highgui.hpp>
typedef std::pair<int, int> CostiIdx; typedef std::pair<int, int> CostiIdx;
using namespace cv;
Mat CmShow::HistBins(CMat& color3f, CMat& val, CStr& title, bool descendShow, CMat &with) namespace cv
{
namespace saliency
{
Mat CmShow::HistBins( CMat& color3f, CMat& val, CStr& title, bool descendShow, CMat &with )
{ {
// Prepare data // Prepare data
int H = 300, spaceH = 6, barH = 10, n = color3f.cols; int H = 300, spaceH = 6, barH = 10, n = color3f.cols;
CV_Assert(color3f.size() == val.size() && color3f.rows == 1); CV_Assert( color3f.size() == val.size() && color3f.rows == 1 );
Mat binVal1i, binColor3b, width1i; Mat binVal1i, binColor3b, width1i;
if (with.size() == val.size()) if( with.size() == val.size() )
with.convertTo(width1i, CV_32S, 400/sum(with).val[0]); // Default shown width with.convertTo( width1i, CV_32S, 400 / sum( with ).val[0] ); // Default shown width
else else
width1i = Mat(1, n, CV_32S, Scalar(10)); // Default bin width = 10 width1i = Mat( 1, n, CV_32S, Scalar( 10 ) ); // Default bin width = 10
int W = cvRound(sum(width1i).val[0]); int W = cvRound( sum( width1i ).val[0] );
color3f.convertTo(binColor3b, CV_8UC3, 255); color3f.convertTo( binColor3b, CV_8UC3, 255 );
double maxVal, minVal; double maxVal, minVal;
minMaxLoc(val, &minVal, &maxVal); minMaxLoc( val, &minVal, &maxVal );
printf("%g\n", H/max(maxVal, -minVal)); printf( "%g\n", H / max( maxVal, -minVal ) );
val.convertTo(binVal1i, CV_32S, 20000); val.convertTo( binVal1i, CV_32S, 20000 );
Size szShow(W, H + spaceH + barH); Size szShow( W, H + spaceH + barH );
szShow.height += minVal < 0 && !descendShow ? H + spaceH : 0; szShow.height += minVal < 0 && !descendShow ? H + spaceH : 0;
Mat showImg3b(szShow, CV_8UC3, Scalar(255, 255, 255)); Mat showImg3b( szShow, CV_8UC3, Scalar( 255, 255, 255 ) );
int* binH = (int*)(binVal1i.data); int* binH = (int*) ( binVal1i.data );
Vec3b* binColor = (Vec3b*)(binColor3b.data); Vec3b* binColor = (Vec3b*) ( binColor3b.data );
int* binW = (int*)(width1i.data); int* binW = (int*) ( width1i.data );
std::vector<CostiIdx> costIdx(n); std::vector<CostiIdx> costIdx( n );
if (descendShow){ if( descendShow )
for (int i = 0; i < n; i++) {
costIdx[i] = std::make_pair(binH[i], i); for ( int i = 0; i < n; i++ )
sort(costIdx.begin(), costIdx.end(), std::greater<CostiIdx>()); costIdx[i] = std::make_pair( binH[i], i );
} sort( costIdx.begin(), costIdx.end(), std::greater<CostiIdx>() );
}
// Show image // Show image
for (int i = 0, x = 0; i < n; i++){ for ( int i = 0, x = 0; i < n; i++ )
int idx = descendShow ? costIdx[i].second : i; {
int h = descendShow ? abs(binH[idx]) : binH[idx]; int idx = descendShow ? costIdx[i].second : i;
Scalar color(binColor[idx]); int h = descendShow ? abs( binH[idx] ) : binH[idx];
Rect reg(x, H + spaceH, binW[idx], barH); Scalar color( binColor[idx] );
showImg3b(reg) = color; // Draw bar Rect reg( x, H + spaceH, binW[idx], barH );
rectangle(showImg3b, reg, Scalar(0)); showImg3b( reg ) = color; // Draw bar
rectangle( showImg3b, reg, Scalar( 0 ) );
reg.height = abs(h); reg.height = abs( h );
reg.y = h >= 0 ? H - h : H + 2 * spaceH + barH; reg.y = h >= 0 ? H - h : H + 2 * spaceH + barH;
showImg3b(reg) = color; showImg3b( reg ) = color;
rectangle(showImg3b, reg, Scalar(0)); rectangle( showImg3b, reg, Scalar( 0 ) );
x += binW[idx]; x += binW[idx];
} }
imshow(String(title.c_str()), showImg3b); imshow( String( title.c_str() ), showImg3b );
return showImg3b; return showImg3b;
} }
/* void CmShow::showTinyMat(CStr &title, CMat &m) /* void CmShow::showTinyMat(CStr &title, CMat &m)
{ {
int scale = 50, sz = m.rows * m.cols; int scale = 50, sz = m.rows * m.cols;
while (sz > 200){ while (sz > 200){
scale /= 2; scale /= 2;
sz /= 4; sz /= 4;
} }
Mat img; Mat img;
resize(m, img, Size(), scale, scale, INTER_NEAREST ); resize(m, img, Size(), scale, scale, INTER_NEAREST );
if (img.channels() == 3) if (img.channels() == 3)
cvtColor(img, img, COLOR_RGB2BGR); cvtColor(img, img, COLOR_RGB2BGR);
SaveShow(img, title); SaveShow(img, title);
} }
void CmShow::SaveShow(CMat& img, CStr& title) void CmShow::SaveShow(CMat& img, CStr& title)
{ {
if (title.size() == 0) if (title.size() == 0)
return; return;
int mDepth = CV_MAT_DEPTH(img.type());
double scale = (mDepth == CV_32F || mDepth == CV_64F ? 255 : 1);
if (title.size() > 4 && title[title.size() - 4] == '.')
imwrite(String(title.c_str()), img*scale);
else if (title.size())
imshow(String(title.c_str()), img);
} */
int mDepth = CV_MAT_DEPTH(img.type()); } // namespace saliency
double scale = (mDepth == CV_32F || mDepth == CV_64F ? 255 : 1); } // namespace cv
if (title.size() > 4 && title[title.size() - 4] == '.')
imwrite(String(title.c_str()), img*scale);
else if (title.size())
imshow(String(title.c_str()), img);
} */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,13 +39,24 @@ ...@@ -39,13 +39,24 @@
// //
//M*/ //M*/
#pragma once #ifndef __OPENCV_CM_SHOW_HPP__
#include "opencv2/saliency/kyheader.h" #define __OPENCV_CM_SHOW_HPP__
#include "src/kyheader.hpp"
namespace cv
{
namespace saliency
{
class CmShow class CmShow
{ {
public: public:
static cv::Mat HistBins(CMat& color3f, CMat& val, CStr& title, bool descendShow = false, CMat &with = cv::Mat()); static cv::Mat HistBins( CMat& color3f, CMat& val, CStr& title, bool descendShow = false, CMat &with = cv::Mat() );
static void showTinyMat(CStr &title, CMat &m); static void showTinyMat( CStr &title, CMat &m );
static inline void SaveShow(CMat& img, CStr& title); static inline void SaveShow( CMat& img, CStr& title );
}; };
}
}
#endif //__OPENCV_CM_SHOW_HPP__
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,35 +39,53 @@ ...@@ -39,35 +39,53 @@
// //
//M*/ //M*/
#pragma once #ifndef __OPENCV_CM_TIMER_HPP__
#ifndef CMTIMER_H #define __OPENCV_CM_TIMER_HPP__
#define CMTIMER_H
namespace cv
{
namespace saliency
{
class CmTimer class CmTimer
{ {
public: public:
CmTimer(CStr t):title(t) { is_started = false; start_clock = 0; cumulative_clock = 0; n_starts = 0; } CmTimer( CStr t ) :
title( t )
~CmTimer(){ if (is_started) printf("CmTimer '%s' is started and is being destroyed.\n", title.c_str()); } {
is_started = false;
inline void Start(); start_clock = 0;
inline void Stop(); cumulative_clock = 0;
inline void Reset(); n_starts = 0;
}
inline bool Report();
inline bool StopAndReport() { Stop(); return Report(); } ~CmTimer()
inline float TimeInSeconds(); {
if( is_started )
private: printf( "CmTimer '%s' is started and is being destroyed.\n", title.c_str() );
CStr title; }
CmTimer& operator=(const CmTimer&); inline void Start();
inline void Stop();
bool is_started; inline void Reset();
clock_t start_clock;
clock_t cumulative_clock; inline bool Report();
unsigned int n_starts; inline bool StopAndReport()
{
Stop();
return Report();
}
inline float TimeInSeconds();
private:
CStr title;
CmTimer& operator=( const CmTimer& );
bool is_started;
clock_t start_clock;
clock_t cumulative_clock;
unsigned int n_starts;
}; };
/************************************************************************/ /************************************************************************/
...@@ -76,55 +94,63 @@ private: ...@@ -76,55 +94,63 @@ private:
void CmTimer::Start() void CmTimer::Start()
{ {
if (is_started){ if( is_started )
printf("CmTimer '%s' is already started. Nothing done.\n", title.c_str()); {
return; printf( "CmTimer '%s' is already started. Nothing done.\n", title.c_str() );
} return;
}
is_started = true;
n_starts++; is_started = true;
start_clock = clock(); n_starts++;
start_clock = clock();
} }
void CmTimer::Stop() void CmTimer::Stop()
{ {
if (!is_started){ if( !is_started )
printf("CmTimer '%s' is started. Nothing done\n", title.c_str()); {
return; printf( "CmTimer '%s' is started. Nothing done\n", title.c_str() );
} return;
}
cumulative_clock += clock() - start_clock;
is_started = false; cumulative_clock += clock() - start_clock;
is_started = false;
} }
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", title.c_str()); {
return; printf( "CmTimer '%s'is started during reset request.\n Only reset cumulative time.\n", title.c_str() );
} return;
cumulative_clock = 0; }
cumulative_clock = 0;
} }
bool CmTimer::Report() bool CmTimer::Report()
{ {
if (is_started){ if( is_started )
printf("CmTimer '%s' is started.\n Cannot provide a time report.", title.c_str()); {
return false; printf( "CmTimer '%s' is started.\n Cannot provide a time report.", title.c_str() );
} return false;
}
float timeUsed = TimeInSeconds();
printf("[%s] CumuTime: %gs, #run: %d, AvgTime: %gs\n", title.c_str(), timeUsed, n_starts, timeUsed/n_starts); float timeUsed = TimeInSeconds();
return true; printf( "[%s] CumuTime: %gs, #run: %d, AvgTime: %gs\n", title.c_str(), timeUsed, n_starts, timeUsed / n_starts );
return true;
} }
float CmTimer::TimeInSeconds() float CmTimer::TimeInSeconds()
{ {
if (is_started){ if( is_started )
printf("CmTimer '%s' is started. Nothing done\n", title.c_str()); {
return 0; printf( "CmTimer '%s' is started. Nothing done\n", title.c_str() );
} return 0;
return float(cumulative_clock) / CLOCKS_PER_SEC; }
return float( cumulative_clock ) / CLOCKS_PER_SEC;
} }
#endif // CMTIMER_H } // namespace saliency
} // namespace cv
#endif // __OPENCV_CM_TIMER_HPP__
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,10 +39,14 @@ ...@@ -39,10 +39,14 @@
// //
//M*/ //M*/
#include "CmShow.h" #include "precomp.hpp"
#include "opencv2/saliency/FilterTIG.h" #include "CmShow.hpp"
#include "src/FilterTIG.hpp"
using namespace cv; namespace cv
{
namespace saliency
{
void FilterTIG::update( CMat &w1f ) void FilterTIG::update( CMat &w1f )
{ {
...@@ -125,3 +129,6 @@ Mat FilterTIG::matchTemplate( const Mat &mag1u ) ...@@ -125,3 +129,6 @@ Mat FilterTIG::matchTemplate( const Mat &mag1u )
scores( Rect( 8, 8, W - 7, H - 7 ) ).copyTo( matchCost1f ); scores( Rect( 8, 8, W - 7, H - 7 ) ).copyTo( matchCost1f );
return matchCost1f; return matchCost1f;
} }
} // namespace saliency
} // namespace cv
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -41,11 +41,13 @@ ...@@ -41,11 +41,13 @@
#include "precomp.hpp" #include "precomp.hpp"
#include "CmTimer.h" #include "CmTimer.hpp"
#include "CmFile.h" #include "CmFile.hpp"
namespace cv namespace cv
{ {
namespace saliency
{
/** /**
* BING Objectness * BING Objectness
...@@ -116,7 +118,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0, ...@@ -116,7 +118,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0,
CV_Assert( _svmSzIdxs.size() > 1 && filters1f.size() == Size(_W, _W) && filters1f.type() == CV_32F ); CV_Assert( _svmSzIdxs.size() > 1 && filters1f.size() == Size(_W, _W) && filters1f.type() == CV_32F );
_svmFilter = filters1f; _svmFilter = filters1f;
if( !matRead( s2, _svmReW1f ) || _svmReW1f.size() != Size( 2, (int)_svmSzIdxs.size() ) ) if( !matRead( s2, _svmReW1f ) || _svmReW1f.size() != Size( 2, (int) _svmSzIdxs.size() ) )
{ {
_svmReW1f = Mat(); _svmReW1f = Mat();
return -1; return -1;
...@@ -126,7 +128,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0, ...@@ -126,7 +128,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0,
void ObjectnessBING::predictBBoxSI( CMat &img3u, ValStructVec<float, Vec4i> &valBoxes, vecI &sz, int NUM_WIN_PSZ, bool fast ) void ObjectnessBING::predictBBoxSI( CMat &img3u, ValStructVec<float, Vec4i> &valBoxes, vecI &sz, int NUM_WIN_PSZ, bool fast )
{ {
const int numSz =(int) _svmSzIdxs.size(); const int numSz = (int) _svmSzIdxs.size();
const int imgW = img3u.cols, imgH = img3u.rows; const int imgW = img3u.cols, imgH = img3u.rows;
valBoxes.reserve( 10000 ); valBoxes.reserve( 10000 );
sz.clear(); sz.clear();
...@@ -374,7 +376,7 @@ void ObjectnessBING::gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u ) ...@@ -374,7 +376,7 @@ void ObjectnessBING::gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u )
const int *x = x1i.ptr<int>( r ), *y = y1i.ptr<int>( r ); const int *x = x1i.ptr<int>( r ), *y = y1i.ptr<int>( r );
BYTE* m = mag1u.ptr<BYTE>( r ); BYTE* m = mag1u.ptr<BYTE>( r );
for ( int c = 0; c < W; c++ ) for ( int c = 0; c < W; c++ )
m[c] = (BYTE)min( x[c] + y[c], 255 ); //((int)sqrt(sqr(x[c]) + sqr(y[c])), 255); m[c] = (BYTE) min( x[c] + y[c], 255 ); //((int)sqrt(sqr(x[c]) + sqr(y[c])), 255);
} }
} }
...@@ -491,7 +493,7 @@ bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray ob ...@@ -491,7 +493,7 @@ bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray ob
Mat( sortedBB ).copyTo( objectnessBoundingBox ); Mat( sortedBB ).copyTo( objectnessBoundingBox );
// List of the rectangles' objectness value // List of the rectangles' objectness value
unsigned long int valIdxesSize = (unsigned long int)finalBoxes.getvalIdxes().size(); unsigned long int valIdxesSize = (unsigned long int) finalBoxes.getvalIdxes().size();
objectnessValues.resize( valIdxesSize ); objectnessValues.resize( valIdxesSize );
for ( uint i = 0; i < valIdxesSize; i++ ) for ( uint i = 0; i < valIdxesSize; i++ )
objectnessValues[i] = finalBoxes.getvalIdxes()[i].first; objectnessValues[i] = finalBoxes.getvalIdxes()[i].first;
...@@ -499,4 +501,5 @@ bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray ob ...@@ -499,4 +501,5 @@ bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray ob
return true; return true;
} }
} /* namespace saliency */
}/* namespace cv */ }/* namespace cv */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,48 +39,60 @@ ...@@ -39,48 +39,60 @@
// //
//M*/ //M*/
#pragma once #ifndef __OPENCV_FILTER_TIG_HPP__
#include "kyheader.h" #define __OPENCV_FILTER_TIG_HPP__
#include "src/kyheader.hpp"
namespace cv
{
namespace saliency
{
class FilterTIG class FilterTIG
{ {
public: public:
void update(CMat &w); void update( CMat &w );
// For a W by H gradient magnitude map, find a W-7 by H-7 CV_32F matching score map // For a W by H gradient magnitude map, find a W-7 by H-7 CV_32F matching score map
cv::Mat matchTemplate(const cv::Mat &mag1u); cv::Mat matchTemplate( const cv::Mat &mag1u );
inline float dot(const int64_t tig1, const int64_t tig2, const int64_t tig4, const int64_t tig8); inline float dot( const int64_t tig1, const int64_t tig2, const int64_t tig4, const int64_t tig8 );
public: public:
void reconstruct(cv::Mat &w); // For illustration purpose void reconstruct( cv::Mat &w ); // For illustration purpose
private: private:
static const int NUM_COMP = 2; // Number of components static const int NUM_COMP = 2; // Number of components
static const int D = 64; // Dimension of TIG static const int D = 64; // Dimension of TIG
int64_t _bTIGs[NUM_COMP]; // Binary TIG features int64_t _bTIGs[NUM_COMP]; // Binary TIG features
float _coeffs1[NUM_COMP]; // Coefficients of binary TIG features float _coeffs1[NUM_COMP]; // Coefficients of binary TIG features
// For efficiently deals with different bits in CV_8U gradient map // For efficiently deals with different bits in CV_8U gradient map
float _coeffs2[NUM_COMP], _coeffs4[NUM_COMP], _coeffs8[NUM_COMP]; float _coeffs2[NUM_COMP], _coeffs4[NUM_COMP], _coeffs8[NUM_COMP];
}; };
inline float FilterTIG::dot( const int64_t tig1, const int64_t tig2, const int64_t tig4, const int64_t tig8 )
inline float FilterTIG::dot(const int64_t tig1, const int64_t tig2, const int64_t tig4, const int64_t tig8)
{ {
int64_t bcT1 = (int64_t)POPCNT64(tig1); int64_t bcT1 = (int64_t) POPCNT64( tig1 );
int64_t bcT2 = (int64_t)POPCNT64(tig2); int64_t bcT2 = (int64_t) POPCNT64( tig2 );
int64_t bcT4 = (int64_t)POPCNT64(tig4); int64_t bcT4 = (int64_t) POPCNT64( tig4 );
int64_t bcT8 = (int64_t)POPCNT64(tig8); int64_t bcT8 = (int64_t) POPCNT64( tig8 );
int64_t bc01 = (int64_t)(POPCNT64(_bTIGs[0] & tig1) << 1) - bcT1; int64_t bc01 = (int64_t) ( POPCNT64(_bTIGs[0] & tig1) << 1 ) - bcT1;
int64_t bc02 = (int64_t)((POPCNT64(_bTIGs[0] & tig2) << 1) - bcT2) << 1; int64_t bc02 = (int64_t) ( ( POPCNT64(_bTIGs[0] & tig2) << 1 ) - bcT2 ) << 1;
int64_t bc04 = (int64_t)((POPCNT64(_bTIGs[0] & tig4) << 1) - bcT4) << 2; int64_t bc04 = (int64_t) ( ( POPCNT64(_bTIGs[0] & tig4) << 1 ) - bcT4 ) << 2;
int64_t bc08 = (int64_t)((POPCNT64(_bTIGs[0] & tig8) << 1) - bcT8) << 3; int64_t bc08 = (int64_t) ( ( POPCNT64(_bTIGs[0] & tig8) << 1 ) - bcT8 ) << 3;
int64_t bc11 = (int64_t)(POPCNT64(_bTIGs[1] & tig1) << 1) - bcT1; int64_t bc11 = (int64_t) ( POPCNT64(_bTIGs[1] & tig1) << 1 ) - bcT1;
int64_t bc12 = (int64_t)((POPCNT64(_bTIGs[1] & tig2) << 1) - bcT2) << 1; int64_t bc12 = (int64_t) ( ( POPCNT64(_bTIGs[1] & tig2) << 1 ) - bcT2 ) << 1;
int64_t bc14 = (int64_t)((POPCNT64(_bTIGs[1] & tig4) << 1) - bcT4) << 2; int64_t bc14 = (int64_t) ( ( POPCNT64(_bTIGs[1] & tig4) << 1 ) - bcT4 ) << 2;
int64_t bc18 = (int64_t)((POPCNT64(_bTIGs[1] & tig8) << 1) - bcT8) << 3; int64_t bc18 = (int64_t) ( ( POPCNT64(_bTIGs[1] & tig8) << 1 ) - bcT8 ) << 3;
return _coeffs1[0] * (bc01 + bc02 + bc04 + bc08) + _coeffs1[1] * (bc11 + bc12 + bc14 + bc18); return _coeffs1[0] * ( bc01 + bc02 + bc04 + bc08 ) + _coeffs1[1] * ( bc11 + bc12 + bc14 + bc18 );
} }
} /* namespace saliency */
} /* namespace cv */
#endif //__OPENCV_FILTER_TIG_HPP__
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -39,12 +39,18 @@ ...@@ -39,12 +39,18 @@
// //
//M*/ //M*/
#pragma once #ifndef __OPENCV_VAL_STRUCT_VEC_HPP__
#define __OPENCV_VAL_STRUCT_VEC_HPP__
/************************************************************************/ /************************************************************************/
/* A value struct vector that supports efficient sorting */ /* A value struct vector that supports efficient sorting */
/************************************************************************/ /************************************************************************/
namespace cv
{
namespace saliency
{
template<typename VT, typename ST> template<typename VT, typename ST>
struct ValStructVec struct ValStructVec
{ {
...@@ -142,3 +148,7 @@ std::vector<std::pair<VT, int> > ValStructVec<VT, ST>::getvalIdxes() ...@@ -142,3 +148,7 @@ std::vector<std::pair<VT, int> > ValStructVec<VT, ST>::getvalIdxes()
return valIdxes; return valIdxes;
} }
} /* namespace saliency */
} /* namespace cv */
#endif //__OPENCV_VAL_STRUCT_VEC_HPP__
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -87,6 +87,11 @@ typedef unsigned char BYTE; ...@@ -87,6 +87,11 @@ typedef unsigned char BYTE;
#include <windows.h> #include <windows.h>
#endif #endif
namespace cv
{
namespace saliency
{
typedef std::vector<int> vecI; typedef std::vector<int> vecI;
typedef const std::string CStr; typedef const std::string CStr;
typedef const cv::Mat CMat; typedef const cv::Mat CMat;
...@@ -280,6 +285,9 @@ inline int popcnt_byte( register uint32_t u ) ...@@ -280,6 +285,9 @@ inline int popcnt_byte( register uint32_t u )
return (int)c; return (int)c;
} }
}
}
///// /////
#endif // KYHEADER_H #endif // KYHEADER_H
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -43,9 +43,12 @@ ...@@ -43,9 +43,12 @@
namespace cv namespace cv
{ {
namespace saliency
{
/** /**
* Motion Saliency * Motion Saliency
*/ */
} /* namespace saliency */
}/* namespace cv */ }/* namespace cv */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
namespace cv namespace cv
{ {
namespace saliency
{
/* cv::Ptr<Size> MotionSaliencyBinWangApr2014::getWsize() /* cv::Ptr<Size> MotionSaliencyBinWangApr2014::getWsize()
{ {
...@@ -157,7 +159,7 @@ bool MotionSaliencyBinWangApr2014::fullResolutionDetection( const Mat& image2, M ...@@ -157,7 +159,7 @@ bool MotionSaliencyBinWangApr2014::fullResolutionDetection( const Mat& image2, M
for ( size_t z = 0; z < backgroundModel.size(); z++ ) for ( size_t z = 0; z < backgroundModel.size(); z++ )
{ {
counter += (int)backgroundModel[z]->ptr<Vec2f>( i )[j][1]; counter += (int) backgroundModel[z]->ptr<Vec2f>( i )[j][1];
} }
if( counter != 0 ) //if at least the first template is activated / initialized if( counter != 0 ) //if at least the first template is activated / initialized
...@@ -460,17 +462,17 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask, ...@@ -460,17 +462,17 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask,
else if( i == 0 && j == 0 ) // upper leftt else if( i == 0 && j == 0 ) // upper leftt
{ {
split( *backgroundModel[z], mv ); split( *backgroundModel[z], mv );
backgroundModelROI = mv[0]( Rect( j, i, (int)ceil( roiSize / 2 ), (int)ceil( roiSize / 2 ) ) ); backgroundModelROI = mv[0]( Rect( j, i, (int) ceil( roiSize / 2 ), (int) ceil( roiSize / 2 ) ) );
} }
else if( j == 0 && i > 0 && i < ( backgroundModel[z]->rows - 1 ) ) // middle left else if( j == 0 && i > 0 && i < ( backgroundModel[z]->rows - 1 ) ) // middle left
{ {
split( *backgroundModel[z], mv ); split( *backgroundModel[z], mv );
backgroundModelROI = mv[0]( Rect( j, i - (int) floor( roiSize / 2 ), (int)ceil( roiSize / 2 ), roiSize ) ); backgroundModelROI = mv[0]( Rect( j, i - (int) floor( roiSize / 2 ), (int) ceil( roiSize / 2 ), roiSize ) );
} }
else if( i == ( backgroundModel[z]->rows - 1 ) && j == 0 ) //down left else if( i == ( backgroundModel[z]->rows - 1 ) && j == 0 ) //down left
{ {
split( *backgroundModel[z], mv ); split( *backgroundModel[z], mv );
backgroundModelROI = mv[0]( Rect( j, i - (int) floor( roiSize / 2 ), (int)ceil( roiSize / 2 ), (int)ceil( roiSize / 2 ) ) ); backgroundModelROI = mv[0]( Rect( j, i - (int) floor( roiSize / 2 ), (int) ceil( roiSize / 2 ), (int) ceil( roiSize / 2 ) ) );
} }
else if( i == 0 && j > 0 && j < ( backgroundModel[z]->cols - 1 ) ) // upper - middle else if( i == 0 && j > 0 && j < ( backgroundModel[z]->cols - 1 ) ) // upper - middle
{ {
...@@ -486,7 +488,7 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask, ...@@ -486,7 +488,7 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask,
else if( i == 0 && j == ( backgroundModel[z]->cols - 1 ) ) // upper right else if( i == 0 && j == ( backgroundModel[z]->cols - 1 ) ) // upper right
{ {
split( *backgroundModel[z], mv ); split( *backgroundModel[z], mv );
backgroundModelROI = mv[0]( Rect( j - (int)floor( roiSize / 2 ), i, (int) ceil( roiSize / 2 ), (int) ceil( roiSize / 2 ) ) ); backgroundModelROI = mv[0]( Rect( j - (int) floor( roiSize / 2 ), i, (int) ceil( roiSize / 2 ), (int) ceil( roiSize / 2 ) ) );
} }
else if( j == ( backgroundModel[z]->cols - 1 ) && i > 0 && i < ( backgroundModel[z]->rows - 1 ) ) // middle - right else if( j == ( backgroundModel[z]->cols - 1 ) && i > 0 && i < ( backgroundModel[z]->rows - 1 ) ) // middle - right
{ {
...@@ -572,4 +574,5 @@ bool MotionSaliencyBinWangApr2014::computeSaliencyImpl( const InputArray image, ...@@ -572,4 +574,5 @@ bool MotionSaliencyBinWangApr2014::computeSaliencyImpl( const InputArray image,
return true; return true;
} }
} // namespace saliency
} // namespace cv } // namespace cv
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -43,9 +43,11 @@ ...@@ -43,9 +43,11 @@
namespace cv namespace cv
{ {
namespace saliency
{
/** /**
* Objectness * Objectness
*/ */
} /* namespace saliency*/
}/* namespace cv */ }/* namespace cv */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
namespace cv namespace cv
{ {
namespace saliency
{
Saliency::~Saliency() Saliency::~Saliency()
{ {
...@@ -68,4 +71,5 @@ String Saliency::getClassName() const ...@@ -68,4 +71,5 @@ String Saliency::getClassName() const
return className; return className;
} }
} /* namespace saliency */
} /* namespace cv */ } /* namespace cv */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
namespace cv namespace cv
{ {
namespace saliency
{
CV_INIT_ALGORITHM( StaticSaliencySpectralResidual, "SALIENCY.SPECTRAL_RESIDUAL", CV_INIT_ALGORITHM( StaticSaliencySpectralResidual, "SALIENCY.SPECTRAL_RESIDUAL",
obj.info()->addParam( obj, "resImWidth", obj.resImWidth); obj.info()->addParam( obj, "resImHeight", obj.resImHeight) ); obj.info()->addParam( obj, "resImWidth", obj.resImWidth); obj.info()->addParam( obj, "resImHeight", obj.resImHeight) );
...@@ -68,4 +70,5 @@ bool initModule_saliency( void ) ...@@ -68,4 +70,5 @@ bool initModule_saliency( void )
return all; return all;
} }
} } // namespace saliency
} // namespace cv
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
namespace cv namespace cv
{ {
namespace saliency
{
/** /**
* StaticSaliency * StaticSaliency
...@@ -95,4 +97,5 @@ bool StaticSaliency::computeBinaryMap( const Mat& saliencyMap, Mat& BinaryMap ) ...@@ -95,4 +97,5 @@ bool StaticSaliency::computeBinaryMap( const Mat& saliencyMap, Mat& BinaryMap )
} }
}/* namespace saliency */
}/* namespace cv */ }/* namespace cv */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// License Agreement // License Agreement
// For Open Source Computer Vision Library // For Open Source Computer Vision Library
// //
// Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners. // Third party copyrights are property of their respective owners.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
...@@ -43,25 +43,27 @@ ...@@ -43,25 +43,27 @@
namespace cv namespace cv
{ {
namespace saliency
{
/** /**
* SaliencySpectralResidual * SaliencySpectralResidual
*/ */
/*cv::Ptr<Size> StaticSaliencySpectralResidual::getWsize() /*cv::Ptr<Size> StaticSaliencySpectralResidual::getWsize()
{ {
return resizedImageSize; return resizedImageSize;
} }
void StaticSaliencySpectralResidual::setWsize( const cv::Ptr<Size>& newSize ) void StaticSaliencySpectralResidual::setWsize( const cv::Ptr<Size>& newSize )
{ {
resizedImageSize = newSize; resizedImageSize = newSize;
}*/ }*/
StaticSaliencySpectralResidual::StaticSaliencySpectralResidual() StaticSaliencySpectralResidual::StaticSaliencySpectralResidual()
{ {
className = "SPECTRAL_RESIDUAL"; className = "SPECTRAL_RESIDUAL";
resImWidth=64; resImWidth = 64;
resImHeight=64; resImHeight = 64;
//resizedImageSize = Ptr<Size>( new Size( 64, 64 ) ); //resizedImageSize = Ptr<Size>( new Size( 64, 64 ) );
} }
...@@ -70,12 +72,12 @@ StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual() ...@@ -70,12 +72,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 );
} }
...@@ -84,7 +86,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image ...@@ -84,7 +86,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
{ {
Mat grayTemp, grayDown; Mat grayTemp, grayDown;
std::vector<Mat> mv; std::vector<Mat> mv;
Size resizedImageSize(resImWidth, resImHeight); Size resizedImageSize( resImWidth, resImHeight );
Mat realImage( resizedImageSize, CV_64F ); Mat realImage( resizedImageSize, CV_64F );
Mat imaginaryImage( resizedImageSize, CV_64F ); Mat imaginaryImage( resizedImageSize, CV_64F );
...@@ -148,4 +150,5 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image ...@@ -148,4 +150,5 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
} }
} /* namespace saliency */
}/* namespace cv */ }/* namespace cv */
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