gpt4 book ai didi

c++ - cvCreateFileCapture()

转载 作者:行者123 更新时间:2023-11-28 03:48:05 25 4
gpt4 key购买 nike

Learning OpenCV一书中,关于这句话有如下说法:

CvCapture* capture = cvCreateFileCapture(argv[1]);

The function cvCreateFileCapture() takes as its argument the name of the AVI file to be loaded and then returns a pointer to a CvCapture structure.

你能解释一下这句话吗:“then returns a pointer to a CvCapture structure”?

最佳答案

它只是分配一个新的CvCapture 结构并返回指向该结构的指针。您并不真正访问该结构的字段,而是将指针传递给其他处理文件捕获的函数,例如 cvQueryFramecvSetCaptureProperty。并且不要忘记在完成文件后使用 cvReleaseCapture 释放资源。

这应该不难理解一些基本的 C 知识,特别是考虑到许多 OpenCV 函数以这种方式工作。

顺便说一句,由于您的问题被标记为 C++,请考虑使用 OpenCV 的 C++ 接口(interface),它可以抽象出其中的许多内容。虽然没有真正的书,只是针对C接口(interface)。

关于c++ - cvCreateFileCapture(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6777872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com