Objectives

Computer vision is an important part of how a robot perceives the world around itself. In this lab you will create a color filtering node to detect one of several colored spheres. Specifically:

  1. Subscribe to the input image topic. This is likely from the image_publisher node (see below) but you may remap as you wish.
  2. Publish a filtered image that shows JUST the colored sphere. Images of the given ping pong balls are here:
    1. Blue ping-pong ball
    2. Pink ping-pong ball
  3. Use some method to easily switch between color filters to change which sphere is being found (a parameter is probably a good choice). Do NOT write multiple color filtering nodes.
    NOTE: each color should only have ONE set of filters regardless of lighting conditions
  4. Once you do the above, find something spherical (or, at least something that presents a circle to the camera) in a NEW color, record your own images with the method of your choice, and create a third filter to find this object.
  5. Demonstrate the above and answer questions.

Tips

  • ROS2 contains a node to publish and a node to view images easily:
    • Publish as /image_raw:
       $ ros2 run image_publisher image_publisher_node <path/to/image.png>
    • View topic of choice:
       $ ros2 run image_view image_view --ros-args --remap image:=<YOUR_TOPIC>
  • Create a launch file that starts your filtering node and image view to save time
  • Get rid of some of the noise by using erode and dilate. MAKE SURE YOU ERODE AND DILATE THE SAME NUMBER OF TIMES TO KEEP THE OBJECT THE SAME SIZE!
  • Do Lab 3.2 immediately after finishing this one for the smoothest results.
  • Unzip the above images and put them somewhere in your src folder to make them accessible to your container.

Submission Instructions

Submit a PDF to blackboard with:

  1. Your git repo URL and git tag for this assignment.
  2. The color ranges to filter each object
  3. Any difficulties you had with this assignment.

Rubric

  • Demonstration: 30 points
    • Filtered image shown: 5 points
    • Filters only the object:
      • Blue ping pong: 5 points
      • Pink ping pong: 5 points
      • Third object: 5 points
    • Answers questions about code: 10 points
  • Blackboard submission: 10 points