OpenCV中文網站

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
熱搜: 安裝 配置
查看: 283|回復: 1
打印 上一主題 下一主題

正宗澳洲卡昂雪地靴: 關于視頻讀取時VideoCapture函數報錯未定義的問題

[復制鏈接]
跳轉到指定樓層
1#
發表于 2019-9-21 16:37:03 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
本帖最后由 changtiaoRAP 于 2019-9-21 17:15 編輯

新手一枚,我用的是VM虛擬機ubuntu16.04版本
環境 :qt-5.13.1      opencv-3.4.5
代碼如下:
pro:
TEMPLATE = app
CONFIG += app_bundle
CONFIG -= qt
SOURCES += \
        main.cpp
INCLUDEPATH += /usr/local/include \
               /usr/local/opencv \
               /usr/local/include/opencv2
LIBS += /usr/local/lib/libopencv_highgui.so \
        /usr/local/lib/libopencv_core.so \
        /usr/local/lib/libopencv_imgproc.so \
        /usr/local/lib/libopencv_imgcodecs.so

main.cpp:
#include <opencv2/opencv.hpp>
using namespace cv;
int main()
{
    VideoCapture capture(“h.mp4”);
    while(1)
    {
        Mat frame;
        capture>>frame;
        imshow("duqu",frame);
        waitKey(0);
    }
}

我參考資料的是毛星云的opencv編輯入門pdf,main.cpp代碼純搬運,pro代碼是在網上找的,pro配合pdf的main.cpp資料可以實現圖片的顯示,腐蝕,模糊,邊緣檢測等功能,所以網上找的pro應該是沒問題的,但是當我實現視頻輸入的時候,系統一直報錯VideoCapeture和capture的錯誤,如下:(VideoCapeture的)/home/~/main.cpp:10: error: undefined reference to `cv::VideoCapture::VideoCapture(int)' 還有 (capture的)  /home/~/main.cpp:11: error: undefined reference to`cv::VideoCapture:perator>>(cv::Mat&)',我同學和我一樣的操作配置成功的調用了一段視頻,但是我的就報錯了,希望有大佬來給指出來問題。謝謝了。
分享到:  QQ好友和群QQ好友和群
收藏收藏
2#
 樓主| 發表于 2019-9-21 18:08:33 | 只看該作者
找到錯誤了我,應該是PRO的配置太少了,我找了一個全一點的copy上去了,把下面的3.0.0改成我自己的3.4.5,把3.0改成3.4就OK了。
INCLUDEPATH += .
INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2
INCLUDEPATH += /usr/local/include/opencv2/core
INCLUDEPATH += /usr/local/include/opencv2/highgui
INCLUDEPATH += /usr/local/include/opencv2/imgproc
INCLUDEPATH += /usr/local/include/opencv2/flann
INCLUDEPATH += /usr/local/include/opencv2/photo
INCLUDEPATH += /usr/local/include/opencv2/video
INCLUDEPATH += /usr/local/include/opencv2/features2d
INCLUDEPATH += /usr/local/include/opencv2/objdetect
INCLUDEPATH += /usr/local/include/opencv2/calib3d
INCLUDEPATH += /usr/local/include/opencv2/ml
INCLUDEPATH += /usr/local/include/opencv2/contrib
LIBS += `pkg-config opencv --cflags --libs`

LIBS += /usr/local/lib/libopencv_calib3d.so \
/usr/local/lib/libopencv_objdetect.so.3.0.0 \
/usr/local/lib/libopencv_calib3d.so.3.0 \
/usr/local/lib/libopencv_photo.so \
/usr/local/lib/libopencv_calib3d.so.3.0.0 \
/usr/local/lib/libopencv_photo.so.3.0 \
/usr/local/lib/libopencv_core.so \
/usr/local/lib/libopencv_photo.so.3.0.0 \
/usr/local/lib/libopencv_core.so.3.0  \
/usr/local/lib/libopencv_shape.so \
/usr/local/lib/libopencv_core.so.3.0.0 \
/usr/local/lib/libopencv_shape.so.3.0 \
/usr/local/lib/libopencv_features2d.so \
/usr/local/lib/libopencv_shape.so.3.0.0 \
/usr/local/lib/libopencv_features2d.so.3.0 \
/usr/local/lib/libopencv_stitching.so \
/usr/local/lib/libopencv_features2d.so.3.0.0 \
/usr/local/lib/libopencv_stitching.so.3.0 \
/usr/local/lib/libopencv_flann.so \
/usr/local/lib/libopencv_stitching.so.3.0.0 \
/usr/local/lib/libopencv_flann.so.3.0 \
/usr/local/lib/libopencv_superres.so \
/usr/local/lib/libopencv_flann.so.3.0.0 \
/usr/local/lib/libopencv_superres.so.3.0 \
/usr/local/lib/libopencv_hal.a \
/usr/local/lib/libopencv_superres.so.3.0.0 \
/usr/local/lib/libopencv_highgui.so \
/usr/local/lib/libopencv_ts.a \
/usr/local/lib/libopencv_highgui.so.3.0 \
/usr/local/lib/libopencv_videoio.so\
/usr/local/lib/libopencv_highgui.so.3.0.0 \
/usr/local/lib/libopencv_videoio.so.3.0 \
/usr/local/lib/libopencv_imgcodecs.so \
/usr/local/lib/libopencv_videoio.so.3.0.0 \
/usr/local/lib/libopencv_imgcodecs.so.3.0 \
/usr/local/lib/libopencv_video.so \
/usr/local/lib/libopencv_imgcodecs.so.3.0.0 \
/usr/local/lib/libopencv_video.so.3.0 \
/usr/local/lib/libopencv_imgproc.so \
/usr/local/lib/libopencv_video.so.3.0.0 \
/usr/local/lib/libopencv_imgproc.so.3.0 \
/usr/local/lib/libopencv_videostab.so \
/usr/local/lib/libopencv_imgproc.so.3.0.0 \
/usr/local/lib/libopencv_videostab.so.3.0 \
/usr/local/lib/libopencv_ml.so \
/usr/local/lib/libopencv_videostab.so.3.0.0 \
/usr/local/lib/libopencv_ml.so.3.0 \
/usr/local/lib/libopencv_ml.so.3.0.0 \
/usr/local/lib/libopencv_objdetect.so \
/usr/local/lib/libopencv_objdetect.so.3.0 \
您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|卡昂瘦身鞋  

GMT+8, 2019-10-19 23:49 , Processed in 0.042804 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回復 卡昂瘦身鞋 返回列表