导航

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

    bpye 发布的帖子

    • 官方例程里面有一个灰度巡线程序,根据寻到线之后产生一个角度,请提供根据角度控制小车巡线的程序。谢谢

      0_1740984219231_灰度巡线.png

      发布在 OpenMV Cam
      B
      bpye
    • 根据寻到产生一个角度,但后面没有循线的过程,没有告诉小车怎么做,后面的这段程序在哪里,我想看一下效果,谢谢。
      
      # This work is licensed under the MIT license.
      # Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
      # https://github.com/openmv/openmv/blob/master/LICENSE
      #
      # Black Grayscale Line Following Example
      #
      # Making a line following robot requires a lot of effort. This example script
      # shows how to do the machine vision part of the line following robot. You
      # can use the output from this script to drive a differential drive robot to
      # follow a line. This script just generates a single turn value that tells
      # your robot to go left or right.
      #
      # For this script to work properly you should point the camera at a line at a
      # 45 or so degree angle. Please make sure that only the line is within the
      # camera's field of view.
      
      import sensor
      import time
      import math
      
      # Tracks a black line. Use [(128, 255)] for a tracking a white line.
      GRAYSCALE_THRESHOLD = [(0, 64)]
      
      # Each roi is (x, y, w, h). The line detection algorithm will try to find the
      # centroid of the largest blob in each roi. The x position of the centroids
      # will then be averaged with different weights where the most weight is assigned
      # to the roi near the bottom of the image and less to the next roi and so on.
      ROIS = [  # [ROI, weight]
          (0, 100, 160, 20, 0.7),  # You'll need to tweak the weights for your app
          (0, 50, 160, 20, 0.3),  # depending on how your robot is setup.
          (0, 0, 160, 20, 0.1),
      ]
      
      # Compute the weight divisor (we're computing this so you don't have to make weights add to 1).
      weight_sum = 0
      for r in ROIS:
          weight_sum += r[4]  # r[4] is the roi weight.
      
      # Camera setup...
      sensor.reset()  # Initialize the camera sensor.
      sensor.set_pixformat(sensor.GRAYSCALE)  # use grayscale.
      sensor.set_framesize(sensor.QQVGA)  # use QQVGA for speed.
      sensor.skip_frames(time=2000)  # Let new settings take affect.
      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()  # Tracks FPS.
      
      while True:
          cl
      
      
      发布在 OpenMV Cam
      B
      bpye