# Project #26695 - Multi-dimensional Arrays

Problem 1 (100 points) Basic Image Processing

All source files have been provided. You only have to modify the ImageProcessor file by implementing

4 methods described below.

An image is basically a 3-dimensional array of integers where the first index (dimension) corresponds to

the channel (meaning Blue, Green or Red), the second index (dimension) corresponds to the number of

rows of the image and the third index corresponds to the number of columns in the image. In other Page 2 of 3

words, colors are three-dimensional entities having a red, green, and blue component. Each integer in

the array has be in the range 0 to 255. See the in-class example of Drawing1.java and etc. Assume all

Example of how to interpret a 3D array a[color][row][column]:

A 3D array has int[][][] arr = new int[3][800][600] means that there are 3 colors

(Red, Green, Blue). Each channel (each color) is an array of 2D – 800 x 600 elements.

For instance, a[2][100][204] = 98; means that change the color intensity of point/pixel at coordinate x =

100, y = 204 in the blue (color code = 2) channel to 124. Smaller values of intensity leads to “darker”

Read the description of ImageProcessingTutorial.pdf (the other pdf file on the homework page)

for the description of these 4 filters.

ï‚· public int[][][] medianFilter(int[][][] image)

o medianFilters an image using an 3 x 3 region

ï‚· public int[][][] minFilter(int[][][] image)

o medianFilters an image using an 3 x 3 region

ï‚· public int[][][] maxFilter(int[][][] image)

o medianFilters an image using an 3 x 3 region

ï‚· public int[][][] scaleFilter(int[][][] image, double gain,

double bias)

o scales an image using the gain and bias

ï‚· Hint:

o In order to return the correct image, create new array of same dimensions as the

parameter image. Update each pixel/point using nested loops. The value/intensity of

each pixel is solely based on the value of the original array image.

o Do NOT write all code at once. Test them step-by-step, put S.o.p statements in the loops.

o You might want to create additional help methods to support the 4 filter methods; there is

a lot of common functions.

o To find a min, max or median, you can copy the values in the 3x3 mask to some array,

sort the array and then retrieve the value you want.

o Make sure that the element values in the 3D array fall in the range [0, 255].

o Press Ctrl + C to terminate the program from the terminal.

o If you remote login (ssh/putty) from home, please make sure you include option –X or

some X11 forwarding to enable Java graphical interface.

o Do NOT comment out the 4 methods, otherwise, you cannot really run the Imaging

program. Just leave the return null statement in method you have not implemented yet.

o To make your life easier, use methods! (You can pass arrays to the methods, remember!)

o Do NOT forget to handle the pixels on the edge – they need special treatment, since they

do not have all 8 surrounding cells around them! Be careful to avoid running to Page 3 of 3

ArrayIndexOutBoundException. Otherwise, you can treat value of “missing” pixels

outside the edge as having a color value of 128.

o Take advantages of “sorting” methods to find the min, max and median. Since a mask 3 x

3 is a 2D subarray, try to use a method to get a 1-Dimensional array representation of that

2D sub-array first, so you can sort and get the min/max/median easily.

o Test your program using small images you can find on the internet or save on a computer

(600 x 400 are good pictures).

How to run the Image Processing program:

1) Save your modifications to ImageProcessor.java

2) (Compiling)

javac ImageProcessor.java

3) (Executing – notice we are running a different class with a main

method, ImageProcessor is a support class with no main method,

but Imaging does have a main method)

java Imaging

4) Optional: development/debugging purpose: run the TestPack.java

to see if the output makes any sense. And yes, you do have to

compute the “correct” output by yourself.)

There are a lot of files there. There are only 2 files/programs with main methods, the remaining fils are source codes.
The first one is TestPack.java . Open the file and read the source code, you can clearly see it hard-codes/embeds some fixed array and just calls the methods - filter - from ImageProcessor.java on that array, then out put the results. So run java TestPack and see if the program outputs make sense to you.

Run java Imaging if you pass the test, that will open the Graphical interface window

Please make the program simple and basic

 Subject Computer Due By (Pacific Time) 04/06/2014 11:59 pm
TutorRating
pallavi

Chat Now!

out of 1971 reviews
amosmm

Chat Now!

out of 766 reviews
PhyzKyd

Chat Now!

out of 1164 reviews
rajdeep77

Chat Now!

out of 721 reviews
sctys

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews
topnotcher

Chat Now!

out of 766 reviews
XXXIAO

Chat Now!

out of 680 reviews