8 #include "complexmat.cuh"
10 #include "complexmat.hpp"
15 ThreadCtx(cv::Size roi, uint num_of_feats, double scale, uint num_of_scales)
18 this->xf_sqr_norm = DynMem(num_of_scales * sizeof(float));
19 this->yf_sqr_norm = DynMem(sizeof(float));
21 uint cells_size = roi.width * roi.height * sizeof(float);
23 #if defined(CUFFT) || defined(FFTW)
24 this->gauss_corr_res = DynMem(cells_size * num_of_scales);
25 this->data_features = DynMem(cells_size * num_of_feats);
27 uint width_freq = roi.width / 2 + 1;
29 this->in_all = cv::Mat(roi.height * num_of_scales, roi.width, CV_32F, this->gauss_corr_res.hostMem());
30 this->fw_all = cv::Mat(roi.height * num_of_feats, roi.width, CV_32F, this->data_features.hostMem());
32 uint width_freq = roi.width;
34 this->in_all = cv::Mat(roi, CV_32F);
37 this->data_i_features = DynMem(cells_size * num_of_feats);
38 this->data_i_1ch = DynMem(cells_size * num_of_scales);
40 this->ifft2_res = cv::Mat(roi, CV_32FC(num_of_feats), this->data_i_features.hostMem());
41 this->response = cv::Mat(roi, CV_32FC(num_of_scales), this->data_i_1ch.hostMem());
44 this->zf.create(roi.height, width_freq, num_of_feats, num_of_scales);
45 this->kzf.create(roi.height, width_freq, num_of_scales);
46 this->kf.create(roi.height, width_freq, num_of_scales);
48 this->zf.create(roi.height, width_freq, num_of_feats, num_of_scales);
49 this->kzf.create(roi.height, width_freq, num_of_scales);
50 this->kf.create(roi.height, width_freq, num_of_scales);
54 if (num_of_scales > 1) {
55 this->max_responses.reserve(num_of_scales);
56 this->max_locs.reserve(num_of_scales);
57 this->response_maps.reserve(num_of_scales);
61 ThreadCtx(ThreadCtx &&) = default;
65 std::future<void> async_res;
68 DynMem xf_sqr_norm, yf_sqr_norm;
70 cv::Mat in_all, fw_all, ifft2_res, response;
71 ComplexMat zf, kzf, kf, xyf;
73 DynMem data_i_features, data_i_1ch;
74 // CuFFT and FFTW variables
75 DynMem gauss_corr_res, data_features;
78 ComplexMat model_alphaf, model_xf;
80 // Variables used during non big batch mode and in big batch mode with ThreadCtx in p_threadctxs in kcf on zero index.
82 double max_val, max_response;
85 // Stores value of responses, location of maximal response and response maps for each scale
86 std::vector<double> max_responses;
87 std::vector<cv::Point2i> max_locs;
88 std::vector<cv::Mat> response_maps;
92 #endif // SCALE_VARS_HPP