OpenCV actual face beauty and beauty (8) - big eyes (on)

background

        From the perspective of public aesthetics, properly "enlarged" eyes will make people look younger. Therefore, there is a big eye function in the beauty model, and its effect is to make the eyes bigger appropriately. The content of this chapter revolves around the big eye algorithm.

image remapping

        The big eye operation is to make the image content in the eye area zoom in and out, which belongs to the local deformation operation. The image deformation operations we often use include translation, rotation, scaling, cropping, etc. At first glance, the big eye operation is different from the above-mentioned processing, but its essence is the same-image remapping. We are all using a certain mapping relationship to calculate the composition of the target image based on the original image.

        In actual operation, we will calculate the pixel coordinates of each pixel in the target image corresponding to the original image, as shown in the figure below, calculate the coordinates (u', v') of the target image (u, v) mapped to the original image point by point . But generally the obtained (u', v') is not an integer, and its pixel value needs to be calculated through an interpolation operation.

image interpolation

        There are many commonly used interpolation methods. Here we mainly introduce three common methods: nearest neighbor, bilinear, and bicubic.

nearest neighbor interpolation

        The definition of nearest neighbor interpolation is to select the pixel (u_, v_) closest to the distance (u', v') and take its pixel value as the result, that is, f(u', v')=f(int(u'+0.5), int(v'+0.5)). As shown in the figure below, the pixel values ​​of all pixels located in area A will take the pixel values ​​at (i, j), and so on for other areas. The principle of this method is simple and the amount of calculation is small, but it is easy to cause the pixel values ​​of the resulting image to be discontinuous, resulting in aliasing.

Guess you like

Origin blog.csdn.net/lwx309025167/article/details/130186735