(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 22281, 616]*) (*NotebookOutlinePosition[ 22943, 639]*) (* CellTagsIndexPosition[ 22899, 635]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Lifting and JPEG2000", "Subtitle"], Cell["\<\ Patrick J. Van Fleet Minicourse #5, Joint Mathematics Meetings New Orleans, LA\ \>", "Subsubtitle"], Cell["Objective", "Section"], Cell[CellGroupData[{ Cell["\<\ In this notebook, we will use lifting to implement the LeGall wavelet \ transformation and look at an application of the transform to lossless \ JPEG2000 compression.\ \>", "Subsubtitle"], Cell["Conventions", "Section"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "This notebook uses the package ", StyleBox["WaveletFunctions", FontColor->RGBColor[0.501961, 0, 0]], " (written by Patrick Van Fleet). All commands from the WaveletFunctions \ library will be denoted in ", StyleBox["maroon", FontColor->RGBColor[0.501961, 0, 0]], ". Help is available for almost every command in ", StyleBox["WaveletFunctions", FontColor->RGBColor[0.501961, 0, 0]], ". Click on Help and then Help Browser (or Shift F1). Next click the \ Add-ons & Links tab. Scroll down until you find ", StyleBox["WaveletFunctions", FontColor->RGBColor[0.501961, 0, 0]], ". Like all ", StyleBox["Mathematica", FontSlant->"Italic"], " help screens, the help is \"live\" - you can either execute the commands \ in the help to see the effects of the command or cut and paste them into your \ own notebook.\n\nValues that can be changed by the user are defined using ", StyleBox["blue", FontColor->RGBColor[0, 0, 1]], ".\n\nComments are useful within cells of code. Any code enclosed by (* \ *) is a comment and ignored by the ", StyleBox["Mathematica", FontSlant->"Italic"], " kernel." }], "Subsubtitle"], Cell[CellGroupData[{ Cell["Load WaveletFunctions", "Section"], Cell[BoxData[ \(<< WaveletFunctions`WaveletFunctions`\)], "Input"] }, Open ]], Cell["Spelling Off", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ This turns off the annoying error messages you get when the spelling of two \ variable names is close.\ \>", "Subsubtitle"], Cell[BoxData[{ \(\(Off[General::spell];\)\), "\[IndentingNewLine]", \(\(Off[General::spell1];\)\)}], "Input"], Cell["Huffman Encoding", "Section"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Here is a module written by two students to perform Huffman encoding. \ They learned a lot of ", StyleBox["Mathematica", FontSlant->"Italic"], " in the process! The input variable can be in the form of a list, matrix, \ or a string. The routine returns all the codes, the length of the original \ bit stream, and the length of the encoded bit stream." }], "Subsubtitle"], Cell[BoxData[ \(\(MakeHuffmanCodes[str_] := Module[{tst, char, freq, probs, s, Codes, retst, obl, nbl}, \[IndentingNewLine]tst = If[AtomQ[str] \[Equal] True, Characters[str], Map[Floor, Flatten[str]]]; \[IndentingNewLine]char = Union[tst]; \[IndentingNewLine]freq = Map[Length, Split[Sort[tst]]]; \nprobs = freq/Length[tst]; \n s = Sort[MapThread[List, {probs, Range[Length[probs]]}, 1]]; \n While[\((Length[s] - 2 \[GreaterEqual] 0)\), \[IndentingNewLine]\(s = Sort[Delete[ Prepend[ s, {s[\([1, 1]\)] + s[\([2, 1]\)], {s[\([1, 2]\)], s[\([2, 2]\)]}}], {{2}, {3}}]];\)]; \n Codes = Flatten[ Table[Position[FlattenAt[Drop[FlattenAt[s, 1], 1], 1], i] - 1, {i, Length[probs]}], 1]; \n retst = MapThread[List, {char, probs, Codes}]; \n obl = 8*Length[tst]; \n nbl = Map[Length, Codes] . freq; \[IndentingNewLine]Return[{retst, obl, nbl}]];\)\)], "Input"], Cell["The Le Gall Wavelet Matrix - Sans Boundary Modifications", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Here is some code for generating the LeGall wavelet transform matrix.\ \>", "Subsubtitle"], Cell[BoxData[ \(\(LeGallW[n_] := Module[{h, g, tp, bt}, \[IndentingNewLine]\t h = RotateLeft[ Join[{\(-1\)/8, 1/4, 3/4, 1/4, \(-1\)/8}, Table[0, {n - 5}]], 2]; \[IndentingNewLine]tp = Table[RotateRight[h, 2*k], {k, 0, n/2 - 1}]; \[IndentingNewLine]g = Join[{\(-1\)/2, 1, \(-1\)/2}, Table[0, {n - 3}]]; \[IndentingNewLine]bt = Table[RotateRight[g, 2*k], {k, 0, n/2 - 1}]; \[IndentingNewLine]Return[ Join[tp, bt]];\[IndentingNewLine]];\)\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Here is the Le Gall matrix of size 10 and the transpose of its inverse. You \ can change the (even) dimension by changing m.\ \>", "Subsubtitle"], Cell[BoxData[{ StyleBox[\(m = 10;\), FontColor->RGBColor[0, 0, 1]], "\[IndentingNewLine]", \(MatrixForm[ LeGallW[m]]\), "\[IndentingNewLine]", \(MatrixForm[ Transpose[Inverse[LeGallW[m]]]]\), "\[IndentingNewLine]", }], "Input"], Cell["The Le Gall Wavelet Transform", "Section"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Given the vector ", StyleBox["v", FontWeight->"Bold"], " of length N, the module below computes the Le Gall Wavelet Transform by \ first partitioning v into ", StyleBox["e", FontWeight->"Bold"], " (holding the even components of ", StyleBox["v", FontWeight->"Bold"], ") and ", StyleBox["o", FontWeight->"Bold"], " (holding the odd components of ", StyleBox["v", FontWeight->"Bold"], ") and then using the formulas:" }], "Subsubtitle"], Cell[BoxData[ \(d\_k\ = \ e\_k\ - \ \[LeftFloor]\ 1\/2\ \((o\_k + \ o\_\(k + 1\))\)\[RightFloor], \ k\ = \ 1, 2, \(\(...\) \(N/2\)\)\)], "Subsubtitle"], Cell["and", "Subsubtitle"], Cell[BoxData[ \(s\_k = \ o\_k + \[LeftFloor]\(1\/4\) \((d\_k + \ d\_\(k - 1\))\)\[RightFloor], \ k = \ 1, 2, ... , N/2\)], "Subsubtitle"], Cell[BoxData[ \(Here, \ o\_\(N/2 + 1\)\ = \ \(o\_\(N/2\)\ and\ d\_0\ = \ \ \(\(d\_1\)\(.\)\)\)\)], "Subsubtitle"], Cell[BoxData[ \(\(LeGall[v_] := Module[{e, o, d, s}, \[IndentingNewLine] (*\ Build\ o\ and\ e\ *) \[IndentingNewLine]{o, e} = Transpose[Partition[v, 2]]; \[IndentingNewLine]o = Append[o, Last[o]]; \[IndentingNewLine]\[IndentingNewLine] (*\ Build\ d\ *) \[IndentingNewLine]d = e - Floor[ Map[Total, Partition[o, 2, 1]]/ 2]; \[IndentingNewLine]\[IndentingNewLine] (*\ Add\ d0\ *) \[IndentingNewLine]d = Prepend[d, First[d]]; \[IndentingNewLine]\[IndentingNewLine] (*\ Drop\ the\ last\ element\ of\ o\ now\ that\ we\ are\ done\ with\ \ \(\(it\)\(.\)\)\ *) \[IndentingNewLine]o\ = \ Drop[o, \(-1\)]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ Build\ s\ *) \[IndentingNewLine]s = o + Floor[ Map[Total, Partition[d, 2, 1]]/4 + 1/2]; \[IndentingNewLine]\[IndentingNewLine] (*\ Drop\ the\ d0\ now\ that\ we' re\ done\ with\ \(\(it\)\(.\)\)\ *) \[IndentingNewLine]d = Drop[d, 1]; \[IndentingNewLine]Return[ Join[s, d]];\[IndentingNewLine]];\)\)], "Input"], Cell["Test Code", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["Here is some code to test the transform.", "Subsubtitle"], Cell[BoxData[{ StyleBox[\(v = Join[Table[k, {k, 1, 10}], Table[10 - k, {k, 1, 10}]];\), FontColor->RGBColor[0, 0, 1]], "\n", \(wt = LeGall[v];\), "\[IndentingNewLine]", \(ListPlot[v, PlotStyle \[Rule] {Red, PointSize[ .015]}, Ticks \[Rule] {{5, 10, 15, 20, 25, 30}, None}];\), "\n", \(ListPlot[ wt, PlotStyle \[Rule] {Blue, PointSize[ .015]}, Ticks \[Rule] {{5, 10, 15, 20, 25, 30}, None}];\)}], "Input"], Cell["Inverse Transform", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Here is the code to implement the inverse LeGall wavelet transform.\ \>", "Subsubtitle"], Cell[BoxData[ \(\(InverseLeGall[v_] := Module[{d, s, o, e}, \[IndentingNewLine] (*\ Partition\ v\ into\ two\ parts\ - \ approximations\ and\ \(\(differences\)\(.\)\)\ \ *) \[IndentingNewLine]{s, d} = Partition[v, Length[v]/2]; \[IndentingNewLine]\[IndentingNewLine] (*\ Add\ d0\ to\ d\ *) \[IndentingNewLine]d = Prepend[d, First[d]]; \[IndentingNewLine]\[IndentingNewLine] (*\ Compute\ the\ odd\ components\ *) \[IndentingNewLine]o = s - Floor[ Map[Total, Partition[d, 2, 1]]/4 + 1/2]; \[IndentingNewLine]\[IndentingNewLine] (*\ Drop\ the\ d0\ now\ that\ we\ are\ done\ with\ it\ and\ repeat\ \ the\ last\ element\ of\ \(\(o\)\(.\)\)\ *) \[IndentingNewLine]d = Drop[d, 1]; \[IndentingNewLine]o = Append[o, Last[o]]; \[IndentingNewLine]\[IndentingNewLine] (*\ Form\ the\ even\ \(\(components\)\(.\)\)\ *) \[IndentingNewLine]e \ = d + Floor[Map[Total, Floor[Partition[o, 2, 1]]/ 2]]; \[IndentingNewLine]\[IndentingNewLine] (*\ Drop\ the\ redundant\ last\ component\ of\ \(\(o\)\(.\)\)\ \ *) \[IndentingNewLine]o = Drop[o, \(-1\)]; \[IndentingNewLine]\[IndentingNewLine] (*\ Intertwine\ even\ and\ odd\ elements\ and\ return\ the\ \ \(\(result\)\(.\)\)\ *) \[IndentingNewLine]Return[ Flatten[Transpose[{o, e}]]];\[IndentingNewLine]];\)\)], "Input"], Cell[CellGroupData[{ Cell["Test Code", "Section"], Cell[BoxData[{ StyleBox[\(v = Table[Random[Integer, {0, 100}], {30}]\), FontColor->RGBColor[0, 0, 1]], "\n", \(wt = LeGall[v];\), "\n", \(iwt = InverseLeGall[wt]\)}], "Input"] }, Open ]], Cell["Two-Dimensional LeGall Wavelet Transform", "Section"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "It is easy to extend the LeGall transform to two dimensions. The code is \ exactly the same as that used for the 2-dimensional HWT. We first write a \ module to apply the transform to A and then the ", StyleBox["LeGall2D", FontWeight->"Bold"], " module uses ", StyleBox["LeftW", FontWeight->"Bold"], " to compute WA and then calls", StyleBox[" LeftW", FontWeight->"Bold"], " again on the transpose of WA.\n\n" }], "Subsubtitle"], Cell[BoxData[{ \(\(LeftW[a_] := Transpose[ Map[LeGall, Transpose[a]]];\)\[IndentingNewLine]\), "\[IndentingNewLine]", \(\(LeGall2D1[a_] := Module[{b, c}, \[IndentingNewLine]c = LeftW[a]; \[IndentingNewLine]b = Transpose[LeftW[Transpose[c]]]; \[IndentingNewLine]Return[ b];\[IndentingNewLine]];\)\)}], "Input"], Cell["Iterating the Two-Dimensional LeGall Wavelet Transform", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Here is some code for iterating the two-dimensional LeGall Wavelet Transform.\ \ \>", "Subsubtitle"], Cell[BoxData[{ \(\(Options[ LeGall2D] = {NumIterations \[Rule] Max};\)\), "\[IndentingNewLine]", \(\(LeGall2D[a_, opts___] := Module[{r, c, b, z, d, j, maxits, its, f}, {r, c} = Dimensions[ a]; \[IndentingNewLine]If[\((Mod[r, 2] \[Equal] 1)\) || \((Mod[c, 2] \[Equal] 1)\), Return["\"]]; \ \[IndentingNewLine]maxits = Min[\(FactorInteger[r]\)[\([1, 2]\)], \(FactorInteger[c]\)[\([1, 2]\)]]; \[IndentingNewLine]its = \(NumIterations /. \ {opts}\) /. Options[LGWT2D]; \[IndentingNewLine]If[its > maxits, Message[WT2D::"\"]; Return[];]; \[IndentingNewLine]If[ its === Max, its = maxits]; \[IndentingNewLine]b = a; \[IndentingNewLine]For[j = 0, j < its, \(j++\), d = GetCorner[b, r/\((2^j)\), c/\((2^j)\)]; \[IndentingNewLine]z = LeGall2D1[d]; \[IndentingNewLine]b = PutCorner[b, z];]; \[IndentingNewLine]Return[ b];];\)\)}], "Input"], Cell["Locating Images", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ If you have access to the internet, then use the imgdir variable that is \ listed for the internet. Else, use the imgdir for images already stored on \ your computer. If you have your own image, create a url/folder location as \ the imgdir variable.\ \>", "Subsubtitle"], Cell[BoxData[ RowBox[{\( (*\ This\ variable\ is\ the\ location\ of\ images\ on\ the\ \ \(\(web\)\(.\)\)\ *) \), "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(imgdir = \ "\";\), FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", \( (*\ This\ variable\ is\ the\ location\ of\ images\ on\ the\ local\ \ \(\(computer\)\(.\)\)\ *) \), "\[IndentingNewLine]", RowBox[{ StyleBox[\(imgdir\ = \ $BaseDirectory <> "\<\\Applications\\Images\\\ \>";\), FontColor->RGBColor[0, 0, 1]], "\[IndentingNewLine]", "\[IndentingNewLine]", \( (*\ You\ can\ create\ your\ own\ version\ of\ imgdir\ \ \(\(below\)\(.\)\)\ *) \), "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(\(\(imgdir\)\(\ \)\(=\)\)\ ;\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}], "\[IndentingNewLine]"}]}]], "Input"], Cell["Available Images", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Here is a list of images for use with this notebook. Surprisingly cartoons \ work really well! Some images work better than others. Uncomment one of the \ images. You can also add your own image!\ \>", "Subsubtitle"], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", StyleBox[\(image\ = \ "\";\), FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(image = \ "\";\), FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(image\ = \ "\";\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}], "\[IndentingNewLine]", " ", RowBox[{ StyleBox[\(image\ = \ "\";\), FontColor->RGBColor[0, 0, 1]], " ", "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(image\ = \ "\";\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(image = "\";\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(image\ = \ "\";\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(image\ = \ "\";\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(\(\(image\)\(\ \)\(=\)\)\ ;\), FontColor->RGBColor[0, 0, 1]], " ", "*)"}]}]}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Here are some maximum iteration numbers for our image list:\n\n", StyleBox["File", FontWeight->"Bold"], "\t\t\t\t", StyleBox["Max Iterations", FontWeight->"Bold"], "\nbeatles.png\t\t\t\t2\ncalvin_hobbes_gray.jpg\t\t5\nfingerprint.gif\t\t\t\ \t7\ngarfield_gray.jpg\t\t\t3\nmoonsurface.png\t\t\t3\t\nsnoopy_gray.jpg\t\t\t\ 1\nspockkirkmccoy.png\t\t\t3\nstooges.gif\t\t\t\t5" }], "Subsubtitle"], Cell["Load an Image", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["We first load an image.", "Subsubtitle"], Cell[BoxData[{\(Clear[A];\), "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"A", "=", StyleBox[\(ReadImage[imgdir <> image, PrintInfo \[Rule] True]\), FontColor->RGBColor[0.501961, 0, 0]]}], StyleBox[";", FontColor->RGBColor[0.501961, 0, 0]]}], "\[IndentingNewLine]", \( (*\ If\ your\ image\ was\ processed\ as\ a\ color\ image, \ uncomment\ the\ line\ below\ to\ convert\ \(\(it\)\(.\)\)\ *) \), "\[IndentingNewLine]", \( (*\ \(A\ = \ Total[A]/3;\)\ *) \)}], "\n", RowBox[{\({rows, cols} = Dimensions[A];\), "\n"}], "\[IndentingNewLine]", StyleBox[\(ImagePlot[A, Frame \[Rule] True, FrameTicks \[Rule] False];\), FontColor->RGBColor[0.501961, 0, 0]]}], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Here is a plot of the 2D LeGall transform.", "Subsubtitle"], Cell[BoxData[{\(wt = LeGall2D1[A];\), "\[IndentingNewLine]", StyleBox[\(WaveletDensityPlot[wt, NumIterations \[Rule] 1, DivideLines \[Rule] True];\), FontColor->RGBColor[0.501961, 0, 0]]}], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["We can iterate twice:", "Subsubtitle"], Cell[BoxData[{\(wt = LeGall2D[A, NumIterations \[Rule] 2];\), "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["WaveletDensityPlot", FontColor->RGBColor[0.501961, 0, 0]], StyleBox["[", FontColor->RGBColor[0.501961, 0, 0]], StyleBox[\(wt, NumIterations \[Rule] 2, DivideLines \[Rule] True\), FontColor->RGBColor[0.501961, 0, 0]], StyleBox["]", FontColor->RGBColor[0.501961, 0, 0]]}], StyleBox[";", FontColor->RGBColor[0.501961, 0, 0]]}]}], "Input"], Cell["JPEG2000 Application", "Section"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ In lossless JPEG2000, 2-3 iterations of the Le Gall transform are computed \ (after shifting the pixel values 128 units to the left). The resulting \ output is then encoded and transmitted. The big holdup right now with JPEG2000 is the patent issues regarding the \ encoding process. These are very complicated routines. To get an idea how \ effective the transformation is, we can Huffman encode the above output. \ \>", "Subsubtitle"], Cell[BoxData[{\(Clear[A];\), "\[IndentingNewLine]", StyleBox[\(image = "\";\), FontColor->RGBColor[0, 0, 1]], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"A", "=", StyleBox[\(ReadImage[imgdir <> image, PrintInfo \[Rule] True]\), FontColor->RGBColor[0.501961, 0, 0]]}], StyleBox[";", FontColor->RGBColor[0.501961, 0, 0]]}], "\[IndentingNewLine]", \( (*\ If\ your\ image\ was\ processed\ as\ a\ color\ image, \ uncomment\ the\ line\ below\ to\ convert\ \(\(it\)\(.\)\)\ *) \), "\n", \( (*\ \(A\ = \ Total[A]/3;\)\ *) \)}], "\[IndentingNewLine]", RowBox[{\({rows, cols} = Dimensions[A];\), "\[IndentingNewLine]"}], "\n", StyleBox[\(ImagePlot[A, Frame \[Rule] True, FrameTicks \[Rule] False];\), FontColor->RGBColor[0.501961, 0, 0]], "\[IndentingNewLine]", \(its = 3;\), "\[IndentingNewLine]", \(wt = LeGall2D[A - 128, NumIterations \[Rule] its];\), "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ StyleBox["WaveletDensityPlot", FontColor->RGBColor[0.501961, 0, 0]], StyleBox["[", FontColor->RGBColor[0.501961, 0, 0]], StyleBox[\(wt, NumIterations \[Rule] its, DivideLines -> True\), FontColor->RGBColor[0.501961, 0, 0]], StyleBox["]", FontColor->RGBColor[0.501961, 0, 0]]}], StyleBox[";", FontColor->RGBColor[0.501961, 0, 0]]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", \(huffcodes\ = MakeHuffmanCodes[Flatten[wt]];\), "\n", \(bitstream = huffcodes[\([3]\)];\), "\n", \(bpp = huffcodes[\([3]\)]/\((rows* cols)\);\), "\[IndentingNewLine]", \(Print["\", bitstream, \ "\< so that the bits per pixel is bpp = \>", Round[1000*bpp]/1000. , "\<.\>"];\)}], "Input"], Cell[BoxData[""], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"5.2 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowSize->{1015, 651}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, Magnification->1 ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 40, 0, 51, "Subtitle"], Cell[1819, 55, 109, 4, 70, "Subsubtitle"], Cell[1931, 61, 28, 0, 73, "Section"], Cell[CellGroupData[{ Cell[1984, 65, 197, 4, 50, "Subsubtitle"], Cell[2184, 71, 30, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[2251, 76, 1184, 28, 172, "Subsubtitle"], Cell[CellGroupData[{ Cell[3460, 108, 40, 0, 73, "Section"], Cell[3503, 110, 70, 1, 30, "Input"] }, Open ]], Cell[3588, 114, 31, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[3656, 119, 133, 3, 30, "Subsubtitle"], Cell[3792, 124, 118, 2, 50, "Input"], Cell[3913, 128, 35, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[3985, 133, 400, 8, 71, "Subsubtitle"], Cell[4388, 143, 1141, 21, 270, "Input"], Cell[5532, 166, 75, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[5644, 171, 100, 2, 30, "Subsubtitle"], Cell[5747, 175, 600, 12, 150, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[6384, 192, 156, 3, 30, "Subsubtitle"], Cell[6543, 197, 249, 4, 90, "Input"], Cell[6795, 203, 48, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[6880, 208, 493, 18, 52, "Subsubtitle"], Cell[7376, 228, 181, 4, 45, "Subsubtitle"], Cell[7560, 234, 26, 0, 30, "Subsubtitle"], Cell[7589, 236, 154, 3, 45, "Subsubtitle"], Cell[7746, 241, 124, 3, 30, "Subsubtitle"], Cell[7873, 246, 1227, 22, 430, "Input"], Cell[9103, 270, 28, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[9168, 275, 63, 0, 30, "Subsubtitle"], Cell[9234, 277, 456, 7, 90, "Input"], Cell[9693, 286, 36, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[9766, 291, 98, 2, 30, "Subsubtitle"], Cell[9867, 295, 1544, 27, 470, "Input"], Cell[CellGroupData[{ Cell[11436, 326, 28, 0, 73, "Section"], Cell[11467, 328, 192, 3, 70, "Input"] }, Open ]], Cell[11674, 334, 59, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[11770, 339, 473, 13, 111, "Subsubtitle"], Cell[12246, 354, 397, 9, 150, "Input"], Cell[12646, 365, 73, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[12756, 370, 110, 3, 30, "Subsubtitle"], Cell[12869, 375, 1132, 21, 250, "Input"], Cell[14004, 398, 34, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[14075, 403, 282, 5, 50, "Subsubtitle"], Cell[14360, 410, 1073, 23, 190, "Input"], Cell[15436, 435, 35, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[15508, 440, 230, 4, 50, "Subsubtitle"], Cell[15741, 446, 1633, 37, 190, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[17411, 488, 426, 10, 231, "Subsubtitle"], Cell[17840, 500, 32, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[17909, 505, 46, 0, 30, "Subsubtitle"], Cell[17958, 507, 777, 15, 150, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[18772, 527, 65, 0, 30, "Subsubtitle"], Cell[18840, 529, 220, 3, 50, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[19097, 537, 44, 0, 30, "Subsubtitle"], Cell[19144, 539, 558, 13, 50, "Input"], Cell[19705, 554, 39, 0, 73, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[19781, 559, 454, 8, 110, "Subsubtitle"], Cell[20238, 569, 1986, 41, 350, "Input"], Cell[22227, 612, 26, 0, 30, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)