Opencv Experiments

CS 585 HW 1
Allison Mann

Problem Definition

This assignment is an exercise in opencv, to get familiar with dealing with images in software. We will manipulate an image in 3 ways.

Method and Implementation

There are 3 parts to this project: converting an image to grayscale, flipping it horizontally (left to right), and a third way of my choice.

For grayscale, I took the average of the 3 channels from the original 3 channel pixel. For flip, I iterated over the pixels on the left half of the image and replaced them with the corresponding pixel on the right side (channels*cols - pixelindex - currentchannel). For my third experiment, I decided to invert the color of the image. I implemented this by iterating through all channels in every pixel and replacing the value with 255-original. This is because channels contain values from 0-255. If a value was 0, I want it to be 255 in the inverted image and vice versa, and I always want the new value to be positive.


Here are the resulting images from the source image of my face:


Trial Result Image
Grayscale Image
Flipped Image
Inverted Color Image


Evaluation is purely qualitative for this assignment, by inspection the images appear to give the intended effect.