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

Function phaseCorrelation

src/Tracker/ldes/correlation.cpp:86–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86cv::Mat phaseCorrelation(cv::Mat& x1, cv::Mat& x2, int h, int w, int channel) {
87 cv::Mat xy = cv::Mat(h, w, CV_32FC2, cv::Scalar(0));
88 cv::Mat xy_temp;
89 cv::Mat x;
90 cv::Mat y;
91 cv::Mat d;
92 cv::Mat d2;
93 for (int i = 0; i < channel; i++) {
94 x = x1.row(i).reshape(1, h);;
95 y = x2.row(i).reshape(1, h);
96 cv::mulSpectrums(fftd(x), fftd(y), xy_temp, 0, true);
97 cv::mulSpectrums(xy_temp, xy_temp, d, 0, true);
98 cv::sqrt(real(d), d);
99 d += 2.2204e-16;
100 //d = complexDivision(xy_temp, d);
101 std::vector<cv::Mat> planes = { d,d };
102 cv::merge(planes, d2);
103 cv::divide(xy_temp, d2, xy_temp);
104 //xy_temp = complexDivision(xy_temp, d2);
105 xy_temp.convertTo(xy_temp, CV_32F);
106 xy += xy_temp;
107 }
108 return xy;
109}

Callers 1

estimateScaleMethod · 0.85

Calls 3

fftdFunction · 0.85
sqrtFunction · 0.85
realFunction · 0.85

Tested by

no test coverage detected