In this assigment, we implement methods to manipulate image files. We learn to load RGB image using the OpenCV library, and implement ways to turn RGB image to greyscale, flip the image, and lastly blurr the input image with a fixed-sized kernel.
Method and Implementation
1. I implemented different converting schemes for converting RGB image into greyscaled images:
- Quick and dirty: for this scheme we simply take the red color channel as the brightness value of the greyscaled image.
- Max-RGB: for this scheme we simply take the maximum value among RGB channel.
- Avg-RGB: for this scheme we simply take the average value among RGB channel.
- Weigh-RGB: for this scheme we simply calculate 0.6*R + 0.3*G + 0.1*B for the brightness value.
2. To flip the image horizontally, I simply inverse the second index of the RGB image.
3. To blurr the image, I assign the average greyscale value of the blurring window to the pixel in the center of the window.
The experiment did not involve multiple times of testing since we have definitive results. The processed image are shown in the latter section.
|Original||GrayScale - Quick-n-Dirty||GrayScale - Max-RGB||GrayScale - Avg-RGB||GrayScale - Weigh-RGB||Horizontal Flip||Blur|
Discuss your method and results:
The weakness of the blur implementation is that it is not paralleled hence slow (takes about 3~5 second).
Future improvements could be making it multi-threaded, since different kernel computation can be parallelly processed.
From this assignment, I learned how RGB images are converted into greyscaled image, and that it can be done in multiple ways. I also notice that OpenCV is a strong library that does all those naiive implementation for us to ease our life when it comes to processing image.
Credits and Bibliography