Class Camera

    Definition

    Namespace:
    Tizen.Multimedia
    Assembly:
    Tizen.Multimedia.Camera.dll

    This camera class provides methods to capture photos and supports setting up notifications for state changes of capturing, previewing, focusing, and informing about the resolution and the binary format, and functions for picture manipulations like sepia, negative, and many more. It also notifies you when a significant picture parameter changes, (For example, focus).

    public class Camera : IDisposable
    Inheritance
    object
    Camera
    Implements
    System.IDisposable

    Constructors

    View Source

    Camera()

    Initializes a new instance of the Camera class.

    Declaration
    public Camera()
    Remarks

    If CameraDeviceManager is supported, CameraDevice will be selected automatically by internal policy.
    (User can check whether CameraDeviceManager is supported or not by using IsCameraDeviceManagerSupported.)
    But, if not, this constructor will try to create Camera instance with CameraDevice0 by default.

    Exceptions
    Type Condition
    System.InvalidOperationException

    There's no available camera device. -or-
    In case of any invalid operations.

    System.NotSupportedException

    The camera feature is not supported.

    See Also
    IsCameraDeviceManagerSupported
    View Source

    Camera(CameraDevice)

    Initializes a new instance of the Camera class.

    Declaration
    public Camera(CameraDevice device)
    Parameters
    Type Name Description
    CameraDevice device

    The camera device to access.

    Exceptions
    Type Condition
    System.ArgumentException

    Invalid CameraDevice type.

    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    The camera feature is not supported.

    Properties

    View Source

    CameraCount

    Gets the camera device count.

    Declaration
    public int CameraCount { get; }
    Property Value
    Type Description
    int

    This returns 2, if the device supports primary and secondary cameras. Otherwise 1, if the device only supports primary camera.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The camera has already been disposed.

    View Source

    Capabilities

    Gets the various camera capabilities.

    Declaration
    public CameraCapabilities Capabilities { get; }
    Property Value
    Type Description
    CameraCapabilities
    View Source

    Direction

    Gets the facing direction of the camera module.

    Declaration
    public CameraFacingDirection Direction { get; }
    Property Value
    Type Description
    CameraFacingDirection

    A CameraFacingDirection that specifies the facing direction of the camera device.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The camera has already been disposed.

    View Source

    Display

    Sets or gets the display type and handle to show preview images. The camera must be in the Created state.

    Declaration
    public Display Display { get; set; }
    Property Value
    Type Description
    Display
    Remarks

    This must be set before the StartPreview() method. In custom ROI display mode, DisplayRoiArea property must be set before calling this method.

    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    DisplayReuseHint

    The hint for the display reuse. If the hint is set to true, the display will be reused when the camera device is changed with the ChangeDevice method.

    Declaration
    public bool DisplayReuseHint { get; set; }
    Property Value
    Type Description
    bool
    Exceptions
    Type Condition
    System.ArgumentException

    In case of invalid parameters.

    System.InvalidOperationException

    An invalid state.

    System.ObjectDisposedException

    The camera has already been disposed.

    View Source

    DisplaySettings

    Get/set various camera display properties.

    Declaration
    public CameraDisplaySettings DisplaySettings { get; }
    Property Value
    Type Description
    CameraDisplaySettings
    View Source

    Handle

    Gets the native handle of the camera.

    Declaration
    public IntPtr Handle { get; }
    Property Value
    Type Description
    System.IntPtr
    View Source

    Settings

    Gets or sets the various camera settings.

    Declaration
    public CameraSettings Settings { get; }
    Property Value
    Type Description
    CameraSettings
    View Source

    State

    Gets the state of the camera.

    Declaration
    public CameraState State { get; }
    Property Value
    Type Description
    CameraState

    None, Created, Preview, Capturing, Captured.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The camera has already been disposed.

    Methods

    View Source

    ChangeDevice(CameraDevice)

    Changes the camera device.

    Declaration
    public void ChangeDevice(CameraDevice device)
    Parameters
    Type Name Description
    CameraDevice device

    The hardware camera to access.

    Remarks

    If display reuse is set using DisplayReuseHint before stopping the preview, the display will be reused and last frame on the display can be kept even though camera device is changed. The camera must be in the Created.

    Exceptions
    Type Condition
    System.ArgumentException

    In case of invalid parameters.

    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of the ChangeDevice feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    View Source

    Dispose()

    Releases all resources used by the camera.

    Declaration
    public void Dispose()
    View Source

    Dispose(bool)

    Releases the unmanaged resources used by the camera.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    View Source

    ~Camera()

    Finalizes an instance of the Camera class.

    Declaration
    protected ~Camera()
    View Source

    GetDeviceState(CameraDevice)

    Gets the device state.

    Declaration
    public static CameraDeviceState GetDeviceState(CameraDevice device)
    Parameters
    Type Name Description
    CameraDevice device

    The device to get the state.

    Returns
    Type Description
    CameraDeviceState

    Returns the state of the camera device.

    Exceptions
    Type Condition
    System.ArgumentException

    In case of invalid parameters.

    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    View Source

    GetFlashState(CameraDevice)

    Gets the flash state.

    Declaration
    public static CameraFlashState GetFlashState(CameraDevice device)
    Parameters
    Type Name Description
    CameraDevice device

    The device to get the state.

    Returns
    Type Description
    CameraFlashState

    Returns the flash state of the camera device.

    Exceptions
    Type Condition
    System.ArgumentException

    In case of invalid parameters.

    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    View Source

    StartCapture()

    Starts capturing of still images. EventHandler must be set for capturing using Capturing and for completed using CaptureCompleted before calling this method. The camera must be in the Preview state.

    Declaration
    public void StartCapture()
    Remarks

    This function causes the transition of the camera state from capturing to captured automatically and the corresponding EventHandlers will be invoked. The preview should be restarted by calling the StartPreview() method after capture is completed.

    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    StartCapture(int, int, CancellationToken)

    Starts continuously capturing still images. EventHandler must be set for capturing using Capturing and for completed using CaptureCompleted before calling this method. The camera must be in the Preview state.

    Declaration
    public void StartCapture(int count, int interval, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    int count

    The number of still images.

    int interval

    The interval of the capture(milliseconds).

    System.Threading.CancellationToken cancellationToken

    The cancellation token to cancel capturing.

    Remarks

    If this is not supported, zero shutter lag occurs. The capture resolution could be changed to the preview resolution. This function causes the transition of the camera state from capturing to captured automatically and the corresponding Eventhandlers will be invoked. Each captured image will be delivered through Eventhandler set using the Capturing event. The preview should be restarted by calling the StartPreview() method after capture is completed.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    In case of invalid parameters.

    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    See Also
    System.Threading.CancellationToken
    View Source

    StartFaceDetection()

    Starts face detection. The camera must be in the Preview state.

    Declaration
    public void StartFaceDetection()
    Remarks

    This should be called after StartPreview() is started. The Eventhandler set using FaceDetected is invoked when the face is detected in the preview frame. Internally, it starts continuously focus and focusing on the detected face.

    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    StartFocusing(bool)

    Starts camera auto-focusing, asynchronously. The camera must be in the Preview or the Captured state.

    Declaration
    public void StartFocusing(bool continuous)
    Parameters
    Type Name Description
    bool continuous

    Continuous auto focus.

    Remarks

    If continuous status is true, the camera continuously tries to focus.

    Exceptions
    Type Condition
    System.ArgumentException

    In case of invalid parameters.

    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    StartPreview()

    Starts capturing and drawing preview frames on the screen. The display property must be set using Display before using this method. If needed set fps PreviewFps, preview resolution PreviewResolution, or preview format PreviewPixelFormat before using this method. The camera must be in the Created or the Captured state.

    Declaration
    public void StartPreview()
    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    StopFaceDetection()

    Stops face detection.

    Declaration
    public void StopFaceDetection()
    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    StopFocusing()

    Stops camera auto focusing. The camera must be in the Preview or the Captured state.

    Declaration
    public void StopFocusing()
    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    View Source

    StopPreview()

    Stops capturing and drawing preview frames on the screen. The camera must be in the Preview state.

    Declaration
    public void StopPreview()
    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ObjectDisposedException

    The camera has already been disposed.

    System.UnauthorizedAccessException

    In case of access to the resources cannot be granted.

    Events

    View Source

    CaptureCompleted

    An event that occurs after the capture of the image.

    Declaration
    public event EventHandler<EventArgs> CaptureCompleted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><System.EventArgs>
    View Source

    Capturing

    An event that occurs during capture of an image.

    Declaration
    public event EventHandler<CameraCapturingEventArgs> Capturing
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraCapturingEventArgs>
    View Source

    DeviceStateChanged

    An event that occurs after the CameraDeviceState is changed.

    Declaration
    public static event EventHandler<CameraDeviceStateChangedEventArgs> DeviceStateChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraDeviceStateChangedEventArgs>
    Exceptions
    Type Condition
    System.InvalidOperationException

    In case of any invalid operations.

    System.NotSupportedException

    In case of this feature is not supported.

    System.ArgumentException

    In case of invalid parameters.

    View Source

    ErrorOccurred

    An event that occurs when there is an asynchronous error.

    Declaration
    public event EventHandler<CameraErrorOccurredEventArgs> ErrorOccurred
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraErrorOccurredEventArgs>
    View Source

    ExtraPreview

    An event that occurs once per frame when previewing.

    Declaration
    public event EventHandler<ExtraPreviewEventArgs> ExtraPreview
    Event Type
    Type Description
    System.EventHandler<TEventArgs><ExtraPreviewEventArgs>
    View Source

    FaceDetected

    An event that occurs when a face is detected in the preview frame.

    Declaration
    public event EventHandler<FaceDetectedEventArgs> FaceDetected
    Event Type
    Type Description
    System.EventHandler<TEventArgs><FaceDetectedEventArgs>
    View Source

    FocusStateChanged

    An event that occurs when the auto focus state is changed.

    Declaration
    public event EventHandler<CameraFocusStateChangedEventArgs> FocusStateChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraFocusStateChangedEventArgs>
    View Source

    HdrCaptureProgress

    An event that occurs when there is a change in the HDR capture progress. Checks whether the IsHdrCaptureSupported is supported or not before adding this EventHandler.

    Declaration
    public event EventHandler<HdrCaptureProgressEventArgs> HdrCaptureProgress
    Event Type
    Type Description
    System.EventHandler<TEventArgs><HdrCaptureProgressEventArgs>
    Exceptions
    Type Condition
    System.NotSupportedException

    In case of HDR feature is not supported.

    View Source

    Interrupted

    An event that occurs when an camera is interrupted by the policy.

    Declaration
    public event EventHandler<CameraInterruptedEventArgs> Interrupted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraInterruptedEventArgs>
    View Source

    InterruptStarted

    An event that occurs when the camera interrupt is started by the policy.

    Declaration
    public event EventHandler<CameraInterruptStartedEventArgs> InterruptStarted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraInterruptStartedEventArgs>
    View Source

    MediaPacketPreview

    An event that occurs once per frame when previewing. Preview callback is registered when an user adds a callback explicitly to avoid useless P/Invoke.

    Declaration
    public event EventHandler<MediaPacketPreviewEventArgs> MediaPacketPreview
    Event Type
    Type Description
    System.EventHandler<TEventArgs><MediaPacketPreviewEventArgs>
    View Source

    Preview

    An event that occurs once per frame when previewing. Preview callback is registered when an user adds a callback explicitly to avoid useless P/Invoke.

    Declaration
    public event EventHandler<PreviewEventArgs> Preview
    Event Type
    Type Description
    System.EventHandler<TEventArgs><PreviewEventArgs>
    View Source

    StateChanged

    An event that occurs when the camera state is changed.

    Declaration
    public event EventHandler<CameraStateChangedEventArgs> StateChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><CameraStateChangedEventArgs>

    Implements

    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX