4

我在 VMware 中运行了 Ubuntu 12.04 32 位。在此之后我安装了 OpenCV 2.4.2(http://www.samontab.com/web/2011/06/installing-opencv-2-2-in-ubuntu-11-04/)。

当我尝试从 CV-Page ( http://docs.opencv.org/doc/tutorials/imgproc/shapeescriptors/find_contours/find_contours.html ) 运行 findContours 的示例时,它会编译,但在“findContours”调用时崩溃.

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

不知道,有什么问题...

我在 Eclipse 中运行代码。CDT 构建控制台 说:

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

有人有想法吗?我从一个使用 VS2010 在 Windows 中使用 CV2.2 运行的旧项目中获得了其他代码,它可以工作...... VStudio 与 Win 与 Eclipse 和 Ubuntu 的区别在哪里?

感谢到目前为止。

4

1 回答 1

4

您似乎安装了两个版本的 OpenCV,并且链接器尝试使用与用于编译代码的版本不同的版本进行链接。

最简单的方法是删除所有其他旧的 OpenCV 版本,然后可能的错误库路径将更加明确。检查所有设置 PATH、链接器标志和包含文件夹,以确保您通过包含/编译/链接设置使用相同的版本

于 2012-11-12T14:55:11.030 回答