Practicing image input and output and preparing a homework webpage

CS 585 HW 1
Mariana Garces Dematte

Problem Definition

This is a practice to get to know OpenCV. The exercise can be described as simple image manipulation, which can be considered very important to any image editing software. The anticipated difficulty is not having knowledge on the library and basic data structures that it has.

Method and Implementation

The methods implemented consisted mostly of going through the pixels of the image and changing their intensities. This includes the intensities of RGB values to create a grey scale and switching pixels with other pixels so a flipped image can be created.

The function used for greyscale looped through the pixels on the image, used a formula (0.3*red + 0.6*green + 0.1 * blue) to average the RGB values, and then changed the image's original RGB values to the result of the formula.
For the flipping, the loop goes to half of the columns of the image and for each pixel on one side, it found a corresponding pixel on the other half of the image and exchanged intensity values of both.
As for the black and white transformation, the code looped through the whole image and if the intensity was larger than 127 (which is halfway through 255), then it considered the pixel white, otherwise the pixel is black.


As it was required, I used a picture of my face to conduct the tests, for most of the trials the code did not compile, but when it did the results were what was expected.


Trial Source Image Result Image
Grey Scale
Black and White


Discuss your method and results:


There are improvements that can be made, but the project reached its objective, which was to further my knowledge on C++ and OpenCV.

Credits and Bibliography

Credit to Yifu (TA) that helped me a lot with this.