[英]Minimalist VideoCapture example produces a Segmentation Fault
A project I was working on suddenly started giving segmentation faults, even with a version I saved and knew was working. 我正在研究的一个项目突然开始出现分段错误,即使我保存了一个版本并且知道它正在工作。
I investigated a bit, and constructed a small example of what's happening : 我调查了一下,并构建了一个发生了什么的小例子:
#include <opencv2/opencv.hpp>
int main()
{
cv::VideoCapture capture("drop.avi");
return 0;
}
According to the documentation , I should be able to do this : 根据文档 ,我应该能够这样做:
C++: VideoCapture::VideoCapture(const string& filename)
C ++:VideoCapture :: VideoCapture(const string&filename)
with 同
filename – name of the opened video file (eg. video.avi) or image sequence
filename - 打开的视频文件的名称(例如video.avi)或图像序列
The following compilation command 以下编译命令
g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` main.cpp
produces the executable without any warning. 生成可执行文件而没有任何警告 However, when I execute the program :
但是,当我执行程序时:
./a.out
zsh: segmentation fault (core dumped) ./a.out
According to users of the Interwebs, the issue could be related to ffmpeg
and opencv
having incompatible versions. 根据Interwebs的用户,该问题可能与
ffmpeg
和opencv
有不兼容的版本有关。 The problem is, I don't see that documented anywhere, and I don't want to spend days compiling random versions of opencv, perhaps to no avail. 问题是,我没有看到任何地方记录,我不想花几天时间编译随机版本的opencv,也许无济于事。
Does anyone have a clue what's going on ? 有没有人知道发生了什么?
I am, of course, willing to provide any complementary information that would be needed. 当然,我愿意提供所需的任何补充信息。
(okay, so apparently I have two versions of ffmpeg ?) (好吧,显然我有两个版本的ffmpeg?)
通过安装OpenCV 3.1解决了这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.