Assignment Title

CS 585 HW 1
Kaikang Zhu
2018/9/12

Problem Definition

Manipulating a picture of myself in several ways, including grayscale, flip, blur or other interesting ways. The antipicated difficluties lie in analyzing the problem and finding the solution. I need to write code to manipulate the pixels of picture to meet the requirements. After test, the pictures show that the result is correct.

Method and Implementation

The first problem is to turn the picture into grayscle. My way is to set a matrix that is single-channel and give the value of the green channel of the original picture to the grayscale picture.

The second problem is to flip the picture. I choose to flip the picture horizontally. Using for loop to give the right pixels to the left area of the flipped picture column by column and row by row.

The third problem is to use another interesting way to produce results. My way is to calculate the average value of the pixel and its eight neighbours and let the pixel equal to the value.

Experiments

The experiments basically include manipulating the pixels, showing the image and saving the result.

We can visualize the result and find it's correct.

Results

Results

Trial Source Image Result Image
trial 1
trial 2
trial 3

Discussion

Discuss your method and results:

• What are the strengths and weaknesses of your method?
• The strength is i get the satisfied results. The weakness is i use two for loops which is time-consuming.

• Do your results show that your method is generally successful or are there limitations? Describe what you expected to find in your experiments, and how that differed or was confirmed by your results.
• The RGB image has three channels and the gray image has one channel. From doing the experiment, i get familiar with the basic manipulation of pixels.

• Potential future work. How could your method be improved? What would you try (if you had more time) to overcome the failures/limitations of your work?
• Maybe I can use more efficient way to manipulate the pixels such as, using pointer instead of at to visit the pixels.

Conclusions

Based on your discussion, what are your conclusions? What is your main message?

Credits and Bibliography

reference:https://stackoverflow.com/questions/17064582/mat-single-channel-element-access https://blog.csdn.net/mooneve/article/details/53067443 https://blog.csdn.net/xiangxianghehe/article/details/71600519

I have discussion on the first problem about how to transform three-channel to one-channel with my classmate Shijie Zhao.