Help Center> Huawei HiLens> FAQs> Managing Data> Can I Record the Images Captured by a HiLens Kit Camera or the Skill Running Result for Storage?
Updated on 2022-02-22 GMT+08:00

Can I Record the Images Captured by a HiLens Kit Camera or the Skill Running Result for Storage?

Yes. You can use OpenCV VideoWriter. Note that the video must be in MJPG format. The reference code is as follows:

  camera = hilens.VideoCapture() 

  fps = 20 
  size = (1280, 720) 
  format = cv2.VideoWriter_fourcc('M','J','P','G') 
  writer = cv2.VideoWriter("output.avi", format, fps, size) 

  count = 0 
  duration = 100 # Duration of the video
  while True: 
      input_nv21 = camera.read()

      input_bgr = cv2.cvtColor(input_nv21, cv2.COLOR_YUV2BGR_NV21) 
      writer.write(input_bgr)

      if count >= fps * duration: 
          break
      count += 1 
  writer.release()

Managing Data FAQs

more