读取和显示opencv视频的程序工作不正常
program to read and display opencv video not working properly
我编写此视频是为了使用CodeBlocks在OpenCV-2.4.2中显示视频。到目前为止,文件编译得很好,但视频似乎没有播放,显示加上显示窗口太小,我看到的只是最小化、最大化和关闭按钮。下面是我的代码,有人能帮忙吗?谢谢
using namespace cv;
using namespace std;
void info()
{
cout << "This program will accept input video with fixed lengths and produce video textures" << endl;
}
int main(int argc, char *argv[])
{
info();
if(argc != 2)
{
cout << "Please enter more parameters" << endl;
return -1;
}
const string source = argv[1];
VideoCapture input_vid(source);
if(! input_vid.isOpened())
{
cout << "Error: Could not find input video file" << source << endl;
return -1;
}
const char* PLAY = "Video player";
namedWindow(PLAY, 0);
setWindowProperty(PLAY, CV_WND_PROP_AUTOSIZE,CV_WINDOW_AUTOSIZE);
for(;;)
{
Mat frame;
input_vid >> frame;
}
return 0;
}
您需要将框架推到窗口
imshow(PLAY, frame);
相关文章:
- 以螺旋方式打印矩阵的程序.(工作不好)
- 我的评分程序无法正常工作
- 如何解决在负数的情况下程序以相同方式工作的问题?
- C++程序工作,但 Windows 显示"程序.exe已停止工作"
- 我无法让我的程序工作,我一直得到未定义的符号:C
- 名为DLL的C++windows服务程序工作不正常
- O2优化水平中断程序工作
- 我在一个生成随机数的程序工作,我想将这些数字存储在一个数组中
- 在我的输入中没有空格的情况下,程序工作正常?C++
- qt检查文件中是否存在文件,如果它没有提示用户输入其位置,则将文件复制到程序工作目录
- 我如何使用关系 btwn 3 整数来确定三角形和/或我可以使用什么声明来使这个程序工作
- 程序工作,但当输入无效时,它会继续循环 c++
- C++ 让腔室为老虎机程序工作
- 打印一个值使程序工作
- 分割故障,程序工作正常
- 如何使程序工作而不要求任何链接的文件
- Pthreads程序工作一段时间,然后停止
- msvc++说变量周围的堆栈正在损坏,但程序工作
- 读取和显示opencv视频的程序工作不正常
- 无法让数学 c++ 程序工作