aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYinhang Liu <yinhangx.liu@intel.com>2017-12-04 15:08:16 +0800
committerwindyuan <feng.yuan@intel.com>2017-12-11 19:19:44 +0800
commite8955c402917f0e29364fc515ac9aae762185642 (patch)
tree54e1b74878daad3c6c5dca9f81fda47b8d3f3128
parent07eacb38b0f85dc1d5880b8e585992d2acd52ad2 (diff)
downloadlibxcam-e8955c402917f0e29364fc515ac9aae762185642.tar.gz
capi-feature-match: fix random corners
-rw-r--r--modules/soft/cv_capi_feature_match.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/modules/soft/cv_capi_feature_match.cpp b/modules/soft/cv_capi_feature_match.cpp
index b0b31c3..ed5fd76 100644
--- a/modules/soft/cv_capi_feature_match.cpp
+++ b/modules/soft/cv_capi_feature_match.cpp
@@ -148,34 +148,19 @@ CVCapiFeatureMatch::detect_and_match (
}
// find the corresponding points in img_right
- err.resize (count);
- status.resize (count);
- corner_left.resize (count);
corner_right.resize (count);
+ status.resize (count);
+ err.resize (count);
- float* optflow_errs = &err[0];
- char* optflow_status = &status[0];
CvPoint2D32f* corner_points1 = &corner_left[0];
CvPoint2D32f* corner_points2 = &corner_right[0];
-
- for (size_t i = 0; i < (size_t)count; ++i) {
- corner_points1[i] = corner_left[i];
- }
+ char* optflow_status = &status[0];
+ float* optflow_errs = &err[0];
cvCalcOpticalFlowPyrLK (
img_left, img_right, 0, 0, corner_points1, corner_points2, count, win_size, 3,
optflow_status, optflow_errs, cvTermCriteria(CV_TERMCRIT_ITER, 40, 0.1), 0 );
- corner_right.reserve (count);
- status.reserve (count);
- err.reserve (count);
- for (size_t i = 0; i < (size_t)count; ++i) {
- CvPoint2D32f &kp = corner_points2[i];
- corner_right.push_back (kp);
- status.push_back (optflow_status[i]);
- err.push_back (optflow_errs[i]);
- }
-
calc_of_match (img_left, img_right, corner_left, corner_right,
status, err, valid_count, mean_offset, x_offset);