导航

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

    otpm

    @otpm

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

    otpm 关注

    otpm 发布的帖子

    • RE: 如何在色块识别的框的范围内进行颜色替换?

      @kidswong999 在 如何在色块识别的框的范围内进行颜色替换? 中说:

      img.flood_fill要在你画线画框函数的上面。看我的代码。

      搞定,谢谢

      发布在 OpenMV Cam
      O
      otpm
    • 180°翻转摄像头后,热成像图像没有翻转

      1_1561021334417_QQ截图20190620165456.png 0_1561021334415_QQ截图20190620165445.png
      如图,热成像区域和实际显示的手部区域是镜像是反的
      我想把热成像区域翻转一下

      # MLX90621 Overlay Demo
      #
      # This example shows off how to overlay a heatmap onto your OpenMV Cam's
      # live video output from the main camera.
      
      import sensor, image, time, fir
      
      ALT_OVERLAY = False # Set to True to allocate a second ir image.
      
      sensor.reset()
      sensor.set_hmirror(True)
      sensor.set_vflip(True)
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      
      # Initialize the thermal sensor
      fir.init(type=fir.FIR_MLX90621)
      
      # Allocate another frame buffer for smoother video.
      extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
      
      # FPS clock
      clock = time.clock()
      
      while (True):
          clock.tick()
      
          # Capture an image
          img = sensor.snapshot()
      
          # Capture FIR data
          #   ta: Ambient temperature
          #   ir: Object temperatures (IR array)
          #   to_min: Minimum object temperature
          #   to_max: Maximum object temperature
          ta, ir, to_min, to_max = fir.read_ir()
      
          if not ALT_OVERLAY:
              # Scale the image and belnd it with the framebuffer
              fir.draw_ir(img, ir)
          else:
              # Create a secondary image and then blend into the frame buffer.
              extra_fb.clear()
              fir.draw_ir(extra_fb, ir, alpha=256)
              img.blend(extra_fb, alpha=128)
      
          # Draw ambient, min and max temperatures.
          #img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0), mono_space = False)
          #img.draw_string(8, 8, "To min: %0.2f C" % to_min, color = (255, 0, 0), mono_space = False)
          #img.draw_string(8, 16, "To max: %0.2f C"% to_max, color = (255, 0, 0), mono_space = False)
      
          # Force high quality streaming...
          img.compress(quality=90)
      
          # Print FPS.
          print(clock.fps())
      
      
      发布在 OpenMV Cam
      O
      otpm
    • 测距模块和串口通信冲突怎么办?

      我想把测距模块返回的距离通过TXRX串口传给Arduino,可是报错Errno 19: ENODEV

      from pyb import UART,Servo
      from machine import I2C
      from vl53l1x import VL53L1X
      uart = UART(3, 9600, timeout_char=1000)
      i2c=I2C(2)#初始化
      juli=VL53L1X(i2c)
      while(True):
              distance = int(juli.read()/10)#K/Lm
              uart.write(send_data)
              print(distance)
      
      发布在 OpenMV Cam
      O
      otpm
    • RE: 如何在色块识别的框的范围内进行颜色替换?

      @kidswong999 在 如何在色块识别的框的范围内进行颜色替换? 中说:

      max_blob=find_max(blobs)
      img.flood_fill(max_blob.cx(), max_blob.cy(), seed_threshold=0.2, floating_thresholds=1, color=(255, 255, 0), invert=False, clear_background=False)
      

      0_1560930374419_QQ截图20190619154549.png
      这我也试过了,这样就只有中心点是一个黄色的点,我是想把整个红色瓶盖换成别的颜色

      发布在 OpenMV Cam
      O
      otpm
    • 如何在色块识别的框的范围内进行颜色替换?

      2_1560836694881_QQ截图20190618134312.png 1_1560836694880_QQ截图20190618134305.png 0_1560836694878_QQ截图20190618134252.png

      思路是先识别色块,然后在框内进行flood_fill的操作
      我想完成图1的效果,但是经常出现图2图3的样子

      我试过将flood_fill的(x,y)替换成色块识别的中心点,但是这样就没法填充了
      以下是代码:

      # 洪水填充
      #
      # 此示例显示图像中的洪水填充区域。
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...
      sensor.set_framesize(sensor.QVGA) # or QQVGA...
      sensor.skip_frames(time = 2000)
      sensor.set_auto_whitebal(False);
      
      
      print("Learning thresholds...")
      threshold = (58, 91, 20, 60, -15, 18)
      
      
      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):
      
          # seed_threshold controls the maximum allowed difference between
          # the initial pixel and any filled pixels. It's important to
          # set this such that flood fill doesn't fill the whole image.
      
          # floating_threshold controls the maximum allowed difference
          # between any two pixels. This can easily fill the whole image
          # with even a very low threshold.
      
          # flood_fill will fill pixels that both thresholds.
      
          # You can invert what gets filled with "invert" and clear
          # everything but the filled area with "clear_background".
      
          #从中心点开始寻找,(x,y)即为Initial pixel
          x = sensor.width()//2
          y = sensor.height()//2
          img = sensor.snapshot()#从摄像头snapshot图像
          blobs=img.find_blobs([threshold], pixels_threshold=100, area_threshold=100, merge=True, margin=10)
          if blobs:
              #寻找最大物体
              max_blob=find_max(blobs)
              #设定ROI范围为最大物体的框
              roi=img.draw_rectangle(max_blob.rect())
              #在框中心点画十字
              img.draw_cross(max_blob.cx(), max_blob.cy())
              #x=max_blob.cx()
              #y=max_blob.cy()
              #在ROI中进行填充
              roi.flood_fill(x, y, seed_threshold=0.2, floating_thresholds=1, color=(255, 255, 0), invert=False, clear_background=False)
      
      发布在 OpenMV Cam
      O
      otpm