Giter VIP home page Giter VIP logo

vision's Introduction

Logo

team 2521 team 2521 team 2521 team 2521

Usage

Before starting the program, you must install OpenCV >= v3.1.x along with the pip dependencies:

$ pip install -r requirements.txt

Then, you can run the program using:

$ python run.py

Full usage:

usage: run.py [-h] [-i IMAGE] [-s SOURCE] [-t TEAM] [-d] [-na MIN_AREA]
              [-xa MAX_AREA] [-nf MIN_FULL] [-xf MAX_FULL]
              [-l LOWER_COLOR [LOWER_COLOR ...]]
              [-u UPPER_COLOR [UPPER_COLOR ...]] [-tn] [-v]

Usage with Docker

If you are using Docker, the installation process is much easier.

Note: due to the sizes of the images that are installed as part of the build process, it is recommended to have a few GB of hard disk space available when building.

First, cd to this repository and then run docker build . -t vision. All existing config files will be used in the build process to make the image.

This will produce a docker image which can be run using:

$ docker run --device /dev/video0 vision

Make sure that you have a camera connected before running this!

Connection Status GUI

SERT's vision software comes with a connection status GUI to help debug connection issues. This GUI can be displayed on a monitor connected to the co-processor. We use an Adafruit 5" screen.

  • RADIO checks connection to the robot's radio (at 10.XX.XX.1)
  • ROBOT checks connection to the roboRIO (at 10.XX.XX.2)
  • NTABL checks connection to the NetworkTables server on the roboRIO
Good Warning Bad
Connection is good and system is ready. Some connections are down. No connection. Ensure ethernet is plugged in.
good good good

installed GUI

Configuration

Command-Line Options

All command-line arguments may be configured in the config.ini file (located at config/config.ini). For example, the --lower-rgb argument may be edited using the lower-rgb line in the config.ini.

optional arguments:
  -h, --help            show this help message and exit
  -i IMAGE, --image IMAGE
                        path to image
  -s SOURCE, --source SOURCE
                        video source (default=0)
  -t TEAM, --team TEAM  the team of the target roboRIO
  -d, --display         display results of processing in a new window
  -na MIN_AREA, --min-area MIN_AREA
                        minimum area for blobs
  -xa MAX_AREA, --max-area MAX_AREA
                        maximum area for blobs
  -nf MIN_FULL, --min-full MIN_FULL
                        minimum fullness of blobs
  -xf MAX_FULL, --max-full MAX_FULL
                        maximum fullness of blobs
  -l LOWER_COLOR [LOWER_COLOR ...], --lower-color LOWER_COLOR [LOWER_COLOR ...]
                        lower color threshold in HSV
  -u UPPER_COLOR [UPPER_COLOR ...], --upper-color UPPER_COLOR [UPPER_COLOR ...]
                        upper color threshold in HSV
  -tn, --tuning         open in tuning mode
  -v, --verbose         for debugging, prints useful values

Camera

For use with the Microsoft Lifecam 3000, the camera's exposure should be set manually because the Lifecam will auto-adjust otherwise, making thresholding difficult. This can be done with V4L:

$ sudo apt-get install v4l-utils
$ v4l-ctl -d /dev/video0 -c exposure_auto=1 # 1=DISABLED, 3=ENABLED
$ v4l-ctl -d /dev/video0 -c exposure_absolute=50

vision's People

Contributors

andrewda avatar daniwhite avatar evanmhm avatar snowsignal avatar supercilex avatar verycumbersome avatar will-hou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

alonzomet1

vision's Issues

Update for OpenCV 4.x

I'll try getting this working on the second Jetson and see how it goes. I think there shouldn't need to be too many changes (if any) needed to get this working with OpenCV 4.x, and it comes with a 30-40% speed boost!

Use consistent quotation marks

Currently very mixed between double quotes and single quotes. I don't care which one we use but we should stick too it ๐Ÿ˜›

Only perform solvePnP once (on the goal we're actually going to use)

Currently, solvePnP is run on all goals, regardless of whether or not we're actually going to use those numbers. We're actually using the numbers from solvePnP to determine which goal is the most central when "locking" onto a new goal, but that can easily be replaced by the goals pixel center offset.

All the solvePnP stuff should be moved out into a new function that is run after we determine which goal we specifically want to use, either from the lock id or as the center-most goal.

Remove dual camera dependency

I think it's fair to say we'll usually be using only a single camera. We should remove the dual camera from this repository and use yearly vision repositories instead, using this only as a base, updating as necessary.

Add CLI option to enable/disable distance calculations

Distance calculations are slow and not useful for every game. We should add a CLI/config option to choose whether or not to use them. Something like:

--calculate-distance, -cd

and would be calculate-distance in the config.ini.

Abstract away more game-specific elements

It'd be nice to abstract away as many game-specific elements as possible. This might be a pretty big task, but I think it can be broken down into several smaller tasks. Eventually, this might become something like the Limelight dashboard.

  • Read in model points from file
    # Points comprising 3D model of target
    full_model_points = np.array([
    (-5.938, 2.938, 0.0),
    (-4.063, 2.375, 0.0),
    (-5.438, -2.938, 0.0),
    (-7.375, -2.500, 0.0),
    (3.938, 2.375, 0.0),
    (5.875, 2.875, 0.0),
    (7.313, -2.500, 0.0),
    (5.375, -2.938, 0.0),
    ])
  • Allow n number of vision targets
  • ... more

Use HSV for thresholding

It will be significantly better. We can choose the specific hue and saturation we're looking for, then allow a very wide brightness value to make it more adaptable to different lightings.

See: hsv cylinder

We choose a point on the circular top of the cylinder that best fits the goal color, and then allow any value beneath that (H, S) pair.

Add camera connection to screen

We can check if /dev/video* exists -- there should only be one camera connected so if it exists, it's safe to say the camera is working correctly.

Make it more user-friendly

Would be nice to have a webpage that allows the user to see what the camera sees with tuning and thresholding options.

Clean up code

We're mixing tabs and spaces ๐Ÿ˜ฌ

Add coala for code linting/prettifying.

Fix command-line options

Adding appJar took away the command line arguments and injected its own. We don't care about appJar's command line options so try to get rid of that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.