导航

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

    zgir 发布的帖子

    • RE: 如何利用openmv识别红色激光点

      @fimw 同问,楼主解决了吗?

      发布在 OpenMV Cam
      zgir
    • OpenMV的标配镜头是不是可以滤掉太阳光的红外线?

      OpenMV的标配镜头是不是可以滤掉太阳光的红外线?
      0_1564970227907_1564970195(1).png

      发布在 OpenMV Cam
      zgir
    • 那我滤光片应该选用哪个波长高透 哪个波长截止 尺寸要多大的滤光片?

      回复: 关于有助于消除环境光照影响的滤波方法

      发布在 OpenMV Cam
      zgir
    • RE: RGB565识别色块,帧率过低怎么办

      @lk3r 你可以给一下逻辑,当主控板给OpenMV发送某个数据即OpenMV接收到主控板发送的某个数据时,才发送数据给主控板

      发布在 OpenMV Cam
      zgir
    • RE: 我在运行识别矩形的例程时,发现rect.x()为负值,这是为什么?

      @kidswong999 请问大佬知不知道产生负值的原因?

      发布在 OpenMV Cam
      zgir
    • RE: RGB565识别色块,帧率过低怎么办

      @lk3r 灰度识别的是亮度,要看看你程序功能是否对亮度有要求

      发布在 OpenMV Cam
      zgir
    • 请问求出来的这个K是只适用于这个程序,还是适用于这个摄像头的所有与Tag有关程序?

      回复: Apriltag识别中,怎么定位/测距?输出的tx ty tz的单位是什么?怎么就得到实际的距离了?

      发布在 OpenMV Cam
      zgir
    • RE: 电脑上OpenMV驱动没有了,怎么安装?

      电脑连接上OpenMV可以识别OpenMV,可以在OpenMV IDE上运行程序,但是不能将程序导入OpenMV
      0_1564884452315_c7107004bc3fd9d9b5d871dc305c308.jpg 0_1564884524824_3e9d1790e373d27246996e4ce1184b8.jpg

      发布在 OpenMV Cam
      zgir
    • 电脑上OpenMV驱动没有了,怎么安装?

      昨天用着用着OpenMV突然不能打开OpenMv的文件夹,在设备管理器中也没有发现OpenMv的驱动,该怎么办?
      0_1564883913717_1564883736(1).png

      发布在 OpenMV Cam
      zgir
    • RE: 我在运行识别矩形的例程时,发现rect.x()为负值,这是为什么?

      @kidswong999 当我识别到多个举行时就会出现这负值
      如图
      0_1564802592483_1564802507(1).png

      硬件版本:
      0_1564802719896_IMG20190803112432.jpg
      是这个吧?

      怎么看固件版本啊?

      IDE版本
      0_1564803029523_1564802996(1).png

      发布在 OpenMV Cam
      zgir
    • 我在运行识别矩形的例程时,发现rect.x()为负值,这是为什么?

      我在运行识别矩形的例程时,发现rect.x(),rect.y()为负值,这是为什么?
      代码:

      # Find Rects Example
      #
      # This example shows off how to find rectangles in the image using the quad threshold
      # detection code from our April Tags code. The quad threshold detection algorithm
      # detects rectangles in an extremely robust way and is much better than Hough
      # Transform based methods. For example, it can still detect rectangles even when lens
      # distortion causes those rectangles to look bent. Rounded rectangles are no problem!
      # (But, given this the code will also detect small radius circles too)...
      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster (160x120 max on OpenMV-M7)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
      
          # `threshold` below should be set to a high enough value to filter out noise
          # rectangles detected in the image which have low edge magnitudes. Rectangles
          # have larger edge magnitudes the larger and more contrasty they are...
      
          for r in img.find_rects(threshold = 10000):
              img.draw_rectangle(r.rect(), color = (255, 0, 0))
              for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
              print(r)
      
          print("FPS %f" % clock.fps())
      
      

      运行结果:
      0_1564591849019_1564591586(1).png

      发布在 OpenMV Cam
      zgir
    • RE: 问题:TypeError:unsupported types for _and_:"float,int'该怎么解决?

      @kidswong999 刚刚我测了一下,var是int型

      发布在 OpenMV Cam
      zgir
    • 我在多文件编程时遇到了问题,求解答

      我在多文件编程时,想在find_circle_uart.py中调用Uart_Protocol.py时,遇到问题AttributeError:' module' object has no attribute ' Find Circular',应该怎么解决?
      问题截图:
      0_1564536252063_61c5fd9a-e052-45f6-b666-45a2ad2a2bc0-image.png

      代码如下:
      Uart_Protocol.py:

      import sensor, image, time
      
      def ExceptionVar(var):
          data = []
          data.append(0)
          data.append(0)
      
          if var == -1:
              data[0] = 0
              data[1] = 0
          else:
              data[0] = var & 0xFF
              data[1] = var >> 8
          return data
      
      
      Frame_Cnt = 0
      fCnt_tmp = [0,0]
      
      # FormType : 所识别的形状 Ps: 0: Cricle      -> 圆心坐标 -> 半径
      #                           1: Rectangle   -> 中心坐标 ->
      #                           2: Lines       -> 端点坐标(靠近(0,0)) -> 角度
      #                           3: LineSegment -> 端点坐标 -> 角度angle
      # FormType_X,FormType_Y : 坐标
      # FormType_Other : 其他
      def UART_Send(FormType, FormType_X, FormType_Y, FormType_Other):
          global Frame_Cnt
          global fCnt_tmp
          Frame_Head = [170,170]
          Frame_End = [85,85]
          fFormType_tmp = [FormType]
          Frame_Cnt += 1
      
          if Frame_Cnt > 65534 :
              FrameCnt = 0
      
          fHead = bytes(Frame_Head)
      
          fCnt_tmp[0] = Frame_Cnt & 0xFF
          fCnt_tmp[1] = Frame_Cnt >> 8
          fCnt = bytes(fCnt_tmp)
      
          fFormType = bytes(fFormType_tmp)
      
          fFormType_X = bytes(ExceptionVar(FormType_X))
          fFormType_Y = bytes(ExceptionVar(FormType_Y))
          fFormType_Other = bytes(ExceptionVar(FormType_Other))
      
          fEnd = bytes(Frame_End)
      
          FrameBuffe = fHead + fCnt + fFormType + fFormType_X + fFormType_Y + fFormType_Other + fEnd
      
          return FrameBuffe
      
      

      find_circle_uart.py:

      # 识别圆形
      
      # OpenMV识别图像中的圆形,并将圆形的坐标,半径通过串口
      
      # 发送给MSP432.
      
      # 串口发送的数据结构参考中科浩电的巡线例程
      
      
      
      import sensor, image, time, pyb
      import math
      import Uart_Protocol
      
      from pyb import UART
      from pyb import LED
      
      Led1 = pyb.LED(3) # 蓝灯
                        # Ps:pyb.LED(1):Red; pyb.LED(1):Green; pyb.LED(4):IR
      
      # 指示灯
      def LED_flicker():
          Led1.on()
          time.sleep(150)
          Led1.off()
          time.sleep(150)
      
      
      sensor.reset()
      
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      
      sensor.set_framesize(sensor.QQVGA)
      
      sensor.skip_frames(time = 2000)
      
      clock = time.clock()
      uart = UART(3, 115200)                         # i使用给定波特率初始化
      # uart.init(115200, bits=8, parity=None, stop=1, timeout_char=1000) # 使用给定参数初始化
      
      
      while(True):
      
          clock.tick()
      
          #lens_corr(1.8)畸变矫正
          img = sensor.snapshot().lens_corr(1.8)
      
          (X,Y,R) = Uart_Protocol.Find_Circular(img)
      
          print(X,Y,R)
      
          uart.write(Uart_Protocol.UART_Send_Circular(X,Y,R))
      
          print("FPS %f" % clock.fps())
      
      
      发布在 OpenMV Cam
      zgir
    • RE: 问题:TypeError:unsupported types for _and_:"float,int'该怎么解决?

      @kidswong999 应该怎么解决?把浮点型改为整型?

      发布在 OpenMV Cam
      zgir
    • 问题:TypeError:unsupported types for _and_:"float,int'该怎么解决?

      我在写程序时遇到问题TypeError:unsupported types for and:"float,int'该怎么解决?
      问题截图:
      0_1564407933123_59b55d1c-5804-43e8-80de-d26b8dfca830-image.png

      程序如下:

      
      import sensor, image, time, pyb
      import math
      
      from pyb import UART
      from pyb import LED
      
      Led1 = pyb.LED(3) # 蓝灯
                        # Ps:pyb.LED(1):Red; pyb.LED(1):Green; pyb.LED(4):IR
      
      enable_lens_corr = False # 使能畸变校正标志
                               # True: 允许畸变校正; False: 禁止畸变校正
      
      # 指示灯
      def LED_flicker():
          Led1.on()
          time.sleep(150)
          Led1.off()
          time.sleep(150)
      
      # 处理数据
      def ExceptionVar(var):
          data = []
          data.append(0)
          data.append(0)
      
          if var == -1:
              data[0] = 0
              data[1] = 0
          else:
              data[0] = var & 0xFF
              data[1] = var >> 8
          return data
      
      # 识别圆 -- 返回圆心坐标及半径(3)
      def Find_Circular(img):
          Formtype = 0xFF
          X = 0
          Y = 0
          R = 0
      
          enable_lens_corr = True
      
          if enable_lens_corr: img.lens_corr(1.8) # 适用于2.8mm镜头...
      
          for c in img.find_circles(threshold = 4000, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
              img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
      #        print(c.x())
              Circle_buffer = "[%d,%d,%d]"%(c.x(), c.y(), c.r())
      
              print(Circle_buffer)
              LED_flicker()
      
              X = c.x()
              Y = c.y()
              R = c.r()
              Formtype = 0
      
          return Formtype,X,Y,R
      
      # 识别矩形 -- 返回矩形中心点坐标(2)
      def Find_Rectangle(img):
          Formtype = 0xFF
          X = 0
          Y = 0
          W = 0
          H = 0
      
          for rects in img.find_rects():#roi=(0,0,80,120),threshold = 10000
              img.draw_rectangle(rects.rect(), color = (255, 0, 0))
              for p in rects.corners():
                  img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
      
              print(rects)
      
              Formtype = 1
              X = rects.x() + rects.w()/2
              Y = rects.y() + rects.h()/2
      #        W = rects.w()
              H = rects.h()
              rectBuffer = "[%d,%d]"%(X,Y)
              print(rectBuffer)
      
          return Formtype,X,Y,W
      
      # 识别直线 -- 返回端点坐标及角度angle(3)
      def Find_Lines(img):
          Formtype = 0xFF
          X = 0
          Y = 0
          Angle = 0
      
          min_degree = 0
          max_degree = 179
      
          if enable_lens_corr: img.lens_corr(1.8) # 适用于2.8mm镜头...
      
          for lines in img.find_lines(threshold = 1000, theta_margin = 25, rho_margin = 25):
              if (min_degree <= lines.theta()) and (lines.theta() <= max_degree):
                  img.draw_line(lines.line(), color = (255, 0, 0))
      
                  Formtype = 2
                  X = lines.x1()
                  Y = lines.y1()
                  Angle = lines.theta()
      
          return Formtype,X,Y,Angle
      
      # 识别线段 -- 返回端点坐标及角度angle(3)
      def Find_LineSegment(img):
          Formtype = 0xFF
          X = 0
          Y = 0
          Angle = 0
      
          if enable_lens_corr: img.lens_corr(1.8) # for 2.8mm lens...
      
          for linesegment in img.find_line_segments(merge_distance = 0, max_theta_diff = 5):
              img.draw_line(linesegment.line(), color = (255, 0, 0))
      
              print(linesegment)
      
              Formtype = 3
              X = linesegment.x1()
              Y = linesegment.y1()
              Angle = linesegment.theta()
      
          return Formtype,X,Y,Angle
      
      # 识别三角形
      def Find_Triangle(img):
      
          pass
      
      # 识别形状(圆,矩形,直线,线段,三角形(线段角度))
      def Find_Formtype(img):
      
          pass
      
      Frame_Cnt = 0
      fCnt_tmp = [0,0]
      
      # FormType : 所识别的形状 Ps: 0: Cricle      -> 圆心坐标 -> 半径
      #                           1: Rectangle   -> 中心坐标 ->
      #                           2: Lines       -> 端点坐标(靠近(0,0)) -> 角度
      #                           3: LineSegment -> 端点坐标 -> 角度angle
      # FormType_X,FormType_Y : 坐标
      # FormType_Other : 其他
      def UART_Send(FormType, FormType_X, FormType_Y, FormType_Other):
          global Frame_Cnt
          global fCnt_tmp
          Frame_Head = [170,170]
          Frame_End = [85,85]
          fFormType_tmp = [FormType]
          Frame_Cnt += 1
      
          if Frame_Cnt > 65534 :
              FrameCnt = 0
      
          fHead = bytes(Frame_Head)
      
          fCnt_tmp[0] = Frame_Cnt & 0xFF
          fCnt_tmp[1] = Frame_Cnt >> 8
          fCnt = bytes(fCnt_tmp)
      
          fFormType = bytes(fFormType_tmp)
      
          fFormType_X = bytes(ExceptionVar(FormType_X))
          fFormType_Y = bytes(ExceptionVar(FormType_Y))
          fFormType_Other = bytes(ExceptionVar(FormType_Other))
      
          fEnd = bytes(Frame_End)
      
          FrameBuffe = fHead + fCnt + fFormType + fFormType_X + fFormType_Y + fFormType_Other + fEnd
      
          return FrameBuffe
      
      
      sensor.reset()
      
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      
      sensor.set_framesize(sensor.QQVGA)
      
      sensor.skip_frames(time = 2000)
      
      clock = time.clock()
      uart = UART(3, 115200)                         # i使用给定波特率初始化
      # uart.init(115200, bits=8, parity=None, stop=1, timeout_char=1000) # 使用给定参数初始化
      
      while(True):
      
          clock.tick()
      
          #lens_corr(1.8)畸变矫正
          img = sensor.snapshot()
      
      #    (FormType,X,Y,R) = Find_Circular(img)
          (FormType,X,Y,W) = Find_Rectangle(img)
      #    (FormType,X,Y,Angle) = Find_Lines(img)
      #    (FormType,X,Y,Angle) = Find_LineSegment(img)
      
          if(FormType == 0):
              print(FormType,X,Y,R)
              uart.write(UART_Send(FormType,X,Y,R))
          elif(FormType == 1):
              print(FormType,X,Y,W)
              uart.write(UART_Send(FormType,X,Y,W))
          elif(FormType == 2):
              print(FormType,X,Y,Angle)
              uart.write(UART_Send(FormType,X,Y,Angle))
          elif(FormType == 3):
              print(FormType,X,Y,Angle)
              uart.write(UART_Send(FormType,X,Y,Angle))
      
      
          print("FPS %f" % clock.fps())
      
      
      
      发布在 OpenMV Cam
      zgir
    • OpenMv串口发送的数据是什么类型的?MSP432该怎么解析OpenMV发送的数据

      这是我写的openmv识别圆的程序,我想把识别到的圆的circle.x(),circle.y()通过串口发送给MSP432,我这个串口发送的是什么类型的数据?我用串口助手查看OpenMV发送的数据,发现全都是0,这是为什么呢?

      以下是我写的OpenMV代码:

      # 圆形检测例程
      
      #
      
      # 这个例子展示了如何用Hough变换在图像中找到圆。
      
      # https://en.wikipedia.org/wiki/Circle_Hough_Transform
      
      #
      
      # 请注意,find_circles()方法将只能找到完全在图像内部的圆。圈子之外的
      
      # 图像/ roi被忽略...
      
      
      
      import sensor, image, time, pyb
      from pyb import UART
      
      LED1 = pyb.LED(3)
      
      sensor.reset()
      
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      
      sensor.set_framesize(sensor.QQVGA)
      
      sensor.skip_frames(time = 2000)
      
      clock = time.clock()
      uart = UART(3, 9600, timeout_char=1000)                         # i使用给定波特率初始化
      uart.init(9600, bits=8, parity=None, stop=1, timeout_char=1000) # 使用给定参数初始化
      
      
      while(True):
      
          clock.tick()
      
      
      
          #lens_corr(1.8)畸变矫正
      
          img = sensor.snapshot().lens_corr(1.8)
      
      
          # Circle对象有四个值: x, y, r (半径), 和 magnitude。
          # magnitude是检测圆的强度。越高越好
      
          # roi 是一个用以复制的矩形的感兴趣区域(x, y, w, h)。如果未指定,
          # ROI 即图像矩形。操作范围仅限于roi区域内的像素。
          # (以左上角为原点)
      
          # x_stride 是霍夫变换时需要跳过的x像素的数量。若已知圆较大,可增加
          # x_stride 。(检测识别x方向大于x_stride个像素点的圆)
      
          # y_stride 是霍夫变换时需要跳过的y像素的数量。若已知直线较大,可增加
          # y_stride 。
      
          # threshold 控制从霍夫变换中监测到的圆。只返回大于或等于阈值的圆。
          # 应用程序的阈值正确值取决于图像。注意:一条圆的大小是组成圆所有
          # 索贝尔滤波像素大小的总和。
          # (如果检测到的圆多余实际,则调大阈值threshold;反之,调小阈值threshold)
      
          # x_margin 控制所检测的圆的合并。 圆像素为 x_margin 、 y_margin 和
          # r_margin的部分合并。
          #(若检测到的两个圆x方向间距小于x_margin个像素点则被合并)
      
          # y_margin 控制所检测的圆的合并。 圆像素为 x_margin 、 y_margin 和
          # r_margin 的部分合并。
      
          # r_margin 控制所检测的圆的合并。 圆像素为 x_margin 、 y_margin 和
          # r_margin 的部分合并。
      
          # r_min,r_max和r_step控制测试圆的半径。
          # 缩小测试圆半径的数量可以大大提升性能。
          # threshold = 3500比较合适。如果视野中检测到的圆过多,请增大阈值;
          # 相反,如果视野中检测到的圆过少,请减少阈值。
      
          for c in img.find_circles(threshold = 4000, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
      
              img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
      
              print(c.x())
      
              Circle_buffer = "[%d,%d,%d]"%(c.x(), c.y(), c.r())
      
              uart.write(Circle_buffer)
              uart.write("\r\n")
      
              LED1.on()
              time.sleep(150)
              LED1.off()
              time.sleep(100)
      
          print("FPS %f" % clock.fps())
      
      

      这是串口助手接收到的数据:
      0_1564239399789_1564236618(1).png

      发布在 OpenMV Cam
      zgir
    • 如何将OpenMV的数据存储到SD卡中?

      我将OpenMV与MSP432连接,OpenMV给MSP432传输数据,我想将OpenMV的数据保存到OpenMV的SD卡中,以方便我在系统运行结束后查看OpenMv的数据

      发布在 OpenMV Cam
      zgir
    • OpenMV中以下方法返回的参数单位是什么?

      0_1563846558747_微信图片_20190723094902.png
      circle.x()
      返回圆的x位置。
      circle.y)
      返回圆的y位置。
      circle.r()
      返回圆的半径。

      这里的圆的x,y位置和圆的半径的单位是什么?

      是多少个像素点?还是cm?

      发布在 OpenMV Cam
      zgir
    • RE: openmv3检测字母

      特征点检测不行吗?

      发布在 OpenMV Cam
      zgir