diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp index 93d599ccee..bc33f03f5d 100644 --- a/modules/core/include/opencv2/core/utility.hpp +++ b/modules/core/include/opencv2/core/utility.hpp @@ -507,7 +507,7 @@ void Mat::forEach_impl(const Functor& operation) { this->rowCall2(row, COLS); } } else { - std::vector idx(COLS); /// idx is modified in this->rowCall + std::vector idx(DIMS); /// idx is modified in this->rowCall idx[DIMS - 2] = range.start - 1; for (int line_num = range.start; line_num < range.end; ++line_num) {