Algorithm 3. Removing distortion from image.
| input: |
| calculate using Algorithm 2 |
| else |
| set as outlier |
| end if |
| end for |
| using variance and average of all to detect outlier ones |
| for each : |
| if is outlier |
| calculate using matrix of neighboring windows |
| end if |
| end for |
| estimate MOG using and assign mean of MOG models to each windows |
| for each pixel index j in x |
| L = set of all jth pixel exist in all transformed windows |
| jth pixel of = median(L) |
| end for |
| return |