Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*This is a C Project. So please, codes must be in C language. BMP file could be anything, does not matter. I have the original

image text in transcribed

*This is a C Project. So please, codes must be in C language. BMP file could be anything, does not matter. I have the original one, you can use any bmp file.

first pixel second pixel third pixel ... RGBRGBRGBR Order of pixels in the bitmap pixel Pixel data of an image data section of the BMP file In this first part of the programming assignment, you will read a BMP image from a file provided to you (itu.bmp), and you will scale the image down by a factor of 2x in each dimension (the image size will be halved both horizontally and vertically). In order to scale the image, you are supposed to implement a basic downscaling algorithm described below: You will take the average of the color component values of neighboring 4 pixels and that average will be the resulting color component of the pixel in the downscaled image. You will repeat this for each color component and for each 4 pixel group. The below figure shows the process. First pixel Second pixel BGBRGB PGBOGB F.GB Downscaled image Third pixel Fourth pixel Original image This figure shows individual bytes of each pixel. The red color bytes of these 4 neighboring pixels are averaged to produce one red color byte written here. Same is done for green and blue color bytes resulting in 1 RGB pixel to be produced out of 4 RGB pixels Original image Downscaled image This figure shows pixel view of the same operation (each grid square corresponds to 1 pixel). 4 neighboring pixels are component-wise averaged together to produce 1 pixel in the downscaled image on the right-hand side. Finally, you will write the resulting pixel values to an output BMP file. You need to write the bitmap file header as well as bitmap info header before the pixel values. Note that you need to modify the header fields mentioned above to account for the reduced image size first pixel second pixel third pixel ... RGBRGBRGBR Order of pixels in the bitmap pixel Pixel data of an image data section of the BMP file In this first part of the programming assignment, you will read a BMP image from a file provided to you (itu.bmp), and you will scale the image down by a factor of 2x in each dimension (the image size will be halved both horizontally and vertically). In order to scale the image, you are supposed to implement a basic downscaling algorithm described below: You will take the average of the color component values of neighboring 4 pixels and that average will be the resulting color component of the pixel in the downscaled image. You will repeat this for each color component and for each 4 pixel group. The below figure shows the process. First pixel Second pixel BGBRGB PGBOGB F.GB Downscaled image Third pixel Fourth pixel Original image This figure shows individual bytes of each pixel. The red color bytes of these 4 neighboring pixels are averaged to produce one red color byte written here. Same is done for green and blue color bytes resulting in 1 RGB pixel to be produced out of 4 RGB pixels Original image Downscaled image This figure shows pixel view of the same operation (each grid square corresponds to 1 pixel). 4 neighboring pixels are component-wise averaged together to produce 1 pixel in the downscaled image on the right-hand side. Finally, you will write the resulting pixel values to an output BMP file. You need to write the bitmap file header as well as bitmap info header before the pixel values. Note that you need to modify the header fields mentioned above to account for the reduced image size

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

Step: 3

blur-text-image

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

3. The group answers the questions.

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago