星瞳实验室APP,快速收到回复
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 人体型识别问题,有哪位大佬知道咋样解决?



    • 0_1608108985527_CE(`P8Y{BA4%ANS)PK(~XXY.png
      这是根据例程人脸追踪改过来的,之前还可以用,但不知道为什么现在只能识别人体,然后就卡在识别那里,下方也不能输出数据,不能追踪了,

      import sensor, time, image
      sensor.reset()
      sensor.set_contrast(3)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.VGA)
      sensor.set_windowing((320, 240))
      sensor.set_pixformat(sensor.RGB565)
      # Skip a few frames to allow the sensor settle down
      sensor.skip_frames(time = 2000)
      
      # Load Haar Cascade
      # By default this will use all stages, lower satges is faster but less accurate.
      body_cascade = image.HaarCascade("haarcascade_fullbody.cascade", stages=25)
      print(body_cascade)
      
      # First set of keypoints
      kpts1 = None
      
      # Find a body!
      while (kpts1 == None):
          img = sensor.snapshot()
          img.draw_string(0, 0, "Looking for a body...")
          # Find bodies
          objects = img.find_features(body_cascade, threshold=0.5, scale=1.25)
          if objects:
              # Expand the ROI by 31 pixels in every direction
              body = (objects[0][0]-31, objects[0][1]-31,objects[0][2]+31*2, objects[0][3]+31*2)
              # Extract keypoints using the detect face size as the ROI
              kpts1 = img.find_keypoints(threshold=10, scale_factor=1.1, max_keypoints=100, roi=body)
              # Draw a rectangle around the first face
              img.draw_rectangle(objects[0])
      
      # Draw keypoints
      print(kpts1)
      img.draw_keypoints(kpts1, size=24)
      img = sensor.snapshot()
      time.sleep(2000)
      
      # FPS clock
      clock = time.clock()
      
      while (True):
          clock.tick()
          img = sensor.snapshot()
          # Extract keypoints from the whole frame
          kpts2 = img.find_keypoints(threshold=10, scale_factor=1.1, max_keypoints=100, normalized=True)
      
          if (kpts2):
              # Match the first set of keypoints with the second one
              c=image.match_descriptor(kpts1, kpts2, threshold=85)
              match = c[6] # C[6] contains the number of matches.
              if (match>5):
                  img.draw_rectangle(c[2:6])
                  img.draw_cross(c[0], c[1], size=10)
                  print(kpts2, "matched:%d dt:%d"%(match, c[7]))
      
          # Draw FPS
          img.draw_string(0, 0, "FPS:%.2f"%(clock.fps()))
      
      


    • 如果升级了最新的固件,把time.sleep改为time.sleep_ms