导航

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

    fe15

    @fe15

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

    fe15 关注

    fe15 发布的帖子

    • 这段代码哪里错了?

      想做一个图像识别,使其检测到汉字后在串行终端输出该汉字,但是程序报错

      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS
      sensor.reset()
      sensor.set_contrast(1)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.QQVGA)
      sensor.set_pixformat(sensor.GRAYSCALE)
      templates = ["/jin.pgm"] #保存多个模板
      clock = time.clock()
      while (True):
          clock.tick()
          img = sensor.snapshot()
          for t in templates:
              template = image.Image(t)
              r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
              if r:
                  img.draw_rectangle(r, color = (255,0,0))
                  print(t[1:4]) #打印模板名字
              if t in ['jin.pgm']
                 print('晋')
              else:
                 print("error")
      
      
      
      
      发布在 OpenMV Cam
      F
      fe15