Skip to content
Vision and graphics scripts useful for FIRST robotics teams
Branch: master
Clone or download
Latest commit a5b3034 Feb 23, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
robovision add overlays, manual calibration fix Feb 18, 2019
tests fix Jan 21, 2019
.gitignore new library version of code Nov 11, 2018
LICENSE bug fixes, add distance scripts Jan 25, 2019 bug fixes, add distance scripts Jan 25, 2019
README.rst readme fix Feb 24, 2019 new library version of code Nov 11, 2018
requirements.txt readme update, remove sphinx docs dir Feb 24, 2019
setup.cfg fix Jan 21, 2019 add overlays, manual calibration fix Feb 18, 2019



Vision processing scripts useful for FIRST robotics teams and probably other purposes.

licence pythonver opencvver


Author: Tim Poulsen, mentor for Team 1518 Raider Robotics


The robovision library includes functions useful for the types of vision tasks typically involved in a FIRST robotics competition. The goal of this library is to reduce (and hide) some of the complexity involved with target identification, measuring, field orienteering, etc.

Some of the functions included:

  • Image acquisition from a web cam, IP cam (i.e. Axis cam), Raspberry Pi camera, or Jetson onboard gstreamer camera
  • Lens distortion removal based on the camera calibrations created with the provided script
  • Retroreflective target identification, contour finding, and geometry finding functions
  • Image resizing, equalization, brightness and contrast adjustments, and more
  • A preprocessor class, which enables you to set up a pipeline of functions that will be applied in series to an image.
  • Overlay arrows, text, borders, or crosshairs on images

The autocalibrate script is a camera calibration utility, which uses the OpenCV chessboard technique to determine lens parameters to be used for dewarping operations. If you prefer, there's a script that lets you adjust the various lens parameters until the image is visually correct.

Installation / Usage

The best way to install this is with pip:

$ pip install robovision

You can also clone the repo and install locally:

$ git clone
$ cd robovision
$ pip install -e .

Target environment

Our primary vision system is a Jetson TX2 board. I've done most of the development on a Mac OS X system, with some testing on an Ubuntu laptop. The scripts should work on a Raspberry Pi, but we haven't tested that yet. We don't intend to use or test on Windows systems, so your guess is as good as ours whether it will work there. (But feel free to make a pull request to add Windows compatibility.)

Our environment is:

  • Python 3.5.x (newer versions, and Anaconda works too)
  • OpenCV 3.4.x
  • Jetson TX2 running Ubuntu 16.04 and JetPack 3.2.1
  • Axis 206 IP camera
  • Onboard Jetson gstreamer camera
  • Microsoft Lifecam USB camera

Python 2.x is not supported.


import cv2
import robovision as rv

# create a video stream to our IP camera
source = ""
vs = rv.VideoStream(source="ipcam", ipcam_url=source)

# instantiate the targeting class and set the color range of
# the retroreflective tape
target = rv.Target()
target.set_color_range(lower=(80, 100, 100), upper=(90, 255, 255))

# start the video stream

cv2.namedWindow('CapturedImage', cv2.WINDOW_NORMAL)

while True:
    frame = vs.read_frame()
    contours = target.find_contours(frame)
    if len(contours) > 0:
        cv2.drawContours(frame, contours, -1, (0, 0, 255), 3)
        print('angle {}'.format(target.get_skew_angle(contours[0])))
    cv2.imshow('CapturedImage', frame)
    # wait for Esc or q key and then exit
    key = cv2.waitKey(1) & 0xFF
    if key == 27 or key == ord("q"):

See the wiki for more information.


Contributions are welcome! Feel free to open a pull request. Or, open an issue if you find something that doesn't work (which is probably a lot!).


MIT License

Copyright (c) 2019, Tim Poulsen, All rights reserved.

You can’t perform that action at this time.