27 cv::matchTemplate(frameGray,
_template.
image, resultImage, cv::TM_CCOEFF_NORMED);
29 double minVal, maxVal;
30 cv::Point minLoc, maxLoc;
31 cv::minMaxLoc(resultImage, &minVal, &maxVal, &minLoc, &maxLoc);
33 std::cout <<
"maxLoc: " << maxLoc << std::endl;
35 cv::Point imCenter = cv::Point((
int)(frameGray.cols * 0.5f),
36 (
int)(frameGray.rows * 0.5f));
37 cv::Point tplCenter = cv::Point((
int)(
_template.
image.cols * 0.5f),
39 cv::Point tplMatchCenter = maxLoc + tplCenter;
41 cv::Point offset = tplMatchCenter - imCenter;
43 float degPerPixelH = hFov / frameGray.cols;
48 float angleCenterTemplateDegH = offset.x * degPerPixelH;
53 vecCurTpl /= cv::norm(vecCurTpl);
54 vecCurForward /= cv::norm(vecCurForward);
55 float angleGPSTemplateDegH = (float)vecCurTpl.dot(vecCurForward);
57 _rotAngDEG = angleGPSTemplateDegH - angleCenterTemplateDegH;
#define PROFILE_FUNCTION()