HW1: Practicing image input and output

CS 585 HW 1
Yueying Li
Xi You
13/09/2018


Problem Definition

The goal of this part of the assignment is to further familiarize you with programming with images. Your program should take an image of your face as an input, manipulate it in three ways and then output the processed face:

1.Create a grayscale image of your face by converting your color image using one of the conversions we discussed in class last week.
2.Flip your face image horizontally, i.e. left to right, right to left.
3.Come up with a third way of manipulating your face that produces an interesting output.


Method and Implementation

1.The grayscale image as it metioned in the class can be done by several ways:
   a.find the max number of RGB in each pixel
   b.calculate the average RGB for each pixel
   c.calculate as p(i,j)=0.30R(i,j)+0.59G(i,j)+0.11B(i,j)) for each pixel
2.the key to flip the image is to switch the pixel with the symmetric pixel, so I traverse half of the image and switch the pixel with other half.
3.turn the image into emboss is very fun. I search on the Internet to learn how to do it. We have to find a pixel's RGB to minus its neighour's and plus 128. In order to make it more like an emboss we then grayscale this picture.

1.Grayscale: I use the method I have mentioned above. Traverse every pixel in this image and calculate as p(i,j)=0.30R(i,j)+0.59G(i,j)+0.11B(i,j)) for each of them.
2.Flip:Since I want to flip the image from left to right, I traverse each rows but half of the columns of pixel and exchange them to another half of the pixel.
3.Emboss:Traverse the whole image. Let the current pixel's RGB minus the previous one and plus 128. Finally, grayscale this pixel.


Experiments

Experiments Environment: window 10/visual studio 2017
Size of the image: 376p*500p

Evaluation: All the result is exactly what I expect.


Results

Results

Trial
Source Image
Result Image
trial 1
trial 2
trial 3


Discussion

Discuss your method and results:


Conclusions

The color and position of the image can be transformed by changing the RGB value and the position of the pixel.


Credits and Bibliography

Emboss image learn from : https://www.cnblogs.com/biglucky/p/4136946.html
Template of this homework: http://www.cs.bu.edu/faculty/betke/cs585/restricted/hw-instructions/cs585-homework-template.html

All the problems came across during the possess discussed with Xi You.