导航

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

    17759718141

    @17759718141

    2
    声望
    16
    楼层
    1399
    资料浏览
    1
    粉丝
    0
    关注
    注册时间 最后登录

    17759718141 关注

    17759718141 发布的帖子

    • 为什么我openmv控制舵机不能动,请问这个是什么问题,还有就是我这个程序要怎么控制离物体很近的时候稳定刹车而不是倒退

      Blob Detection Example

      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.

      import sensor, image, time
      import car
      from pid import PID
      from pyb import Servo

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

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

      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(10)
      sensor.set_auto_gain(False)
      sensor.set_auto_whitebal(False)
      sensor.set_auto_exposure(False,2000)#这里设置曝光时间

      #sensor.skip_frames(time = 2000)

      s3 = Servo(3) # servo on position 1 (P9)

      clock = time.clock()

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

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

      red_threshold = (17, 50, -40, 110, 34, 127)
      size_threshold = 2500
      x_pid = PID(p=3, i=1, imax=100)
      h_pid = PID(p=0.03, 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
      while(True):
      s3.angle(90) # move to 90 degrees
      clock.tick() # Track elapsed milliseconds between snapshots().
      img = sensor.snapshot() # Take a picture and return the image.

      blobs = img.find_blobs([red_threshold])
      if blobs:
          max_blob = find_max(blobs)
          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-50,-h_output+x_output-50)
      
      else:
          s3.angle(-90) # move to -90 degrees
          car.run(500,-500)
      发布在 OpenMV Cam
      1
      17759718141
    • RE: 关于openmv画质偏白,和图像大小问题

      这个size=2000是指多大?还有就是画质偏白怎么调整曝光度?0_1531801337555_CDKWF{QUNDTMH285EC2.png

      发布在 OpenMV Cam
      1
      17759718141
    • 关于openmv画质偏白,和图像大小问题

      请问一下openmv看到的图像画质偏白我设置的阈值是红色的,经常受白光影响,0_1531801155843_CDKWF{QUNDTMH285QEC2.png 要调整哪些参数?还有就是追小球的例程里面size=2000是指多大?怎么算的0_1531801164029_J8%)CWM%39WEA%3)VBIE4GK.png

      发布在 OpenMV Cam
      1
      17759718141
    • RE: 关于openmv颜色识别的问题

      @yuan 大神帮忙看看,墙壁是白色,但是摄像头可以识别到,我阈值设定是红色的,我是根据一个红色信标灯调的阈值。

      发布在 OpenMV Cam
      1
      17759718141
    • RE: 关于openmv颜色识别的问题

      0_1529714637046_}0DR97KGCS`PXIVI6T9I5QJ.png @yuan 墙壁是红色的

      发布在 OpenMV Cam
      1
      17759718141
    • RE: 关于openmv颜色识别的问题

      import sensor, image, time
      import json
      from pyb import UART

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

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

      red_threshold = (100, 92, 104, -5, -7, 94)

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

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

      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_whitebal(False) # turn this off.
      clock = time.clock() # Tracks FPS.

      uart = UART(3, 115200)

      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

      while(True):
      clock.tick() # Track elapsed milliseconds between snapshots().
      img = sensor.snapshot() # Take a picture and return the image.

      blobs = img.find_blobs([red_threshold])
      if blobs:
          max_blob = find_max(blobs)
          print('sum : %d'% len(blobs))
          data=[]
          for b in blobs:
              # Draw a rect around the blob.
              img.draw_rectangle(max_blob[0:4]) # rect
              img.draw_cross(max_blob[5], max_blob[6]) # cx, cy
              data.append((b.cx(),b.cy()))
      
          #{(1,22),(-3,33),(22222,0),(9999,12),(0,0)}
          data_out = json.dumps(set(data))
          uart.write(data_out +'\n')
          print(data_out)
      else:
          print("not found!")
      发布在 OpenMV Cam
      1
      17759718141
    • OPENMV怎么用SPI通信发送色块坐标给arduino

      OPENMV怎么用SPI通信发送色块坐标给arduino,串口通信太慢了,想用SPI但是不知道怎么解析,有大神有参考程序吗?

      发布在 OpenMV Cam
      1
      17759718141
    • 关于openmv颜色识别的问题

      OPENMV识别红色的时候会有问题,看见墙壁也是红色,请问大神们这个是镜头的问题还是程序的问题?我是用来识别红色的灯

      发布在 OpenMV Cam
      1
      17759718141
    • RE: 关于openmv与arduino串口通信控制小车的问题

      @kidswong999 0_1522979398901_e037f58a-4bd1-4dd0-ad6d-682a2f052b43-image.png 传回来是这这些数值,我不知道怎么对这些数值进行计算

      发布在 OpenMV Cam
      1
      17759718141
    • RE: 关于openmv与arduino串口通信控制小车的问题

      @kidswong999 就是openmv通过串口发送给arduino的数据是数组,我在arduino要怎么写程序提取这些数值并且计算

      发布在 OpenMV Cam
      1
      17759718141