## Tuesday, October 16, 2012

### SOCIS - part 10

In the previous post I mentioned that my mentor has updated the POT so that the discontinuity on the t variable is moved away from the initial -1/1 point to -sqrt(2)/2. I thus included, in the metrics computing program, a new metric to computer the number of crossings over this new discontinuity. What I noticed was that the number of discontinuities of this kind is almost the same as the number of -1/1 jumps and that average smoothing takes care of both of them. The results can be found here [1, 2].

In this new POT I incorporated average smoothing and tested to see if indeed the new results were better than the old ones. They were more or less the same. While it is not noticeable on the SNR plots below, this new implementation is slightly better (the SNR values are larger but not by much).

My latest attempt at incorporating resets into the average smoothing implementation, is showing promise. I no longer have discontinuities as in previous attempts, but the image does get blurry again.
From the idea of deprecating previous covariance values I thought about deprecating previous average values. Firstly, why do we need the resets? If we consider an image in which the upper half is water and the lower half is land, this averaging method will specialize on smoothing the upper part and perform badly on the lower part. This is because, as the procedures progresses line by line, the average value is constructed from similar values of a certain region (in this case, the region is the upper half, which is water). But when we switch to a different region (the lower half, which is land), the average constructed from the 'water values' is no longer relevant. For this reason, previous values must be deprecated in time.
My idea was to take 2 averages, the first one we shall name currentAverage and the second newAverage. The actual value we shall use will be a weighted sum of these two, namely (1 - w) * currentAverage + w * newAverage, where 0 <= w <= 1. If we divide the image into blocks of height NUM_LINES, then w = (currentLine mod NUM_LINES) / NUM_LINES. We can see from this that w increases as we approach the block's last line. This means that, in our formula, the bias towards currentAverage decreases and the bias towards newAverage increases. currentAverage is the average of all values from the current block and previous block, while newAverage is just the average of the values in the current block. The 'algorithm' is as follows:

for each line
if currentLine mod NUM_LINES == 0
switch(currentAverage, newAverage) // interchange the two averages
reset(newAverage)
update both currentAverage and newAverage
average to be used = (1 - w) * currentAverage + w * newAverage.

For the image I've been using in my tests (the Mount St. Helens image), I've noticed that increasing NUM_LINES leads to better results, in the sense that we obtain smoother rotation and mean values. This makes sense for our image, as increasing NUM_LINES makes this method resemble 'traditional' average smoothing more and more. However, this image is roughly the same everywhere (in keeping with the previous analogy... we have land everywhere). The resulting images I obtained after smoothing are blurry, but discontinuity free. You can see one here [3] along with the corresponding means and rots here [4,5].

The problem of taking the sign change into account for the lossless case still remains. I'm still have implementation issues here. While my attempt seems correct to me, the results seem to disagree (discontinuities). Still in the process of understanding why this happens.