Commit 30c13c2c authored by jaco's avatar jaco

wip window compile error fixing

parent bc66cc27
...@@ -100,12 +100,13 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency ...@@ -100,12 +100,13 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
MotionSaliencyBinWangApr2014(); MotionSaliencyBinWangApr2014();
~MotionSaliencyBinWangApr2014(); ~MotionSaliencyBinWangApr2014();
typedef Ptr<Size> (Algorithm::*SizeGetter)(); /*typedef Ptr<Size> (Algorithm::*SizeGetter)();
typedef void (Algorithm::*SizeSetter)( const Ptr<Size> & ); typedef void (Algorithm::*SizeSetter)( const Ptr<Size> & );
Ptr<Size> getWsize(); Ptr<Size> getWsize();
void setWsize( const Ptr<Size> &newSize ); void setWsize( const Ptr<Size> &newSize ); */
void setImagesize( int W, int H );
bool init(); bool init();
protected: protected:
...@@ -129,8 +130,8 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency ...@@ -129,8 +130,8 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
// changing structure // changing structure
std::vector<Ptr<Mat> > backgroundModel; // The vector represents the background template T0---TK of reference paper. std::vector<Ptr<Mat> > backgroundModel; // The vector represents the background template T0---TK of reference paper.
// Matrices are two-channel matrix. In the first layer there are the B (background value) // Matrices are two-channel matrix. In the first layer there are the B (background value)
// for each pixel. In the second layer, there are the C (efficacy) value for each pixel // for each pixel. In the second layer, there are the C (efficacy) value for each pixel
Mat potentialBackground; // Two channel Matrix. For each pixel, in the first level there are the Ba value (potential background value) Mat potentialBackground; // Two channel Matrix. For each pixel, in the first level there are the Ba value (potential background value)
// and in the secon level there are the Ca value, the counter for each potential value. // and in the secon level there are the Ca value, the counter for each potential value.
Mat epslonPixelsValue; // epslon threshold Mat epslonPixelsValue; // epslon threshold
...@@ -141,8 +142,10 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency ...@@ -141,8 +142,10 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
//fixed parameter //fixed parameter
bool neighborhoodCheck; bool neighborhoodCheck;
int N_DS; // Number of template to be downsampled and used in lowResolutionDetection function int N_DS; // Number of template to be downsampled and used in lowResolutionDetection function
Ptr<Size> imgSize; // Size of input image //Ptr<Size> imgSize;
int imageWidth; // Width of input image
int imageHeight; //Height of input image
int K; // Number of background model template int K; // Number of background model template
int N; // NxN is the size of the block for downsampling in the lowlowResolutionDetection int N; // NxN is the size of the block for downsampling in the lowlowResolutionDetection
float alpha; // Learning rate float alpha; // Learning rate
...@@ -241,7 +244,7 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness ...@@ -241,7 +244,7 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness
bool filtersLoaded() bool filtersLoaded()
{ {
int n = (int)_svmSzIdxs.size(); int n = (int) _svmSzIdxs.size();
return n > 0 && _svmReW1f.size() == Size( 2, n ) && _svmFilter.size() == Size( _W, _W ); 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 predictBBoxSI( CMat &mag3u, ValStructVec<float, Vec4i> &valBoxes, vecI &sz, int NUM_WIN_PSZ = 100, bool fast = true );
......
...@@ -157,18 +157,18 @@ int main( int argc, char** argv ) ...@@ -157,18 +157,18 @@ int main( int argc, char** argv )
else if( saliency_algorithm.find( "BinWangApr2014" ) == 0 ) else if( saliency_algorithm.find( "BinWangApr2014" ) == 0 )
{ {
Ptr<Size> size = Ptr<Size>( new Size( image.cols, image.rows ) ); //Ptr<Size> size = Ptr<Size>( new Size( image.cols, image.rows ) );
saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->setWsize( size ); saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->setImagesize( image.cols, image.rows );
saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->init(); saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->init();
bool paused=false; bool paused = false;
while ( true ) while ( true )
{ {
if( !paused ) if( !paused )
{ {
cap >> frame; cap >> frame;
cvtColor(frame, frame, COLOR_BGR2GRAY); cvtColor( frame, frame, COLOR_BGR2GRAY );
Mat saliencyMap; Mat saliencyMap;
if( saliencyAlgorithm->computeSaliency( frame, saliencyMap ) ) if( saliencyAlgorithm->computeSaliency( frame, saliencyMap ) )
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "CmFile.h" #include "CmFile.h"
bool CmFile::MkDir( CStr &_path ) bool CmFile::MkDir( CStr &_path )
{ {
if( _path.size() == 0 ) if( _path.size() == 0 )
...@@ -58,7 +57,9 @@ bool CmFile::MkDir( CStr &_path ) ...@@ -58,7 +57,9 @@ bool CmFile::MkDir( CStr &_path )
buffer[i] = '/'; buffer[i] = '/';
} }
} }
return CreateDirectoryA(_S(_path), 0);
CreateDirectoryA(_S(_path), 0);
return true;
#else #else
for ( int i = 0; buffer[i] != 0; i++ ) for ( int i = 0; buffer[i] != 0; i++ )
{ {
...@@ -69,6 +70,7 @@ bool CmFile::MkDir( CStr &_path ) ...@@ -69,6 +70,7 @@ bool CmFile::MkDir( CStr &_path )
buffer[i] = '/'; buffer[i] = '/';
} }
} }
return mkdir( _S( _path ), 0 ); mkdir( _S( _path ), 0 );
return true;
#endif #endif
} }
...@@ -116,7 +116,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0, ...@@ -116,7 +116,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, _svmSzIdxs.size() ) ) if( !matRead( s2, _svmReW1f ) || _svmReW1f.size() != Size( 2, (int)_svmSzIdxs.size() ) )
{ {
_svmReW1f = Mat(); _svmReW1f = Mat();
return -1; return -1;
...@@ -126,7 +126,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0, ...@@ -126,7 +126,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 = _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 +374,7 @@ void ObjectnessBING::gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u ) ...@@ -374,7 +374,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] = 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 +491,7 @@ bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray ob ...@@ -491,7 +491,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 = 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;
......
...@@ -45,11 +45,8 @@ ...@@ -45,11 +45,8 @@
namespace cv namespace cv
{ {
CV_INIT_ALGORITHM( CV_INIT_ALGORITHM( StaticSaliencySpectralResidual, "SALIENCY.SPECTRAL_RESIDUAL",
StaticSaliencySpectralResidual, obj.info()->addParam( obj, "resImWidth", obj.resImWidth); obj.info()->addParam( obj, "resImHeight", obj.resImHeight) );
"SALIENCY.SPECTRAL_RESIDUAL",
obj.info()->addParam( obj, "resImWidth", obj.resImWidth);
obj.info()->addParam( obj, "resImHeight", obj.resImHeight));
//CV_INIT_ALGORITHM( MotionSaliencySuBSENSE, "SALIENCY.SuBSENSE", ); //CV_INIT_ALGORITHM( MotionSaliencySuBSENSE, "SALIENCY.SuBSENSE", );
...@@ -57,19 +54,15 @@ CV_INIT_ALGORITHM( ...@@ -57,19 +54,15 @@ CV_INIT_ALGORITHM(
ObjectnessBING, "SALIENCY.BING", ObjectnessBING, "SALIENCY.BING",
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, "_base", obj._base); obj.info()->addParam(obj, "_NSS", obj._NSS); obj.info()->addParam(obj, "_W", obj._W) );
CV_INIT_ALGORITHM( CV_INIT_ALGORITHM( MotionSaliencyBinWangApr2014, "SALIENCY.BinWangApr2014",
MotionSaliencyBinWangApr2014, obj.info()->addParam( obj, "imageWidth", obj.imageWidth); obj.info()->addParam( obj, "imageHeight", obj.imageHeight) );
"SALIENCY.BinWangApr2014",
obj.info()->addParam( obj, "imgSize", obj.imgSize, false,
reinterpret_cast<SizeGetter>( &MotionSaliencyBinWangApr2014::getWsize ),
reinterpret_cast<SizeSetter>( &MotionSaliencyBinWangApr2014::setWsize ) ) );
bool initModule_saliency( void ) bool initModule_saliency( void )
{ {
bool all = true; bool all = true;
all &= !StaticSaliencySpectralResidual_info_auto.name().empty(); all &= !StaticSaliencySpectralResidual_info_auto.name().empty();
//all &= !MotionSaliencySuBSENSE_info_auto.name().empty(); //all &= !MotionSaliencySuBSENSE_info_auto.name().empty();
all &= !MotionSaliencyBinWangApr2014_info_auto.name().empty(); all &= !MotionSaliencyBinWangApr2014_info_auto.name().empty();
all &= !ObjectnessBING_info_auto.name().empty(); all &= !ObjectnessBING_info_auto.name().empty();
return all; return all;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment