CSE344- Homework 1-a POSIX compatible C program that admits as command line argument the path of a black & white Solved

35.00 $ 17.50 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

Rate this product

 Homework #1

The Tagged Image File Format or Tiff is a format for storing digital images. A digital image can be thought of as a rectangular matrix of non-negative integers, where every point (or pixel) of the image is denoted by a single value. Tiff is a powerful file format that can store multiple scenes in a single file and compress them quite effectively.

This homework’s objective is to write a POSIX compatible C program that admits as command line argument the path of a black & white, uncompressed locally stored tiff file and prints its pixels on the standard output using 0’s for black and 1’s for white.

Example input image (25×25) (test.tif):

Expected output on screen:

$./tiffProcessor test.tif

Width : 25 pixels

Height : 25 pixels

Byte order: Intel

1111111111111111111111110

1111111111111111111111110

1111111111111111111111101

1111111111111111111111011

1111111111111111111110111

1111111111111111111101111

1111111111111111111011111

1111111111111111110111111

1111111111111111101111111

1111111111111111011111111

1111111111111110111111111

1111111111111101111111111

1111111111111011111111111

1111111111110111111111111

1111111111101111111111111

1111111111011111111111111

1111111110111111111111111

1111111101111111111111111

1111111011111111111111111

1111110111111111111111111

1111101111111111111111111

1111011111111111111111111

1110111111111111111111111

1101111111111111111111111

0011111111111111111111111

Rules:

  1. You are not allowed to use any 3rd party libraries for loading tiff files. Use POSIX and Standard C libraries. You can write your program using C11 standards.
  2. Your program must handle eventual errors gracefully according to the POSIX way.
  3. If the command line argument is missing your program must print usage information.
  4. Your program must work with black & white uncompressed tiff files in either Intel of Motorolabyte order.
  5. Make sure your program doesn’t have any memory leak and runs clean. You can check that andmany other things using Valgrind tool. Just run your program from shell like this :

valgrind ./tiffprocessor test.tif

It will output whether your program has memory leak or not. Also it will tell you about invalid memory accesses, uninitialized memory and much more. For example, if your program gives segmentation fault, most of the time Valgrind will tell you the reason. So it is also a very powerful tool for debugging.

A program with no errors or leaks will give you an output like this:

We will be expecting your homeworks to run just like the one above. For each process the output should be: “all heap blocks are freed – no leaks are possible” and “0 errors” when we run it with Valgrind. A few errors is OK if they are not harmful.

  1. Your program MUST not give “segmentation fault” or any other fault that causes your program to end in a bad way. It is better for you to send a little part of the homework with clean and executing code instead of full homework with faults like this.
  2. Provide a makefile to compile your homework. Do not run your program inside makefile. Just compile it.
  3. Think smart and try to do the job with as short as possible and easily understandable code. Do not send homeworks with 1000 lines that can be done in 200 lines. When you find a solution to a problem, think like this: “What could be a better solution…”.
  4. Test your homework using the Virtual Machine given to you.
  5. No late submissions.

Tip for this homework: You can produce uncompressed tiff files using Gimp and ImageJ.

 

 

  • Homework-1-3aunfa.zip