怎么办啊,没法知道摄像头是否已被打开了

HackerII 2003-05-14 07:43:44
用vfw写视频捕捉程序时,有办法知道摄像头已经被打开了吗?
...全文
118 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wrcluomo 2003-05-17
  • 打赏
  • 举报
回复
我想可以知道采集卡是否被占用。如果是模拟摄像头不好办。数字摄像头我公司的我知道有办法。检查一下初始化函数的返回值就行了。
peterleex 2003-05-16
  • 打赏
  • 举报
回复
好象没办法,anyway 以下是 VFW 的简述,取自 MSDN:
Video Capture: A Minimal Approach
Video capture digitizes a stream of video and audio data, and stores it on a hard disk or some other type of persistent storage device. This section describes how to add a simple form of video capture to an application using three statements of code. It also describes how to end or abort a capture session by sending messages to the capture window.

An AVICap capture window handles the details of streaming audio and video capture to AVI files. This frees your application from involvement in the AVI file format, video and audio buffer management, and the low-level access of video and audio device drivers. AVICap provides a flexible interface for applications. You can add video capture to your application, using only the following lines of code:

hWndC = capCreateCaptureWindow ( "My Own Capture Window",
WS_CHILD | WS_VISIBLE , 0, 0, 160, 120, hwndParent, nID);

SendMessage (hWndC, WM_CAP_DRIVER_CONNECT, 0 /* wIndex */, 0L);

SendMessage (hWndC, WM_CAP_SEQUENCE, 0, 0L);

A macro interface is also available that provides an alternative to using the SendMessage function and improves the readability of an application. The following example uses the macro interface to add video capture to an application.

hWndC = capCreateCaptureWindow ( "My Own Capture Window",
WS_CHILD | WS_VISIBLE , 0, 0, 160, 120, hwndParent, nID);

capDriverConnect (hWndC, 0);

capCaptureSequence (hWndC);

After your application creates a capture window of the AVICap window class and connects it to a video driver, the capture window is ready to capture data. At this point, your application can simply send the WM_CAP_SEQUENCE message (or the capCaptureSequence macro) to begin capturing.

Using default settings, WM_CAP_SEQUENCE initiates the capture of video and audio input to a file named CAPTURE.AVI. Capture continues until one of the following events occurs:

The user presses the ESC key or a mouse button.
Your application stops or aborts capture operation.
The disk becomes full.
In an application, you can stop streaming captured data to a file by sending the WM_CAP_STOP (or the capCaptureStop macro) message to a capture window. You can also abort the capture operation by sending the WM_CAP_ABORT message (or the capCaptureAbort macro) to a capture window.
jesjes 2003-05-16
  • 打赏
  • 举报
回复
可以解释一下vfw吗?
jesjes 2003-05-14
  • 打赏
  • 举报
回复
视频捕捉程序?是不是有块视频卡就行了,或者借助二次开发包,自己编很麻烦吧?

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