Merge pull request #6821 from sturkmen72:TickMeter_class_addition
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
#include "opencv2/cudaimgproc.hpp"
|
||||
#include "opencv2/cudawarping.hpp"
|
||||
|
||||
#include "tick_meter.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::cuda;
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#include "opencv2/cudaimgproc.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
#include "tick_meter.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
|
@@ -17,8 +17,6 @@
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/cudastereo.hpp"
|
||||
|
||||
#include "tick_meter.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::cuda;
|
||||
|
@@ -11,8 +11,6 @@
|
||||
#include "opencv2/superres/optical_flow.hpp"
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#include "tick_meter.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::superres;
|
||||
|
@@ -1,48 +0,0 @@
|
||||
#ifndef OPENCV_CUDA_SAMPLES_TICKMETER_
|
||||
#define OPENCV_CUDA_SAMPLES_TICKMETER_
|
||||
|
||||
class CV_EXPORTS TickMeter
|
||||
{
|
||||
public:
|
||||
TickMeter();
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
int64 getTimeTicks() const;
|
||||
double getTimeMicro() const;
|
||||
double getTimeMilli() const;
|
||||
double getTimeSec() const;
|
||||
int64 getCounter() const;
|
||||
|
||||
void reset();
|
||||
private:
|
||||
int64 counter;
|
||||
int64 sumTime;
|
||||
int64 startTime;
|
||||
};
|
||||
|
||||
std::ostream& operator << (std::ostream& out, const TickMeter& tm);
|
||||
|
||||
|
||||
TickMeter::TickMeter() { reset(); }
|
||||
int64 TickMeter::getTimeTicks() const { return sumTime; }
|
||||
double TickMeter::getTimeMicro() const { return getTimeMilli()*1e3;}
|
||||
double TickMeter::getTimeMilli() const { return getTimeSec()*1e3; }
|
||||
double TickMeter::getTimeSec() const { return (double)getTimeTicks()/cv::getTickFrequency();}
|
||||
int64 TickMeter::getCounter() const { return counter; }
|
||||
void TickMeter::reset() {startTime = 0; sumTime = 0; counter = 0; }
|
||||
|
||||
void TickMeter::start(){ startTime = cv::getTickCount(); }
|
||||
void TickMeter::stop()
|
||||
{
|
||||
int64 time = cv::getTickCount();
|
||||
if ( startTime == 0 )
|
||||
return;
|
||||
++counter;
|
||||
sumTime += ( time - startTime );
|
||||
startTime = 0;
|
||||
}
|
||||
|
||||
std::ostream& operator << (std::ostream& out, const TickMeter& tm) { return out << tm.getTimeSec() << "sec"; }
|
||||
|
||||
#endif
|
@@ -14,8 +14,6 @@
|
||||
#include <opencv2/cudacodec.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
|
||||
#include "tick_meter.hpp"
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@@ -11,8 +11,6 @@
|
||||
#include "opencv2/cudacodec.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
#include "tick_meter.hpp"
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
Reference in New Issue
Block a user