Main Content

propertyInfo

Retrieve metadata for webcam properties

Since R2024a

    Description

    info = propertyInfo(cam) returns the metadata information in info related to all the properties of the webcam object specified in cam.

    example

    info = propertyInfo(cam,propertyNames) returns the metadata information related to only the webcam properties specified in propertyNames. You can specify a single property or multiple properties in propertyNames.

    Examples

    Retrieve Metadata for All Properties

    Find the name of your camera using the webcamlist function to ensure that MATLAB can discover your camera(s).

    webcamlist
    ans = 2×1 cell array
        {'Logitech Webcam C925e'          }
        {'Microsoft® LifeCam Cinema(TM)'}
    
    

    Create a webcam object for your camera.

    cam = webcam(1)
    cam = 
    
      webcam with properties:
    
                        Name: 'Logitech Webcam C925e'
                  Resolution: '1920x1080'
        AvailableResolutions: {'1920x1080'}
    
    

    Use the propertyInfo function to retrieve the metadata for all properties supported by the webcam object.

    info = propertyInfo(cam)
    info = 
    
      1×3 PropertyInfo array with properties:
    
       PropertyInfo with properties:
    
                 Name: "Name"
                 Type: "string"
              Default: []
             ReadOnly: 1
        AllowedValues: []
    
       PropertyInfo with properties:
    
                 Name: "Resolution"
                 Type: "string"
              Default: []
             ReadOnly: 0
        AllowedValues: "1920x1080"
    
       PropertyInfo with properties:
    
                 Name: "AvailableResolutions"
                 Type: "cell"
              Default: []
             ReadOnly: 1
        AllowedValues: []

    The propertyInfo does not return a default value for the Name, AvailableResolutions, and Resolution properties as the webcam object does not support default values for these properties.

    Return Metadata for Multiple Properties

    To retrieve the metadata for a single or multiple properties of webcam.

    Find the name of your camera using the webcamlist function to ensure that MATLAB can discover your camera(s).

    webcamlist
    ans = 
    
      2×1 cell array  
        {'Logitech Webcam C925e'} 
        {'Webcam Test Device'   }
    
    

    Create a webcam object for your camera.

    cam = webcam(1)
    cam =   
    
      webcam with properties: 
    
                         Name: 'Logitech Webcam C925e' 
                   Resolution: '640x480' 
         AvailableResolutions: {1×19 cell} 
        BacklightCompensation: 0 
                   Brightness: 128 
                     Contrast: 128 
                     Exposure: -5 
                 ExposureMode: 'auto' 
                        Focus: 0 
                    FocusMode: 'auto' 
                         Gain: 0 
                          Pan: 0 
                   Saturation: 128 
                    Sharpness: 128 
                         Tilt: 0 
                 WhiteBalance: 4000
             WhiteBalanceMode: 'auto' 
                         Zoom: 100 
    
    

    Use the propertyInfo function to retrieve the metadata for the Brightness property of the webcam object.

    info = propertyInfo(cam,"Brightness")
    info =  
    
      PropertyInfo with properties: 
    
                 Name: "Brightness" 
                 Type: "double" 
              Default: 128 
             ReadOnly: 0 
        AllowedValues: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … ] (1×256 double) 

    Use the propertyInfo function to retrieve the metadata for the Name and Sharpness properties of the webcam object.

    info = propertyInfo(cam,["Name","Sharpness"])
    infos =   
    
      1×2 PropertyInfo array with properties:  
    
       PropertyInfo with properties: 
    
                 Name: "Name" 
                 Type: "string" 
              Default: [] 
             ReadOnly: 1 
        AllowedValues: [] 
    
       PropertyInfo with properties:  
    
                 Name: "Sharpness" 
                 Type: "double" 
              Default: 128 
             ReadOnly: 0 
        AllowedValues: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … ] (1×256 double) 
    
    

    Input Arguments

    collapse all

    Hardware connection to a webcam, specified as a webcam object.

    Name of webcam property or properties specified as 1-by-n vector of string or character array, where n <= N. N is the number of supported webcam properties.

    Output Arguments

    collapse all

    Property metadata, returned as a 1-by-N array of propertyInfo objects containing property metadata. N is the number of supported webcam properties passed through the propertyInfo function. Each propertyInfo object contains five properties.

    Properties of propertyInfo object

    PropertyDescription
    NameName of the webcam property stored as a string.
    Type

    Data type of the webcam property. This can be any fundamental data type or a user-defined data type supported by MATLAB®.

    ReadOnlyLogical value indicating if the webcam property is read-only.
    DefaultDefault value of the webcam property. The Default value depends on the type of webcam.
    AllowedValuesVector of valid string or numeric values for the webcam property. The AllowedValues property depends on the type of webcam.

    Version History

    Introduced in R2024a