导航

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

    mvlf

    @mvlf

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

    mvlf 关注

    mvlf 发布的帖子

    • LAB值中的L在阈值中的设置是如何设置的呢具体设置最大值和最小值是什么意思呢

      🙏 🙏 🙏

      发布在 OpenMV Cam
      M
      mvlf
    • 这是寻找最大色块的程序,电脑连上摄像头以后大部分时候识别不到,偶尔能识别到

      import sensor, image, time, math
      import json
      from pyb import Pin, Timer
      #屏幕 320*240
      height = 120
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      #sensor.set_windowing(320,240))
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      red_block_x=1
      green_block_x=2
      blue_block_x=3

      message=000

      #lcd.init() # Initialize the lcd screen.

      threshold_index = 0 # 0 for red, 1 for green, 2 for blue

      Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)

      The below thresholds track in general red/green/blue things. You may wish to tune them...

      thresholds = [(23, 55, 26, 64, -19, 42), # generic_red_thresholds
      (53, 74, -42, -7, -29, 2), # generic_green_thresholds
      (53, 76, -30, 40, -68, -27)] # generic_blue_thresholds
      objthresholds = [(61, 86, 11, 44, -33, 0), # generic_red_thresholds
      (34, 97, -11, -46, -52, 40), # generic_green_thresholds
      (69, 51, 5, 44, -29, -50)] # generic_blue_thresholds

      graythreshold=[(100,255)]

      K=5000
      while(True):

      clock.tick()
      
      light = Timer(2, freq=1800).channel(1, Timer.PWM, pin=Pin("P6"))#ferq=50000
      light.pulse_width_percent(2)#30
      if(C_led):
          light.pulse_width_percent(2)#30
      # 控制亮度 0~100##############################################
      CS_flag=1
      
      img = sensor.snapshot()
      
      if(CS_flag):
          #light = Timer(2, freq=1800).channel(1, Timer.PWM, pin=Pin("P6"))#ferq=50000
          #light.pulse_width_percent(2)#30
          clock.tick() # Track elapsed milliseconds between snapshots().
          img = sensor.snapshot() # Take a picture and return the image.
          blobs = img.find_blobs([thresholds[0],thresholds[1],thresholds[2]],x_stride=40,y_stride=40,pixels_threshold=1000)
          if blobs:
              data=[]
              max_blob = find_max(blobs)
              img.draw_cross(max_blob.cx(),max_blob.cy())
              img.draw_circle(max_blob.cx(),max_blob.cy(),max_blob.cx()-max_blob.x(), color = (255, 255, 255))
              X =int(max_blob.cx()-img.width()/2)
              Y =int(max_blob.cy()-img.height()/2)
              data.append((X,Y))
              data_out = json.dumps(set(data))
              uart.write('CS'+data_out +"\r\n")
              print(data_out)
              print("偏移坐标 : ",X, Y)
              #print("Y轴偏移坐标 : ",Y)
              #print("帧率 : ",clock.fps())
              CS_flag = 0
      发布在 OpenMV Cam
      M
      mvlf
    • RE: 示例的10-Color_Ttracking-blob_detection运行没有出现识别框

      @mvlf 还有阈值是设置正确了的

      发布在 OpenMV Cam
      M
      mvlf
    • 示例的10-Color_Ttracking-blob_detection运行没有出现识别框
      # Blob Detection Example
      #
      # 这个例子展示了如何使用find_blobs函数来查找图像中的颜色色块。这个例子特别寻找深绿色的物体。
      
      import sensor, image, time
      
      # 为了使色彩追踪效果真的很好,你应该在一个非常受控制的照明环境中。
      green_threshold   = (   0,   80,  -70,   -10,   -0,   30)
      # 设置绿色的阈值,括号里面的数值分别是L A B 的最大值和最小值(minL, maxL, minA,
      # maxA, minB, maxB),LAB的值在图像左侧三个坐标图中选取。如果是灰度图,则只需
      # 设置(min, max)两个数字即可。
      
      # 你可能需要调整上面的阈值来跟踪绿色的东西…
      # 在Framebuffer中选择一个区域来复制颜色设置。
      
      sensor.reset() # 初始化sensor
      
      sensor.set_pixformat(sensor.RGB565) # use RGB565.
      #设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种
      
      sensor.set_framesize(sensor.QQVGA) # 使用QQVGA的速度。
      #设置图像像素大小
      
      sensor.skip_frames(10) # 让新的设置生效。
      sensor.set_auto_whitebal(False) # turn this off.
      #关闭白平衡。白平衡是默认开启的,在颜色识别中,需要关闭白平衡。
      clock = time.clock() # 跟踪FPS帧率
      
      while(True):
          clock.tick() # 追踪两个snapshots()之间经过的毫秒数.
          img = sensor.snapshot() # 拍一张照片并返回图像。
      
          blobs = img.find_blobs([green_threshold])
          #find_blobs(thresholds, invert=False, roi=Auto),thresholds为颜色阈值,
          #是一个元组,需要用括号[ ]括起来。invert=1,反转颜色阈值,invert=False默认
          #不反转。roi设置颜色识别的视野区域,roi是一个元组, roi = (x, y, w, h),代表
          #从左上顶点(x,y)开始的宽为w高为h的矩形区域,roi不设置的话默认为整个图像视野。
          #这个函数返回一个列表,[0]代表识别到的目标颜色区域左上顶点的x坐标,[1]代表
          #左上顶点y坐标,[2]代表目标区域的宽,[3]代表目标区域的高,[4]代表目标
          #区域像素点的个数,[5]代表目标区域的中心点x坐标,[6]代表目标区域中心点y坐标,
          #[7]代表目标颜色区域的旋转角度(是弧度值,浮点型,列表其他元素是整型),
          #[8]代表与此目标区域交叉的目标个数,[9]代表颜色的编号(它可以用来分辨这个
          #区域是用哪个颜色阈值threshold识别出来的)。
          if blobs:
          #如果找到了目标颜色
              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
                  #在目标颜色区域的中心画十字形标记
                  print(b[5], b[6])
                  #输出目标物体中心坐标
      
              print(clock.fps()) # 注意: 当连接电脑后,OpenMV会变成一半的速度。当不连接电脑,帧率会增加。
      
      发布在 OpenMV Cam
      M
      mvlf
    • 怎么解决出现ImportError: no module named 'Icd'

      0_1724845671894_QQ20240828-192454.png

      发布在 OpenMV Cam
      M
      mvlf