Resampling: Downsampling vs Upsampling


Introduction

The main purpose of downscaling an image (or called subsampled or downsampled ) is twofold:

  1. Make the image fit the size of the display area;
  2. Generate a thumbnail of the corresponding image.

The main purpose of upscaling an image (or upsampling or interpolating ) is to enlarge the original image so that it can be displayed on a higher resolution display device.

Scaling an image does not bring more information about the image, so the quality of the image will inevitably suffer. However, there are indeed some scaling methods that can increase the information of the image, so that the quality of the scaled image exceeds the quality of the original image.

  • \(\color{lime}{downsampling principle}\) : For an image size of \(M \times N\) , perform \(s\) times downsampling, that is, \(\frac{M} {s} \times \frac{N}{s}\) resolution image, of course, \(s\) should be the common divisor of \(M\) and \(N\) , if it is considered The image in matrix form is to change the image in the original image \(s \times s\) window into a pixel, and the value of this pixel is the mean of all pixels in the window:
    \[P_k = \sum_{i \in win (k)} \frac{I_i} {s^2}\]

  • \(\color{lime}{Upsampling principle}\) : Image enlargement almost always adopts the interpolation method, that is, on the basis of the original image pixels, a suitable interpolation algorithm is used to insert new elements between the pixels.

interpolation algorithm

  1. Traditional Difference Principle and Evaluation
    In traditional image interpolation algorithms, neighbor interpolation is relatively simple and easy to implement, and was widely used in the early days. However, this method produces noticeable jagged edges and mosaics in new images. The bilinear interpolation method has a smoothing function, which can effectively overcome the shortcomings of the adjacent method, but it will degrade the high-frequency part of the image and blur the image details. When the magnification is relatively high, high-order interpolation, such as bicubic and cubic spline interpolation, is better than low-order interpolation. These interpolation algorithms can make the pixel gray value generated by interpolation continue the continuity of the grayscale change of the original image, so that the change of shades of the enlarged image is naturally smooth. However, in the image, there is a sudden change in the gray value between some pixels and adjacent pixels, that is, there is gray discontinuity. These pixels with sudden changes in gray value are the edge pixels in the image that describe the outline of the object or the texture image. In image magnification, for these pixels with discontinuous grayscale characteristics, if a conventional interpolation algorithm is used to generate newly added pixels, the outline and texture of the magnified image will be blurred and the image quality will be reduced.

  2. Edge-based Image Interpolation Algorithms
    In order to overcome the shortcomings of traditional methods, many edge-protected interpolation methods are proposed, which can enhance the edge of the interpolated image to a certain extent, so that the visual effect of the image is better. The edge-protected interpolation methods can be divided into two categories. : The method based on the edge of the original low-resolution image and the method based on the edge of the high-resolution image after interpolation. Methods based on the edges of the original low-resolution image:
    • First detect the edge of the low-resolution image, and then classify and process the pixels according to the detected edge. For the pixels in the flat area, the traditional method is used for interpolation; for the pixels in the edge area, a special interpolation method is designed to achieve the purpose of maintaining the edge details.
    • Methods based on the edges of high-resolution images after interpolation This type of interpolation methods: first use traditional methods to interpolate low-resolution images, then detect the edges of high-resolution images, and finally perform special processing on the edges and nearby pixels to remove blur and enhance the image. the edge of.
  3. The region-based image interpolation algorithm
    first divides the original low-resolution image into different regions, then maps the interpolation points to the low-resolution image, determines the region to which they belong, and finally designs different interpolation formulas according to the neighborhood pixels of the interpolation points to calculate the interpolation value. point value.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324847207&siteId=291194637