2012-11-12 50 views
4

我在Ubuntu中運行了Ubuntu 12.04 32bit。在此之後我安裝了OpenCV 2.4.2(http://www.samontab.com/web/2011/06/installing-opencv-2-2-in-ubuntu-11-04/)。OpenCV 2.4.2 findContours拋出錯誤(使用CV示例編)

當我嘗試從CV-Page(http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/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 

有人有個想法嗎?我從一箇舊的項目中使用CV2.2在VS2010中運行的其他代碼,它的工作原理... VStudio與Win與Eclipse和Ubuntu和Ubuntu的區別在哪裏?

到目前爲止感謝。

+2

你說你安裝了OpenCV 2.4.2,但是在錯誤庫中找到opencv- 2.3.1左右請澄清這一點。 – isrish

+0

是的,這肯定會有問題。我想卸載並重建最新版本。希望工程。 Thx – MiseriaCantare

回答

4

看來你已經安裝了兩個版本的OpenCV,並且鏈接器試圖使用與編譯代碼不同的鏈接。

最簡單的方法是刪除所有其他舊的OpenCV版本,然後可能會出現錯誤的庫路徑。檢查所有設置PATH,鏈接器標誌和包含文件夾,以確保通過包含/ complile /鏈接設置使用相同版本

+0

它始終使用最新版本。試試opencv2.4的教程,但要確保鏈接器和include lib的路徑使用opencv2.4。並接受答案 – isrish

+0

好吧,升級到Ubuntu 12.10,我想刪除所有舊的OpenCV並編譯2.4.3。 什麼是完全卸載CV以獲取新版本的最佳方式? 到目前爲止感謝! – MiseriaCantare

+0

作品,謝謝! – MiseriaCantare