Image upsampling and image downsampling

Reference:
https://www.cnblogs.com/han1ning1/p/6924404.html
https://blog.csdn.net/ccblogger/article/details/72875497
An interpolation algorithm based on image edges. Han Ping

1. The concept of image downsampling and upsampling

Both the upsampling and downsampling of the image can be implemented using the imresize function in matlab, and these operations must be indispensable steps in the algorithm that uses the image pyramid. The concept of the two is briefly introduced below.

1.1 Image downsampling

Image downsampling (subsampled) can be colloquially understood as reducing the image, also known as downsampling (downsampled). Its purpose is two-fold: 1) make the image fit the size of the display area; 2) generate a thumbnail of the corresponding image.

1.2 Image Upsampling

Image upsampling (upsampling) is to enlarge the image, which can also be called image interpolation (interpolating), and its main purpose is to enlarge the original image, so that the image can be displayed on a higher resolution display device.

2. Principle

2.1 The principle of downsampling

To illustrate downsampling, let's take an example. Suppose we have an image Img whose size is M*N, and we want to downsample the image by s times, even if the image is reduced by s times, here we need to reduce the length and width by s times at the same time. Then the size of the final down-sampled image (result image) is (M/s)×(N/s). As for how to convert the image to (M/s)×(N/s) size, here are two methods. as follows:

img = imread('lena.tif');
[height,width,~]  =size(img);
% 使用2种方法进行下采样
sub_1 = img(1:2:end,1:2:end)
sub_2 = imresize(img,[height/2,width/2],'bilinear');

2.2 Upsampling principle

Image upsampling 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 pixel points.
Specifically, because the image upsampling is to enlarge the image, the process will inevitably generate some pixels, and these pixels do not exist originally. This begs the question, how should the pixel values ​​of these new pixels be determined? The interpolation algorithm exists to calculate the pixel values ​​of these new pixels.
In the document "Overview of Image Interpolation Technology", the interpolation algorithms are briefly divided into three categories: traditional interpolation, edge-based interpolation and region-based interpolation.
Next, we briefly describe these three types of algorithms.

2.2.1 Traditional interpolation algorithm

The most classic interpolation methods include nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation. In order to overcome the smoothing effect of traditional interpolation, edge-based image interpolation algorithms and object-based image interpolation algorithms appear.

nearest neighbor interpolation

The nearest neighbor interpolation is a method of taking the gray value of the nearest neighbor among the four adjacent pixels around the sampling point as the gray value of the point. The nearest neighbor interpolation algorithm is the fastest, but produces noticeable aliasing and mosaicism.

bilinear interpolation

Bilinear interpolation uses the gray values ​​of the surrounding four neighboring points to perform linear interpolation in two directions to obtain the gray value of the sampling point. This method eliminates aliasing to a large extent, but becomes more blurred on the edges

Trilinear interpolation

Bicubic interpolation not only considers the gray value of four adjacent points, but also considers the influence of the gray value change rate between adjacent points. is an improved algorithm for bilinear interpolation. Compared with the first two classical interpolation methods, better interpolation effect can be achieved. However, it still has low-pass filtering, which will lose the high-frequency part of the interpolated image, thus blurring the edges of the image.

2.2.2 Edge-based image interpolation algorithm

Although the traditional interpolation methods are simple and fast, they often cause blurred image edge contours due to their low-pass filtering effect. In view of the advantages and disadvantages of traditional methods, different scholars have proposed many interpolation methods based on image edges. The basic point of this type of interpolation method is: in the non-edge area, the traditional image interpolation method has a good effect, and the processing speed is fast and the amount of calculation is small, so the traditional interpolation method is used in the non-edge area; area, using a special interpolation method to enhance the edge, effectively preserving the details of the image.

2.2.1 Region-based image interpolation algorithm

First, the original low-resolution image is divided into different regions, then the interpolation point is mapped to the low-resolution image, and the region to which it belongs is determined. Finally, different interpolation formulas are designed according to the neighborhood pixels of the interpolation point to calculate the value of the interpolation point.

Guess you like

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