Question: For this assignment you must write a c++ program that will manipulate a ppm image when it is provided. The program should read the image

For this assignment you must write a c++ program that will manipulate a ppm image when it is provided. The program should read the image then produce the output as the transformed image through the following methods.

1. Write a function that will resize an image. One way to do this is to calculate the relative height and width to find the pixel of the original image that is closest in location to the pixel needed in the new image. The function prototype for the above solution is as follows:

void resizeImage(image_t*, image_t* );

The two image_t* parameters represent the original image and the new resized image.

2. Write a function that will grayscale an image. One formula to calculate the grayscale RGB values is: 0.21R + 0.72G + 0.07B. This value will become the Pixels RGB values. The values could result in the RGB values being outside of the allowed range of 0 255. Therefore, you would need to check the calculated value. If the value is less than 0 make it 0, if it is > 255 them make it 255. This should be a function in itself.

3. Write a function that will transform an image by flipping it upside-down.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!