导航

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

    ckor

    @ckor

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

    ckor 关注

    ckor 发布的帖子

    • openmv接收数据无法修改阈值

      我使用电脑发送数据给openmv,修改颜色的阈值,串口返回值显示阈值修改成功了,但是实际上摄像头没有使用发送的阈值进行颜色识别,依旧使用的初始值,请问摄像头只是运行一次颜色识别的img.find_blobs吗?

      L_min=0#87     #0
      L_max=0#21    #100
      A_min=0#27   #-128
      A_max=0#93    #127
      B_min=0#-5   #-128
      B_max=0#92   #127
      red_threshold   = (L_min, L_max, A_min, A_max, B_min, B_max)
      
      def recive_data():
          global uart
          global L_max,A_min,B_max
          global L_min,A_max,B_min
      
          if uart.any():
              tmp_data = uart.readline().decode().strip().split(',')
              D_uart_0 = (tmp_data[0])
              D_uart_1 = (tmp_data[1])
              D_uart_d = int(tmp_data[2])
              D_uart_4 = (tmp_data[4])
              print(D_uart_0)
              print(D_uart_1)
              if D_uart_0=='L':
                  if D_uart_1=='I':
                      print(D_uart_d)
                      L_min=D_uart_d
                  else:
                      D_uart_1=='X'
                      print(D_uart_d)
                      L_max=D_uart_d
      
              if D_uart_0=='A':
                  if D_uart_1=='I':
                      print(D_uart_d)
                      A_min=D_uart_d
                  else:
                      D_uart_1=='X'
                      print(D_uart_d)
                      A_max=D_uart_d
      
              if D_uart_0=='B':
                  if D_uart_1=='I':
                      print(D_uart_d)
                      B_min=D_uart_d
                  else:
                      D_uart_1=='X'
                      print(D_uart_d)
                      B_max=D_uart_d
      while(True):
      red_blobs  =  img.find_blobs([red_threshold])
      
      发布在 OpenMV Cam
      C
      ckor
    • RE: 使用MV4 H7 PLUS,提示:RuntimeError:Capturn Failed:-4,需要重新连接,怎么解决?

      但是我用其他的openmv却能正常运行;
      报错的是:openmv4 cam h7 plus
      正常的是:openmv4 cam h7

      发布在 OpenMV Cam
      C
      ckor
    • RE: 使用MV4 H7 PLUS,提示:RuntimeError:Capturn Failed:-4,需要重新连接,怎么解决?

      0_1600570411486_48563dd8-5322-4b82-80cc-ba759c918e40-image.png

      发布在 OpenMV Cam
      C
      ckor
    • 使用MV4 H7 PLUS,提示:RuntimeError:Capturn Failed:-4,需要重新连接,怎么解决?
      import sensor, image, time, math,lcd,pyb
      from pyb import UART
      import json
      import ustruct
      
      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.RGB565)
      sensor.skip_frames(time = 2000)
      lcd.init()
      clock = time.clock()
      uart = UART(3,115200)   #定义串口3变量    P4 TX<-->PA10  P5 RX<-->PA9
      uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters
      
      find_threshold = (35, 9, -5, 6, 28, 13)
      
      def find_max(blobs): 
          blobs.sort(key=lambda x:x.pixels(),reverse=True);
          max_blob={}            
          length=len(blobs)
          if length>0:
              max_blob=blobs[0]
          return max_blob
      
      def sending_data(cx_max,cy_max):
          global uart;
          #frame=[0x2C,18,cx%0xff,int(cx/0xff),cy%0xff,int(cy/0xff),0x5B];
          #data = bytearray(frame)
          data = ustruct.pack("<bbhhb", 
                         0x2C,                       
                         0x12,                      
                         int(cx_max), # up sample by 4    
                         int(cy_max), # up sample by 4    
                         0x5B);
          uart.write(data); 
      
      while(True):
          clock.tick()
          lcd.display(sensor.snapshot()) 
          img = sensor.snapshot()#.lens_corr(1.3);
          #img.binary([binary_threshold], invert = 1)
          blobs = img.find_blobs([find_threshold],area_threshold=100,pixel_threshold=8000)
      
      
          if blobs:
              max_blob=find_max(blobs)
              img.draw_rectangle(max_blob.rect(),color=(0,0,255))
              img.draw_cross(max_blob.cx(), max_blob.cy(),color=(0,0,255))
              img.draw_cross(160, 120,color=(255,0,0)) # 在中心点画标记
              img.draw_line((160,120,max_blob.cx(),max_blob.cy()), color=(0,0,255));
              img.draw_circle(160, 120, 10, color = (255,0,0), thickness = 1, fill = False)
      
              xywh=max_blob.rect()
              print("xywh=",xywh)
              print("中心x坐标:",max_blob.cx(),"中心y坐标:",max_blob.cy())
              print("L =", 160 - max_blob.cx())
              print("H =", 120 - max_blob.cy())
              print("像素数量:",max_blob.pixels()) 
              print("\r\n")
              print(clock.fps())
      
      
      
      发布在 OpenMV Cam
      C
      ckor