gpt4 book ai didi

c++ - object_detection 在 eclipse 上使用 c/c++ 中的 opencv

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:25 25 4
gpt4 key购买 nike

我正在尝试从网络摄像头拍摄的视频中检测人脸和眼睛。我在 ubuntu 11.10 上使用 eclipse 和 opencv-2.3.1。我想用 C/C++ 编写这段代码。我通过查看教程配置了 Eclipse。我在线获得代码为 objectDetection.cpp

我收到如下错误:

> **** Build of configuration Release for project opencv_try **** make all 
> Building file: ../objectDetection2.cpp
> Invoking: GCC C++ Compiler
> g++ -I/home/vidula/OpenCV-2.3.1/include/opencv -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"objectDetection2.d" -MT"objectDetection2.d" -o"objectDetection2.o" "../objectDetection2.cpp"
> Finished building: ../objectDetection2.cpp
> Building target: opencv_try
> Invoking: GCC C++ Linker
> g++ -L/usr/lib -L/home/vidula/OpenCV-2.3.1/lib -L/home/vidula/OpenCV-2.3.1/modules/imgproc/include/opencv2/imgproc -o"opencv_try" ./objectDetection2.o -lopencv_core -lopencv_highgui
> /usr/bin/ld: ./objectDetection2.o: undefined reference to symbol 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
> /usr/bin/ld: note: 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' is defined in DSO /usr/local/lib/libopencv_imgproc.so.2.3 so try adding it to the linker command line
> /usr/local/lib/libopencv_imgproc.so.2.3: could not read symbols: Invalid operation collect2: ld returned 1 exit status make:
> *** [opencv_try] Error 1

我尝试将它链接到链接器,但我不知道我做错了什么。谁能帮我找出问题所在?

最佳答案

它似乎在告诉您您需要的 cv::cvtColor 符号在 libopencv_imgproc 库中,因此您需要将其添加到链接器选项中使用选项 -lopencv_imgproc,就像您对 corehighgui

所做的一样

关于c++ - object_detection 在 eclipse 上使用 c/c++ 中的 opencv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14100449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com