The Pyrdowm operator is used to obtain different resolution representations of the image.
There are currently two types of interpolation supported by this operator: Gaussian interpolation and bilinear interpolation.
The pyramids corresponding to the two interpolation methods are called Gaussian and bilinear pyramids, respectively.
Gaussian pyramid downsamples the picture through processes such as Gaussian smoothing and sampling to produce an image whose length and width are half the size of the original. The current Gaussian pyramid only supports 1 level of computation.
The bilinear pyramid directly generates a new image of half the size of the previous image of the current layer in length and width through the processes of bilinear interpolation and downsampling.The current bilinear pyramid supports 5 levels of computation.
Based on the principle of downsampling, there are two methods: Gaussian downsampling and bilinear downsampling.
The implementation process of downsampling with Gaussian pyramid is to first perform Gaussian smoothing on the original image and then remove the even rows and columns to finally get the target image.
The Gaussian filter kernel used in the Gaussian smoothing stage is as follows:
Bilinear pyramid uses bilinear interpolation to accomplish the downsampling calculation of the image, the principle of bilinear interpolation is shown in the figure below:
In the interpolation process, it is assumed that the interpolated pixel point to be output is P, and the distance between the four to-be-interpolated source points P1,P2,P3,P4 adjacent to P is one.
Since the interpolation method is linear, the order of interpolation in the horizontal and vertical directions does not affect the final result.
The specific interpolation point formula is as follows:
P12=(1−a)∗P1+a∗P2
P34=(1−a)∗P3+a∗P4
P=(1−a)∗(1−b)∗P1+a∗(1−b)∗P2+(1−a)∗b∗P3+a∗b∗P4
The coefficients of the coordinates of each point in Eq. can be considered as the weight values of the interpolated source points for the output pixel points.
The pyramid interface presented in this operator uses a bilinear interpolation defaulting to equal distances from the output point to each interpolated source point.
The input image data is downsampled by one-half of its aspect size. After obtaining a 2*2 image region data, the corresponding homogenization is performed to obtain a resultant pixel.
The maximum number of layers for the op is up to 5 layers.
The width and height of the image size of each layer is 1/2 of the previous layer. The specific calculations are as follows:
Among them, SRC is the input image pixel, i, j are the pixel coordinates of the output bl layer, and BL is the bilinear downsampling result of the current layer output.