16-311 Intro to Robotics s13

Lab 2

Aaron Anderson (aaanders)

Below is the output of this program on the three test images:


The histograms generated by the vision program represent, in a qualitative fashion, how many pixels of each value between 0 and 255 were found in the image. The bar for pixels with value 0 is on the far left of the histogram, while the bar for pixels with value 255 is on the far right. Each test image is paired below with its histogram as generated by the program.

Mona Lisa

Mona Lisa's histogram

Letter F

Histogram of letter F


Histogram of tractor


The program can increase the contrast of images by identifying the highest and lowest valued pixels and then scaling every pixel in the image by an amount appropriate to maximize the range of pixel values (i.e. 0 to 255). This especially helps brighten washed-out images, as in the case of the tractor.

Mona Lisa

Mona Lisa with contrasting

Letter F

Letter F with contrasting


Tractor with contrasting

For this last image, where the colors are originally washed out, the contrasting effect is most noticeably clear.


Thresholding takes each pixel and compares its value to a threshold value given as input to the program. If the pixel value is less than the threshold, the program sets the pixel to the minimum value 0. Otherwise, the program sets the pixel to the maximum value 255. The threshold values were hand-picked based on the histograms to maximize the number of pixels in each half of the image.

Mona Lisa

Mona Lisa with thresholding (threshold value = 64)

Letter F

Letter F with thresholding (threshold value = 40)


Tractor with thresholding (threshold value = 170)

The source code of the program which produced these images: vision.c

Back to home