Docsity

CS 350: Image Denoising via Client-Server Communication, Assignments of Computer Science

Toggle sidebar
bg1
CS 350: COMPUTER SYSTEM CONCEPTS
PROGRAMMING ASSIGNMENT 3: (OS PART)
IMAGE DENOISING VIA CLIENT-SERVER COMMUNICATION
ANNOUNCED: APRIL 08, 2009
DUE DATE: APRIL 16, 2009, 5:00PM (SUBMIT DOCUMENTATION IN CLASS)
DUE DATE: APRIL 23, 2009, 11:59PM (PROGRAM CODES AND FINAL RESULTS)
MAXIMUM MARK: 115
A copy of this document and other required files for the assignment can be found via the course web page:
This assignment is based on the previous project in Assignment 2.
But note that there are a few differences, and some new calculations required.
1. GENERAL
Image analysis is generally a time consuming process. In some cases, a special machine with special computing resources may
be used for the analysis. Depending on the type of task, the required image analysis task can however be performed
independently on different parts of the image. When there are different processors available, we may be able to speed up the
analysis by performing some of the required tasks in parallel.
In this assignment, we shall simulate a situation whereby we have a client that needs to do some simple image analysis task.
We shall also assume that we have available, multiple servers that can perform the required task. A client process can then
send its requests to the servers, and each server will perform the required analysis and return the results to the client. For
simplicity, we just assume that the client and the servers are in the same machine.
2. THE PROBLEM (AS DESCRIBED IN ASSIGNMENT 2)
Imagine that you have lost some old picture you took a while ago. However, you still have the negative for the picture, but
these have been corrupted by noise, say due to dirt, age, weather, etc. Assume the given negative is an m
×
m image negative
A. We are required to apply some simple transformations (median filtering and image inversion) on this noisy image negative
to produce a reconstructed image I. This type of filtering is usually performed during some stages of image and video analysis.
The required transformation is performed using the following steps.
Define n
×
n as the neighborhood block size, assume n is odd (n=3, 5, 7). For each n
×
n block of the image, we compute the
median pixel value. (This is done on overlapping blocks). The median value then becomes the value for the pixel at the center
of the block. To invert the image, we apply a simple point operation on each pixel as follows: g(x)=G-A(x); Assume G=256.
A schematic diagram of the required mapping is shown below.
Noisy image negative A Median
filter Denoised image negative Invert
image Reconstructed image I
(denoised and inverted)
Your program should produce the reconstructed version of a noisy image negative from the user. For instance, the client
process could divide the input image into n
×
n smaller overlapping image blocks, and then call on a server process to perform
the required analysis operations. The server would return the median (and other required statistics) of the input array to the
client, which then organizes the final result into a de-noised image negative, and prints out the summary statistics. As part of
the server’s job, it will also be able to take a given pixel in the image block, and the inverted pixel value.
pf3

Partial preview of the text

Download CS 350: Image Denoising via Client-Server Communication and more Assignments Computer Science in PDF only on Docsity!

CS 350: COMPUTER SYSTEM CONCEPTS

PROGRAMMING A SSIGNMENT 3: (OS PART )

I MAGE D ENOISING VIA C LIENT -S ERVER C OMMUNICATION

A NNOUNCED : A PRIL 08, 2009

D UE D ATE : A PRIL 16, 2009, 5:00 PM (SUBMIT DOCUMENTATION I N C LASS )

D UE D ATE : A PRIL 23, 2009, 11:59 PM (PROGRAM CODES AND FINAL R ESULTS )

M AXIMUM MARK : 115

A copy of this document and other required files for the assignment can be found via the course web page:

This assignment is based on the previous project in Assignment 2. But note that there are a few differences, and some new calculations required.

  1. G ENERAL Image analysis is generally a time consuming process. In some cases, a special machine with special computing resources may be used for the analysis. Depending on the type of task, the required image analysis task can however be performed independently on different parts of the image. When there are different processors available, we may be able to speed up the analysis by performing some of the required tasks in parallel.

