38 #include <visp3/ustk_gui/usTracker2DQtWrapper.h>
40 #if (defined(USTK_HAVE_VTK_QT) || defined(USTK_HAVE_QT5)) && defined(VISP_HAVE_MODULE_USTK_TEMPLATE_TRACKING)
45 usTracker2DQtWrapper::usTracker2DQtWrapper()
46 : QObject(), m_tracker(), m_firstImage(), m_firstFrameArrived(false), m_isInitialized(false)
53 usTracker2DQtWrapper::~usTracker2DQtWrapper() {}
59 void usTracker2DQtWrapper::initTracker(vpRectOriented rect)
61 if (m_firstFrameArrived) {
62 m_tracker.init(m_firstImage, rect);
63 m_isInitialized =
true;
65 throw(vpException(vpException::fatalError,
"Cannot init tracker: no frames sent to usTracker2DQtWrapper."));
73 void usTracker2DQtWrapper::updateImage(vpImage<unsigned char> image)
75 if (m_isInitialized) {
76 m_tracker.update(image);
77 emit(newTrackedRectangle(m_tracker.getTarget()));
80 m_firstFrameArrived =
true;
90 if (m_isInitialized) {
91 m_tracker.update(image);
92 emit(newTrackedRectangle(m_tracker.getTarget()));
95 m_firstFrameArrived =
true;
105 if (m_isInitialized) {
106 m_tracker.update(image);
107 emit(newTrackedRectangle(m_tracker.getTarget()));
109 m_firstImage = image;
110 m_firstFrameArrived =
true;
117 void usTracker2DQtWrapper::stopTracking()
119 m_firstFrameArrived =
false;
120 m_isInitialized =
false;