导航

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

    2yu5

    @2yu5

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

    2yu5 关注

    2yu5 发布的帖子

    • 串口数据传输速度太慢怎么提高速度呢?
      # Edge Impulse - OpenMV Image Classification Example
      
      import sensor, image, time, os, tf
      from pyb import UART
      import json
      
      
      sensor.reset()                         # Reset and initialize the sensor.
      sensor.set_pixformat(sensor.RGB565)    # Set pixel format to RGB565 (or GRAYSCALE)
      sensor.set_framesize(sensor.QVGA)      # Set frame size to QVGA (320x240)
      sensor.set_windowing((240, 240))       # Set 240x240 window.
      sensor.skip_frames(time=2000)          # Let the camera adjust.
      
      net = "trained.tflite"#调用神经网络模型
      labels = [line.rstrip('\n') for line in open("labels.txt")]
      color_threshold = [(0, 100, 19, 127, -9, 127)]#红色色块提取
      uart = UART(3, 115200)#串口通信
      
      def zfl(s, width):
          return '{:0>{w}}'.format(s, w=width)
      
      def find_max(blobs):
          max_pixels=0
          for blob in blobs:
              if blob[4] > max_pixels:
                  max_blob=blob
                  max_pixels = blob[4]
          return max_blob
      
      clock = time.clock()
      while(True):
          clock.tick()
      
          img = sensor.snapshot()
          blobs = img.find_blobs(color_threshold,pixels_threshold=100, area_threshold=10)
          #色块提取,确定roi区域
          if blobs:
              max_blob = find_max(blobs)
              x = max_blob.x()
              y = max_blob.y()
              w = max_blob.w()
              h = max_blob.h()
              thresholds = (x,y,w,h)
              #获取图像xy伸缩率,float形式
              x_change = 240.0/w
              y_change = 240.0/h
              #中心位置转为4位字符串形式
              X = zfl(str(max_blob.cx()),4)
              Y = zfl(str(max_blob.cy()),4)
              #图像roi区域复制,便于之后操作
              img = img.crop(roi=thresholds,x_scale=x_change,y_scale=y_change,copy_to_fb=True)
              #神经网络判别并输出,置信度70%
              for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):
       #           print("----------" )
                  predictions_list = list(zip(labels, obj.output()))
                  for i in range(len(predictions_list)):
                      if (predictions_list[i][1] > 0.6):#相似度达到60%以上认为是
                          output_str = 'AB'+X+Y
                          print("%s"%(predictions_list[i][0]))
      
                          uart.write(output_str)
                          print(output_str)
                          print(clock.fps()) 
      

      输出的fps只有3.5,我需要fps至少为20,怎么提高传输的速度呢?0_1620800958864_微信图片_20210512142902.png

      发布在 OpenMV Cam
      2
      2yu5
    • RE: 与ros串口传输数据乱码

      已经解决了,是地线连接不稳导致经常传输/0xff这种数据

      发布在 OpenMV Cam
      2
      2yu5
    • RE: 与ros串口传输数据乱码

      传输失败的图片一致传不上来,一至报错,发不上来
      传输的类似\0xf1\0x8b\0xfe1u10068AB01511\0xfc\0xdeaBx1511068\0xff\0xf9这样的,我都不知道是什么,求求了,卡了两天了,哥哥姐姐们快回复我吧

      发布在 OpenMV Cam
      2
      2yu5
    • 与ros串口传输数据乱码
      import sensor, image, time, os, tf
      from pyb import UART
      import json
      
      
      sensor.reset()                         # Reset and initialize the sensor.
      sensor.set_pixformat(sensor.RGB565)    # Set pixel format to RGB565 (or GRAYSCALE)
      sensor.set_framesize(sensor.QVGA)      # Set frame size to QVGA (320x240)
      sensor.set_windowing((240, 240))       # Set 240x240 window.
      sensor.skip_frames(time=2000)          # Let the camera adjust.
      
      net = "trained.tflite"#调用神经网络模型
      labels = [line.rstrip('\n') for line in open("labels.txt")]
      color_threshold = [(0, 100, 12, 127, -9, 55)]#红色色块提取
      uart = UART(3, 115200)#串口通信
      
      def zfl(s, width):
          return '{:0>{w}}'.format(s, w=width)
      
      
      clock = time.clock()
      while(True):
          clock.tick()
      
          img = sensor.snapshot()
          #色块提取,确定roi区域
          for blob in img.find_blobs(color_threshold,pixels_threshold=100, area_threshold=10):
              x = blob.x()
              y = blob.y()
              w = blob.w()
              h = blob.h()
              thresholds = (x,y,w,h)
              #获取图像xy伸缩率,float形式
              x_change = 240.0/w
              y_change = 240.0/h
              #中心位置转为4位字符串形式
              x_t = str(blob.cx())
              y_t = str(blob.cy())
              X = zfl(str(blob.cx()),4)
              Y = zfl(str(blob.cy()),4)
              #图像roi区域复制,便于之后操作
              img = img.crop(roi=thresholds,x_scale=x_change,y_scale=y_change,copy_to_fb=True)
              #神经网络判别并输出,置信度70%
              for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):
       #           print("----------" )
                  predictions_list = list(zip(labels, obj.output()))
                  for i in range(len(predictions_list)):
                      if (predictions_list[i][1] > 0.6):#相似度达到60%以上认为是
                          output_str = 'AB'+X+Y
       #                   print("%s"%(predictions_list[i][0]))
                          #output_str = 'A'+'B'+'A'+x_t+y_t
                          uart.write(output_str)
                          print(output_str)
      

      0_1619772864413_QQ图片20210430165406.png
      print打印的都正常,通过TTL转USB串口传输之后就跟我想要的毫无干系了,出错的图片证明上传失败了,放在评论。。。。

      ![0_1619772901461_IMG_20210430_165113.jpg](正在上传 100%)

      发布在 OpenMV Cam
      2
      2yu5
    • RE: 特征点匹配过程中经常出现descriptors have different types!报错,怎么解决啊?

      0_1615708946287_QQ图片20210314155947.png

      发布在 OpenMV Cam
      2
      2yu5
    • 特征点匹配过程中经常出现descriptors have different types!报错,怎么解决啊?
      import sensor, image, time
      
      sensor.reset()
      sensor.set_contrast(3)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.RGB565)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      sensor.set_auto_gain(False, value=100)
      sensor.set_windowing((320, 240))
      
      
      def draw_keypoints(img, kpts):
          if kpts:
              print(kpts)
              img.draw_keypoints(kpts)
              img = sensor.snapshot()
              time.sleep_ms(1000)
      
      
      clock = time.clock()
      thresholds = (61, 255)
      
      
      while(True):
      
          clock.tick()
          kptsF = image.load_descriptor("kptsBF.orb")
          kptsC = image.load_descriptor("kptsBC.orb")
          img = sensor.snapshot()
          img.binary([(0, 100, 11, 127, -2, 30),(16, 57, -24, -12, -28, 3)])
          img.to_grayscale
          
          for blob in img.find_blobs([thresholds], pixels_threshold=50, merge=False):#10米处50cm大小约为13像素
              pixel = blob.pixels()
              kpts2 = img.find_keypoints(max_keypoints=150, threshold=1, normalized=True)
              if (pixel < 4900):#距离较远,图像不够清晰时
                  match = image.match_descriptor(kptsF, kpts2, threshold=85)
              elif (pixel > 4900):#距离较近,图像清晰时
                  match = image.match_descriptor(kptsC, kpts2, threshold=85)
                      
              if (match.count()>1):
                  print("matched:%d dt:%d  x:%d y:%d"%(match.count(), match.theta(),blob.w(), blob.h()))
      
      
      发布在 OpenMV Cam
      2
      2yu5