读取视频文件"Open CV WARNING: Couldn't read movie file bird.avi"时出现问题
Problems reading video file "Open CV WARNING: Couldn't read movie file bird.avi"
我在Xcode中使用C 的简单教程遇到了巨大的问题。我无法获得该程序来读取电影文件。请注意,如果存在与阅读集装箱格式无关的问题,请注意,评论的部分是我测试。IE。所有的路径/ibraries等都很好。我尝试了AVI容器MP4,MOV等 - 这是代码:
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <unistd.h>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
Mat frame; // Container for each frame
string video = "bird.avi";
// string video = "hat.jpg";
VideoCapture vid(video);
if (!vid.isOpened()) { // Check if video file was opened
cout << "ERROR: Video file not opened...n";
return -1;
}
// Get fps from video inputCvCapture *input_video = cvCreateFileCapture("guitarplaying.avi");
int fps = (int)vid.get(CV_CAP_PROP_FPS); // Gets FPS from video
cout << "FPS=" << fps << endl;
// Create a window for displaying the video
namedWindow("hello"); // Creates a window
while (1) {
if (!vid.read(frame)) { // Check end of video file
cout << "Video file ends.n";
break;
}
// Show the frame on window
imshow("hello", frame); // Show current frame on window
// Wait for read next frame or key pressed
if (waitKey(1000/fps) >= 0)
break;
}
return 0;
}
替换:
string video = "bird.avi";
以完整的路径,例如:
string video = "c:\samples\bird.avi";
相关文章:
- Seg Fault Issue C++ (file IO / getline)
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- File.cpp.o:OpenPose 标志 CMakeFiles/.. 的多重定义/main.cpp.o:首先在这里定
- Visual Studio C++ Project File CustomBuild Task: Filter Outp
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- 可视化 如何在C++中将字符数组转换为 FILE 类型
- 如何在从文件中读取整数时使用 file.eof()?
- "No such file or directory" C++标头问题
- 使用 sftp_open() 使用 C++ 中的 SFTP libssh 将文件从本地复制到远程时,File 返回 N
- Visual Studio "fatal error LNK1104: cannot open file"未使用或包含的库
- typedef vector size_type in header file
- make 命令创建 .file,但不创建应用程序文件
- 为什么 VScode 在 .h 文件中显示"'iostream' file not found"?
- 我在 #include < bits/stdc++h.> 放置时出错"No such file or directory"
- 使用 编译时。RES File with MinGW G++, .无法识别 RES
- fopen 在创建大量文件后因 EFBIG "File too large" 而失败
- 叮叮当当。target_include_directories "No such file or directory"
- File to std::string_view
- 读取视频文件"Open CV WARNING: Couldn't read movie file bird.avi"时出现问题