1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4 
5 #ifndef OPENCV_TRACKER_CSRT_UTILS
6 #define OPENCV_TRACKER_CSRT_UTILS
7 
8 #include <fstream>
9 #include <iostream>
10 #include <vector>
11 #include <iostream>
12 #include <algorithm>
13 #include <iterator>
14 
15 namespace cv
16 {
17 
modul(int a,int b)18 inline int modul(int a, int b)
19 {
20     // function calculates the module of two numbers and it takes into account also negative numbers
21     return ((a % b) + b) % b;
22 }
23 
kernel_epan(double x)24 inline double kernel_epan(double x)
25 {
26     return (x <= 1) ? (2.0/3.14)*(1-x) : 0;
27 }
28 
29 Mat circshift(Mat matrix, int dx, int dy);
30 Mat gaussian_shaped_labels(const float sigma, const int w, const int h);
31 std::vector<Mat> fourier_transform_features(const std::vector<Mat> &M);
32 Mat divide_complex_matrices(const Mat &A, const Mat &B);
33 Mat get_subwindow(const Mat &image, const Point2f center,
34         const int w, const int h,Rect *valid_pixels = NULL);
35 
36 float subpixel_peak(const Mat &response, const std::string &s, const Point2f &p);
37 double get_max(const Mat &m);
38 double get_min(const Mat &m);
39 
40 Mat get_hann_win(Size sz);
41 Mat get_kaiser_win(Size sz, float alpha);
42 Mat get_chebyshev_win(Size sz, float attenuation);
43 
44 std::vector<Mat> get_features_rgb(const Mat &patch, const Size &output_size);
45 std::vector<Mat> get_features_hog(const Mat &im, const int bin_size);
46 std::vector<Mat> get_features_cn(const Mat &im, const Size &output_size);
47 
48 Mat bgr2hsv(const Mat &img);
49 
50 } //cv namespace
51 
52 #endif
53