mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-23 00:49:38 +08:00
tracking: make opencv_dnn dependancy optional
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include "gtrTracker.hpp"
|
||||
|
||||
|
||||
@@ -54,9 +54,16 @@ void TrackerGOTURN::Params::write(cv::FileStorage& /*fs*/) const {}
|
||||
|
||||
Ptr<TrackerGOTURN> TrackerGOTURN::createTracker(const TrackerGOTURN::Params ¶meters)
|
||||
{
|
||||
#ifdef HAVE_OPENCV_DNN
|
||||
return Ptr<gtr::TrackerGOTURNImpl>(new gtr::TrackerGOTURNImpl(parameters));
|
||||
#else
|
||||
(void)(parameters);
|
||||
CV_ErrorNoReturn(cv::Error::StsNotImplemented , "to use GOTURN, the tracking module needs to be built with opencv_dnn !");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCV_DNN
|
||||
namespace gtr
|
||||
{
|
||||
|
||||
@@ -183,9 +190,11 @@ bool TrackerGOTURNImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
|
||||
//Set new model image and BB from current frame
|
||||
((TrackerGOTURNModel*)static_cast<TrackerModel*>(model))->setImage(curFrame);
|
||||
((TrackerGOTURNModel*)static_cast<TrackerModel*>(model))->setBoudingBox(curBB);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
#endif // OPENCV_HAVE_DNN
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user