Answered step by step
Verified Expert Solution
Link Copied!

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:
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago