From 81b897c2914b231b5baf47003dae6b702877453e Mon Sep 17 00:00:00 2001 From: Anna Prigarina <44146733+APrigarina@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:46:57 +0300 Subject: [PATCH] Merge pull request #20243 from APrigarina:fix_tracking_api Tracking API: fix incorrect structure * fix incorrect structure of best score id * video(DaSiamRPN): specify sizes of scalar arrays --- modules/video/src/tracking/tracker_dasiamrpn.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/video/src/tracking/tracker_dasiamrpn.cpp b/modules/video/src/tracking/tracker_dasiamrpn.cpp index 4d1004b419..72e0aa1f3a 100644 --- a/modules/video/src/tracking/tracker_dasiamrpn.cpp +++ b/modules/video/src/tracking/tracker_dasiamrpn.cpp @@ -251,14 +251,14 @@ void TrackerDaSiamRPNImpl::trackerEval(Mat img) pscore = penalty.mul(score); pscore = pscore * (1.0 - trackState.windowInfluence) + trackState.windows * trackState.windowInfluence; - int bestID[] = { 0 }; + int bestID[2] = { 0, 0 }; // Find the index of best score. minMaxIdx(pscore.reshape(0, { trackState.anchorNum * trackState.scoreSize * trackState.scoreSize, 1 }), 0, 0, 0, bestID); delta = delta.reshape(0, { 4, trackState.anchorNum * trackState.scoreSize * trackState.scoreSize }); penalty = penalty.reshape(0, { trackState.anchorNum * trackState.scoreSize * trackState.scoreSize, 1 }); score = score.reshape(0, { trackState.anchorNum * trackState.scoreSize * trackState.scoreSize, 1 }); - int index[] = { 0, bestID[0] }; + int index[2] = { 0, bestID[0] }; Rect2f resBox = { 0, 0, 0, 0 }; resBox.x = delta.at(index) / scaleZ; @@ -311,7 +311,7 @@ void TrackerDaSiamRPNImpl::softmax(const Mat& src, Mat& dst) void TrackerDaSiamRPNImpl::elementMax(Mat& src) { int* p = src.size.p; - int index[] = { 0, 0, 0, 0 }; + int index[4] = { 0, 0, 0, 0 }; for (int n = 0; n < *p; n++) { for (int k = 0; k < *(p + 1); k++) @@ -365,8 +365,8 @@ Mat TrackerDaSiamRPNImpl::generateAnchors() baseAnchors.push_back(anchor); } - int anchorIndex[] = { 0, 0, 0, 0 }; - const int sizes[] = { 4, (int)ratios.size(), scoreSize, scoreSize }; + int anchorIndex[4] = { 0, 0, 0, 0 }; + const int sizes[4] = { 4, (int)ratios.size(), scoreSize, scoreSize }; Mat anchors(4, sizes, CV_32F); for (auto i = 0; i < scoreSize; i++)