In this assignment, we shall simulate a situation whereby we have a client that needs to do some simple image analysis task. We shall also assume that we have available, multiple servers that can perform the required task. A client process can then send its requests to the servers, and each server will perform the required analysis and return the results to the client. For simplicity, we just assume that the client and the servers are in the same machine.

  1. THE PROBLEM ( AS DESCRIBED IN A SSIGNMENT 2) Imagine that you have lost some old picture you took a while ago. However, you still have the negative for the picture, but

these have been corrupted by noise, say due to dirt, age, weather, etc. Assume the given negative is an m × m image negative

A. We are required to apply some simple transformations (median filtering and image inversion) on this noisy image negative to produce a reconstructed image I. This type of filtering is usually performed during some stages of image and video analysis.

The required transformation is performed using the following steps.

Define n × n as the neighborhood block size, assume n is odd (n=3, 5, 7). For each n × n block of the image, we compute the

median pixel value. (This is done on overlapping blocks). The median value then becomes the value for the pixel at the center of the block. To invert the image, we apply a simple point operation on each pixel as follows: g ( x )=G-A( x ); Assume G=256.

A schematic diagram of the required mapping is shown below.

Noisy image negative A Median filter

Denoised image negative Invert image

Reconstructed image I (denoised and inverted)

Your program should produce the reconstructed version of a noisy image negative from the user. For instance, the client

process could divide the input image into n × n smaller overlapping image blocks, and then call on a server process to perform

the required analysis operations. The server would return the median (and other required statistics) of the input array to the client, which then organizes the final result into a de-noised image negative, and prints out the summary statistics. As part of the server’s job, it will also be able to take a given pixel in the image block, and the inverted pixel value.

  1. The Client Side (parent process) At the client, we have a process that needs to produce a filtered and inverted image from a noisy image negative. The process

will have to partition the input image into a total of n × n smaller overlapping image blocks and distribute the partitions to its

children. Each child will act as an image analysis server. Assume we have p child processes, (2 ≤ p ≤ 10).

The parent will do the following: i. Read the input image (imageIn.ppm)

ii. Partition the original image into smaller overlapping subimages (or blocks) each of size n × n

iii. Distribute the jobs (the image blocks) amongst the p child-processes, or p threads. iv. Wait for the children to return their results v. Arrange the returned results to form the de-noised negative image vi. Use the results from all the children to calculate and printout the following statistics of the original noisy image:

  1. Overall image mean (i.e. mean of the individual block averages)
  2. Average subimage standard deviation (mean of the standard deviation from the individual blocks)
  3. Standard deviation of the block averages vii. Write the reconstructed image I (de-noised and inverted image) to a file (imageOut.ppm)

You are to decide on the specifics of how the parent and its children will communicate and how the parent will distribute the tasks to its children. For instance, since the parent and child process will have copies of the variables at the time a child is created, the parent can communicate which image parts each child will handle by modifying some variables just before the child is created. Thus, the image data will generally be accessible to the child, which will then extract its own assigned part of the image (for instance based on an index number) and then pass the data to the server. Similarly, you will need to decide on how you want the child processes to return their results to the parent, for instance via pipes, or some other mechanism.

  1. The Server Side (child processes) The server's job is simple. i. Receive the input image block from the client. ii. Compute three image statistics using the block received from the parent iii. Depending on the mode, performs the median filtering operation on the block, and then inverts the single median value (or calls the function to invert the image block, and then perform the filtering on the inverted block). The result of this step will always be one single value for the received block. iv. Send back the results (the three statistics – median, mean, and standard deviation) to the client. Note that at this point, the median value would have already been inverted, and hence the client process does not need to do this again.

The three simple image statistics required from the server are the median, mean and standard deviation - using the image block passed to it by the client (in this case the parent).

Note: given a collection of numbers, x 1 , x 1 , x 3 ,..., xn the mean and standard deviation are defined respectively as:

=

n

i

n xi

1

=

n

i

n xi

1

2 1

  1. The Input Data (Same as in Assignment 2) The input data will be a noisy image negative in ppm (portable pixel format) to be provided by the user. (Two sample images are provided in the project directory). Also provided are two functions, one to read images in ppm format, and the other to create a ppm image from a given data. You are not required to create your own program for reading or writing image files. But there will be no penalty for doing so :-). However, if you use a different image format, you will have to be able to read from and write to such formats. Also, we can assume that images are only grey-level images.