I\'m trying to get started with contour detection in OpenCV 2.4.2. To this end, I set up a project for OpenCV and copied the whole example code found in the documentation. F
You're building your application in debug mode and linking against the Multithreaded Debug DLL CRT. Do you know which CRT the OpenCV DLL(s) are linked against? If it's linked against a static CRT it'll fill up the vector with data allocated from a separate heap, which causes an assertion in the Debug CRT you're using.
If you build your application in Release mode you should no longer see the assert, but you might end up leaking memory. The best thing would be to ensure that both your application and the OpenCV DLL(s) are linked against the same Multithreaded DLL CRT.
EDIT: If you can't rebuild OpenCV to use the same CRT as your application you could try telling the linker to use the same CRT version as OpenCV for your application by modifying the application manifest. See How to Enforce C++ compiler to use specific CRT version? for more information on how to do that.
Go into your solution-options, there the c-runtime (CRT) settings and check the linking (CRT as mentioned above)... if your project was/is (once) created with VS10 and you use a newer version, just edit the links not to be 10, but 11 or 12 ..
Add to System Path (as an example): H:\Source\opencv_v2_4_13_2\output\bin\Debug
where directory: "H:\Source\opencv_v2_4_13_2\output" is used from CMake as destination directory for visual Studio 14 (2015) opencv projects.
Your project uses opencv dll files, but is not find: opencv_core2413d.dll