Skip to content

FRC-Coders/NerdyVision

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NerdyVision

FRC Vision Processing using OpenCV Python

What You Need

Python 2.7, NumPy and OpenCV

PyNetworkTables

MJPG streamer

Raspberry Pi compatible USB camera (Microsoft Lifecam HD-3000 used in this project)

Food

Calibration Mode 1

  1. Set a small centered rectangle as the calibration box (can change the size in constants)

  2. Get frame from camera

  3. Find average BGR value inside calibration box

  4. Convert BGR value to HSV value

  5. Print HSV values for every frame

Calibration Mode 2

  1. Create adjustable trackbars for H, S, and V values

  2. Get HSV range from trackbars

  3. Capture frame from camera

  4. Apply HSV mask

  5. Print HSV values in use

Tracking Mode

  1. Get frame from camera

  2. Remove everything but specified color in frame

  3. Find contour for the largest object with the specified color (closest goal)

  4. Find centroid of that object (ideal position to shoot / drop off gear)

  5. Calculate error and converts from pixels to degrees

  6. If the center of the camera is aligned with the center x-axis of the object (goal), then it is ready to shoot

  7. Send data over NetworkTables and print in terminal.

Testing

Testing has been done with

  • example images provided by WPILIB (2017 images included in this project under sample images)

    • Tests for all example images in the boiler folder successful except for images 7 and 32
  • custom made high goal / boiler / gear peg with green highlighter / marker

About

FRC Vision using OpenCV Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%