导航

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

    b2em 创建的帖子

    • B

      openmv的P9引脚外接了一个LED
      OpenMV Cam • • b2em

      4
      0
      赞同
      4
      楼层
      1553
      浏览

      大概改了一下代码: import sensor, image, time from pyb import UART,LED import pyb sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) # 灰度更快(160x120 max on OpenMV-M7) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) clock = time.clock() p = pyb.Pin("P9",pyb.Pin.OUT_PP) #p.high() #p.low() LED(1).on() LED(2).on() LED(3).on() while(True): clock.tick() img = sensor.snapshot() rects=img.find_rects(threshold = 15000) if rects: p.value(1) else: p.value(0) for r in rects: img.draw_rectangle(r.rect(), color = (255, 0, 0)) cx = r.x() + (r.w() // 2) cy = r.y() + (r.h() // 2) img.draw_line((80,60,cx,cy), color=(127)) img.draw_cross(cx ,cy) img.draw_cross(80 ,60) for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0)) print(cx,cy) print("FPS %f" % clock.fps())
    • B

      识别矩形如何提高识别精度
      OpenMV Cam • • b2em

      2
      0
      赞同
      2
      楼层
      1102
      浏览

      先用binary把矩形和背景分割出来,在黑白的图像上再调用img.find_rects
    • B

      openmv怎么发送负数?
      OpenMV Cam • • b2em

      2
      0
      赞同
      2
      楼层
      1069
      浏览

      用ustruct.pack。不管大端小端,signed 还是 unsigned,short还是int还是long还是long long还是float。
    • B

      如何计算摄像头中心与目标中心的夹角
      OpenMV Cam • • b2em

      4
      0
      赞同
      4
      楼层
      1685
      浏览

      因为不同的对焦情况,视角也有不同,所以你可以自己测量一下。
    • B

      openmv串口数据输出问题
      OpenMV Cam • • b2em

      5
      0
      赞同
      5
      楼层
      1973
      浏览

      B

      @kidswong999 import sensor, image, time, math from pyb import UART,LED import json import ustruct #white_threshold_01 = ((95, 100, -18, 3, -8, 4)); #白色阈值 red_threshold_01 = ((17, 67, 23, 71, -1, 45)); sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() red_led =LED(1) green_led =LED(2) blue_led=LED(3) uart = UART(3,500000) #定义串口3变量 uart.init(500000, bits=8, parity=None, stop=1) # init with given parameters def find_max(blobs): #定义寻找色块面积最大的函数 max_size=0 for blob in blobs: if blob.pixels() > max_size: max_blob=blob max_size = blob.pixels() return max_blob def USART_SendData(fx,dx,fy,dy): global uart; #frame=[0x2C,18,cx%0xff,int(cx/0xff),cy%0xff,int(cy/0xff),0x5B]; #data = bytearray(frame) data = ustruct.pack("<bbhhhhb", #格式为俩个字符俩个短整型(2字节) 0xFF, #帧头 0xFE, int(fx), # up sample by 4 #数据1 int(dx), int(fy), # up sample by 4 #数据2 int(dy), 0xFD) uart.write(data); #必须要传入一个字节数组 def recive_data(): global uart if uart.any(): tmp_data = uart.readline(); print(tmp_data) #mainloop while(True): clock.tick() # Track elapsed milliseconds between snapshots(). img = sensor.snapshot() # Take a picture and return the image. # pixels_threshold=100, area_threshold=100 blobs = img.find_blobs([red_threshold_01], area_threshold=150); cx=0;cy=0; if blobs: #如果找到了目标颜色 max_b = find_max(blobs); # Draw a rect around the blob. img.draw_rectangle(max_b[0:4]) # rect #用矩形标记出目标颜色区域 img.draw_cross(max_b[5], max_b[6]) # cx, cy img.draw_cross(160, 120) # 在中心点画标记 #在目标颜色区域的中心画十字形标记 cx=max_b[5]; cy=max_b[6]; img.draw_line((160,120,cx,cy), color=(127)); #img.draw_string(160,120, "(%d, %d)"%(160,120), color=(127)); img.draw_string(cx, cy, "(%d, %d)"%(cx,cy), color=(127)); fx=cx//10 fy=cy//10 dx=fx/10 dy=fy/10 USART_SendData(fx,dx,fy,dy) #发送点位坐 print('整数:%d '%fx,'余数:%d '%dx,'整数:%d '%fy,'余数:%d '%dy); time.sleep(5); recive_data(); blue_led.off() red_led.off() green_led.on() else: blue_led.off() green_led.off() red_led.on() if uart.any(): tmp_data = uart.readline(); blue_led.on() green_led.off() red_led.off()
    • B

      openmv输出十进制数据
      OpenMV Cam • • b2em

      2
      0
      赞同
      2
      楼层
      1049
      浏览

      你这么发就行。十进制,十六进制,只是进制,存储是一样的。
    • B

      openmv数据接收
      OpenMV Cam • • b2em

      4
      0
      赞同
      4
      楼层
      1631
      浏览

      我要看具体文档。
    • B

      openmv连接飞控怎么实现定点悬停
      OpenMV Cam • • b2em

      5
      0
      赞同
      5
      楼层
      1774
      浏览

      https://book.openmv.cc/example/18-MAVLink/mavlink-apriltags-landing-target.html https://book.openmv.cc/example/18-MAVLink/mavlink-opticalflow.html
    • B

      openmv读取代码的解码程序该怎么写?规范的格式是什么?
      OpenMV Cam • • b2em

      2
      0
      赞同
      2
      楼层
      1017
      浏览

      看不懂你的问题,你具体要做什么?