Cam Capture
Upcoming SlideShare
Loading in...5
×
 

Cam Capture

on

  • 2,236 views

Capturing web cam frames with a .Net application

Capturing web cam frames with a .Net application

Statistics

Views

Total Views
2,236
Views on SlideShare
2,236
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Cam Capture Cam Capture Presentation Transcript

  •  
  •  
  •  
    • Incorporating video capturing capabilities into our application.
    • Connecting
    • Listing available video capture devices
    • Used to manipulate various windows.
    • Mechanism of .Net language calling unmanaged functions in DLL’s.
    • Calling Windows API functions
    • Calling third-party functions provided in DLLs
    • List all available capture devices installed in the system
    • Select the appropriate device
    • Create a capture window
    • Connect the camera
    • Start camera preview and capture
    • Disconnect camera
    • Stop Recording and release memory
    • Dim DriverName As String = Space(80)
    • Dim DriverVersion As String = Space(80) 
      • capGetDriverDescriptionA(0, DriverName, 80,DriverVersion, 80)
    •  
    • Declare Function capGetDriverDescriptionA Lib "avicap32.dll" _
    • (ByVal wDriverIndex As Short, _
    • ByVal lpszName As String, ByVal cbName As Integer, _
    • ByVal lpszVer As String, _
    • ByVal cbVer As Integer) As Boolean
  •  
    • Private windowHandle As Integer
    • Const WS_CHILD = &H40000000
    • Const WS_VISIBLE = &H10000000
    • nID = 0 (index of camera) (eg: index is 1 then nID=1)
    • windowHandle = capCreateCaptureWindowA("My Cam", WS_CHILD Or WS_VISIBLE, xPos, yPos, wWidth, wHight, parentHandle, nId)
    • Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll“ (ByVal lpszWindowName As String, ByVal dwStyle As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Short, ByVal hWndParent As Integer, ByVal nID As Integer) As Integer
    • Const WM_CAP_START = &H400S 
    • Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
    • SendMessage(windowHandle, WM_CAP_DRIVER_CONNECT, 0, 0)
    • Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Int32, ByVal lParam As Int32) As Integer
    • Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52
    • Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50
    • Private frameRate As Integer = 25
    • '---start previewing the image--- SendMessage(windowHandle, WM_CAP_SET_PREVIEW, 1,0)
    • '---set the preview rate ---  
    • SendMessage(windowHandle, M_CAP_SET_PREVIEWRATE, frameRate, 0)
    • ‘ --- Capturing---
    • SendMessage(windowHandle, WM_CAP_SEQUENCE, 0, 0)
    • SendMessage(windowHandle, WM_CAP_DRIVER_DISCONNECT, 0, 0)
    • SendMessage(windowHandle, WM_CAP_STOP, 0, 0)
    • '-- This function destroys the specified window —
    • DestroyWindow(windowHandle)
    • Declare Function DestroyWindow Lib "user32" _ (ByVal hndw As Integer) As Boolean
  •