Problem Definition
Create a grayscale image of your face by converting your color image.
Flip your face image horizontally, i.e. left to right, right to left.
Come up with a third way of manipulating your face that produces an interesting output. For example, you may create a blurred image of your grayscale face by assigning to each pixel the average grayscale pixel value of itself and its 8 neighbors. Hint: You may have to run your program a few times to make the blurring noticeable.
Method and Implementation
I used the cv.imread() method provided by the openCV library to read the images.
Greyscale:- To get the greyscale image, I took the mean of all the 3 channels for all image coordinates. I used the numpy function np.mean() to calculate the mean of all 3 channels.
Flip:- To flip the image, I used the numpy function np.flip().
Transpose_left:- To rotate the image to the left by 90 Degrees, I transposed the image array using python's transpose function.
Transpose_right:- To rotate the image to the right by 90 Degrees, I flipped the image and transposed it.
Tint:- To tint the image, I set all the pixels of the Blue channel to 0.
Results
Following images were generated by using the above functions:
Results | ||
Trial | Source Image | Result Image |
Grayscale | ![]() |
![]() |
Flipped Horizontal | ![]() |
![]() |
Flipped Right | ![]() |
![]() |
Flipped Left | ![]() |
![]() |
Custom (Removed Blue channel) | ![]() |
![]() |
Conclusions
OpenCv reads images as Numpy Arrays which makes it easy to work with images at a pixel level. Applying transpormations becomes easier as it is the same is aplpying transformations to a matrix of numbers.