1
0
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:
berak
2017-03-04 12:38:50 +01:00
parent ab63d35db2
commit 43925b60d3
9 changed files with 46 additions and 15 deletions

View File

@@ -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 &parameters)
{
#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
}