HW3, Computer problem, part (a)
EECS 203A. UCI. FALL 2004

by Nasser Abbasi

This below shows the solution to this problem.
First initliaize session and load package needed to read/write binary files.

In[14]:=

Remove["Global`*"] ; Install["binary"] ; <<Graphics`Graphics` ; <<DiscreteMath`Combinatorica` ;

In[18]:=

SetDirectory[ToFileName[Extract["FileName"/.NotebookInformation[EvaluationNotebook[]], {1}, FrontEnd`FileName]]] ;

Define the filter response function. This takes the filter itself and the piece of data below the filter and returns the new pixel value

In[24]:=

filterResponse[filter_, data_] := Module[{n, m, r, c, i, j, v},  {n, m ... 62371;(*Print["returning from filter response, v=", v] ; *)Return[v] ] ;

Read the image file and display it.

In[27]:=

process[fileName_, outFileName_] := Module[{}, nRow = 480 ; nCol = 640 ; ɯ ... 55}, All}, FrameTrue, DisplayFunction$DisplayFunction] ; ]

In[28]:=

 process["cat.raw", "cat_linear_averaged.raw"] ;  process["triangle.raw", "triangle_linear_averaged.raw"] ; 

Dimensions of data read is = {307211}

Filter used is = ( 1   1   1   1   1 )                                 ...                            1   1   1   1   1                                     1   1   1   1   1

Dimensions of data after partition is = {480, 640}

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_9.gif]

New image dimensions= {476, 636}

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_11.gif]

Writing new image to file cat_linear_averaged.raw

display histogram of original image

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_14.gif]

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_15.gif]

Dimensions of data read is = {307200}

Filter used is = ( 1   1   1   1   1 )                                 ...                            1   1   1   1   1                                     1   1   1   1   1

Dimensions of data after partition is = {480, 640}

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_19.gif]

New image dimensions= {476, 636}

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_21.gif]

Writing new image to file triangle_linear_averaged.raw

display histogram of original image

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_24.gif]

[Graphics:HTMLFiles/EECS_203A_HW3_computer_problem_a_25.gif]








Created by Mathematica  (October 24, 2004)