Question 1: Convert the original color in the image to gray.
Question 2: Flip the image horizontally.
Question 3: Interesting output: convert the image to a oil painting style.
Method and Implementation
Question 1: Using the for loop to iterate all the pixels in the image and spliting RGB channels in each pixel. Weighing each channel in order to convert the color to gray. The weighing formula is: R * 0.3 + G * 0.6 + B * 0.1
Question 2: First of all, seting up a new and blank Mat which have the same amount of row and column of the original face image. Then iterating all the pixels from rows to columns. Copy the column of the original image to new image in reverse order and the row in order.
Question 3: To obtain the oil painting style image, iterating every pixel is essential. After spliting RGB channels in each pixel, the value in each channel should be modified with a rule. The formula is: img(i,j)[R/G/B] = img(i,j)[R/G/B] / value * value + value / 2
|Trial||Source Image||Result Image|