文档详情

net利用vfw操作摄像头.doc

发布:2018-11-20约4.54千字共4页下载文档
文本预览下载声明
net利用vfw操作摄像头操作摄像头我想主要有以下几点。启动摄像头;将摄像头的视频流转为图片或视频文件保存;一些设置。 ?? 启动摄像头 ?? 包括创建捕捉窗口,连接硬件设备,显示图像以及一些基本设置。view plaincopy to clipboardprint? ?? Dim lpszName As String * 100 ?? Dim lpszVer As String * 100 ?? Dim Caps As CAPDRIVERCAPS ?? //Create Capture Window ?? capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100 // Retrieves driver info ?? lwndC = capCreateCaptureWindowA(lpszName, WS_CAPTION Or WS_THICKFRAME Or WS_VISIBLE Or WS_CHILD, 0, 0, 160, 120, Me.hWnd, 0) ?? // Set title of window to name of driver ?? SetWindowText lwndC, lpszName ?? // Set the video stream callback function ?? capSetCallbackOnStatus lwndC, AddressOf MyStatusCallback ?? capSetCallbackOnError lwndC, AddressOf MyErrorCallback ?? // Connect the capture window to the driver ?? If capDriverConnect(lwndC, 0) Then ?? ///// ?? // Only do the following if the connect was successful. ?? // if it fails, the error will be reported in the call ?? // back function. ?? ///// ?? // Get the capabilities of the capture driver ?? capDriverGetCaps lwndC, VarPtr(Caps), Len(Caps) ?? // If the capture driver does not support a dialog, grey it out ?? // in the menu bar. ?? If Caps.fHasDlgVideoSource = 0 Then mnuSource.Enabled = False ?? If Caps.fHasDlgVideoFormat = 0 Then mnuFormat.Enabled = False ?? If Caps.fHasDlgVideoDisplay = 0 Then mnuDisplay.Enabled = False ?? // Turn Scale on ?? capPreviewScale lwndC, True ?? // Set the preview rate in milliseconds ?? capPreviewRate lwndC, 66 ?? // Start previewing the image from the camera ?? capPreview lwndC, True ?? // Resize the capture window to show the whole image ?? ResizeCaptureWindow lwndC ?? End If ?? Dim lpszName As String * 100 ?? Dim lpszVer As String * 100 ?? Dim Caps As CAPDRIVERCAPS ?? //Create Capture Window ?? capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100 // Retrieves driver info ?? lwndC = capCreateCaptureWindowA(lpszName, WS_CAPTION Or WS_THICKFRAME Or WS_VISIBLE Or WS_CHILD, 0, 0, 160, 120, Me.hWnd, 0)
显示全部
相似文档