Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Through this programming assignment, the students will learn to do the following 1. Learn to read and write bina ry files. 2. Gain more experience

image text in transcribed

image text in transcribed

image text in transcribed

Through this programming assignment, the students will learn to do the following 1. Learn to read and write bina ry files. 2. Gain more experience with using pointers 3. Gain more experience with dynamic memory allocation and deallocation. In this assignment, you are asked to manipulate image from a 24-bit uncompressed bmp file. (The format of bmp files is given in http://en.wikipedia.org/wiki/B MP file format). To help with reading and writing the image file, you are given library functions and an example that deal with the bmp file (in a zip file on my faculty website). In the example, the image is flipped horizontally. Y ou are asked to implement the verticalflip(), enlarge) and rota te () functions: the firs t flips the image vertically, the second is used to enlarge the image by an integer scale factor, the last one is used to rota te the image either clockwise or counter-clockwis e by a certain degree (which must be a multiple of 90) depending whe ther the rotation degree is pos itive or negatve. Positive is clockwise and negative is counterclockwise The program should take the follow command-line options: %,bmptool Fs scale l-r degree l-f I-v ] to output-file] [input-file) Where -s means to scale the image by the given scale (a positive integer 1,2,3, . r means to rota te the image by 'degree (which must be a multiple of 90, clockwis e if positive, counter-clockwise if negative), -v means to flip the image vertically and f means to flip the image horizontally You can assume for each type (-5,-r,-f, or-v), the command line has at most one option. That is, the user is not supposed to do something like "omptool -s 2-5 4". If that happens, you can either prompt with an error, or take either 2 or 4 as the scale. However, the user may present a combinaton, say /bmptool -r 90 -s 4: If multiple option types are present, the order for processing the image is that you do scale first, then rota te, and then flip vertically and finally flip horizontally You are required to use getopt) to process e command-line. If-o output-fie, is missing, use standard output. If 'input file' is missing, use standard input. The optons to use s tandard input or Through this programming assignment, the students will learn to do the following 1. Learn to read and write bina ry files. 2. Gain more experience with using pointers 3. Gain more experience with dynamic memory allocation and deallocation. In this assignment, you are asked to manipulate image from a 24-bit uncompressed bmp file. (The format of bmp files is given in http://en.wikipedia.org/wiki/B MP file format). To help with reading and writing the image file, you are given library functions and an example that deal with the bmp file (in a zip file on my faculty website). In the example, the image is flipped horizontally. Y ou are asked to implement the verticalflip(), enlarge) and rota te () functions: the firs t flips the image vertically, the second is used to enlarge the image by an integer scale factor, the last one is used to rota te the image either clockwise or counter-clockwis e by a certain degree (which must be a multiple of 90) depending whe ther the rotation degree is pos itive or negatve. Positive is clockwise and negative is counterclockwise The program should take the follow command-line options: %,bmptool Fs scale l-r degree l-f I-v ] to output-file] [input-file) Where -s means to scale the image by the given scale (a positive integer 1,2,3, . r means to rota te the image by 'degree (which must be a multiple of 90, clockwis e if positive, counter-clockwise if negative), -v means to flip the image vertically and f means to flip the image horizontally You can assume for each type (-5,-r,-f, or-v), the command line has at most one option. That is, the user is not supposed to do something like "omptool -s 2-5 4". If that happens, you can either prompt with an error, or take either 2 or 4 as the scale. However, the user may present a combinaton, say /bmptool -r 90 -s 4: If multiple option types are present, the order for processing the image is that you do scale first, then rota te, and then flip vertically and finally flip horizontally You are required to use getopt) to process e command-line. If-o output-fie, is missing, use standard output. If 'input file' is missing, use standard input. The optons to use s tandard input or

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions