OpenCV 2.4.2 findContours throws error (with CV example prog)
opencv, ubuntu
Solution
It seems you have two versions of OpenCV installed, and the linker tries to use a different one for linking than the one used to compile your code.
The simplest way is to remove all the other old OpenCV versions, and then a possible wrong library path will be more explicit. check all the settings PATH, linker flags and include folders to make sure you are using the same version through the include/complile/link settings
Problem
I got Ubuntu 12.04 32bit running in VMware. I installed OpenCV 2.4.2 after this (http://www.samontab.com/web/2011/06/installing-opencv-2-2-in-ubuntu-11-04/). When I try to run the example for findContours from CV-Page (http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html), it compiles, but crashes on the "findContours" call. ``` OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in release, file /build/build /opencv-2.3.1/modules/core/src/matrix.cpp, line 1364 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.3.1/modules/core/src/matrix.cpp:1364: error: (-215) k == STD_VECTOR_MAT in function release ``` I don't know, what's the problem... I run the code in Eclipse with. CDT Build Console says: ``` make all Building file: ../src/FrameTest.cpp Invoking: Cross G++ Compiler g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/FrameTest.d" -MT"src/FrameTest.d" -o "src/FrameTest.o" "../src/FrameTest.cpp" ../src/FrameTest.cpp:26:2: warning: "/*" within comment [-Wcomment] ../src/FrameTest.cpp: In function ‘int main()’: ../src/FrameTest.cpp:319:25: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../src/FrameTest.cpp: In function ‘void thresh_callback(int, void*)’: ../src/FrameTest.cpp:345:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Finished building: ../src/FrameTest.cpp Building target: FrameTest Invoking: Cross G++ Linker g++ -L/home/ubu/workspace/opencv -L/usr/share -L/usr/share/doc/libcv-dev -L/lib -L/lib/i386-linux-gnu -L/home/ubu/OpenCV-2.4.2/include/opencv -L/home/ubu/OpenCV-2.4.2/include/opencv2 -o "FrameTest" ./src/FrameTest.o -lopencv_core -lopencv_highgui -lpthread -lopencv_imgproc Finished building target: FrameTestenter code here ``` Someone got an idea? I got other code from an old project running with CV2.2 in Windows with VS2010 and it works... Where is the difference VStudio with Win vs. Eclipse and Ubuntu? Thanks so far.