parent
cf68a01138
commit
e1cd60c96e
6 changed files with 2 additions and 325 deletions
@ -1,3 +0,0 @@ |
||||
#include "perf_precomp.hpp" |
||||
|
||||
CV_PERF_TEST_MAIN(saliency) |
@ -1,106 +0,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) 2014, 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 "perf_precomp.hpp" |
||||
#include <fstream> |
||||
#include <opencv2/videoio.hpp> |
||||
|
||||
//write sanity: ./bin/opencv_perf_saliency --perf_write_sanity=true
|
||||
//verify sanity: ./bin/opencv_perf_saliency
|
||||
|
||||
using namespace std; |
||||
using namespace cv; |
||||
using namespace perf; |
||||
|
||||
#define TESTSET_NAMES \ |
||||
"/cv/saliency/motion/blizzard.webm",\
|
||||
"/cv/saliency/motion/pedestrian.webm" ,\
|
||||
"/cv/saliency/motion/snowFall.webm" |
||||
|
||||
const string SALIENCY_DIR = "cv/saliency"; |
||||
|
||||
typedef perf::TestBaseWithParam<std::string> sal; |
||||
|
||||
PERF_TEST_P(sal, motionSaliencyBinWangApr2014, testing::Values(TESTSET_NAMES)) |
||||
{ |
||||
string filename = getDataPath(GetParam()); |
||||
int startFrame=0; |
||||
Mat frame; |
||||
Mat saliencyMap; |
||||
double videoSize=0; |
||||
|
||||
Ptr<saliency::Saliency> saliencyAlgorithm = saliency::Saliency::create( "BinWangApr2014" ); |
||||
|
||||
TEST_CYCLE_N(1) |
||||
{ |
||||
VideoCapture c; |
||||
c.open( filename); |
||||
videoSize=c.get( CAP_PROP_FRAME_COUNT); |
||||
c.set( CAP_PROP_POS_FRAMES, startFrame ); |
||||
|
||||
for ( int frameCounter = 0; frameCounter < videoSize; frameCounter++ ) |
||||
{ |
||||
c >> frame; |
||||
|
||||
if( frame.empty() ) |
||||
{ |
||||
break; |
||||
} |
||||
|
||||
saliencyAlgorithm.dynamicCast<saliency::MotionSaliencyBinWangApr2014>()->setImagesize( frame.cols, frame.rows ); |
||||
saliencyAlgorithm.dynamicCast<saliency::MotionSaliencyBinWangApr2014>()->init(); |
||||
|
||||
if( saliencyAlgorithm->computeSaliency( frame, saliencyMap ) ) |
||||
{ |
||||
|
||||
} |
||||
else |
||||
{ |
||||
FAIL()<< "***Error in the instantiation of the saliency algorithm...***\n" << endl; |
||||
return; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
SANITY_CHECK(saliencyMap); |
||||
|
||||
} |
@ -1,108 +0,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) 2014, 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 "perf_precomp.hpp" |
||||
|
||||
//write sanity: ./bin/opencv_perf_saliency --perf_write_sanity=true
|
||||
//verify sanity: ./bin/opencv_perf_saliency
|
||||
|
||||
using namespace std; |
||||
using namespace cv; |
||||
using namespace perf; |
||||
using std::tr1::make_tuple; |
||||
using std::tr1::get; |
||||
|
||||
typedef perf::TestBaseWithParam<std::string> sal; |
||||
|
||||
#define BING_IMAGES \ |
||||
"cv/saliency/objectness/000021.jpg", \
|
||||
"cv/saliency/objectness/000022.jpg" |
||||
|
||||
void getMatOfRects( const vector<Vec4i>& saliencyMap, Mat& bbs_mat ) |
||||
{ |
||||
for ( int b = 0; b < (int)saliencyMap.size(); b++ ) |
||||
{ |
||||
bbs_mat.at<int>( b, 0 ) = saliencyMap[b].val[0]; |
||||
bbs_mat.at<int>( b, 1 ) = saliencyMap[b].val[1]; |
||||
bbs_mat.at<int>( b, 2 ) = saliencyMap[b].val[2]; |
||||
bbs_mat.at<int>( b, 3 ) = saliencyMap[b].val[3]; |
||||
} |
||||
} |
||||
|
||||
PERF_TEST_P(sal, objectnessBING, testing::Values(BING_IMAGES)) |
||||
{ |
||||
string filename = getDataPath(GetParam()); |
||||
cout<<endl<<endl<<"path "<<filename<<endl<<endl; |
||||
Mat image = imread(filename); |
||||
vector<Vec4i> saliencyMap; |
||||
String training_path = "/home/puja/src/opencv_contrib/modules/saliency/samples/ObjectnessTrainedModel"; |
||||
|
||||
if (image.empty()) |
||||
FAIL() << "Unable to load source image " << filename; |
||||
|
||||
Ptr<saliency::Saliency> saliencyAlgorithm = saliency::Saliency::create( "BING" ); |
||||
|
||||
TEST_CYCLE_N(1) |
||||
{ |
||||
if( training_path.empty() ) |
||||
{ |
||||
FAIL() << "Path of trained files missing! " << endl; |
||||
return; |
||||
} |
||||
|
||||
else |
||||
{ |
||||
saliencyAlgorithm.dynamicCast<saliency::ObjectnessBING>()->setTrainingPath( training_path ); |
||||
saliencyAlgorithm.dynamicCast<saliency::ObjectnessBING>()->setBBResDir( training_path + "/Results" ); |
||||
|
||||
if( saliencyAlgorithm->computeSaliency( image, saliencyMap ) ) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} //end CYCLE
|
||||
|
||||
//save the bounding boxes in a Mat
|
||||
Mat bbs_mat( (int)saliencyMap.size(), 4, CV_32F ); |
||||
getMatOfRects( saliencyMap, bbs_mat ); |
||||
|
||||
SANITY_CHECK( bbs_mat); |
||||
} |
@ -1,21 +0,0 @@ |
||||
#ifdef __GNUC__ |
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations" |
||||
# if defined __clang__ || defined __APPLE__ |
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes" |
||||
# pragma GCC diagnostic ignored "-Wextra" |
||||
# endif |
||||
#endif |
||||
|
||||
#ifndef __OPENCV_SALIENCY_PRECOMP_HPP__ |
||||
#define __OPENCV_SALIENCY_PRECOMP_HPP__ |
||||
|
||||
#include <opencv2/ts.hpp> |
||||
#include <opencv2/imgproc.hpp> |
||||
#include <opencv2/saliency.hpp> |
||||
#include <opencv2/highgui.hpp> |
||||
|
||||
#ifdef GTEST_CREATE_SHARED_LIBRARY |
||||
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined |
||||
#endif |
||||
|
||||
#endif |
@ -1,87 +0,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) 2014, 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 "perf_precomp.hpp" |
||||
|
||||
//write sanity: ./bin/opencv_perf_saliency --perf_write_sanity=true
|
||||
//verify sanity: ./bin/opencv_perf_saliency
|
||||
|
||||
using namespace std; |
||||
using namespace cv; |
||||
using namespace perf; |
||||
using std::tr1::make_tuple; |
||||
using std::tr1::get; |
||||
|
||||
typedef perf::TestBaseWithParam<std::string> sal; |
||||
|
||||
#define STATIC_IMAGES \ |
||||
"cv/saliency/static_saliency/8.jpg",\
|
||||
"cv/saliency/static_saliency/39.jpg" ,\
|
||||
"cv/saliency/static_saliency/41.jpg" ,\
|
||||
"cv/saliency/static_saliency/62.jpg" |
||||
|
||||
PERF_TEST_P(sal, statiSaliencySpectralResidual, testing::Values(STATIC_IMAGES)) |
||||
{ |
||||
string filename = getDataPath(GetParam()); |
||||
Mat image = imread(filename); |
||||
Mat saliencyMap; |
||||
|
||||
if (image.empty()) |
||||
FAIL() << "Unable to load source image " << filename; |
||||
|
||||
Ptr<saliency::Saliency> saliencyAlgorithm = saliency::Saliency::create( "SPECTRAL_RESIDUAL" ); |
||||
|
||||
TEST_CYCLE_N(1) |
||||
{ |
||||
|
||||
if( saliencyAlgorithm->computeSaliency( image, saliencyMap ) ) |
||||
{ |
||||
|
||||
} |
||||
else |
||||
{ |
||||
FAIL()<< "***Error in the instantiation of the saliency algorithm...***\n" << endl; |
||||
return; |
||||
} |
||||
} //end CYCLE
|
||||
|
||||
SANITY_CHECK(saliencyMap); |
||||
} |
Loading…
Reference in new issue