Homework 1

CS 585 HW 1
Zhuohao Yang
No teammate

Problem Definition

How to convert a colored image to grayscale? How to blur a image? How can computer automatically crop human face out of a picture?

Method and Implementation

To convert from a colored image to a grayscale image, I calculated the average value of each color channel of a pixel, and then assigned the average value to each channel.

To blur a image, I sum all the values of one pixel and the eight pixels around that particular pixel. Then I calculated the average and assigned that value to the center pixel. I repeat this process for all three color channels.

I tried to crop the human face out of a image based on colors. Because most human faces have high color values for green and red, and low values for blue, I basically replaced all pixels with high blue values with white color. The majority remaining pixels are pixels of human face.


I tried different color values for different color channels. I found that human face has green value between 90 and 200, red value greater than 140, and blue value less than 40.


The following are the original and modified pictures.

Input Image

Grayscale Image

Blurred Grayscale Image

Color Based Face Detection Image



I learned that to convert a color image to grayscale image, I just need to average each color channels in every pixel. To blur a image, I just need to apply converlution algorithm to a picture a couple times. Also, most human faces have high color values for green and red but low values for blue.