Vision Processing: Automating Artifact Recognition

Green or Purple? How to use OpenCV and TensorFlow to sort game pieces automatically.

Vision Processing: Automating Artifact Recognition

In DECODE, picking up the wrong color (Opponent’s Artifact) is a penalty or a wasted cycle. Your intake moves too fast for human reaction. You need Computer Vision.

Option 1: Color Blobs (OpenCV)

  • How it works: “Is there a big blob of GREEN pixels in this rectangle?”
  • Pros: Extremely fast (60FPS). Simple code (Core.inRange, Imgproc.findContours).
  • Cons: Lighting changes can break it. A green wall might look like a green artifact.

Option 2: Machine Learning (TensorFlow)

  • How it works: You train a neural network on 1000 images of Artifacts. It learns the shape and texture.
  • Pros: Robust. Works in weird lighting.
  • Cons: Slower. Requires training data.

Implementation Application

  1. Intake Reject: If the camera sees the wrong color inside the intake, the motor automatically reverses.
  2. Auto Select: The robot drives to the stack and automatically targets only the Purple one.

Conclusion

Start with OpenCV logic. It handles 95% of cases. Only upgrade to TensorFlow if lighting varies wildly.

Explore FIRST® Robotics

FIRST® (For Inspiration and Recognition of Science and Technology) is a global robotics community preparing young people for the future. Discover the ultimate sport for the mind and see how you can get involved in STEM and robotics!

Learn More at firstinspires.org