# MAT335 IFS Encoder Usage Instructions

(This documentation applies to MAT335prog version 1.1)

NOTE: This document has been updated to reflect new additions made to the programme. Specifically, the encoding section has been updated with documentation describing how to specify minimum and maximum quadtree depths.

This document provides usage instructions for the programme mat335prog created for Randall Pyke (pyke@math.utoronto.ca) as part of my final project in the course MAT335 in the Spring of 2001.

My programme uses Y. Fisher's quadtree fractal compression algorithm to compress and decompress images. This algorithm works by classifying the domains and ranges of an image into a quadtree structure. This means that we cover the planar region of interest by a square then recursively partition squares (domain blocks) into smaller squares (range blocks) until each square contains a suitably uniform subset of the input. Next, we generate the various affine transformations of the range blocks to the domain blocks. If the specified tolerance is not met, we improve the technique by further subdividing a region in order to get a better match at the cost of encoding speed.

My programme allows for the loading, saving, encoding and decoding of images and has a simple and easy-to-use interface. When the programme is loaded, the window view is drawn in a solid dark-yellow colour; that is, no image is in the window view. At this point, an image must be either loaded or an image must be decoded. Once an image is loaded, it can be encoded or saved. The programme only supports 256x256 greyscale images. While it is possible to apply adaptive partitioning schemes for non-square images, such algorithms are more complicated and computationally expensive.

The following bullets summarise the main features:

| Loading images
| Saving images
| Encoding images (updated)
| Decoding images
| Known Bugs and Limitations

Novice users of Windows programmes ought to read this document from beginning to end in order to familiarise themselves with the programme and its features. More expereinced users, on the other hand, will likely only need to use this document as a reference as many of the interface features are common in Windows applications and are self-explanatory.

## Loading Images

To load an image into view click the File menu then choose the "Load new image..." menu item. A dialogue will appear and allow you to choose a PNG (Portable Network Graphics) image file. Once you have selected an image file name, click the "Open" button and the image will appear in the programme window. Once an image is loaded, it can be Saved or Encoded. Note that only 256x256 greyscale images may be loaded; attempting to load images of different resolution will result in an error message. The following images illustrate the process of loading an image:

Choose menu item (step 1) | Choose file name to load (step 2) | Image appears in window (result)

## Saving Images

Before an image can be saved, one must be loaded into view (see Loading Images for more information).

To save an image, choose the "Save current image..." menu item from the File menu. A dialogue is displayed prompting you for the file name. Enter a file name and press the "Save" button. Often times, it is useful to save decoded images as PNG image files for later viewing (in a web page or document, etc.). Note that if an image is not currently loaded in window, attempting choosing the "Save current image..." menu item results in an error message. The following images illustrate the process of saving an image:

Choose menu item (step 1) | Choose file name to save as (step 2)

## Encoding Images

Before an image can be encoded, one must be loaded into view (see Loading Images for more information).

To encode an image select the "Encode current image & save..." menu item from the Quadtree menu. A dialogue is displayed prompting you for the following encoding parameters: RMS tolerance, Minimum and maximum quadtree depths and domain search flag. The parameters have the following meanings:

| RMS tolerance specifies the final RMS error in the encoded image; the default value of 8.0 usually suffices. Higher tolerances result in smaller compressed images with poorer image quality while low tolerances result in larger compressed images with higher image quality. Specifying a tolerance greater than 50.0 defaults to 50.0 tolerance and values between 2 and 15 are usually adequate -- see the Known Bugs and Limitations section for more information about this.
| Minimum recursion depth specifies the minimum number of times the largest square sub-image will be recursively quadtree partitioned. Using larger values will result in higher compression ratios when the file is easy to encode.
| Maximum recursion depth specifies the maximum number of times that the largest square sub-image will be quadtree partitioned. Using larger values will help encode the fine detail in the image at the cost of encoding time and smaller compression ratio.
| Search 24 domain classes flag forces search 24 domains for each range. This results in slower encoding but higher image quality.

Note that the following restriction must be satisfied for the minimum and maximum recursion depths:

0 < minimum recursion depth < maximum recursion depth < 7

The restriction is such that the minimum recursion depth is both always less than the maximum recursion depth and always greater than zero. Also, the maximum recursion depth of the quadtree partitions cannot exceed 7 levels. Partitioning beyond 7 levels is semantically sound, but requires too much memory and is sufficient for this programme's purpose.

Once all parameters have been specified, click the "Encode" button. Next, a dialogue prompts you for the file name to save the compressed image as. Specify a file name then press the "Save" button. Once the encoding is complete (it may take a while), a message box displays the compression ratio (and the size of the original and compressed files). Press the "OK" button to return to the programme window. The following images illustrate the process of encoding an image:

Choose menu item once an image is already loaded (step 1) | Specify encoding parameters (step 2) | Choose file name to save as (step 3)

## Decoding Images

To decode an image, select the "Decode..." menu item from the Quadtree menu. A dialogue appears prompting you for the CIF file (that is, compressed image file) to load. Choose a file name then press the "Open" button. Next, a dialogue appears prompting you for the decoding parameters. Specify the number of iterations (that is, the number of times each transformation should be executed) and whether image smoothing should be performed. Finally, click the "Decode" button to decode the compressed image file. Once decoding is complete, the image will appear in the programme window. The following images illustrate the process of decoding a compressed image file:

Choose menu item (step 1) | Choose compressed image file to open (step 2) | Specify decoding parameters (step 3)

## Known Bugs and Limitations

The programme has a few well-known bugs in the encoding and decoding modules. The specific nature of these bugs is not explained here, however if you encounter a crash while using the programme to decode an image it's recommend that you try to re-encode the image using the same parameters but a lower RMS tolerance value.

Send questions and comments to Farhad Sadaghiani (g9sada@cdf.utoronto.ca)
Last updated Monday June 18, 2001 19:37:26 -0400