Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a C + + template class for a grayscale image. The class should overload stream operations to read and write a binary grayscale image
Create a C template class for a grayscale image. The class should overload stream operations to read and write a binary grayscale image in pgm format from and to the disk, respectively.
a
Extend this class to include a function to compute the complement of an image, also called the inverse or negative of an image.
b
Create a driver main program that tests these operations. The program should read an image with a user specified filename, compute the negative of the image, and write the computed image to disk with a new filename.
Notes:
An image can be saved in grayscale pgm format using:
GIMP GNU Image Manipulation Program
A description of the grayscale pgm image file format is available from:
PGM Format Specification lblgov
The complement of an image is the image where each pixel value is subtracted from the maximum pixel value supported by the pgm format and by the class. For example, if the image data is of type uintt the maximum pixel value is so each pixel value is subtracted from to get the complement also called negative or inverse image:
Complement image MATLAB imcomplement mathworkscom
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started