SAFR Windows SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events
RealNetworks.CameraKit.Camera Class Referenceabstract

Camera is an abstract base class which represents a camera device and its properties. There are concrete subclasses for specific types of cameras: USB cameras, IP cameras and ONVIF cameras. More...

Inheritance diagram for RealNetworks.CameraKit.Camera:
RealNetworks.CameraKit.IntelRealsenseCamera RealNetworks.CameraKit.OnvifCamera RealNetworks.CameraKit.USBCamera RealNetworks.CameraKit.XimeaCamera

Public Member Functions

 Camera (CameraIdentifier identifier)
 
IVideoProfile GetProfile (string token)
 Returns the profile for the given token or nil if no such profile is known to the camera. More...
 
abstract List< IDepthProfileGetDepthProfiles (IVideoProfile vp)
 The depth profiles that are available for the given video profile. More...
 
IDepthProfile GetBestDepthProfile (IVideoProfile vp)
 Returns the highest quality depth profile that is available for the given video profile. More...
 
abstract void Authenticate (CameraCredentials creds, CameraConnectCompletion completion)
 Authenticates the camera. This means that the camera will store the provided account and use it to get the current state of the physical camera which requires authentication to access it. E.g. it will fetch the available media profiles. More...
 
abstract CaptureSession CreateCaptureSession (IVideoProfile video, IDepthProfile depth=null, Accelerator accelerator=null)
 Create a new capture session with the given video profile. More...
 

Protected Member Functions

void OnConfigurationDidChange (bool restartCaptureSession=false)
 Saves the current camera state and posts a didChange notification. Does nothing if the key paths array is empty. More...
 

Properties

CameraIdentifier Identifier [get]
 Returns the globally unique camera identifier. More...
 
CameraType CameraType [get]
 Returns the type of the camera. More...
 
abstract string LocalizedName [get, set]
 Returns the localized camera name. More...
 
abstract CameraPosition Position [get]
 Returns the position of the camera. More...
 
abstract bool CanCaptureDepthData [get]
 Returns true if the camera is able to deliver depth data in addition to video data. More...
 
virtual string?? UserSource [get, set]
 The user source override. The global default user source will be used if the camera doesn't have its own user source. More...
 
virtual bool MirroringEnabled [get, set]
 Returns true if the video frames are mirrored about the Y axis; false otherwise. More...
 
virtual int Rotation [get, set]
 Returns the value by which video frames are rotated clockwise after mirroring. More...
 
abstract bool CanAdjustGainExposure [get]
 Returns true if the camera supports adjusting gain and exposure. More...
 
abstract Range< float > GainRange [get]
 Returns the range of supported gain values. An empty range is returned if gain adjustment is not supported More...
 
abstract float Gain [get, set]
 The current camera sensor gain value. More...
 
abstract Range< float > ExposureRange [get]
 Returns the range of supported exposure values. Exposure is measured in milliseconds. An empty range is returned if exposure adjustments are not supported. More...
 
abstract float Exposure [get, set]
 The current exposure value in milliseconds. Exposure is typically half the frame rate. Exposure time is capped by the frame rate (it can not be longer than the time of a single frame). More...
 
abstract bool IsAutoGainExposureEnabled [get, set]
 Controls whether the camera itself should automatically adjust gain and exposure as needed. More...
 
bool CanCrop = true [get, protected set]
 Is cropping supported. More...
 
virtual bool CroppingEnabled [get, set]
 Is cropping enabled. More...
 
virtual ? RectangleF CropRectangle [get, set]
 The video crop rectangle in a normalized coordinate system from 0-1 with the origin in the top left corner. The video frame is cropped from the native resolution to this rectangle. If this is nil no cropping will occur. More...
 
float FrameRateReduction [get, set]
 Frame rate reduciton ratio (1.0 - no reduction). More...
 
abstract CameraConfiguration Configuration [get, set]
 Returns the camera configuration. More...
 
virtual bool ContrastEnhancementEnable [get, set]
 Enables / disables contrast enhancement. More...
 
