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.
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
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.
|Trial||Source Image||Result Image|
Discuss your method and results:
- The strength of my method was that it correctly produced the results that were expected. A weakness of this method is the speed. Perhaps a more optimized version of my functions would lead to a faster running time.
- My results show that my method is successful since it was able to generate the necessary output to solve the given conditions.
- Potential future work: My method can be improved by running faster. I would try different approaches to discover more optimal ways for my functions.
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