c - opencv(C语言)视频编写器无法使用方法

标签 c opencv

这是程序(部分):

CvVideoWriter* vidWriterDepth = 0;

在 while 循环中(从相机获取视频帧):

if (vidWriterColored == 0) {
   vidWriterDepth = cvCreateVideoWriter("depth_vid", CV_FOURCC('Z', 'L', 'I', 'B'), 30 , cvSize(rawImg1->width, rawImg1->height), 0);
}
...
vidWriterDepth->

这里我尝试调用 vidWriterDepth 的方法,但出现错误: 不允许指向不完整类类型的指针(显示 vidWriterDepth->)。 所以我不能使用vidWriterDepth的任何方法。 如果没有它,即使创建并初始化 vidWriterDepth,它也会编译。

最佳答案

我想知道,C 中有方法吗?

你必须使用像

这样的函数
cvWriteFrame(vidWriterDepth, FImage);

它被称为C接口(interface)。来自 online help 的任意示例。查看C:描述

VideoCapture::grab

Grabs the next frame from video file or capturing device.
C++: bool VideoCapture::grab()
Python: cv2.VideoCapture.grab() → retval
C: int cvGrabFrame(CvCapture* capture)
Python: cv.GrabFrame(capture) → int

关于c - opencv(C语言)视频编写器无法使用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34034781/

相关文章:

php - 使用 php 页面调用 OpenCV python 脚本

c - 在 C 中使用 fork() 时出现段错误

opencv - 尺度不变性和方向不变性是什么意思?

c++ - 使用 BOWImgDescriptorExtractor 重用描述符

opencv - 在 OpenCV 中镜像 haar 级联

c++ - 在 C++ OpenCV 中使用相同的变量作为输入和输出是否安全?

c - 如何用C语言从本地服务器发送HTTP协议(protocol)

谁能告诉我如何在sunsolaris系统中运行udp客户端服务器程序?

c++ - linux C++ 通知文件类型创建

编译一个c程序以在python代码中使用