virtual double LowLightThreshold [get, set]
 Contrast enhancement low light threshold. More...
 
virtual double ExposureBoost [get, set]
 Contrast enhanement exposure boost. More...
 
virtual bool DetectionOnlyContrastEnhancement [get, set]
 Enables / disables deferring of contrast enhancement from the camera side to the face detector side. More...
 
abstract List< IVideoProfileProfiles [get, protected set]
 The available profiles. More...
 
abstract IVideoProfile DefaultProfile [get]
 Returns the default profile. This is a profile that should be used for capturing if you don't have any specific profile selection criteria. Nil is returned if the camera has no suitable profiles available. More...
 
bool IsConnected [get]
 Returns true if the camera is connected and false if it got disconnected / removed. More...
 
abstract ? CameraCredentials Credentials [get]
 The credentials to use for authentication. More...
 
abstract bool RequiresAuthentication [get]
 Returns true if the camera requires authentication in order to access its video profile information and to stream from it. More...
 
abstract bool IsAuthenticated [get]
 Returns true if the camera has been successfully authenticated; false otherwise. More...
 
virtual int MetadataPort [get, set]
 The metadata ip port. More...
 
bool ShouldRestartCaptureSession = false [get, set]
 The metadata ip port. More...
 
DirectionOfTravelDescriptor DirectionOfTravelDescriptor [get, set]
 Unauthorized direction configuration. More...
 

Events

EventHandler< DidChangeConfigurationEventArgsDidChangeConfiguration
 Configuration change event handler. More...
 

Detailed Description

Camera is an abstract base class which represents a camera device and its properties. There are concrete subclasses for specific types of cameras: USB cameras, IP cameras and ONVIF cameras.

An IP camera is a camera which makes a video stream available which can be connected to via a public (an usually unsecured) HTTP or RTSP URL. An ONVIF camera is a camera which implements the ONVIF camera discovery and control standard. The CameraManager uses the ONVIF protocol to discover ONVIF cameras and the OnvifCamera class uses the ONVIF protocol to acquire information about the camera and to initiate a video stream.

You acquire camera objects by asking teh CameraManager for them. The CameraManager knows how to discover and manage cameras.

A camera has properties like a name and the set of available video formats. Some of those properties may be setable for some types of cameras and read-only for other types. For example, the name of a camera is settable for IP cameras but read-only for ONVIF cameras because the name of the camera in this case is only settable via the web-UI provided by the camera software.

Every camera has a globally unique identifier. This identifier is guaranteed to remain stable and may be persisted. You can use this identifier to associate sour own configuration information with a camera.

You create a video stream from a camera by asking the camera for a capture session via the CreateCaptureSession() function. This function takes a video profile which specifies the video resolution and frames per second that the video stream should have. Note that some cameras may allow you to create more than one capture session for a given video profile and some may allow only one active capture session per video profile.

Use the DefaultProfile property to get the default video profile of a camera. The default profile is usually a 1080p profile or close to it. Use the Profiles property to get the full list of available profile. You can iterate through this list of profiles to find one that matches most closely what you are looking for. Then create a capture session with this profile.

Once you've create a capture session you should register event handlers on the capture session object to receive video frames and errors. Then start the capture session by setting its Capturing property to true. You can pause / stop capturing at any time by setting Capturing to false.

Constructor & Destructor Documentation

◆ Camera()

RealNetworks.CameraKit.Camera.Camera ( CameraIdentifier  identifier)

Member Function Documentation

◆ Authenticate()

abstract void RealNetworks.CameraKit.Camera.Authenticate ( CameraCredentials  creds,
CameraConnectCompletion  completion 
)
pure virtual

Authenticates the camera. This means that the camera will store the provided account and use it to get the current state of the physical camera which requires authentication to access it. E.g. it will fetch the available media profiles.

Parameters
credsthe camera credentials
completionthe completion handler to invoke

