Table of Contents

Class CameraService

Namespace
Ink_Canvas.Helpers
Assembly
InkCanvasForClass.dll
public class CameraService : IDisposable
Inheritance
CameraService
Implements
Inherited Members

Constructors

CameraService()

public CameraService()

CameraService(int, int, int)

public CameraService(int rotationAngle, int resolutionWidth, int resolutionHeight)

Parameters

rotationAngle int
resolutionWidth int
resolutionHeight int

Properties

AvailableCameras

public List<FilterInfo> AvailableCameras { get; }

Property Value

List<FilterInfo>

CurrentCamera

public FilterInfo CurrentCamera { get; }

Property Value

FilterInfo

IsCapturing

public bool IsCapturing { get; }

Property Value

bool

ResolutionHeight

public int ResolutionHeight { get; set; }

Property Value

int

ResolutionWidth

public int ResolutionWidth { get; set; }

Property Value

int

RotationAngle

public int RotationAngle { get; set; }

Property Value

int

Methods

Dispose()

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

public void Dispose()

GetCameraNames()

获取摄像头名称列表

public List<string> GetCameraNames()

Returns

List<string>

GetCurrentFrameAsBitmapSource()

获取当前帧的BitmapSource(WPF格式),直接返回可用的WPF位图

public BitmapSource GetCurrentFrameAsBitmapSource()

Returns

BitmapSource

HasAvailableCameras()

检查是否有可用摄像头

public bool HasAvailableCameras()

Returns

bool

RefreshCameraList()

刷新可用摄像头列表

public void RefreshCameraList()

StartPreview(int)

开始摄像头预览

public bool StartPreview(int cameraIndex = 0)

Parameters

cameraIndex int

摄像头索引

Returns

bool

StopPreview()

停止摄像头预览

public void StopPreview()

SwitchCamera(int)

切换到指定摄像头

public bool SwitchCamera(int cameraIndex)

Parameters

cameraIndex int

摄像头索引

Returns

bool

Events

ErrorOccurred

public event EventHandler<string> ErrorOccurred

Event Type

EventHandler<string>

FrameReceived

public event EventHandler<Bitmap> FrameReceived

Event Type

EventHandler<Bitmap>