Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
