Question: Write a C program that inputs a PPM image file (as defined below) of up to 500,000 RGB points, with each point defined by 3

Write a C program that inputs a PPM image file (as defined below) of up to 500,000 RGB points, with each point defined by 3 integer values (an RGB triplet) in the range of 0-255 inclusive, where (0,0,0) equals black and (255,255,255) is white. We will define a pixels darkness value DV as the sum of its R, G, and B values, with absolute black therefore hav- ing DV = 0. Your program should first find the darkest point in the image, then output the coordinates (in order top-to-bottom, left-to-right, with the row first followed by the column) of all pixels that have a DV within (i.e. up to and including) 30% of this value. For example, if DV = 29 for the darkest point in an image, you should report the locations of all pixels with a DV up to and including 38. When reporting the location of your dark pixels, assume the upper left corner of the image is location 1, 1.

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!