By now, you should be familiar with playing around with images processing such as:
- Getting images from streams
- Smoothing Images
- Eroding and Dilating (Morphology transformation)
- Basic thresholding
- Hough Circle Transform
- Template Matching
- Finding contours in your image
- Image Moments
- Point Polygon Test
documentation & examples on image filtering can be taken from here & here or from the tutorials.
more info & examples on
As an assignment, we would like you to complete a module that employs what we have seen so far in order to extract the closest blob from a stream of disparity images. This will be useful for you when you will do the machine learning course.
You should be able to accomplish the following tasks:
- Get a stream of images from the yarpdataplayer: disparity and rgb.
- Apply image processing techniques to make the disparity image cleaner for processing. (GaussianBlur, erode, dilate)
- Retrieve the maximum value and its position.
- Apply thresholding on that point to remove unwanted background
- Find the contour of the closest object with its moment and mass center
- Draw it on the disparity image
- Get its bounding box (ROI-Region of Interest)
- Create a cropped image containing the RGB image of the ROI
- Fill in a YARP bottle as a list
- Finally, stream the resulting image out.
The outcome should look something like the animation below:
Most of the points reported above have been already addressed in the tutorials, so you need to fill in the missing gaps highlighted by the comment // FILL IN THE CODE
.
Once done, you can test your code in two ways:
- Manually: running the yarpmanager scripts provided from within app/scripts.
- Automatically: running the script test.sh in the smoke-test directory. Take into account these important points:
- The smoke test basically will automatically compare the content of the streamed bounding box historgrams in hsv at various frames with the base solution.
- The test will pass if an overall comparison of the five histograms is above 90%.
You will need to run the dataset dataDisparity in:
cd $ROBOT_CODE
$ cd datasets
$ wget http://www.icub.org/download/software/datasetplayer-demo/dataDisparity.zip
$ unzip dataDisparity.zip