diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 656647212..30ac40ec0 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -2367,6 +2367,7 @@ Ptr BruteForceMatcher::clone( bool emptyTrainData ) BruteForceMatcher* matcher = new BruteForceMatcher(distance); if( !emptyTrainData ) { + matcher->trainDescCollection.resize(trainDescCollection.size()); std::transform( trainDescCollection.begin(), trainDescCollection.end(), matcher->trainDescCollection.begin(), clone_op ); }