From 49e0126b8e741fcacd2924e78cb5fd7d4b9c9828 Mon Sep 17 00:00:00 2001 From: berak Date: Mon, 13 Aug 2018 11:17:32 +0200 Subject: [PATCH] apps: fix interactive calibration --- apps/interactive-calibration/calibController.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/interactive-calibration/calibController.cpp b/apps/interactive-calibration/calibController.cpp index 1888ee57db..f0aa6df36e 100644 --- a/apps/interactive-calibration/calibController.cpp +++ b/apps/interactive-calibration/calibController.cpp @@ -224,8 +224,10 @@ void calib::calibDataController::filterFrames() cv::Mat newErrorsVec = cv::Mat((int)numberOfFrames - 1, 1, CV_64F); std::copy(mCalibData->perViewErrors.ptr(0), mCalibData->perViewErrors.ptr((int)worstElemIndex), newErrorsVec.ptr(0)); - std::copy(mCalibData->perViewErrors.ptr((int)worstElemIndex + 1), mCalibData->perViewErrors.ptr((int)numberOfFrames), + if((int)worstElemIndex < (int)numberOfFrames-1) { + std::copy(mCalibData->perViewErrors.ptr((int)worstElemIndex + 1), mCalibData->perViewErrors.ptr((int)numberOfFrames), newErrorsVec.ptr((int)worstElemIndex)); + } mCalibData->perViewErrors = newErrorsVec; } }