如何在 c++ 中获取网络摄像头视频流字节
我的目标是 Windows 机器。我需要访问指向描述来自附加 USB 网络摄像头的各个流帧的字节数组的指针。我从 Windows sdk 中看到了 playcap directshow 示例,但我不知道如何获取原始数据,坦率地说,我不明白视频实际上是如何到达窗口的。因为除了视频捕获之外我不需要任何东西,所以我不想使用 opencv。
Visual Studio 2008 C++
I am targeting windows machines. I need to get access to the pointer to the byte array describing the individual streaming frames from an attached usb webcam. I saw the playcap directshow sample from the windows sdk, but I dont see how to get to raw data, frankly, I don't understand how the video actually gets to the window. Since I don't really need anything other than the video capture I would prefer not to use opencv.
Visual Studio 2008 c++
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
插入样品采集过滤器。将相机源连接到样本采集器,然后连接到空渲染器。样本采集器是一个转换,因此您需要将输出提供给某个地方,但如果您不需要渲染它,则空渲染器是一个不错的选择。
您可以使用 ISampleGrabber 配置样本采集器。您可以为每个帧安排对应用程序的回调,为您提供指向位本身的指针,或指向 IMediaSample 对象的指针,该对象也将为您提供元数据。
你需要在你的对象上实现ISampleGrabberCB,然后你需要这样的东西(伪代码)
Insert the sample grabber filter. Connect the camera source to the sample grabber and then to the null renderer. The sample grabber is a transform, so you need to feed the output somewhere, but if you don't need to render it, the null renderer is a good choice.
You can configure the sample grabber using ISampleGrabber. You can arrange a callback to your app for each frame, giving you either a pointer to the bits themselves, or a pointer to the IMediaSample object which will also give you the metadata.
You need to implement ISampleGrabberCB on your object, and then you need something like this (pseudo code)