Updated on 2022-02-22 GMT+08:00
Example - Input
The following is an example of the input module:
- The following example calls the video collector API when the firmware version is 1.0.7 or later. You can set the video size when calling this API. That is, you can set the width and height parameters when calling hilens.VideoCapture(camera, width, height).
- When the HiLens Studio or firmware version is earlier than 1.0.7, the video size cannot be set.
#! /usr/bin/python3.7 import hilens import numpy as np def run(): # Construct a camera. cap0 = hilens.VideoCapture() # Built-in camera cap1 = hilens.VideoCapture("IPC1") # IP camera whose name is IPC1 in the camera configuration file. To configure the camera, log in to the Huawei HiLens console, choose Skill Development > Skill Management > Create Skill, and add the configuration in the Runtime Configuration area. cap2 = hilens.VideoCapture("rtsp://192.168.1.1/video") # RTSP video stream whose address is rtsp://192.168.1.1/video cap3 = hilens.VideoCapture("/tmp/test.mp4", 1920, 1080) # Read the test.mp4 video file in the /tmp directory on HiLens Kit cameras and adjust the video frame width and height to 1920 and 1080. (The firmware version must be 1.0.7 or later.) cap4 = hilens.VideoCapture(0) # Currently, only one UV camera is supported. The camera ID is 0. # Obtain the video size. w = cap0.width h = cap0.height hilens.info("width: %d, height: %d" % (w, h)) # Read video data. frame0 = cap0.read() # Other processing pass if __name__ == '__main__': hilens.init("hello") run() hilens.terminate()
Parent topic: Video Input Module
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot