Question: In this problem, you will write a program ( filter . cc ) which performs some very simple image processing operations. You can find a

In this problem, you will write a program (filter.cc) which performs some very simple image processing operations. You can find a template program in Moodle (filter-template.cc). The program, once compiled, can be run as follows:
filter image.pgm
where image.pgm is the file containing an image.
Write the allocate and deallocate functions (see the template) which allocates and deallocates two-dimensional arrays of integers.
You will also write three functions which are used to process images in different ways:
(a) int average(int A[5][5]);
This function computes the average (rounded to the nearest integer) of the two-
dimensional array of 25 integers.
(b) int median(int A[5][5]);
This function computes the median of the two-dimensional array of 25 integers, rounded to the nearest integer. You may reuse code you have written for the previous problems.
(c) int strange(int A[5][5]);
This function should return the value:
255.0\times (A[1][1]2\times A[2][1] A[3][1]+ A[1][3]+2\times A[2][3]+ A[3][3]+1020)2040
rounded to the nearest integer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!