Implemented in RealNetworks.CameraKit.XimeaCamera, RealNetworks.CameraKit.USBCamera, RealNetworks.CameraKit.IntelRealsenseCamera, and RealNetworks.CameraKit.OnvifCamera.

◆ CreateCaptureSession()

abstract CaptureSession RealNetworks.CameraKit.Camera.CreateCaptureSession ( IVideoProfile  video,
IDepthProfile  depth = null,
Accelerator  accelerator = null 
)
pure virtual

Create a new capture session with the given video profile.

Parameters
videothe desired video profile
depththe desired depth profile (optional)
acceleratorthe accelerator that should be used for video decoding. Null means use the primary display accelerator
Returns
the capture session

Implemented in RealNetworks.CameraKit.OnvifCamera, RealNetworks.CameraKit.XimeaCamera, RealNetworks.CameraKit.USBCamera, and RealNetworks.CameraKit.IntelRealsenseCamera.

◆ GetBestDepthProfile()

IDepthProfile RealNetworks.CameraKit.Camera.GetBestDepthProfile ( IVideoProfile  vp)

Returns the highest quality depth profile that is available for the given video profile.

Parameters
vpthe video profile
Returns
the best depth profile available for the video profile

◆ GetDepthProfiles()

abstract List<IDepthProfile> RealNetworks.CameraKit.Camera.GetDepthProfiles ( IVideoProfile  vp)
pure virtual

The depth profiles that are available for the given video profile.

Parameters
vpthe video profile
Returns
the available depth profiles

Implemented in RealNetworks.CameraKit.OnvifCamera, RealNetworks.CameraKit.XimeaCamera, RealNetworks.CameraKit.USBCamera, and RealNetworks.CameraKit.IntelRealsenseCamera.

◆ GetProfile()

IVideoProfile RealNetworks.CameraKit.Camera.GetProfile ( string  token)

Returns the profile for the given token or nil if no such profile is known to the camera.

Parameters
tokenthe video profile token
Returns
the video profile; null if none found

◆ OnConfigurationDidChange()

void RealNetworks.CameraKit.Camera.OnConfigurationDidChange ( bool  restartCaptureSession = false)
protected

Saves the current camera state and posts a didChange notification. Does nothing if the key paths array is empty.

Property Documentation

◆ CameraType

CameraType RealNetworks.CameraKit.Camera.CameraType
get

Returns the type of the camera.

◆ CanAdjustGainExposure

abstract bool RealNetworks.CameraKit.Camera.CanAdjustGainExposure
get

Returns true if the camera supports adjusting gain and exposure.

◆ CanCaptureDepthData

abstract bool RealNetworks.CameraKit.Camera.CanCaptureDepthData
get

Returns true if the camera is able to deliver depth data in addition to video data.

◆ CanCrop

bool RealNetworks.CameraKit.Camera.CanCrop = true
getprotected set

Is cropping supported.

◆ Configuration

abstract CameraConfiguration RealNetworks.CameraKit.Camera.Configuration
getset

Returns the camera configuration.

◆ ContrastEnhancementEnable

virtual bool RealNetworks.CameraKit.Camera.ContrastEnhancementEnable
getset

Enables / disables contrast enhancement.

◆ Credentials

abstract ? CameraCredentials RealNetworks.CameraKit.Camera.Credentials
get

The credentials to use for authentication.

◆ CroppingEnabled

virtual bool RealNetworks.CameraKit.Camera.CroppingEnabled
getset

Is cropping enabled.

◆ CropRectangle

virtual ? RectangleF RealNetworks.CameraKit.Camera.CropRectangle
getset

The video crop rectangle in a normalized coordinate system from 0-1 with the origin in the top left corner. The video frame is cropped from the native resolution to this rectangle. If this is nil no cropping will occur.

◆ DefaultProfile

abstract IVideoProfile RealNetworks.CameraKit.Camera.DefaultProfile
get

Returns the default profile. This is a profile that should be used for capturing if you don't have any specific profile selection criteria. Nil is returned if the camera has no suitable profiles available.

