Navigation

    • Login
    • Search
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. Home
    2. a2bm
    A
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    • mipush

    a2bm

    @a2bm

    0
    Reputation
    7
    Posts
    52
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Location 浙江

    a2bm Follow

    Posts made by a2bm

    • 识别二维码,之后进行判断

      我想先进行识别二维码,扫描出二维码的内容之后根据内容进行判断应该如何写

      import sensor, image,pyb,time
      from pyb import UART
      from pyb import Pin
      uart = UART(3, 9600)
      led1 = pyb.LED(1)
      led2 = pyb.LED(2)
      led3 = pyb.LED(3)
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7...
      sensor.skip_frames(30)
      sensor.set_auto_gain(False) # must turn this off to prevent image washout...
      
      while(True):
             img = sensor.snapshot()
             img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
             for code in img.find_qrcodes():
               xingxi = code.payload()
               print(xingxi)
               uart.write(xingxi)
      
      
      
      
      

      这是代码,例如:识别出二维码内容是123+123,让红灯亮,识别出内容321+321让绿灯亮。判断的程序应该怎么写

      posted in OpenMV Cam
      A
      a2bm
    • RE: 识别颜色的时候加上led灯,会出现花屏

      而且帧率会特别低

      posted in OpenMV Cam
      A
      a2bm
    • 识别颜色的时候加上led灯,会出现花屏

      这是代码

      import sensor, image, time,pyb
      
      red_threshold   = (85, 25, 93, 16, 42, 21)
      blue_threshold = (52, 61, -128, 10, -118, -23)
      green_threshold = (9, 53, -49, -7, -8, 11)
      # 设置绿色的阈值,括号里面的数值分别是L A B 的最大值和最小值(minL, maxL, minA,
      # maxA, minB, maxB),LAB的值在图像左侧三个坐标图中选取。如果是灰度图,则只需
      # 设置(min, max)两个数字即可。
      
      # 你可能需要调整上面的阈值来跟踪绿色的东西…
      # 在Framebuffer中选择一个区域来复制颜色设置。
      
      led1 = pyb.LED(1)#红色
      led2 = pyb.LED(2)#绿色
      led3 = pyb.LED(3)#蓝色
      
      sensor.reset() 
      sensor.set_pixformat(sensor.RGB565) 
      sensor.set_framesize(sensor.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([red_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
                  #用矩形标记出目标颜色区域
                  led1.on()               
                  time.sleep(300)
                  led1.off()               
                  time.sleep(300) 
      
      
              
      
      

      有时候会出现花屏0_1607655826941_3228babb-4ea7-439e-9efa-7869951a8bdd-image.png

      posted in OpenMV Cam
      A
      a2bm
    • 特征点检测检测份特征点,输出不同的信号

      我现在需要检测多份特征点,检测到不同的特征点时候输出不同的信号,应该怎么做一共6份特征点0_1607515777527_2720f7b5-1267-41ca-93d9-0e1124087fdc-image.png

      比如检测到4号特征点给一种信号,检测到5号特征点给另外一种信号。

      posted in OpenMV Cam
      A
      a2bm
    • 模板匹配中出现报错zzzz

      在模板匹配里面0_1605944481089_12dc6790-395c-4b38-8583-d1a2841f4241-image.png

      # Template Matching Example - Normalized Cross Correlation (NCC)
      #
      # This example shows off how to use the NCC feature of your OpenMV Cam to match
      # image patches to parts of an image... expect for extremely controlled enviorments
      # NCC is not all to useful.
      #
      # WARNING: NCC supports needs to be reworked! As of right now this feature needs
      # a lot of work to be made into somethin useful. This script will reamin to show
      # that the functionality exists, but, in its current state is inadequate.
      
      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS
      #从imgae模块引入SEARCH_EX和SEARCH_DS。使用from import仅仅引入SEARCH_EX, 
      #SEARCH_DS两个需要的部分,而不把image模块全部引入。
      
      # Reset sensor
      sensor.reset()
      
      # Set sensor settings
      sensor.set_contrast(1)
      sensor.set_gainceiling(16)
      # Max resolution for template matching with SEARCH_EX is QQVGA
      sensor.set_framesize(sensor.QQVGA)
      # You can set windowing to reduce the search image.
      #sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
      sensor.set_pixformat(sensor.GRAYSCALE)
      
      # Load template.
      # Template should be a small (eg. 32x32 pixels) grayscale image.
      template = image.Image("/N.pgm")
      #加载模板图片
      
      clock = time.clock()
      
      # Run template matching
      while (True):
          clock.tick()
          img = sensor.snapshot()
      
          # find_template(template, threshold, [roi, step, search])
          # ROI: The region of interest tuple (x, y, w, h).
          # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
          # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
          #
          # Note1: ROI has to be smaller than the image and bigger than the template.
          # Note2: In diamond search, step and ROI are both ignored.
          r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
          #find_template(template, threshold, [roi, step, search]),threshold中
          #的0.7是相似度阈值,roi是进行匹配的区域(左上顶点为(10,0),长80宽60的矩形),
          #注意roi的大小要比模板图片大,比frambuffer小。
          #把匹配到的图像标记出来
          if r:
              img.draw_rectangle(r)
      
          print(clock.fps())
      
      

      会显示错误0_1605944536226_647f7905-d40d-441b-893e-a5bc68e48143-image.png

      posted in OpenMV Cam
      A
      a2bm
    • openMV4 H7

      openMV4 H7在使用过程中用一会就发热了,是正常情况吗

      posted in OpenMV Cam
      A
      a2bm
    • openMV4 H7一个接口是usb接口,另外一个是干什么的?

      openMV4 H7一个接口是usb接口,另外一个是干什么的?

      posted in OpenMV Cam
      A
      a2bm