OpenCV中文网站

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 安装 配置
查看: 276|回复: 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 \
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站  

GMT+8, 2019-10-18 04:15 , Processed in 0。040705 second(s), 15 queries 。

Powered by X3.4

© 2001-2017

快速回复 返回顶部 返回列表
网易彩票 中兴彩票app 国丰彩票 128彩票 快3平台 重庆彩票网 全中彩票 上海11选5 合乐彩票 北京快3