Image Zooming (continued)
In the method. each new pixel with four original pixels at its four corners. [the "11" pixels in Fig 14.(b)] is interpolate first by using the weighted median of the four nearest original pixels as the value for that pixel. Since all original pixels are equally trustworthy and the same distance from the pixel being interpolated, a weighted of 1 is used for the four nearest original pixels. The resulting array is shown in Fig (5.31c). The remaining pixels are determined by taking a weighted median of the four closest pixels Thus each of the "01" pixels in Fig (5.31c) is interpolated by using two original pixels to the left and right and two previously interpolated pixels above and below. Similarly, the "10" pixels are interpolated with original pixels above and below and interpolated pixels ("11" pixels) to the right and left.
Since the "11" pixels were interpolated, they are less reliable than the original pixels and should be given lower weights in determining the "01" and "10" pixels. Therefore the "11" are given weights of 0.5 in the median to determine the "01" and "10" pixels, while the "00" original pixels have weights of 1 associated with them. The weight of 0.5 is used because it implies that when both "11" pixels have values that are not between the two "00" pixel values then one of the "00" pixels or their average will be used.
Thus "11" pixels differing from the "00" pixels do not greatly affect the result of the weighted median. Only when the "11" pixels between the two "00" pixels, they have a direct effect on the interpolation. The choice of 0.5 for the weight is arbitrary, since any weight greater than 0 and less than 1 will produce the same result. When the ployphase method is implemented, the "01" and "10" pixels must be treated differently because the orientation of the two closest original pixels is different for the two types of pixels. Figure (5.31d) shows the final result of doubling the size of the original array.
To illustrate the process, consider an expansion of the grayscale image represented by an array of pixels, the pixel in the ith row and jth column having brightness a ij will be interpolated into the array , with p and q taking values 0 or 1, indicating in the same way as above the type of interpolation required:
The pixels are interpolated as follows:
,where "◊" is relication operator.
An example of median interpolation compared with belinear interpolation is given in Fig (5.32). Bilinear interpolation uses the average of the nearest two original pixels to interpolated the "01" and "10" pixels in Fig. (5.31b) and the average of the nearest four original pixels for the "11" pixels. The edge-preserving advantage of the weighted median interpolation is readily seen in the figure.