• 星瞳实验室APP,快速收到回复。扫描二维码或者点击 https://singtown.com/app/
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 每一个新的提问,单独发一个新帖子
  • 描述一定要详细 描述一定要详细 描述一定要详细
  • 请贴出具体的的目的,就是你要做什么。
  • 请贴出具体的代码,与报错提示
  • 代码一定要让别人可以运行的文本,不要贴图片
  • 关于人脸检测矩形框不准或不显示的问题



    • import sensor,image,time
      
      
      
      sensor.reset() # Initialize the camera sensor.
      sensor.set_contrast(1)
      sensor.set_gainceiling(16)
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.HQVGA) # or sensor.QQVGA (or others)
      sensor.skip_frames(time = 2000) # Let new settings take affect.
      
      # Load up a face detection HaarCascade. This is object that your OpenMV Cam
      # can use to detect faces using the find_features() method below. Your OpenMV
      # Cam has fontalface HaarCascade built-in. By default, all the stages of the
      # HaarCascade are loaded. However, You can adjust the number of stages to speed
      # up processing at the expense of accuracy. The frontalface HaarCascade has 25
      # stages.
      face_cascade = image.HaarCascade("frontalface", stages=25)
      print(face_cascade)
      while(True):
          img = sensor.snapshot()
              # Threshold can be between 0.0 and 1.0. A higher threshold results in a
              # higher detection rate with more false positives. The scale value
              # controls the matching scale allowing you to detect smaller faces.
          faces = img.find_features(face_cascade, threshold=0.75, scale_factor=1.35)
      
      
          for r in faces:
              img.draw_rectangle(r)
          
      

      尝试过更改stage,threshold和scale_factor,但无法像视频教程14那样持续且准确地框出人脸,stage偏大时无法显示矩形框,想请问是openmv自带模型的问题?摄像头的问题?计算机配置问题?还是其他问题?
      print(face_cascade)在串行终端显示为"width":24, "height":24, "n_stages":25, "n_features":2913, "n_rectangles":6383



    • 可能是光线不好,灯应该正对人脸,如果背对这光,脸就会黑。

      你可以发个照片看一下。