Occurs when I try to clear the memory of a vector. There is something similar , but I'm not sure how much this applies to my problem, since there was a conflict between the DLL and the template, but I have no templates (see below, it turned out that there is, namely Rect ).
And I connect opencv via .hpp files, although the linker has settings that I need .lib from opencv\build\x64\vc14\lib , and the .dll in the next folder. True, it is opencv_ffmpeg310_64.dll , opencv_world310.dll and opencv_world310d.dll .
cv::Size size(40, 60); std::vector<cv::Rect> objects1, objects2; // достаём xml с каскадом Хаара для анфаса, ищем на кадре и записываем static_cast<cv::CascadeClassifier*>(repository->get(VisionFrontCascade))-> detectMultiScale(*gray, objects1, 1.3, 3, 0, size); // достаём xml с каскадом Хаара для профиля, ищем на кадре и записываем static_cast<cv::CascadeClassifier*>(repository->get(VisionProfileCascade))-> detectMultiScale(*gray, objects2, 1.3, 3, 0, size); if (!objects2.empty()) { objects1.insert(objects1.end(), objects2.begin(), objects2.end()); objects2.clear(); } objects2.shrink_to_fit(); // ошибка здесь // черчение прямоугольников вокруг найденных объектов Concurrency::parallel_for_each(objects1.begin(), objects1.end(), [&](cv::Rect collection) { auto x = collection.x, y = collection.y; rectangle(*frame, cv::Point(x * 2, y * 2), cv::Point((x + collection.width) * 2, (y + collection.height) * 2), cv::Scalar(0.0, 0.0, 255.0)); // скаляр работает в BGR }); objects1.clear(); objects1.shrink_to_fit(); // или здесь It turned out that the template is still there - in cv :: Rect .
But for cv::CascadeClassifier::detectMultiScale be sure to specify std::vector<cv::Rect> .
If you remove shrink_to_fit() , then the error occurs already in the destructor.
/MDdfor debug and/MDfor release in the project settings. - brenoritvrezorkrestd::vector<cv::Rect>* objects1 = new std::vector<cv::Rect>;and do not touch them until the end of time, it will be a memory leak, but you'll know about it). - goldstar_labs