/*
Tracker based on Kernelized Correlation Filter (KCF) [1] and Circulant Structure with Kernels (CSK) [2].
CSK is implemented by using raw gray level features, since it is a single-channel filter.
KCF is implemented by using HOG features (the default), since it extends CSK to multiple channels.
[1] J. F. Henriques, R. Caseiro, P. Martins, J. Batista,
"High-Speed Tracking with Kernelized Correlation Filters", TPAMI 2015.
[2] J. F. Henriques, R. Caseiro, P. Martins, J. Batista,
"Exploiting the Circulant Structure of Tracking-by-detection with Kernels", ECCV 2012.
Authors: Joao Faro, Christian Bailer, Joao F. Henriques
Contacts: joaopfaro@gmail.com, Christian.Bailer@dfki.de, henriques@isr.uc.pt
Institute of Systems and Robotics - University of Coimbra / Department Augmented Vision DFKI
Constructor parameters, all boolean:
hog: use HOG features (default), otherwise use raw pixels
fixed_window: fix window size (default), otherwise use ROI size (slower but more accurate)
multiscale: use multi-scale tracking (default; cannot be used with fixed_window = true)
Default values are set for all properties of the tracker depending on the above choices.
Their values can be customized further before calling init():
interp_factor: linear interpolation factor for adaptation
sigma: gaussian kernel bandwidth
lambda: regularization
cell_size: HOG cell size
padding: area surrounding the target, relative to its size
output_sigma_factor: bandwidth of gaussian target
template_size: template size in pixels, 0 to use ROI size
scale_step: scale step for multi-scale estimation, 1 to disable it
scale_weight: to downweight detection scores of other scales for added stability
For speed, the value (template_size/cell_size) should be a power of 2 or a product of small prime numbers.
Inputs to init():
image is the initial frame.
roi is a cv::Rect with the target positions in the initial frame
Inputs to update():
image is the current frame.
Outputs of update():
cv::Rect with target positions for the current frame
By downloading, copying, installing or using the software you agree to this license.
If you do not agree to this license, do not download, install,
copy or use the software.
License Agreement
For Open Source Computer Vision Library
(3-clause BSD License)
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of the contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are disclaimed.
In no event shall copyright holders or contributors be liable for any direct,
indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused
and on any theory of liability, whether in contract, strict liability,
or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
*/
#ifndef _KCFTRACKER_HEADERS
#include "kcftracker.hpp"
#include "ffttools.hpp"
#include "recttools.hpp"
#include "fhog.hpp"
#include "labdata.hpp"
#endif
// Constructor
KCFTracker::KCFTracker(bool hog, bool fixed_window, bool multiscale, bool lab)
{
// Parameters equal in all cases
lambda = 0.0001;
padding = 2.5;
//output_sigma_factor = 0.1;
output_sigma_factor = 0.125;
if (hog) { // HOG
// VOT
interp_factor = 0.012;
sigma = 0.6;
// TPAMI
//interp_factor = 0.02;
//sigma = 0.5;
cell_size = 4;
_hogfeatures = true;
if (lab) {
interp_factor = 0.005;
sigma = 0.4;
//output_sigma_factor = 0.025;
output_sigma_factor = 0.1;
_labfeatures = true;
_labCentroids = cv::Mat(nClusters, 3, CV_32FC1, &data);
cell_sizeQ = cell_size*cell_size;
}
else{
_labfeatures = false;
}
}
else { // RAW
interp_factor = 0.075;
sigma = 0.2;
cell_size = 1;
_hogfeatures = false;
if (lab) {
printf("Lab features are only used with HOG features.\n");
_labfeatures = false;
}
}
if (multiscale) { // multiscale
template_size = 96;
//template_size = 100;
scale_step = 1.05;
scale_weight = 0.95;
if (!fixed_window) {
//printf("Multiscale does not support non-fixed window.\n");
fixed_window = true;
}
}
else if (fixed_window) { // fit correction without multiscale
template_size = 96;
//template_size = 100;
scale_step = 1;
}
else {
template_size = 1;
scale_step = 1;
}
}
// Initialize tracker
void KCFTracker::init(const cv::Rect &roi, cv::Mat image)
{
_roi = roi;
assert(roi.width >= 0 && roi.height >= 0);
_tmpl = getFeatures(image, 1);
_prob = createGaussianPeak(size_patch[0], size_patch[1]);
_alphaf = cv::Mat(size_patch[0], size_patch[1], CV_32FC2, float(0));
//_num = cv::Mat(size_patch[0], size_patch[1], CV_32FC2, float(0));
//_den = cv::Mat(size_patch[0], size_patch[1], CV_32FC2, float(0));
train(_tmpl, 1.0); // train with initial frame
}
// Update position based on the new frame
cv::Rect KCFTracker::update(cv::Mat image)
{
if (_roi.x + _roi.width <= 0) _roi.x = -_roi.width + 1;
if (_roi.y + _roi.height <= 0) _roi.y = -_roi.height + 1;
if (_roi.x >= image.cols - 1) _roi.x = image.cols - 2;
if (_roi.y >= image.rows - 1) _roi.y = image.rows - 2;
float cx = _roi.x + _roi.width / 2.0f;
float cy = _roi.y + _roi.height / 2.0f;
float peak_value;
cv::Point2f res = detect(_tmpl, getFeatures(image, 0, 1.0f), peak_value);
if (scale_step != 1) {
// Test at a smaller _scale
float new_peak_value;
cv::Point2f new_res = detect(_tmpl, getFeatures(image, 0, 1.0f / scale_step), new_peak_value);
if (scale_weight * new_peak_value > peak_value) {
res = new_res;
peak_value = new_peak_value;
_scale /= scale_step;
_roi.width /= scale_step;
_roi.height /= scale_step;
}
// Test at a bigger _scale
new_res = detect(_tmpl, getFeatures(image, 0, scale_step), new_peak_value);
if (scale_weight * new_peak_value > peak_value) {
res = new_res;
peak_value = new_peak_value;
_scale *= scale_step;
_roi.width *= scale_step;
_roi.height *= scale_step;
}
}
// Adjust by cell size and _scale
_roi.x = cx - _roi.width / 2.0f + ((float) res.x * cell_size * _scale);
_roi.y = cy - _roi.height / 2.0f + ((float) res.y * cell_size * _scale);
if (_roi.x >= image.cols - 1) _roi.x = image.cols - 1;
if (_roi.y >= image.rows - 1) _roi.y = image.rows - 1;
if (_roi.x + _roi.width <= 0) _roi.x = -_roi.width + 2;
if (_roi.y + _roi.height <= 0) _roi.y = -_roi.height + 2;
assert(_roi.width >= 0 && _roi.height >= 0);
cv
没有合适的资源?快使用搜索试试~ 我知道了~
基于无人车的目标三维定位--本科毕业设计.zip
共707个文件
h:281个
hpp:277个
lib:92个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 117 浏览量
2023-10-05
01:49:31
上传
评论
收藏 43.83MB ZIP 举报
温馨提示
本科毕业设计
资源推荐
资源详情
资源评论
收起资源包目录
基于无人车的目标三维定位--本科毕业设计.zip (707个子文件)
ClassDiagram.cd 59B
OpenCVModules-release.cmake 30KB
OpenCVModules-debug.cmake 29KB
OpenCVConfig.cmake 16KB
OpenCVModules.cmake 7KB
kcftracker.cpp 19KB
fhog.cpp 17KB
robotcontroldialog.cpp 4KB
robotclient.cpp 4KB
mylabel.cpp 4KB
runtracker.cpp 3KB
cameracontrol.cpp 2KB
main.cpp 1KB
myplotlabel.cpp 897B
cameralogindialog.cpp 770B
logindialog.cpp 690B
mymaplabel.cpp 351B
opencv_imgproc310d.dll 26.44MB
opencv_imgproc310.dll 19.67MB
opencv_core310d.dll 12.33MB
opencv_core310.dll 8.58MB
AriaDebugVC12.dll 4.85MB
AriaDebugVC12.dll 4.85MB
opencv_tracking310d.dll 4.67MB
opencv_imgcodecs310d.dll 4.24MB
opencv_tracking310.dll 3.19MB
AriaVC12.dll 2.42MB
AriaVC12.dll 2.42MB
opencv_imgcodecs310.dll 2.25MB
ArNetworkingDebugVC12.dll 1.7MB
ArNetworkingDebugVC12.dll 1.7MB
VitaminCtrl.dll 1.21MB
opencv_aruco310d.dll 990KB
opencv_video310d.dll 773KB
opencv_highgui310d.dll 741KB
ArNetworkingVC12.dll 676KB
ArNetworkingVC12.dll 676KB
opencv_videoio310d.dll 535KB
opencv_video310.dll 399KB
opencv_highgui310.dll 327KB
opencv_videoio310.dll 222KB
QtRobot.vcxproj.filters 5KB
.gitattributes 2KB
.gitignore 3KB
vitamindecoderlib.h 256KB
ArFunctor.h 152KB
core_c.h 127KB
ariaUtil.h 79KB
ArRobot.h 75KB
ArMapInterface.h 65KB
types_c.h 59KB
ArMapComponents.h 53KB
imgproc_c.h 51KB
ArRobotParams.h 41KB
kmeans_index.h 36KB
ArConfigArg.h 35KB
ArActionDesired.h 35KB
videoio_c.h 34KB
ArMapUtils.h 33KB
ArLaser.h 30KB
ArGPS.h 28KB
ArMap.h 28KB
dist.h 27KB
hierarchical_clustering_index.h 25KB
ArConfig.h 25KB
ArMapChanger.h 24KB
ArVCC4.h 24KB
ArServerBase.h 21KB
autotuned_index.h 20KB
kdtree_single_index.h 20KB
calib3d_c.h 20KB
ArCameraCollection.h 19KB
kdtree_index.h 19KB
ui_robotcontroldialog.h 18KB
ArRangeDevice.h 18KB
ArSoundsQueue.h 18KB
ArServerHandlerCamera.h 18KB
lsh_table.h 18KB
types_c.h 17KB
ArClientBase.h 17KB
ArPTZ.h 17KB
ArSonarMTX.h 16KB
ArServerHandlerConfig.h 16KB
ArBatteryMTX.h 16KB
ArModes.h 15KB
cvdef.h 15KB
ArClientFileUtils.h 15KB
lsh_index.h 15KB
ArDPPTU.h 15KB
result_set.h 15KB
ArSocket.h 14KB
ArMapObject.h 14KB
ariaInternal.h 13KB
ArServerMode.h 13KB
ArRobotConfigPacketReader.h 12KB
ArServerHandlerPopup.h 12KB
ArActionTriangleDriveTo.h 12KB
ArServerSimpleCommands.h 12KB
ArSick.h 11KB
tracking_c.h 11KB
共 707 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
学术菜鸟小晨
- 粉丝: 1w+
- 资源: 4928
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功