Algorithm II was first run on images artificially induced with fog. The 3 pictures below illustrate this process for one of the images that was tested, an airplane flying over the mountains.

This is the original image:

This is the image with artificially induced fog:

This is the image after defogging by algorithm II:

The algorithm was also run on some images containing actual fog. Two example images, a roadside landscape and mountains, are given below.

### Analysis of Distance Matrix Values

To determine the effect of the distance matrix on the performance of algorithm two, fog was first induced on the image using high distances at the bottom of the picture and low distances at the top. The same distance matrix was then used in the algorithm to remove the fog. The B value achieved in the resulting image was recorded. Next, the distance matrix values in the algorithm were doubled and the algorithm was run on the fogged image again. The resulting image was identical to the first defogged image, though the B value was twice as much. The process was repeated using several other scalar values of the original distance, and in each case the result was a consistent value of B*Rij for a given pixel, where Rij represents the distance to that pixel. This result is consistent with the fogging theory, as B and R both appear as products in the exponential term.Next, the distance matrix pattern was changed from the one that was used to induce the fog and algorithm was applied again. The new pattern had high distances at the top and low ones at the bottom. In this case, as could be expected, the produced image was visually different than the original image. Some fog was removed from certain sections, and other sections were brightened or darkened compared to the original image.

The results indicate that only the relative distance values are important in order for the correct image to be achieved. If B is expected to be in a specific unit, the distances in the distance matrix will have to correspond to that value, but otherwise the absolute distance values used aren't important. On the other hand, the relative distance of each pixel has been determined to be extremely critical to obtaining the proper result.

### Analysis of Initial Guess for B

This section details the analysis of how much the initial guess for B affects the convergence of the second algorithm, mainly through the number of iterations required before the defogged image is produced. C0 is not analyzed, since this algorithm picks a value for C0 which doesn't change throughout the defogging process.

To start out, the algorithm was run on the lake image with artifically induced fog using a B value of zero. The value of B produced by the algorithm was the correct value and was used as a baseline B guess for all other tests on the same image (assumming the same distance matrix, of course). The number of iterations for this initial guess was recorded. The algorithm was then run a second time, using the baseline value for B. The third time, the algorithm was run using a much higher value for B. For each run the number of iterations until completion was recorded.

The above process was repeated on four other images. The process was then repeated for all the images again, but using a different distance martix to induce the fog and defog the image. Negative values for the B guess were tested as well.

### Analysis of Performance vs. Run Time

This analysis was performed by limiting the number of iterations that the algorithm would perform. The image quality, as determined by visual inspection and root mean square error, are the key measures of comparison.

As can be seen, the first few iterations are by far the most important. After just two iterations, the images closely resemble the original image.

The results of running the same process on the pepper image are very similar and are given below.

When the airplane image was tested in this way, it ran for 100 iterations. This seemed to be a good image from which to collect performace vs. run time data. However, the algorithm was found to quickly converge to a close copy of the original image and remain the same thereafter. The resulting images are displayed below.

Even though it took 100 iterations, there is no visual difference between the third and fourth iterations, or any thereafter. Nor does there appear to be any actual difference, as shown by both the constant B produced and the constant RMSE. The initial guess for B does largely affect the image appearance after the first iteration, however.