Lab 5 Solution

$29.99 $18.99

The purpose of this lab is to give you some practice using structs and reading binary data from files. To get started, visit Lab5 in MarkUs to trigger the creation of a Lab5 subdirectory containing the starter code in your repository. We’ve provided the Makefile for this lab; you shouldn’t need to change it. Simply…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

Rate this product

The purpose of this lab is to give you some practice using structs and reading binary data from files. To get started, visit Lab5 in MarkUs to trigger the creation of a Lab5 subdirectory containing the starter code in your repository.

We’ve provided the Makefile for this lab; you shouldn’t need to change it. Simply run make to compile the program.

  • 24-bit bitmap file is a simple image file format that consists of two main parts:

    1. The file metadata.

    1. The pixel array, storing numbers corresponding to the blue, green, and red colour values of each pixel in the image (as a number between 0 and 255).

(Note: the actual file format consists of an optional third section after the pixel array, but we’ll ignore that section for the purpose of this lab.)

At fixed locations in the file metadata, there are three important integers (each stored with exactly 4 bytes):

At byte offset 10-13, the offset in the bitmap file where the pixel array starts.

At byte offset 18-21, the width of the image, in pixels.

At byte offset 22-25, the height of the image, in pixels.

Suppose our bitmap image has height m and width n; we’ll always assume in this lab that the width n is a multiple of 4, which simplifies the byte layout in the file a little. For this image, the pixel array stores exactly 3nm bytes, in the following way:

Each group of 3 bytes represents a single pixel, where the bytes store the blue, green, and red colour values of the pixel, in that order.

Pixels are grouped by row. For example, the first 3n bytes in the pixel array represent the pixels in the top-most row of the image.

That’s all you need for this lab, but if you’re curious about learning more about the bitmap file format, you can start here (https://en.wikipedia.org/wiki/BMP_file_format) .

2页 共2 2019/3/23 14:08