#endif
#include "cnfeat.hpp"
-#include "fft.h"
+#ifdef FFTW
+#include "fft_fftw.h"
+#define FFT Fftw
+#elif defined(CUFFT)
+#include "fft_cufft.h"
+#define FFT cuFFT
+#else
+#include "fft_opencv.h"
+#define FFT FftOpencv
+#endif
#include "pragmas.h"
class Kcf_Tracker_Private;
friend Kcf_Tracker_Private;
public:
bool m_debug {false};
- bool m_visual_debug {false};
- const bool m_use_scale {true};
- const bool m_use_color {true};
- const bool m_use_subpixel_localization {true};
- const bool m_use_subgrid_scale {true};
- const bool m_use_cnfeat {true};
- const bool m_use_linearkernel {false};
+ enum class vd {NONE, PATCH, RESPONSE} m_visual_debug {vd::NONE};
+ constexpr static bool m_use_scale {true};
+ constexpr static bool m_use_color {true};
+ constexpr static bool m_use_subpixel_localization {true};
+ constexpr static bool m_use_subgrid_scale {true};
+ constexpr static bool m_use_subgrid_angle {true};
+ constexpr static bool m_use_cnfeat {true};
+ constexpr static bool m_use_linearkernel {false};
const int p_cell_size = 4; //4 for hog (= bin_size)
/*
double getFilterResponse() const; // Measure of tracking accuracy
private:
- Fft &fft;
+ FFT &fft;
// Initial pose of tracked object in internal image coordinates
// (scaled by p_downscale_factor if p_resize_image)
bool p_resize_image = false;
- const double p_downscale_factor = 0.5;
- const double p_floating_error = 0.0001;
+ constexpr static double p_downscale_factor = 0.5;
+ constexpr static double p_floating_error = 0.0001;
const double p_padding = 1.5;
const double p_output_sigma_factor = 0.1;
cv::Size p_windows_size; // size of the patch to find the tracked object in
cv::Size fit_size; // size to which rescale the patch for better FFT performance
- const uint p_num_scales = m_use_scale ? 7 : 1;
- const double p_scale_step = 1.02;
+ constexpr static uint p_num_scales = m_use_scale ? 5 : 1;
+ constexpr static double p_scale_step = 1.03;
double p_min_max_scale[2];
std::vector<double> p_scales;
- const uint p_num_angles = 3;
- const int p_angle_step = 10;
+ constexpr static uint p_num_angles = 3;
+ constexpr static int p_angle_step = 10;
std::vector<double> p_angles;
- const int p_num_of_feats = 31 + (m_use_color ? 3 : 0) + (m_use_cnfeat ? 10 : 0);
+ constexpr static int p_num_of_feats = 31 + (m_use_color ? 3 : 0) + (m_use_cnfeat ? 10 : 0);
cv::Size feature_size;
std::unique_ptr<Kcf_Tracker_Private> d;
void resizeImgs(cv::Mat &input_rgb, cv::Mat &input_gray);
void train(cv::Mat input_rgb, cv::Mat input_gray, double interp_factor);
double findMaxReponse(uint &max_idx, cv::Point2d &new_location) const;
+ double sub_grid_angle(uint max_index);
};
#endif //KCF_HEADER_6565467831231