16-311 Introduction to Robotics
|Main Schedule Homework Labs Links|
Lab 2: Vision
Create a MATLAB pipeline to take in images of known objects and determine the distance to these objects.
One of the first techniques we discussed was thresholdiing. This enables us to take colored or grayscale image and reduce it down to a black-and-white thresholded version where each pixel is either a 0 or a 1. In order to create this result, we choose a pixel value (or perhaps a value for each of the colored channels in a pixel) and set all the pixels with a lower value than this threshold value to 0 (black if we assume lower numbers are closer to black) and all pixels with a higher value than this threshold value to 1.
In order to pick this threhold value, we can use a histogram to visualize the distribution of pixel values. Here we see a simple example of a 9-pixel image and the accompanying histogram.
Based on this histogram, we may decide to threshold at 2, so any pixels greater than or eaqual to 2 are set to the high value. And any pixels less than 2 are set to 0.
Alternatively, we may see the lighter pixels as still valuable portions of the colored space and decide to threshold at 1, instead of 2.
In this class, we preform segmentation using the floodfill algorithm. Here are two examples of the alorithm in action, one using 4-point connectivity and one using 8-point connectivity.
The above animations use a recursive structure. That is, you select a pixel. If this pixel is of interest (we will say those pixels have value 1 for explanatory purposes), it is set equal to our segmentation number. If this pixel is not of interest, it is not changed. Then this same function is applied in each direction (4 directions or 8 directions depending on connectivity).
We recommend that you implement this function using a queue, instead of recursion. To do this, instead of calling the funciton in each of the directions, if those pixels in each direction are of interest, they are changed to the segment number and added to the queue. Then you repeat this process until the queue is empty.
Check out the information here: Homework 2: Camera Geometry
The specifications for Lab 2 are presented in the following document. This will be the most up-to-date resource for lab requirements.