◆ DetectionOnlyContrastEnhancement

virtual bool RealNetworks.CameraKit.Camera.DetectionOnlyContrastEnhancement
getset

Enables / disables deferring of contrast enhancement from the camera side to the face detector side.

◆ DirectionOfTravelDescriptor

DirectionOfTravelDescriptor RealNetworks.CameraKit.Camera.DirectionOfTravelDescriptor
getset

Unauthorized direction configuration.

◆ Exposure

abstract float RealNetworks.CameraKit.Camera.Exposure
getset

The current exposure value in milliseconds. Exposure is typically half the frame rate. Exposure time is capped by the frame rate (it can not be longer than the time of a single frame).

◆ ExposureBoost

virtual double RealNetworks.CameraKit.Camera.ExposureBoost
getset

Contrast enhanement exposure boost.

◆ ExposureRange

abstract Range<float> RealNetworks.CameraKit.Camera.ExposureRange
get

Returns the range of supported exposure values. Exposure is measured in milliseconds. An empty range is returned if exposure adjustments are not supported.

◆ FrameRateReduction

float RealNetworks.CameraKit.Camera.FrameRateReduction
getset

Frame rate reduciton ratio (1.0 - no reduction).

◆ Gain

abstract float RealNetworks.CameraKit.Camera.Gain
getset

The current camera sensor gain value.

◆ GainRange

abstract Range<float> RealNetworks.CameraKit.Camera.GainRange
get

Returns the range of supported gain values. An empty range is returned if gain adjustment is not supported

◆ Identifier

CameraIdentifier RealNetworks.CameraKit.Camera.Identifier
get

Returns the globally unique camera identifier.

◆ IsAuthenticated

abstract bool RealNetworks.CameraKit.Camera.IsAuthenticated
get

Returns true if the camera has been successfully authenticated; false otherwise.

◆ IsAutoGainExposureEnabled

abstract bool RealNetworks.CameraKit.Camera.IsAutoGainExposureEnabled
getset

Controls whether the camera itself should automatically adjust gain and exposure as needed.

◆ IsConnected

bool RealNetworks.CameraKit.Camera.IsConnected
get

Returns true if the camera is connected and false if it got disconnected / removed.

◆ LocalizedName

abstract string RealNetworks.CameraKit.Camera.LocalizedName
getset

Returns the localized camera name.

◆ LowLightThreshold

virtual double RealNetworks.CameraKit.Camera.LowLightThreshold
getset

Contrast enhancement low light threshold.

◆ MetadataPort

virtual int RealNetworks.CameraKit.Camera.MetadataPort
getset

The metadata ip port.

◆ MirroringEnabled

virtual bool RealNetworks.CameraKit.Camera.MirroringEnabled
getset

Returns true if the video frames are mirrored about the Y axis; false otherwise.

◆ Position

abstract CameraPosition RealNetworks.CameraKit.Camera.Position
get

Returns the position of the camera.

◆ Profiles

abstract List<IVideoProfile> RealNetworks.CameraKit.Camera.Profiles
getprotected set

The available profiles.

◆ RequiresAuthentication

abstract bool RealNetworks.CameraKit.Camera.RequiresAuthentication
get

Returns true if the camera requires authentication in order to access its video profile information and to stream from it.

◆ Rotation

virtual int RealNetworks.CameraKit.Camera.Rotation
getset

Returns the value by which video frames are rotated clockwise after mirroring.

◆ ShouldRestartCaptureSession

bool RealNetworks.CameraKit.Camera.ShouldRestartCaptureSession = false
getset

The metadata ip port.

◆ UserSource

virtual string?? RealNetworks.CameraKit.Camera.UserSource
getset

The user source override. The global default user source will be used if the camera doesn't have its own user source.

Event Documentation

◆ DidChangeConfiguration

EventHandler<DidChangeConfigurationEventArgs> RealNetworks.CameraKit.Camera.DidChangeConfiguration

Configuration change event handler.