MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / estimateScale

Method estimateScale

src/Tracker/ldes/ldes_tracker.cpp:258–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256
257///
258void LDESTracker::estimateScale(cv::Mat& z, cv::Mat& x)
259{
260 cv::Mat rf = phaseCorrelation(x, z, size_scale[0], size_scale[1], size_scale[2]);
261 cv::Mat res = fftd(rf, true);
262 rearrange(res);
263
264 cv::Rect center(5, 5, size_scale[1] - 10, size_scale[0] - 10);
265
266 res = res(center).clone();
267
268 cv::Point2i pi;
269 double pv_;
270 cv::minMaxLoc(res, NULL, &pv_, NULL, &pi);
271 float pv = static_cast<float>(pv_);
272
273 cv::Point2f pf(pi.x + 5.f, pi.y + 5.f);
274 //weightedPeak(res, pf, 1);
275 if (pi.x > 0 && pi.x < res.cols - 1) {
276 pf.x += subPixelPeak(res.at<float>(pi.y, pi.x - 1), pv, res.at<float>(pi.y, pi.x + 1));
277 }
278
279 if (pi.y > 0 && pi.y < res.rows - 1) {
280 pf.y += subPixelPeak(res.at<float>(pi.y - 1, pi.x), pv, res.at<float>(pi.y + 1, pi.x));
281 }
282
283 float px = pf.x, py = pf.y;
284
285 px -= size_scale[1] * 0.5f;
286 py -= size_scale[0] * 0.5f;
287 //px *= cell_size_scale;
288 //py *= cell_size_scale;
289
290 float rot = -(py) * 180.0f / (size_scale[0] * 0.5f);
291 float scale = exp((px) / mag);
292
293 sscore = static_cast<float>(pv);
294
295 delta_rot = rot;
296 delta_scale = scale;
297 if (abs(delta_rot) > 5)
298 delta_rot = 0;
299 delta_scale = MIN(MAX(delta_scale, 0.6f), 1.4f);
300}
301
302/*
303*Update BGD(Block Gradient Descend, original AAAI Paper MATLAB Code)

Callers

nothing calls this directly

Calls 7

phaseCorrelationFunction · 0.85
fftdFunction · 0.85
rearrangeFunction · 0.85
expFunction · 0.85
absFunction · 0.85
MINFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected