@@ -140,37 +140,35 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
140
140
std::vector<Rect2d> candidates;
141
141
std::vector<double > candidatesRes;
142
142
bool trackerNeedsReInit = false ;
143
- bool DETECT_FLG = false ;
144
- for ( int i = 0 ; i < 2 ; i++ )
143
+ bool DETECT_FLG = false ;
144
+
145
+ // run tracker
146
+ Rect2d tmpCandid = boundingBox;
147
+ if (!data->failedLastTime && trackerProxy->update (image, tmpCandid))
145
148
{
146
- Rect2d tmpCandid = boundingBox;
149
+ candidates.push_back (tmpCandid);
150
+ resample (image_gray, tmpCandid, standardPatch);
151
+ candidatesRes.push_back (tldModel->detector ->Sc (standardPatch));
152
+ }
153
+ else
154
+ trackerNeedsReInit = true ;
147
155
148
- if (i == 1 )
149
- {
156
+ // run detector
157
+ tmpCandid = boundingBox;
150
158
#ifdef HAVE_OPENCL
151
- if (false )// ocl::useOpenCL())
152
- {
153
- DETECT_FLG = tldModel->detector ->ocl_detect (imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize ());
154
- }
155
- else
159
+ if (false )// ocl::useOpenCL())
160
+ DETECT_FLG = tldModel->detector ->ocl_detect (imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize ());
161
+ else
156
162
#endif
157
- DETECT_FLG = tldModel->detector ->detect (imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize ());
158
- }
159
- if ( ( (i == 0 ) && !data->failedLastTime && trackerProxy->update (image, tmpCandid) ) || ( DETECT_FLG))
160
- {
161
- candidates.push_back (tmpCandid);
162
- if ( i == 0 )
163
- resample (image_gray, tmpCandid, standardPatch);
164
- else
165
- resample (imageForDetector, tmpCandid, standardPatch);
166
- candidatesRes.push_back (tldModel->detector ->Sc (standardPatch));
167
- }
168
- else
169
- {
170
- if ( i == 0 )
171
- trackerNeedsReInit = true ;
172
- }
163
+ DETECT_FLG = tldModel->detector ->detect (imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize ());
164
+
165
+ if (DETECT_FLG)
166
+ {
167
+ candidates.push_back (tmpCandid);
168
+ resample (imageForDetector, tmpCandid, standardPatch);
169
+ candidatesRes.push_back (tldModel->detector ->Sc (standardPatch));
173
170
}
171
+
174
172
std::vector<double >::iterator it = std::max_element (candidatesRes.begin (), candidatesRes.end ());
175
173
176
174
if ( it == candidatesRes.end () ) // candidates are empty
0 commit comments