找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

搜索
MakerMare-创客海社区 门户 查看主题

2017四轴飞行器-第五讲(2)四轴飞行器之openmv定点

发布者: 凡哥 | 发布时间: 2019-3-9 05:00 PM| 查看数: 637| 评论数: 3|帖子模式

目前支持微信扫码直接登陆 或邮箱验证注册登陆,结交更多好友,享用更多功能,让你轻松玩转社区!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
QQ截图20190309170319.png

最新评论

150432 发表于 2019-4-22 17:03:23
请问我用openmv在对圆形区域进行颜色识别,控制飞行器降落。在openmv里程序怎么写?能不能有代码参考,我有思路,但pathon不熟,来不及细学,急!
凡哥 发表于 2019-4-23 12:31:05
凡哥 发表于 2019-4-23 12:32:02
[Python] 纯文本查看 复制代码
# Find Circles Example
#
# This example shows off how to find circles in the image using the Hough
# Transform. [url]https://en.wikipedia.org/wiki/Circle_Hough_Transform[/url]
#
# Note that the find_circles() method will only find circles which are completely
# inside of the image. Circles which go outside of the image/roi are ignored...

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot().lens_corr(1.8)

    # Circle objects have four values: x, y, r (radius), and magnitude. The
    # magnitude is the strength of the detection of the circle. Higher is
    # better...

    # `threshold` controls how many circles are found. Increase its value
    # to decrease the number of circles detected...

    # `x_margin`, `y_margin`, and `r_margin` control the merging of similar
    # circles in the x, y, and r (radius) directions.

    # r_min, r_max, and r_step control what radiuses of circles are tested.
    # Shrinking the number of tested circle radiuses yields a big performance boost.

    for c in img.find_circles(threshold = 2000, 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)

    print("FPS %f" % clock.fps())