Help Center> Huawei HiLens> SDK Reference> Video Input> Constructing Video Collectors
Updated on 2023-06-15 GMT+08:00

Constructing Video Collectors

Local Camera

This part describes how to construct a video collector (local camera). If the operation fails, you can view the skill logs or output to locate the error cause.

  • API calling

    static std::shared_ptr<VideoCapture> hilens::VideoCapture::Create()

  • Return value

    If the operation is successful, a video collector instance is returned. If the operation fails, nullptr is returned.

IP Camera

This part describes how to construct a video collector (IP camera). If the operation fails, you can view the skill logs or output to locate the error cause.

  • API calling

    static std::shared_ptr<VideoCapture> hilens::VideoCapture::Create(const std::string & name)

    static std::shared_ptr<VideoCapture> hilens::VideoCapture::Create(const std::string & name, const unsigned int width, const unsigned int height)

  • Parameter description
    Table 1 Parameters

    Parameter

    Description

    name

    Camera name in the device configuration file (IPC in the device configurations). The camera name in the device configuration file is preferentially used. You can also enter a stream obtaining address in the format of rtsp://xxx. In 1.0.7 and later versions, the local MP4 files can be directly read, and the width and height of the read video frame can be set.

    You can configure the camera name on the HiLens management console. For details, see the "Configuring Cameras" section in HiLens User Guide.

    width

    Width of the read video frame. The width must be a multiple of 16. The recommended value is a multiple of 32, and the minimum value is 128. This parameter is supported only by 1.0.7 and later versions.

    height

    Height of the read video frame. The value must be a multiple of 2 and the minimum value is 128. This parameter is supported only by 1.0.7 and later versions.

USB Camera

This part describes how to construct a video collector (USB camera). If the operation fails, the "CreateError" message is displayed, and you can view the skill logs or output to locate the error cause. Currently, only one UVC camera can be inserted. The camera ID is 0.

  • API calling

    static std::shared_ptr hilens::VideoCapture::Create(int dev)

  • Parameter description
    Table 2 Parameters

    Parameter

    Description

    dev

    ID of the UVC camera in /dev of the HiLens Kit system.

    For details on how to log in to the HiLens Kit system, see the "Connecting to a HiLens Kit Device Using SSH" section in HiLens User Guide.

  • Return value

    If the operation is successful, a video collector instance is returned. If the operation fails, nullptr is returned.