Assignment 1

CS 585 HW 1
Kristian Ramsamooj
Date: 9-9-18


Problem Definition

The current problem is manipulating images with OpenCV and Visual Studio 2017. What needs to be solved is first reading in images with imread then implmenting the necessary algorithms to solve the following problems.

1) Create a grayscale image of your face by converting your color image using one of the conversions we discussed in class last week.

2) Flip your face image horizontally, i.e. left to right, right to left.

3) 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

1) For the first problem, creating a grayscale of the image, I simply looped through the image and kept an unsigned char pointer keeping track of each row. Afterwhich, I extracted the index of the blue, green, and red color channels then calculated the average between them. This value was then stored back into the index of each blue, green, red pixels. Simply creating a grayscale image.

2) For the second problem, flipping the image horizontally, I created a simple flip function that took in 2 images and then flipped the first image and stored the result in the second image.

3) For the last problem, I used the same principal as grayscaling the image but instead I used the random number generator to generate random numbers from 0-255 and used that result to be the values for the blue channel.


Experiments

The experiments that were done for this assignment were just some simple debugging and error handling. The running times for each method is as follows

1) O(n^2)

2) O(n^2)

3) O(n^2)


Results

List your experimental results. Provide examples of input images and output images. If relevant, you may provide images showing any intermediate steps. If your work involves videos, do not submit the videos but only links to them.

Results

Trial Source Image Result Image
Grayscale
Flip
Random Blues


Discussion

Discuss your method and results:


Conclusions

The main message here is that I was able to became more comfortable with operating on images and using the OpenCV API.


Credits and Bibliography

https://opencv.org/ | Accessed: 9-9-18