Your program should follow the steps below: 1. Prompt the user to enter the input PPM file name, the output PPM file name, and one of the following commands to determine what modification should be applied to the input PPM image so that the modified image is stored in the output PPM file: A. "negate" B. "high contrast" C. "gray scale" D. "remove " where is "red", "green", or "blue" 2. Apply the image modification based on the user command. You must define the functions mentioned below to perform the image modification. Note that the original image file should not be changed; the modified image must be stored in the output PPM image file name. Also note that the output file should have the same header lines as the input file. a. negate_image(): accepts the input image file object and the output image file object as arguments. For each pixel element in the input file, it takes the value, subtracts 255 from it and takes the absolute value of the result. This result is written to the output file.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Your program should follow the steps below:

1. Prompt the user to enter the input PPM file name, the output PPM
file name, and one of the following commands to determine what
modification should be applied to the input PPM image so that the
modified image is stored in the output PPM file:

A. "negate"
B. "high contrast"
C. "gray scale"
D. "remove <color>" where <color> is "red", "green", or "blue"

2. Apply the image modification based on the user command. You must
define the functions mentioned below to perform the image
modification. Note that the original image file should not be changed;
the modified image must be stored in the output PPM image file name.
Also note that the output file should have the same header lines as the
input file.

a. negate_image(): accepts the input image file object and the output
image file object as arguments. For each pixel element in the input file,
it takes the value, subtracts 255 from it and takes the absolute value of
the result. This result is written to the output file.
 
 
 
 
 
 
 
b. high_contrast_image(): accepts the input image file object and the
output image file object as arguments. For each pixel element in the
input file, if the value is higher than 127, set it to 255 or else set it to
zero. This result is written to the output file.

c. gray_scale_image(): accepts the input image file object and the
output image file object as arguments. For each element in a RGB
triplet (consecutive three elements) in the input file, convert its value
to the triplet’s average. The result is written to the output file.

d. remove_red_image(): accepts the input image file object and the
output image file object as arguments. This function sets all red values
to 0 (red is the 1st value in an RGB triple). The result is written to the
output file.

e. remove_green_image(): accepts the input image file object and the
output image file object as arguments. This function sets all green
values to 0 (green is the 2nd value in an RGB triple). The result is written
to the output file.

f. remove_blue_image(): accepts the input image file object and the
output image file object as arguments. This function sets all blue values
to 0 (blue is the 3rd value in an RGB triple). The result is written to the
output file.

3. Test the output of the above functions by displaying the modified
image with a PPM image reader software such as Ifranview.


Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education