Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this programming assignment, you will apply a smoothing filter on the original image. In order to apply smoothing, you need to apply a convolution

In this programming assignment, you will apply a smoothing filter on the original image. In order to apply smoothing, you need to apply a convolution operation on the image. A convolution operation uses a kernel which is a fixed size small matrix. For this assignment, we will use a 3x3 blurring kernel. The convolution operation moves this kernel over the image, shifting it one pixel at a time and takes the dot product of matrix elements with the pixel values underneath (element-wise multiplication and addition operation see below). The filter traverses the entire image this way producing a single pixel out of 9 adjacent pixels.image text in transcribed

Note that similar to downscaling operation, this operation needs to be carried out separately for each color component of a pixel. That is, firstly, the kernel will be applied to R color components of 9 adjacent pixels producing the R color component of the resulting pixel; then, it will be applied to G color components of the same 9 adjacent pixels producing the G color component of the resulting pixel; and finally, it will be applied to B color components of the same 9 adjacent pixels producing the B color component of the resulting pixel. However, there is a problem. If we do not let the kernel move beyond the boundaries of the image, the resulting image will be smaller than the original image. For instance, a 3x3 kernel traversing a 90-pixel wide image left-toright can only produce 90 - 2 convolutions without kernel exceeding image boundaries. Therefore, in this case, the resulting image would have a width of 88 pixels. In order to preserve the image size both horizontally and vertically, we apply padding to the input image by adding 0 valued pixels around the edges of the image. See below.

image text in transcribed

IMPORTANT: USE ONLY C, IF YOU'RE NOT FAMLAR C, PLEASE DON'T ANSWER THE QUESTON

1-) Source code must be commented properly.

2-) Your code needs to use dynamic memory allocation to allocate memory for processing images in memory and should free that memory properly when done.

3-) Use functions to modularize your code.

0.0625(0.125 0.0625 85 100120110 |98|64|46 150 80 70 100 120 110 98 64 46 * 0.125 025 0.125 150 80 70 0.0625 0.125 25 Image patch Kernel (filter) Input Output 1000.0625+120x0.125+110 0.0625+980.125+64x0.25+46 0.125+150_0.0625+80*0.125+700.0625 = 85.875 - 85 In this figure, each grid box represents a single pixel for simplicity. ! 000 votojo 00 00 01010101 010 0 001 0 0 0 0 0 0 0 0 10 0 0 0 0 0 10 0 0 0 0 010 10 1100 000000000000000 3x3 Kernel Input Image Output Image (has the same size as the input) 0.0625(0.125 0.0625 85 100120110 |98|64|46 150 80 70 100 120 110 98 64 46 * 0.125 025 0.125 150 80 70 0.0625 0.125 25 Image patch Kernel (filter) Input Output 1000.0625+120x0.125+110 0.0625+980.125+64x0.25+46 0.125+150_0.0625+80*0.125+700.0625 = 85.875 - 85 In this figure, each grid box represents a single pixel for simplicity. ! 000 votojo 00 00 01010101 010 0 001 0 0 0 0 0 0 0 0 10 0 0 0 0 0 10 0 0 0 0 010 10 1100 000000000000000 3x3 Kernel Input Image Output Image (has the same size as the input)

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

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago