partially recovered binary compatibility (ticket #2415)
This commit is contained in:
parent
25a9b0a255
commit
94b97b7a63
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace cv
|
|
||||||
{
|
|
||||||
class DetectionBasedTracker
|
class DetectionBasedTracker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -169,5 +167,10 @@ class DetectionBasedTracker
|
|||||||
cv::Rect calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const;
|
cv::Rect calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const;
|
||||||
void detectInRegion(const cv::Mat& img, const cv::Rect& r, std::vector<cv::Rect>& detectedObjectsInRegions);
|
void detectInRegion(const cv::Mat& img, const cv::Rect& r, std::vector<cv::Rect>& detectedObjectsInRegions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace cv
|
||||||
|
{
|
||||||
|
typedef ::DetectionBasedTracker DetectionBasedTracker;
|
||||||
|
|
||||||
} //end of cv namespace
|
} //end of cv namespace
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,15 +60,12 @@ static inline cv::Rect scale_rect(const cv::Rect& r, float scale)
|
|||||||
return cv::Rect(x, y, cvRound(width), cvRound(height));
|
return cv::Rect(x, y, cvRound(width), cvRound(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace cv
|
void* workcycleObjectDetectorFunction(void* p);
|
||||||
{
|
|
||||||
void* workcycleObjectDetectorFunction(void* p);
|
|
||||||
}
|
|
||||||
|
|
||||||
class cv::DetectionBasedTracker::SeparateDetectionWork
|
class DetectionBasedTracker::SeparateDetectionWork
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SeparateDetectionWork(cv::DetectionBasedTracker& _detectionBasedTracker, cv::Ptr<DetectionBasedTracker::IDetector> _detector);
|
SeparateDetectionWork(DetectionBasedTracker& _detectionBasedTracker, cv::Ptr<DetectionBasedTracker::IDetector> _detector);
|
||||||
virtual ~SeparateDetectionWork();
|
virtual ~SeparateDetectionWork();
|
||||||
bool communicateWithDetectingThread(const Mat& imageGray, vector<Rect>& rectsWhereRegions);
|
bool communicateWithDetectingThread(const Mat& imageGray, vector<Rect>& rectsWhereRegions);
|
||||||
bool run();
|
bool run();
|
||||||
@ -119,7 +116,7 @@ class cv::DetectionBasedTracker::SeparateDetectionWork
|
|||||||
long long timeWhenDetectingThreadStartedWork;
|
long long timeWhenDetectingThreadStartedWork;
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork(DetectionBasedTracker& _detectionBasedTracker, cv::Ptr<DetectionBasedTracker::IDetector> _detector)
|
DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork(DetectionBasedTracker& _detectionBasedTracker, cv::Ptr<DetectionBasedTracker::IDetector> _detector)
|
||||||
:detectionBasedTracker(_detectionBasedTracker),
|
:detectionBasedTracker(_detectionBasedTracker),
|
||||||
cascadeInThread(),
|
cascadeInThread(),
|
||||||
isObjectDetectingReady(false),
|
isObjectDetectingReady(false),
|
||||||
@ -152,7 +149,7 @@ cv::DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork(Detectio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::DetectionBasedTracker::SeparateDetectionWork::~SeparateDetectionWork()
|
DetectionBasedTracker::SeparateDetectionWork::~SeparateDetectionWork()
|
||||||
{
|
{
|
||||||
if(stateThread!=STATE_THREAD_STOPPED) {
|
if(stateThread!=STATE_THREAD_STOPPED) {
|
||||||
LOGE("\n\n\nATTENTION!!! dangerous algorithm error: destructor DetectionBasedTracker::DetectionBasedTracker::~SeparateDetectionWork is called before stopping the workthread");
|
LOGE("\n\n\nATTENTION!!! dangerous algorithm error: destructor DetectionBasedTracker::DetectionBasedTracker::~SeparateDetectionWork is called before stopping the workthread");
|
||||||
@ -162,7 +159,7 @@ cv::DetectionBasedTracker::SeparateDetectionWork::~SeparateDetectionWork()
|
|||||||
pthread_cond_destroy(&objectDetectorRun);
|
pthread_cond_destroy(&objectDetectorRun);
|
||||||
pthread_mutex_destroy(&mutex);
|
pthread_mutex_destroy(&mutex);
|
||||||
}
|
}
|
||||||
bool cv::DetectionBasedTracker::SeparateDetectionWork::run()
|
bool DetectionBasedTracker::SeparateDetectionWork::run()
|
||||||
{
|
{
|
||||||
LOGD("DetectionBasedTracker::SeparateDetectionWork::run() --- start");
|
LOGD("DetectionBasedTracker::SeparateDetectionWork::run() --- start");
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
@ -211,18 +208,18 @@ do {
|
|||||||
} while(0)
|
} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void* cv::workcycleObjectDetectorFunction(void* p)
|
void* workcycleObjectDetectorFunction(void* p)
|
||||||
{
|
{
|
||||||
CATCH_ALL_AND_LOG({ ((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->workcycleObjectDetector(); });
|
CATCH_ALL_AND_LOG({ ((DetectionBasedTracker::SeparateDetectionWork*)p)->workcycleObjectDetector(); });
|
||||||
try{
|
try{
|
||||||
((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->stateThread = cv::DetectionBasedTracker::SeparateDetectionWork::STATE_THREAD_STOPPED;
|
((DetectionBasedTracker::SeparateDetectionWork*)p)->stateThread = DetectionBasedTracker::SeparateDetectionWork::STATE_THREAD_STOPPED;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
LOGE0("DetectionBasedTracker: workcycleObjectDetectorFunction: ERROR concerning pointer, received as the function parameter");
|
LOGE0("DetectionBasedTracker: workcycleObjectDetectorFunction: ERROR concerning pointer, received as the function parameter");
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
|
void DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
|
||||||
{
|
{
|
||||||
static double freq = getTickFrequency();
|
static double freq = getTickFrequency();
|
||||||
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- start");
|
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- start");
|
||||||
@ -346,7 +343,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
|
|||||||
LOGI("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector: Returning");
|
LOGI("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector: Returning");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::SeparateDetectionWork::stop()
|
void DetectionBasedTracker::SeparateDetectionWork::stop()
|
||||||
{
|
{
|
||||||
//FIXME: TODO: should add quickStop functionality
|
//FIXME: TODO: should add quickStop functionality
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
@ -363,7 +360,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::stop()
|
|||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::SeparateDetectionWork::resetTracking()
|
void DetectionBasedTracker::SeparateDetectionWork::resetTracking()
|
||||||
{
|
{
|
||||||
LOGD("DetectionBasedTracker::SeparateDetectionWork::resetTracking");
|
LOGD("DetectionBasedTracker::SeparateDetectionWork::resetTracking");
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
@ -384,7 +381,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::resetTracking()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread(const Mat& imageGray, vector<Rect>& rectsWhereRegions)
|
bool DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread(const Mat& imageGray, vector<Rect>& rectsWhereRegions)
|
||||||
{
|
{
|
||||||
static double freq = getTickFrequency();
|
static double freq = getTickFrequency();
|
||||||
|
|
||||||
@ -434,13 +431,13 @@ bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingT
|
|||||||
return shouldHandleResult;
|
return shouldHandleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::DetectionBasedTracker::Parameters::Parameters()
|
DetectionBasedTracker::Parameters::Parameters()
|
||||||
{
|
{
|
||||||
maxTrackLifetime=5;
|
maxTrackLifetime=5;
|
||||||
minDetectionPeriod=0;
|
minDetectionPeriod=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::DetectionBasedTracker::InnerParameters::InnerParameters()
|
DetectionBasedTracker::InnerParameters::InnerParameters()
|
||||||
{
|
{
|
||||||
numLastPositionsToTrack=4;
|
numLastPositionsToTrack=4;
|
||||||
numStepsToWaitBeforeFirstShow=6;
|
numStepsToWaitBeforeFirstShow=6;
|
||||||
@ -453,7 +450,7 @@ cv::DetectionBasedTracker::InnerParameters::InnerParameters()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::DetectionBasedTracker::DetectionBasedTracker(cv::Ptr<IDetector> mainDetector, cv::Ptr<IDetector> trackingDetector, const Parameters& params)
|
DetectionBasedTracker::DetectionBasedTracker(cv::Ptr<IDetector> mainDetector, cv::Ptr<IDetector> trackingDetector, const Parameters& params)
|
||||||
:separateDetectionWork(),
|
:separateDetectionWork(),
|
||||||
parameters(params),
|
parameters(params),
|
||||||
innerParameters(),
|
innerParameters(),
|
||||||
@ -474,7 +471,7 @@ cv::DetectionBasedTracker::DetectionBasedTracker(cv::Ptr<IDetector> mainDetector
|
|||||||
weightsSizesSmoothing.push_back(0.2);
|
weightsSizesSmoothing.push_back(0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::DetectionBasedTracker::~DetectionBasedTracker()
|
DetectionBasedTracker::~DetectionBasedTracker()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +544,7 @@ void DetectionBasedTracker::process(const Mat& imageGray)
|
|||||||
updateTrackedObjects(detectedObjectsInRegions);
|
updateTrackedObjects(detectedObjectsInRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::getObjects(std::vector<cv::Rect>& result) const
|
void DetectionBasedTracker::getObjects(std::vector<cv::Rect>& result) const
|
||||||
{
|
{
|
||||||
result.clear();
|
result.clear();
|
||||||
|
|
||||||
@ -561,7 +558,7 @@ void cv::DetectionBasedTracker::getObjects(std::vector<cv::Rect>& result) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::getObjects(std::vector<Object>& result) const
|
void DetectionBasedTracker::getObjects(std::vector<Object>& result) const
|
||||||
{
|
{
|
||||||
result.clear();
|
result.clear();
|
||||||
|
|
||||||
@ -574,7 +571,7 @@ void cv::DetectionBasedTracker::getObjects(std::vector<Object>& result) const
|
|||||||
LOGD("DetectionBasedTracker::process: found a object with SIZE %d x %d, rect={%d, %d, %d x %d}", r.width, r.height, r.x, r.y, r.width, r.height);
|
LOGD("DetectionBasedTracker::process: found a object with SIZE %d x %d, rect={%d, %d, %d x %d}", r.width, r.height, r.x, r.y, r.width, r.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void cv::DetectionBasedTracker::getObjects(std::vector<ExtObject>& result) const
|
void DetectionBasedTracker::getObjects(std::vector<ExtObject>& result) const
|
||||||
{
|
{
|
||||||
result.clear();
|
result.clear();
|
||||||
|
|
||||||
@ -586,7 +583,7 @@ void cv::DetectionBasedTracker::getObjects(std::vector<ExtObject>& result) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cv::DetectionBasedTracker::run()
|
bool DetectionBasedTracker::run()
|
||||||
{
|
{
|
||||||
if (!separateDetectionWork.empty()) {
|
if (!separateDetectionWork.empty()) {
|
||||||
return separateDetectionWork->run();
|
return separateDetectionWork->run();
|
||||||
@ -594,14 +591,14 @@ bool cv::DetectionBasedTracker::run()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::stop()
|
void DetectionBasedTracker::stop()
|
||||||
{
|
{
|
||||||
if (!separateDetectionWork.empty()) {
|
if (!separateDetectionWork.empty()) {
|
||||||
separateDetectionWork->stop();
|
separateDetectionWork->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::resetTracking()
|
void DetectionBasedTracker::resetTracking()
|
||||||
{
|
{
|
||||||
if (!separateDetectionWork.empty()) {
|
if (!separateDetectionWork.empty()) {
|
||||||
separateDetectionWork->resetTracking();
|
separateDetectionWork->resetTracking();
|
||||||
@ -609,7 +606,7 @@ void cv::DetectionBasedTracker::resetTracking()
|
|||||||
trackedObjects.clear();
|
trackedObjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::updateTrackedObjects(const vector<Rect>& detectedObjects)
|
void DetectionBasedTracker::updateTrackedObjects(const vector<Rect>& detectedObjects)
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
NEW_RECTANGLE=-1,
|
NEW_RECTANGLE=-1,
|
||||||
@ -730,7 +727,7 @@ void cv::DetectionBasedTracker::updateTrackedObjects(const vector<Rect>& detecte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cv::DetectionBasedTracker::addObject(const Rect& location)
|
int DetectionBasedTracker::addObject(const Rect& location)
|
||||||
{
|
{
|
||||||
LOGD("DetectionBasedTracker::addObject: new object {%d, %d %dx%d}",location.x, location.y, location.width, location.height);
|
LOGD("DetectionBasedTracker::addObject: new object {%d, %d %dx%d}",location.x, location.y, location.width, location.height);
|
||||||
trackedObjects.push_back(TrackedObject(location));
|
trackedObjects.push_back(TrackedObject(location));
|
||||||
@ -739,12 +736,12 @@ int cv::DetectionBasedTracker::addObject(const Rect& location)
|
|||||||
return newId;
|
return newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect cv::DetectionBasedTracker::calcTrackedObjectPositionToShow(int i) const
|
Rect DetectionBasedTracker::calcTrackedObjectPositionToShow(int i) const
|
||||||
{
|
{
|
||||||
ObjectStatus status;
|
ObjectStatus status;
|
||||||
return calcTrackedObjectPositionToShow(i, status);
|
return calcTrackedObjectPositionToShow(i, status);
|
||||||
}
|
}
|
||||||
Rect cv::DetectionBasedTracker::calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const
|
Rect DetectionBasedTracker::calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const
|
||||||
{
|
{
|
||||||
if ( (i < 0) || (i >= (int)trackedObjects.size()) ) {
|
if ( (i < 0) || (i >= (int)trackedObjects.size()) ) {
|
||||||
LOGE("DetectionBasedTracker::calcTrackedObjectPositionToShow: ERROR: wrong i=%d", i);
|
LOGE("DetectionBasedTracker::calcTrackedObjectPositionToShow: ERROR: wrong i=%d", i);
|
||||||
@ -830,7 +827,7 @@ Rect cv::DetectionBasedTracker::calcTrackedObjectPositionToShow(int i, ObjectSta
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, vector<Rect>& detectedObjectsInRegions)
|
void DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, vector<Rect>& detectedObjectsInRegions)
|
||||||
{
|
{
|
||||||
Rect r0(Point(), img.size());
|
Rect r0(Point(), img.size());
|
||||||
Rect r1 = scale_rect(r, innerParameters.coeffTrackingWindowSize);
|
Rect r1 = scale_rect(r, innerParameters.coeffTrackingWindowSize);
|
||||||
@ -867,7 +864,7 @@ void cv::DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, ve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cv::DetectionBasedTracker::setParameters(const Parameters& params)
|
bool DetectionBasedTracker::setParameters(const Parameters& params)
|
||||||
{
|
{
|
||||||
if ( params.maxTrackLifetime < 0 )
|
if ( params.maxTrackLifetime < 0 )
|
||||||
{
|
{
|
||||||
@ -885,7 +882,7 @@ bool cv::DetectionBasedTracker::setParameters(const Parameters& params)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cv::DetectionBasedTracker::Parameters& DetectionBasedTracker::getParameters() const
|
const DetectionBasedTracker::Parameters& DetectionBasedTracker::getParameters() const
|
||||||
{
|
{
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
@ -2124,11 +2124,15 @@ CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, in
|
|||||||
|
|
||||||
//! makes multi-channel array out of several single-channel arrays
|
//! makes multi-channel array out of several single-channel arrays
|
||||||
CV_EXPORTS void merge(const Mat* mv, size_t count, OutputArray dst);
|
CV_EXPORTS void merge(const Mat* mv, size_t count, OutputArray dst);
|
||||||
|
CV_EXPORTS void merge(const vector<Mat>& mv, OutputArray dst );
|
||||||
|
|
||||||
//! makes multi-channel array out of several single-channel arrays
|
//! makes multi-channel array out of several single-channel arrays
|
||||||
CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst);
|
CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst);
|
||||||
|
|
||||||
//! copies each plane of a multi-channel array to a dedicated array
|
//! copies each plane of a multi-channel array to a dedicated array
|
||||||
CV_EXPORTS void split(const Mat& src, Mat* mvbegin);
|
CV_EXPORTS void split(const Mat& src, Mat* mvbegin);
|
||||||
|
CV_EXPORTS void split(const Mat& src, vector<Mat>& mv );
|
||||||
|
|
||||||
//! copies each plane of a multi-channel array to a dedicated array
|
//! copies each plane of a multi-channel array to a dedicated array
|
||||||
CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);
|
CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);
|
||||||
|
|
||||||
@ -2547,7 +2551,7 @@ CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts,
|
|||||||
Point offset=Point() );
|
Point offset=Point() );
|
||||||
|
|
||||||
//! draws one or more polygonal curves
|
//! draws one or more polygonal curves
|
||||||
CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts,
|
CV_EXPORTS void polylines(Mat& img, const Point** pts, const int* npts,
|
||||||
int ncontours, bool isClosed, const Scalar& color,
|
int ncontours, bool isClosed, const Scalar& color,
|
||||||
int thickness=1, int lineType=8, int shift=0 );
|
int thickness=1, int lineType=8, int shift=0 );
|
||||||
|
|
||||||
@ -3995,7 +3999,7 @@ public:
|
|||||||
//! closes the file and releases all the memory buffers
|
//! closes the file and releases all the memory buffers
|
||||||
CV_WRAP virtual void release();
|
CV_WRAP virtual void release();
|
||||||
//! closes the file, releases all the memory buffers and returns the text string
|
//! closes the file, releases all the memory buffers and returns the text string
|
||||||
CV_WRAP virtual string releaseAndGetString();
|
CV_WRAP string releaseAndGetString();
|
||||||
|
|
||||||
//! returns the first element of the top-level mapping
|
//! returns the first element of the top-level mapping
|
||||||
CV_WRAP FileNode getFirstTopLevelNode() const;
|
CV_WRAP FileNode getFirstTopLevelNode() const;
|
||||||
@ -4538,6 +4542,7 @@ template<> struct ParamType<uint64>
|
|||||||
class CV_EXPORTS CommandLineParser
|
class CV_EXPORTS CommandLineParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CommandLineParser(int argc, const char* const argv[], const char* keys);
|
||||||
CommandLineParser(int argc, const char* const argv[], const string& keys);
|
CommandLineParser(int argc, const char* const argv[], const string& keys);
|
||||||
CommandLineParser(const CommandLineParser& parser);
|
CommandLineParser(const CommandLineParser& parser);
|
||||||
CommandLineParser& operator = (const CommandLineParser& parser);
|
CommandLineParser& operator = (const CommandLineParser& parser);
|
||||||
@ -4559,17 +4564,18 @@ public:
|
|||||||
getByIndex(index, space_delete, ParamType<T>::type, (void*)&val);
|
getByIndex(index, space_delete, ParamType<T>::type, (void*)&val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has(const string& name) const;
|
bool has(const string& name);
|
||||||
|
|
||||||
bool check() const;
|
bool check() const;
|
||||||
|
|
||||||
void about(const string& message);
|
void about(const string& message);
|
||||||
|
|
||||||
void printMessage() const;
|
void printMessage() const;
|
||||||
void printErrors() const;
|
void printErrors() const;
|
||||||
|
void printParams();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
string getString(const string& name);
|
||||||
void getByName(const string& name, bool space_delete, int type, void* dst) const;
|
void getByName(const string& name, bool space_delete, int type, void* dst) const;
|
||||||
void getByIndex(int index, bool space_delete, int type, void* dst) const;
|
void getByIndex(int index, bool space_delete, int type, void* dst) const;
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ public:
|
|||||||
|
|
||||||
static Ptr<GlFont> get(const std::string& family, int height = 12, Weight weight = WEIGHT_NORMAL, Style style = STYLE_NORMAL);
|
static Ptr<GlFont> get(const std::string& family, int height = 12, Weight weight = WEIGHT_NORMAL, Style style = STYLE_NORMAL);
|
||||||
|
|
||||||
void draw(const char* str, size_t len) const;
|
void draw(const char* str, int len) const;
|
||||||
|
|
||||||
inline const std::string& family() const { return family_; }
|
inline const std::string& family() const { return family_; }
|
||||||
inline int height() const { return height_; }
|
inline int height() const { return height_; }
|
||||||
|
@ -27,9 +27,12 @@ struct CommandLineParser::Impl
|
|||||||
|
|
||||||
vector<CommandLineParserParams> data;
|
vector<CommandLineParserParams> data;
|
||||||
|
|
||||||
|
Impl() { refcount = 1; }
|
||||||
|
Impl(int argc, const char* const argv[], const char* keys);
|
||||||
|
|
||||||
vector<string> split_range_string(const string& str, char fs, char ss) const;
|
vector<string> split_range_string(const string& str, char fs, char ss) const;
|
||||||
vector<string> split_string(const string& str, char symbol = ' ', bool create_empty_item = false) const;
|
vector<string> split_string(const string& str, char symbol = ' ', bool create_empty_item = false) const;
|
||||||
string cat_string(const string& str) const;
|
string trim_spaces(const string& str) const;
|
||||||
|
|
||||||
void apply_params(const string& key, const string& value);
|
void apply_params(const string& key, const string& value);
|
||||||
void apply_params(int i, string value);
|
void apply_params(int i, string value);
|
||||||
@ -83,26 +86,39 @@ static void from_str(const string& str, int type, void* dst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string CommandLineParser::getString(const string& name)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < impl->data.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
|
||||||
|
{
|
||||||
|
if (name.compare(impl->data[i].keys[j]) == 0)
|
||||||
|
{
|
||||||
|
string v = impl->data[i].def_value;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string();
|
||||||
|
}
|
||||||
|
|
||||||
void CommandLineParser::getByName(const string& name, bool space_delete, int type, void* dst) const
|
void CommandLineParser::getByName(const string& name, bool space_delete, int type, void* dst) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < impl->data.size(); i++)
|
string v = ((CommandLineParser*)this)->getString(name);
|
||||||
|
if( v.empty() )
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
|
impl->error = true;
|
||||||
{
|
impl->error_message += "Unknown parametes " + name + "\n";
|
||||||
if (name.compare(impl->data[i].keys[j]) == 0)
|
}
|
||||||
{
|
else
|
||||||
string v = impl->data[i].def_value;
|
{
|
||||||
if (space_delete)
|
if (space_delete)
|
||||||
v = impl->cat_string(v);
|
v = impl->trim_spaces(v);
|
||||||
from_str(v, type, dst);
|
from_str(v, type, dst);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
impl->error = true;
|
|
||||||
impl->error_message += "Unknown parametes " + name + "\n";
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
@ -121,7 +137,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
|
|||||||
if (impl->data[i].number == index)
|
if (impl->data[i].number == index)
|
||||||
{
|
{
|
||||||
string v = impl->data[i].def_value;
|
string v = impl->data[i].def_value;
|
||||||
if (space_delete == true) v = impl->cat_string(v);
|
if (space_delete == true) v = impl->trim_spaces(v);
|
||||||
from_str(v, type, dst);
|
from_str(v, type, dst);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -154,36 +170,45 @@ static bool cmp_params(const CommandLineParserParams & p1, const CommandLinePars
|
|||||||
|
|
||||||
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const string& keys)
|
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const string& keys)
|
||||||
{
|
{
|
||||||
impl = new Impl;
|
impl = new Impl(argc, argv, keys.c_str());
|
||||||
impl->refcount = 1;
|
}
|
||||||
|
|
||||||
|
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const char* keys)
|
||||||
|
{
|
||||||
|
impl = new Impl(argc, argv, keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandLineParser::Impl::Impl(int argc, const char* const argv[], const char* keys)
|
||||||
|
{
|
||||||
|
refcount = 1;
|
||||||
|
|
||||||
// path to application
|
// path to application
|
||||||
size_t pos_s = string(argv[0]).find_last_of("/\\");
|
size_t pos_s = string(argv[0]).find_last_of("/\\");
|
||||||
if (pos_s == string::npos)
|
if (pos_s == string::npos)
|
||||||
{
|
{
|
||||||
impl->path_to_app = "";
|
path_to_app = "";
|
||||||
impl->app_name = string(argv[0]);
|
app_name = string(argv[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
impl->path_to_app = string(argv[0]).substr(0, pos_s);
|
path_to_app = string(argv[0]).substr(0, pos_s);
|
||||||
impl->app_name = string(argv[0]).substr(pos_s + 1, string(argv[0]).length() - pos_s);
|
app_name = string(argv[0]).substr(pos_s + 1, string(argv[0]).length() - pos_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl->error = false;
|
error = false;
|
||||||
impl->error_message = "";
|
error_message = "";
|
||||||
|
|
||||||
// parse keys
|
// parse keys
|
||||||
vector<string> k = impl->split_range_string(keys, '{', '}');
|
vector<string> k = split_range_string(keys, '{', '}');
|
||||||
|
|
||||||
int jj = 0;
|
int jj = 0;
|
||||||
for (size_t i = 0; i < k.size(); i++)
|
for (size_t i = 0; i < k.size(); i++)
|
||||||
{
|
{
|
||||||
vector<string> l = impl->split_string(k[i], '|', true);
|
vector<string> l = split_string(k[i], '|', true);
|
||||||
CommandLineParserParams p;
|
CommandLineParserParams p;
|
||||||
p.keys = impl->split_string(l[0]);
|
p.keys = split_string(l[0]);
|
||||||
p.def_value = l[1];
|
p.def_value = l[1];
|
||||||
p.help_message = impl->cat_string(l[2]);
|
p.help_message = trim_spaces(l[2]);
|
||||||
p.number = -1;
|
p.number = -1;
|
||||||
if (p.keys[0][0] == '@')
|
if (p.keys[0][0] == '@')
|
||||||
{
|
{
|
||||||
@ -191,7 +216,7 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const s
|
|||||||
jj++;
|
jj++;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl->data.push_back(p);
|
data.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse argv
|
// parse argv
|
||||||
@ -202,13 +227,13 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const s
|
|||||||
|
|
||||||
if (s.find('=') != string::npos && s.find('=') < s.length())
|
if (s.find('=') != string::npos && s.find('=') < s.length())
|
||||||
{
|
{
|
||||||
vector<string> k_v = impl->split_string(s, '=', true);
|
vector<string> k_v = split_string(s, '=', true);
|
||||||
for (int h = 0; h < 2; h++)
|
for (int h = 0; h < 2; h++)
|
||||||
{
|
{
|
||||||
if (k_v[0][0] == '-')
|
if (k_v[0][0] == '-')
|
||||||
k_v[0] = k_v[0].substr(1, k_v[0].length() -1);
|
k_v[0] = k_v[0].substr(1, k_v[0].length() -1);
|
||||||
}
|
}
|
||||||
impl->apply_params(k_v[0], k_v[1]);
|
apply_params(k_v[0], k_v[1]);
|
||||||
}
|
}
|
||||||
else if (s.length() > 1 && s[0] == '-')
|
else if (s.length() > 1 && s[0] == '-')
|
||||||
{
|
{
|
||||||
@ -217,16 +242,16 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const s
|
|||||||
if (s[0] == '-')
|
if (s[0] == '-')
|
||||||
s = s.substr(1, s.length() - 1);
|
s = s.substr(1, s.length() - 1);
|
||||||
}
|
}
|
||||||
impl->apply_params(s, "true");
|
apply_params(s, "true");
|
||||||
}
|
}
|
||||||
else if (s[0] != '-')
|
else if (s[0] != '-')
|
||||||
{
|
{
|
||||||
impl->apply_params(jj, s);
|
apply_params(jj, s);
|
||||||
jj++;
|
jj++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl->sort_params();
|
sort_params();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,7 +315,7 @@ void CommandLineParser::Impl::sort_params()
|
|||||||
sort (data.begin(), data.end(), cmp_params);
|
sort (data.begin(), data.end(), cmp_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
string CommandLineParser::Impl::cat_string(const string& str) const
|
string CommandLineParser::Impl::trim_spaces(const string& str) const
|
||||||
{
|
{
|
||||||
int left = 0, right = (int)str.length();
|
int left = 0, right = (int)str.length();
|
||||||
while( left <= right && str[left] == ' ' )
|
while( left <= right && str[left] == ' ' )
|
||||||
@ -305,7 +330,7 @@ string CommandLineParser::getPathToApplication() const
|
|||||||
return impl->path_to_app;
|
return impl->path_to_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::has(const string& name) const
|
bool CommandLineParser::has(const string& name)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < impl->data.size(); i++)
|
for (size_t i = 0; i < impl->data.size(); i++)
|
||||||
{
|
{
|
||||||
@ -333,6 +358,11 @@ void CommandLineParser::printErrors() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandLineParser::printParams()
|
||||||
|
{
|
||||||
|
printMessage();
|
||||||
|
}
|
||||||
|
|
||||||
void CommandLineParser::printMessage() const
|
void CommandLineParser::printMessage() const
|
||||||
{
|
{
|
||||||
if (impl->about_message != "")
|
if (impl->about_message != "")
|
||||||
@ -374,7 +404,7 @@ void CommandLineParser::printMessage() const
|
|||||||
std::cout << ", ";
|
std::cout << ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string dv = impl->cat_string(impl->data[i].def_value);
|
string dv = impl->trim_spaces(impl->data[i].def_value);
|
||||||
if (dv.compare("") != 0)
|
if (dv.compare("") != 0)
|
||||||
{
|
{
|
||||||
std::cout << " (value:" << dv << ")";
|
std::cout << " (value:" << dv << ")";
|
||||||
@ -394,7 +424,7 @@ void CommandLineParser::printMessage() const
|
|||||||
|
|
||||||
std::cout << k;
|
std::cout << k;
|
||||||
|
|
||||||
string dv = impl->cat_string(impl->data[i].def_value);
|
string dv = impl->trim_spaces(impl->data[i].def_value);
|
||||||
if (dv.compare("") != 0)
|
if (dv.compare("") != 0)
|
||||||
{
|
{
|
||||||
std::cout << " (value:" << dv << ")";
|
std::cout << " (value:" << dv << ")";
|
||||||
|
@ -267,6 +267,11 @@ void cv::split(InputArray _m, OutputArrayOfArrays _mv)
|
|||||||
split(m, dst);
|
split(m, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cv::split(const Mat& src, vector<Mat>& mv)
|
||||||
|
{
|
||||||
|
split(_InputArray(src), _OutputArray(mv));
|
||||||
|
}
|
||||||
|
|
||||||
void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
|
void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
|
||||||
{
|
{
|
||||||
CV_Assert( mv && n > 0 );
|
CV_Assert( mv && n > 0 );
|
||||||
@ -349,6 +354,11 @@ void cv::merge(InputArrayOfArrays _mv, OutputArray _dst)
|
|||||||
merge(!mv.empty() ? &mv[0] : 0, mv.size(), _dst);
|
merge(!mv.empty() ? &mv[0] : 0, mv.size(), _dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cv::merge(const vector<Mat>& _mv, OutputArray _dst)
|
||||||
|
{
|
||||||
|
merge(_InputArray(_mv), _dst);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
* Generalized split/merge: mixing channels *
|
* Generalized split/merge: mixing channels *
|
||||||
\****************************************************************************************/
|
\****************************************************************************************/
|
||||||
|
@ -1730,7 +1730,7 @@ void fillPoly( Mat& img, const Point** pts, const int* npts, int ncontours,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void polylines( Mat& img, const Point* const* pts, const int* npts, int ncontours, bool isClosed,
|
void polylines( Mat& img, const Point** pts, const int* npts, int ncontours, bool isClosed,
|
||||||
const Scalar& color, int thickness, int line_type, int shift )
|
const Scalar& color, int thickness, int line_type, int shift )
|
||||||
{
|
{
|
||||||
if( line_type == CV_AA && img.depth() != CV_8U )
|
if( line_type == CV_AA && img.depth() != CV_8U )
|
||||||
|
@ -1257,7 +1257,7 @@ cv::GlFont::GlFont(const string& _family, int _height, Weight _weight, Style _st
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::GlFont::draw(const char* str, size_t len) const
|
void cv::GlFont::draw(const char* str, int len) const
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
(void)str;
|
(void)str;
|
||||||
@ -1409,7 +1409,7 @@ void cv::render(const string& str, const Ptr<GlFont>& font, Scalar color, Point2
|
|||||||
|
|
||||||
glRasterPos2d(2.0 * (viewport[0] + pos.x) / viewport[2] - 1.0, 1.0 - 2.0 * (viewport[1] + pos.y + font->height()) / viewport[3]);
|
glRasterPos2d(2.0 * (viewport[0] + pos.x) / viewport[2] - 1.0, 1.0 - 2.0 * (viewport[1] + pos.y + font->height()) / viewport[3]);
|
||||||
|
|
||||||
font->draw(str.c_str(), str.length());
|
font->draw(str.c_str(), (int)str.length());
|
||||||
|
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
#endif
|
#endif
|
||||||
|
@ -636,8 +636,10 @@ CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
|
|||||||
//! computes PSNR image/video quality metric
|
//! computes PSNR image/video quality metric
|
||||||
CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
|
CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
|
||||||
|
|
||||||
|
CV_EXPORTS Point2d phaseCorrelate(InputArray src1, InputArray src2,
|
||||||
|
InputArray window = noArray());
|
||||||
CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
|
CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
|
||||||
InputArray window = noArray(), CV_OUT double* response=0);
|
InputArray window, CV_OUT double* response CV_WRAP_DEFAULT(0));
|
||||||
CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
|
CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
|
||||||
|
|
||||||
//! type of the threshold operation
|
//! type of the threshold operation
|
||||||
|
@ -568,6 +568,10 @@ cv::Point2d cv::phaseCorrelate(InputArray _src1, InputArray _src2, InputArray _w
|
|||||||
return (center - t);
|
return (center - t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cv::Point2d cv::phaseCorrelate(InputArray _src1, InputArray _src2, InputArray _window)
|
||||||
|
{
|
||||||
|
return phaseCorrelate(_src1, _src2, _window, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type)
|
void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type)
|
||||||
{
|
{
|
||||||
|
@ -63,9 +63,6 @@ public:
|
|||||||
virtual void setRadius(int val) { radius_ = val; }
|
virtual void setRadius(int val) { radius_ = val; }
|
||||||
virtual int radius() const { return radius_; }
|
virtual int radius() const { return radius_; }
|
||||||
|
|
||||||
virtual void deblur(int idx, Mat &frame) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// data from stabilizer
|
// data from stabilizer
|
||||||
|
|
||||||
virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
|
virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
|
||||||
@ -77,6 +74,9 @@ public:
|
|||||||
virtual void setBlurrinessRates(const std::vector<float> &val) { blurrinessRates_ = &val; }
|
virtual void setBlurrinessRates(const std::vector<float> &val) { blurrinessRates_ = &val; }
|
||||||
virtual const std::vector<float>& blurrinessRates() const { return *blurrinessRates_; }
|
virtual const std::vector<float>& blurrinessRates() const { return *blurrinessRates_; }
|
||||||
|
|
||||||
|
virtual void update() {}
|
||||||
|
virtual void deblur(int idx, Mat &frame) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int radius_;
|
int radius_;
|
||||||
const std::vector<Mat> *frames_;
|
const std::vector<Mat> *frames_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user