Assignment 1

CS 585 HW 1
Kexuan Cui
9/14/2017


Problem Definition

The goal of this assignment is to further familiarize with programming with images, by taking an image of face as input and manipulating it in three ways:
1. Convert color image into grayscale image.
2. Create a blurred image by assigning to each pixel the average grayscale pixel value of itself and its neighbors.
3. Come up with an interesting way to manipulate face image.


Method and Implementation

1.Firstly, I resized the image so that it can best fit my webpage. I set the size into 500*375.
2.For converting RGB into grayscale part, I decided to use the function (R+B+G)/3 to get the value of my grayscale image. So I scanned over all pixels within the image and calculated the result image value using the upper function.
3.For blurring part, as mentioned in the assignment, I used the same way which I completed my EC520 assignment. Simply by adding up each value of the neighborhood then divided by 9, then replaced the original value. In order to have a noticeable result, I looped the blurring function 4 times.
4.For the last part, I did image enhancement for the grayscale image. After calculating on the paper, I used the function of

in this way I can get a contrast stretching image.


Experiments

I ran the blurring function for 1, 4, 8, 12times, and choose the 4-time running as my result image.


Results

Original Image Resized Image
Grayscale Image Blur(1 time) Image
Blur(4 times) Image Enhancement Image


Discussion

Potential future work. I used to do image processing via MATLAB, and seldom use C++ for coding. I am planning to do more practice on C++ and OpenCV.


Conclusions

Successfully completed simple programming of images.


Credits and Bibliography


Slides of the course.
C++ Tutorial.
Help of classmates.