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:
1)
An image can be saved in grayscale pgm format using:
GIMP - GNU Image Manipulation Program
2)
A description of the grayscale pgm image file format is available from:
PGM Format Specification (lbl.gov)
3)
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 uint8_t, the maximum pixel value is 255, so each pixel value is subtracted from 255 to get the complement (also called negative or inverse) image:
Complement image - MATLAB imcomplement (mathworks.com)

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!