Objectives

This homework will help you learn how to process images (cropping and filtering) in ROS. Our goal in Lab 3 is to create our own lane detector. The first step is to start processing images in ROS using OpenCV. To complete this homework, create a ROS node that:

  1. Subscribes to the “/image” topic (NOTE: this assumes you start the publisher mentioned below in the “/” namespace, adjust as needed)
  2. Crops the top half out of the received image. The new image should be half as tall as the input image and contain only the bottom half of the input image. This should remove most of the non-lane portion of the image. Feel free to experiment with the exact amount that you crop the image but leave a comment to justify if you choose something besides 50%.
  3. Publishes the new image on a ROS topic called “/image_cropped”
  4. Converts this cropped image to HSV (unless you’d rather experiment with other methods)
  5. Filters the image for white pixels such that you can clearly see at least the lane marker on the right of each sample image
  6. Filters the image for yellow pixels such that you can clearly see at least the first dashed marker in the middle of the lane
  7. Optionally, uses erode and/or dilate to improve your results
  8. Publishes BOTH the white and yellow filtered images as the ROS topics “/image_white” and “/image_yellow” respectively.

Additionally, create a ROS launch file that:

  1. Starts your node
  2. Starts three rqt_image_views, one for each output topic. This should look something like:
    <node pkg=”rqt_image_view” type=”rqt_image_view” name=”image_view_cropped” args=”/image_cropped”/>
    <node pkg=”rqt_image_view” type=”rqt_image_view” name=”image_view_white” args=”/image_white”/>
    <node pkg=”rqt_image_view” type=”rqt_image_view” name=”image_view_yellow” args=”/image_yellow”/>
  3. Starts the image_pub_all.py ROS node, which will publish each image to your node.

Also, update your launcher script for HW7. Running the launcher script should start your node and display the results as all five images are cycled as inputs.

Given ROS Package

An example has been included in your repo: the flip_image node in the image_processing_hw package. This example takes an input image on the ROS topic “image” and flips it horizontally. You can use it as a reference when designing your solution for this assignment.

Also uploaded is a helper node, image_pub, in the same package. This node takes in the filename of an image on the command line and publishes it to the “image” topic. On the robot, images will be published by other code, but you can use this to test your code for now. You can see your output using rqt_image_view.

$ rosrun image_processing_hw image_pub.py /code/catkin_ws/src/<REPO>/eece5560/packages/image_processing_hw/sample_images/image0.png

Five sample images have been included in the sample_images folder in the image_processing_hw package. Use them to test your code for this homework.

A launch file has been provided that allows you to start the image_pub node and supply an argument to select which image to show. For example, use this command:

$ roslaunch image_processing_hw image_pub.launch index:=2

To start the node to display the second image (image2.png). This will work for index 0-4.

For your final submission, use the image_pub_all.py node in your launch file as this will publish ALL test images.

Submission Instructions

Complete the survey with this information:

  • The URL of your repo
  • The git tag for this commit
  • The roslaunch command that starts your assignment
  • A description of any difficulties you had with this assignment

Rubric

6 points: Submission details (tag, instructions, launcher, etc)

14 points: Correct math/algorithm for image processing

20 points: Correct output images