Question: C++ You are given a computer system that stores gray-scale images using an N-by-N array of pixels. Each pixel stores the intensity value as an
C++

You are given a computer system that stores gray-scale images using an N-by-N array of pixels. Each pixel stores the intensity value as an integer. A common filtering function replaces the intensity value of each pixel with the average of the intensities of the given pixel and each pixel surrounding it. For example, in the grid shown below, the intensity value for pixel Y is replaced with the average of Y and all of the pixels marked X that surround it. If the pixel is on the edge of the image so that it does not have all of its neighbors, such as pixel A below, the new value is the average of only the pixel and its existing neighbors, marked B in this example. Write a program that reads an N-by-N array from stdin and this averaging process on the input array. The final result should be stored in an array. The intensity values should be printed from this array to stdout as integer values. Be sure to use functions appropriately to make your program easy to read and understand. BB AB BB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
