C# Class WebcamLib.Webcam

Represents a webcam.
Inheritance: IDisposable
Show file Open project: joeyespo/webcam-lib Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GrabFrame ( ) : Image

Grabs a single frame and returns it as an image.

SetPreviewCallback ( CamPreviewCallback previewCallback ) : void

Sets the preview callback (set to null to disable preview mode).

ShowVideoDisplayDialog ( ) : bool

Shows the video display dialog.

ShowVideoFormatDialog ( ) : bool

Shows the video format dialog.

ShowVideoSourceDialog ( ) : bool

Shows the video source dialog.

Webcam ( IWin32Window owner, CamPreviewCallback previewCallback = null, int previewRate = 66 ) : System

Initializes a new instance of the Webcam class.

Private Methods

Method Description
CreatePreviewWindow ( ) : IntPtr

Creates the preview window.

DestroyPreviewWindow ( ) : void

Destroys the preview window.

FrameCallbackProc ( IntPtr hWnd, System.Win32 &VideoHeader ) : int

Called on each frame update.

In order to draw on the resulting image, it must first be copied. This is because setting the bitmap data pointer directly and rotating the image can lead to random exceptions. This is expensive though. So by design, this doesn't happen automatically. See the following sites for details about this: http://msdn.microsoft.com/en-us/library/system.drawing.image.rotateflip.aspx http://social.msdn.microsoft.com/Forums/en-IE/csharplanguage/thread/affa1855-e1ec-476d-bfb1-d0985971f394

PreviewTick ( object sender, EventArgs e ) : void

Grab the next frame.

SetPreviewWindow ( IntPtr windowHandle ) : void

Sets the preview window.

Method Details

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

GrabFrame() public method

Grabs a single frame and returns it as an image.
public GrabFrame ( ) : Image
return Image

SetPreviewCallback() public method

Sets the preview callback (set to null to disable preview mode).
public SetPreviewCallback ( CamPreviewCallback previewCallback ) : void
previewCallback CamPreviewCallback
return void

ShowVideoDisplayDialog() public method

Shows the video display dialog.
public ShowVideoDisplayDialog ( ) : bool
return bool

ShowVideoFormatDialog() public method

Shows the video format dialog.
public ShowVideoFormatDialog ( ) : bool
return bool

ShowVideoSourceDialog() public method

Shows the video source dialog.
public ShowVideoSourceDialog ( ) : bool
return bool

Webcam() public method

Initializes a new instance of the Webcam class.
public Webcam ( IWin32Window owner, CamPreviewCallback previewCallback = null, int previewRate = 66 ) : System
owner IWin32Window The owner window.
previewCallback CamPreviewCallback The method to call when new frames are taken.
previewRate int The rate at which to call .
return System