logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Assignment #2 Instructions: BMP Gain more experience with dynamic memory allocation and deallocation.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

BMP image processing program written in C. also must use getopt. Instructions and relevant code are in the ZIP file attached.

 

Assignment #2 Instructions: BMP 

Image Processing

Through this programming assignment, the students will learn to 

do the following:

1. Learn to read and write binary 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 an image from a 

24-bit uncompressed bmp file. (The format of bmp files is given in 

http://en.wikipedia.org/wiki/BMP_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). In the example, 

the image is flipped horizontally. You are asked to implement 

some additional functions including the verticalflip(), enlarge() and 

rotate() functions: the first flips the image vertically, the second is 

used to enlarge the image by an integer scale factor of 2 or 3; the 

last one is used to rotate the image either clockwise by 90 

degrees or counter-clockwise by 90 degrees.

The program should take the follow command-line options:

% bmptool [-f | -r | -l | -s scale| -v ] [-o output_file] 

[input_file]

Where -s means to scale the image by a scale factor of 2 or 3 as 

indicated on the command line with a 2 or a 3, -r means to rotate 

the image by 90 degrees clockwise, -l means to rotate the image 

by 90 degrees counter-clockwise, -v means to flip the image 

vertically and -f means to flip the image horizontally. You can 

assume for each type (-s, -r, - l, -f, or -v), the command line has at 

most one option, but that should not affect your code. Only 

implement each one one time no matter how many times it is 

included. However, the user may present a combination, say, 

'bmptool -r -s -l -f -v'. If multiple option types are present, the order 

for processing the image is that you do scale first, then any rotate 

options, and then flip vertically and finally flip horizontally.

You are required to use getopt() to process the command-line. If '-

o output_file' is missing, use standard output. If 'input_file' is 

missing, use standard input. The options to use standard input or 

standard output will only be used when chaining commands. 

Make sure the program returns 0 on success. In that case, one 

can 'chain' the commands using pipes, like:

% bmptool -s 2 1.bmp | bmptool -r | bmptool -f -o 2.bmp

Your program needs to provide necessary sanity-check for 

command line arguments and handle various error conditions and 

prompt the user with helpful information. You need to use getopt() 

to process the command line arguments. Test your program with 

various combinations to make sure it works as expected. You 

must use dynamic memory to store the content of the new image 

before writing out to file. You need to reclaim memory afterwards 

to prevent memory leaks. Please submit your work through 

Canvas as one zip file called FirstnameLastnameA2.zip. Follow 

the instructions below carefully (to avoid unnecessary loss of 

grade). Include your source code, your Makefile, the bmplib files 

that I have provided, and the example.bmp file in the zip file. I 

should be able to create the executable by typing ‘make’. The 

Makefile should also contain a 'clean' target for cleaning up the 

directory (removing all object files). Make sure you don't include 

intermediate files: *.o, executables, *~, etc., in your submission. 

(There'll be a penalty for including unnecessary intermediate 

files).

Please make sure you submit homework before the deadline. 

There will be a late penalty as per the syllabus.

If the program does not compile and do something useful 

when it runs it will not earn any credit.

bmplib

Download bmplib

(Zip file) - files needed to complete this assignment.

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

768 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

757 Answers

Hire Me
expert
Husnain SaeedComputer science

986 Answers

Hire Me
expert
Atharva PatilComputer science

867 Answers

Hire Me
July
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30