导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 6f4a
    6
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    6f4a

    @6f4a

    0
    声望
    19
    楼层
    1930
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    6f4a 关注

    6f4a 发布的帖子

    • RE: 追踪不同色的小车

      但这样,不能向左向右转

      发布在 OpenMV Cam
      6
      6f4a
    • 追踪不同色的小车

      如何让小车检测到红色进行跟踪,检测到绿色进行退,如果同时能进行形状识别那更好,求大神帮忙解决一下,颜色识别的和形状识别,还有追小球的小车的视频已经解决了

      发布在 OpenMV Cam
      6
      6f4a
    • RE: 多色识别不同追踪

      @kidswong999 让它识别到不同的颜色,执行不同的运动,当收到a时,开启颜色识别,当检测到绿色,跟着绿色走,红色的话,让他发送一个b,延时后再发送一个c,蓝色的话先停止然后结束,因为a只发了一次,所以这时跳出判断后,就不会再进行颜色识别,检测绿色是,打印一个a,可以在终端看执行程序那部分,同理蓝色时打印10,11也是,代码没有错误,但是运行的时候,你没把绿色,蓝色放在摄像头里,它老是把别的颜色识别进去。你可以把程序烧进去看下,就很快知道怎么回事了

      发布在 OpenMV Cam
      6
      6f4a
    • RE: 多色识别不同追踪

      我觉得应该是阈值的问题,我那程序阈值的设置和调用大概是这样子,你帮我看下阈值这样设,对不对
      green_threshold =(63, 38, 15, -65, -11, -112)
      red_threshold =(41, 13, -78, -13, -24, 72)
      blue_threshold =(10, 36, -18, 17, -19, 13)

      blob1 = img.find_blobs([green_threshold])
      blob2 = img.find_blobs([red_threshold])
      blob3 = img.find_blobs([blue_threshold])

      if blob1:
      程序1
      elif blob2:
      程序2
      elif blob3:
      程序3
      else:
      程序4

      发布在 OpenMV Cam
      6
      6f4a
    • RE: 多色识别不同追踪

      @kidswong999 就是它老是别别的颜色识别进去,你可以帮我看下,程序那里出错了吗?需要怎么改

      发布在 OpenMV Cam
      6
      6f4a
    • RE: 多色识别不同追踪

      @kidswong999 你帮我看下程序可以吗,我怕程序写漏了什么,非常感谢,急用

      发布在 OpenMV Cam
      6
      6f4a
    • RE: 多色识别不同追踪

      但是我,一个颜色就不会,多个颜色就会

      发布在 OpenMV Cam
      6
      6f4a
    • 多色识别不同追踪

      当收到“a”时开启颜色识别,识别到不同颜色执行不同程序,小车有不同的反应,但是一开启摄像头老是识别到不是你设点的颜色,不知道为啥?急用,请帮我看下,非常感谢

      This example shows off how to use the find_blobs function to find color

      blobs in the image. This example in particular looks for dark green objects.

      from pyb import UART
      uart = UART(3,9600)
      import sensor, image, time
      import car
      from pid import PID
      sensor.reset() # Initialize the camera sensor.
      sensor.set_pixformat(sensor.RGB565) # use RGB565.
      sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
      sensor.skip_frames(10) # Let new settings take affect.
      sensor.set_auto_gain(False)
      sensor.set_auto_whitebal(False) # turn this off.
      clock = time.clock() # Tracks FPS.

      For color tracking to work really well you should ideally be in a very, very,

      very, controlled enviroment where the lighting is constant...

      green_threshold =(63, 38, 15, -65, -11, -112)
      red_threshold =(41, 13, -78, -13, -24, 72)
      blue_threshold =(10, 36, -18, 17, -19, 13)
      size_threshold = 10000
      x_pid = PID(p=0.5, i=1, imax=100)
      h_pid = PID(p=0.05, i=0.1, imax=50)

      def find_max(blobs):
      max_size=0
      for blob in blobs:
      if blob[2]*blob[3] > max_size:
      max_blob=blob
      max_size = blob[2]*blob[3]
      return max_blob

      You may need to tweak the above settings for tracking green things...

      Select an area in the Framebuffer to copy the color settings.

      while True:
      if(uart.any()):
      data = uart.readline()
      print("reseived:",data)
      if data.decode().startswith('a'):
      while(True):
      clock.tick() # Track elapsed milliseconds between snapshots().
      img = sensor.snapshot() # Take a picture and return the image.

                  blob1 = img.find_blobs([green_threshold])
                  blob2 = img.find_blobs([red_threshold])
                  blob3 = img.find_blobs([blue_threshold])
                  if blob1:
                      max_blob = find_max(blob1)
                      x_error = max_blob[5]-img.width()/2
                      h_error = max_blob[2]*max_blob[3]-size_threshold
                      print("x error: ", x_error)
                      '''
                      for b in blobs:
                          # Draw a rect around the blob.
                          img.draw_rectangle(b[0:4]) # rect
                          img.draw_cross(b[5], b[6]) # cx, cy
                      '''
                      img.draw_rectangle(max_blob[0:4]) # rect
                      img.draw_cross(max_blob[5], max_blob[6]) # cx, cy
                      x_output=x_pid.get_pid(x_error,1)
                      h_output=h_pid.get_pid(h_error,1)
                      print("h_output",h_output)
                      car.run(-h_output-x_output,-h_output+x_output)
                      print("a")
                  elif blob2:
                      max_blob = find_max(blob2)
                      x_error = max_blob[5]-img.width()/2
                      h_error = max_blob[2]*max_blob[3]-size_threshold
                      print("x error: ", x_error)
                      '''
                      for b in blobs:
                          # Draw a rect around the blob.
                          img.draw_rectangle(b[0:4]) # rect
                          img.draw_cross(b[5], b[6]) # cx, cy
                      '''
                      img.draw_rectangle(max_blob[0:4]) # rect
                      img.draw_cross(max_blob[5], max_blob[6])
                      uart.write("b")
                      time.sleep(1000)
                      uart.write("c")
                      print("10")
                      time.sleep(3000)
                      print("11")
                      #for i in range(100000):
                      car.run(30,-30)
      
                  elif blob3:
                      max_blob = find_max(blob3)
                      #x_error = max_blob[5]-img.width()/2
                      #h_error = max_blob[2]*max_blob[3]-size_threshold
                      print("x error: ", x_error)
                      '''
                      for b in blobs:
                          # Draw a rect around the blob.
                          img.draw_rectangle(b[0:4]) # rect
                          img.draw_cross(b[5], b[6]) # cx, cy
                      '''
                      #img.draw_rectangle(max_blob[0:4]) # rect
                      #img.draw_cross(max_blob[5], max_blob[6])
                      print("T")
                      car.run(0,0)
                      break
                  else:
                      car.run(30,-30)
                      print("b")
          else:
                  car.run(0,0)
      else:
          car.run(0,0)
      发布在 OpenMV Cam
      6
      6f4a
    • UnicodeError

      ox00oxoo...UnicodeError么解决

      发布在 OpenMV Cam
      6
      6f4a
    • 与51通讯

      读取51的字符用那个函数

      发布在 OpenMV Cam
      6
      6f4a