2011-09-13 19:19:40 +08:00
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
|
|
|
#include "opencv2/highgui/highgui.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace cv;
|
|
|
|
using namespace perf;
|
|
|
|
|
2011-10-19 18:48:45 +08:00
|
|
|
typedef TestBaseWithParam<String> stitch;
|
2011-09-13 19:19:40 +08:00
|
|
|
|
2011-10-19 18:48:45 +08:00
|
|
|
PERF_TEST_P( stitch, a123, testing::Values("surf", "orb"))
|
2011-09-13 19:19:40 +08:00
|
|
|
{
|
|
|
|
Mat pano;
|
|
|
|
|
|
|
|
vector<Mat> imgs;
|
|
|
|
imgs.push_back( imread( getDataPath("stitching/a1.jpg") ) );
|
|
|
|
imgs.push_back( imread( getDataPath("stitching/a2.jpg") ) );
|
|
|
|
imgs.push_back( imread( getDataPath("stitching/a3.jpg") ) );
|
|
|
|
|
|
|
|
Stitcher::Status status;
|
2011-10-19 18:48:45 +08:00
|
|
|
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
|
|
|
|
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
|
|
|
|
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
|
2011-09-13 19:19:40 +08:00
|
|
|
|
2011-10-19 18:48:45 +08:00
|
|
|
Ptr<detail::FeaturesMatcher> featuresMatcher = GetParam() == "orb"
|
|
|
|
? new detail::BestOf2NearestMatcher(false, 0.3f)
|
|
|
|
: new detail::BestOf2NearestMatcher(false, 0.65f);
|
|
|
|
|
|
|
|
declare.time(30 * 20).iterations(50);
|
2011-09-13 19:19:40 +08:00
|
|
|
|
2011-09-29 20:11:18 +08:00
|
|
|
while(next())
|
|
|
|
{
|
|
|
|
Stitcher stitcher = Stitcher::createDefault();
|
2011-10-19 18:48:45 +08:00
|
|
|
stitcher.setFeaturesFinder(featuresFinder);
|
|
|
|
stitcher.setFeaturesMatcher(featuresMatcher);
|
2011-09-29 20:11:18 +08:00
|
|
|
|
|
|
|
startTimer();
|
|
|
|
status = stitcher.stitch(imgs, pano);
|
|
|
|
stopTimer();
|
|
|
|
}
|
2011-09-13 19:19:40 +08:00
|
|
|
}
|
|
|
|
|
2011-10-19 18:48:45 +08:00
|
|
|
PERF_TEST_P( stitch, b12, testing::Values("surf", "orb"))
|
2011-09-13 19:19:40 +08:00
|
|
|
{
|
|
|
|
Mat pano;
|
|
|
|
|
|
|
|
vector<Mat> imgs;
|
|
|
|
imgs.push_back( imread( getDataPath("stitching/b1.jpg") ) );
|
|
|
|
imgs.push_back( imread( getDataPath("stitching/b2.jpg") ) );
|
|
|
|
|
|
|
|
Stitcher::Status status;
|
2011-10-19 18:48:45 +08:00
|
|
|
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
|
|
|
|
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
|
|
|
|
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
|
|
|
|
|
|
|
|
Ptr<detail::FeaturesMatcher> featuresMatcher = GetParam() == "orb"
|
|
|
|
? new detail::BestOf2NearestMatcher(false, 0.3f)
|
|
|
|
: new detail::BestOf2NearestMatcher(false, 0.65f);
|
2011-09-13 19:19:40 +08:00
|
|
|
|
2011-10-19 18:48:45 +08:00
|
|
|
declare.time(30 * 20).iterations(50);
|
2011-09-13 19:19:40 +08:00
|
|
|
|
2011-09-29 20:11:18 +08:00
|
|
|
while(next())
|
|
|
|
{
|
|
|
|
Stitcher stitcher = Stitcher::createDefault();
|
2011-10-19 18:48:45 +08:00
|
|
|
stitcher.setFeaturesFinder(featuresFinder);
|
|
|
|
stitcher.setFeaturesMatcher(featuresMatcher);
|
2011-09-29 20:11:18 +08:00
|
|
|
|
|
|
|
startTimer();
|
|
|
|
status = stitcher.stitch(imgs, pano);
|
|
|
|
stopTimer();
|
|
|
|
}
|
2011-09-13 19:19:40 +08:00
|
|
|
}
|