Image deformation processing method, electronic device and computer readable storage medium

By attenuating the deformation force from the inside out with the head of the character as the center in image processing, the problem of image proportional imbalance and distortion caused by head or face deformation alone is solved, and the overall image effect is improved.

CN117726499BActive Publication Date: 2025-04-29HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310620009.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2025-04-29
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

Deforming the head or face of the character alone can easily lead to image proportional imbalance and obvious distortion of the surrounding area, affecting the overall image effect.

Method used

By displaying the first image, receiving the user's operation, and displaying the deformed second image in response to the operation, the deformation force of the second image attenuates from the inside out with the head of the character as the center, ensuring that the overall image is gradually deformed and avoiding distortion of the edge area.

Benefits of technology

The deformation of the head of the person in the image is realized while ensuring that the background area of ​​the image does not cause obvious distortion, improving the overall effect of the image after deformation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117726499B_ABST
    Figure CN117726499B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and provides an image deformation processing method, an electronic device, and a computer-readable storage medium, including: the electronic device displays a first image, and the first image is an image including a person's head. Then, after receiving a first operation from a user for triggering deformation processing of the image of the person's head to thin the face and / or reduce the head, the electronic device displays a second image obtained by deforming the first image in response to the first operation. Compared with the various areas centered on the person's head in the first image, the deformation strength of the corresponding area in the second image decays from the inside to the outside with the person's head as the center. It can be seen that the method is based on the deformation processing of the entire image, and the deformation strength of each area in the image is in an attenuated state, so that the image as a whole can achieve a gradual deformation, thereby achieving the deformation of the person's head while avoiding the phenomenon of obvious distortion in other areas outside the person's head.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to an image deformation processing method, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the continuous development of image processing technology and the increasing demand of users for camera image effects, the ways of image processing are becoming more and more diverse. For example, you can adjust the image clarity, remove image noise, and beautify images including faces. Among them, image beautification usually includes skin smoothing, whitening, face thinning and head reduction processing.

[0003] At present, most deformation processing such as face thinning and head reduction is performed on the face or head of a person separately, mainly to achieve the face thinning or head reduction effect inside the face. However, deformation processing performed on the face or head alone is not only easy to cause facial proportion imbalance, but also easy to cause obvious distortion of the image area around the face or head, thus affecting the overall effect of the image. Summary of the invention

[0004] The embodiments of the present application provide a facial image deformation processing method, an electronic device and a computer-readable storage medium, which are used to solve the problem of image distortion caused by deformation of a person's head / face, thereby improving the overall effect of the image.

[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a method for image deformation processing is provided, the method comprising: displaying a first image; receiving a first operation of a user on the first image; and displaying a second image obtained by deforming the first image in response to the first operation. The first image is an image including a person's head. The first operation is used to trigger deformation processing of the image of the person's head, and the deformation processing includes at least one of face thinning and head reduction. And, compared with each area centered on the person's head in the first image, the deformation strength of the corresponding area in the second image decays from the inside to the outside centered on the person's head.

[0007] It can be seen that in this method, the second image is a deformed image obtained by deforming the first image as a whole. Moreover, in the second image, compared with the various areas centered on the head of the person in the first image, the deformation strength of the corresponding area decays from the inside to the outside with the head of the person as the center. That is, the second image is a deformed image that is centered on the head of the person and deforms to different degrees from the inside to the outside, thereby realizing a progressive deformation of the image from the inside to the outside. This ensures that the overall image is deformed softly and smoothly, and ensures that other areas outside the head of the person, especially the area around the head, do not have obvious distortion. Therefore, the use of this method can achieve deformation of the head of the person in the image while ensuring that the background area of ​​the image does not have obvious distortion, thereby improving the overall effect of the deformed image.

[0008] In a possible implementation of the first aspect, in response to the first operation, a second image obtained by deforming the first image is displayed, including: in response to the first operation, detecting an edge area of ​​the first image; taking the head of the character as the center, deforming other areas of the first image except the edge area in a manner in which the deformation force decays from the inside to the outside, to obtain and display the second image.

[0009] It can be seen that by bypassing the edge area of ​​the image for deformation processing, the edge area can be free from deformation processing, thereby ensuring that the edge area is not deformed, and further ensuring the integrity of the deformed image.

[0010] In another possible implementation of the first aspect, with the head of the person as the center, the deformation processing is performed on the other areas in the first image except the edge area in a manner that the deformation force decays from the inside to the outside, and a second image is obtained and displayed, including: identifying the center point of the head of the person in the first image as a deformation anchor point; with the deformation anchor point as the center point, the deformation processing is performed on the other areas in the first image except the edge area in a manner that the deformation force decays from the inside to the outside, and the second image is obtained and displayed; wherein the same deformation force is used for the area corresponding to the head of the person; and the deformation force of other areas except the head of the person decays from the inside to the outside starting from the head of the person.

[0011] It can be seen that determining the center point as the deformation anchor point for image deformation can make each area deform in the same direction to ensure the uniformity of the deformation. This can avoid deviations in the deformation directions of each area of ​​the image and improve the overall deformation effect of the image. At the same time, the same deformation strength is used in the corresponding areas of the character's head, and the deformation strength of other areas is attenuated, which can make the head deform in proportion and avoid disproportion of the head after deformation.

[0012] In a possible implementation of the first aspect, with the deformation anchor point as the center point, the deformation processing is performed on the other areas in the first image except the edge area in a manner that the deformation strength decays from the inside to the outside, and the second image is obtained and displayed, including: establishing a coordinate system in the first image; based on the deformation strength, the other coordinate points in the coordinate system except the coordinate points corresponding to the edge area are linearly moved toward the deformation anchor point; wherein the coordinate points corresponding to the head of the person use the same deformation strength; the deformation strength of the coordinate points other than the head of the person decays from the inside to the outside starting from the head of the person. Thus, by establishing a coordinate system to represent the image area with coordinate points, and then linearly moving the coordinate points to achieve deformation, the accuracy of the deformation is improved.

[0013] In a possible implementation of the first aspect, identifying the center point of the head of the person in the first image as the deformation anchor point includes: identifying the position of the head of the person in the first image; detecting the center point of the facial features in the area corresponding to the position of the head of the person, and using the center point of the facial features as the deformation anchor point. It can be seen that by constraining the deformation anchor point to be the center point of the facial features, it is possible to prevent the facial features from being out of proportion after deformation.

[0014] In a possible implementation of the first aspect, after detecting the edge area of ​​the first image, the method further includes: freezing the edge area of ​​the first image. Thus, by freezing the edge area, even if the electronic device accidentally affects the edge area of ​​the image when performing attenuation deformation on the image, the edge can be prevented from being deformed. This strengthens the protection of the edge area and ensures the integrity of the image.

[0015] In a possible implementation of the first aspect, a first image is displayed, including: in response to a second operation of the user, a first interface is displayed, the first interface including the first image, the first interface also including a preset deformation control, the preset deformation control being used to trigger deformation processing of an image of a person's head in the first image; wherein the first operation is a click operation on the preset deformation control in the first interface.

[0016] In a possible implementation of the first aspect, in response to the first operation, before displaying the second image obtained by deforming the first image, it also includes: detecting the rotation angle of the head of the person in the first image; if the rotation angle of the head of the person is greater than the angle threshold, displaying a prompt pop-up window; if the rotation angle of the head of the person is less than or equal to the angle threshold, in response to the first operation, displaying the second image obtained by deforming the first image. It can be seen that by detecting and comparing the rotation angle of the head of the person, a pop-up window prompt is given for images whose rotation angle does not meet the requirements and affects the deformation, and only the images whose rotation angle meets the requirements are processed, which can improve the success rate of the deformation processing.

[0017] In a second aspect, the present application provides an electronic device, comprising: one or more processors and a memory, the memory being coupled to the processor; one or more computer program codes being stored in the memory, the computer program codes comprising computer instructions; when the processor executes the computer instructions, the electronic device performs the following steps: displaying a first image; receiving a first operation of the user on the first image; and in response to the first operation, displaying a second image obtained by deforming the first image. Among them, the first image is an image including a person's head. The first operation is used to trigger deformation processing of the image of the person's head, and the deformation processing includes at least one of face thinning and head reduction. And, compared with each area centered on the person's head in the first image, the deformation strength of the corresponding area in the second image decays from the inside to the outside centered on the person's head.

[0018] In a possible implementation of the second aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: in response to the first operation, detect the edge area of ​​the first image; with the character's head as the center, perform deformation processing on other areas of the first image except the edge area in a manner in which the deformation force decays from the inside to the outside, to obtain and display the second image.

[0019] In a possible implementation of the second aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: identifying the center point of the character's head in the first image as the deformation anchor point; taking the deformation anchor point as the center point, deforming the other areas in the first image except the edge area in a manner that the deformation force decays from the inside to the outside, to obtain and display the second image; wherein the same deformation force is used for the area corresponding to the character's head; and the deformation force of other areas except the character's head decays from the inside to the outside starting from the character's head.

[0020] In a possible implementation of the second aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device also performs the following steps: establishing a coordinate system in the first image; based on the deformation force, the other coordinate points in the coordinate system except the coordinate points corresponding to the edge area are moved in a straight line toward the deformation anchor point; wherein the coordinate points corresponding to the character's head use the same deformation force; the deformation force of the coordinate points other than the character's head decays from the inside to the outside starting from the character's head.

[0021] In a possible implementation of the second aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: identifying the position of the person's head in the first image; detecting the center point of the facial features in the area corresponding to the position of the person's head, and using the center point of the facial features as the deformation anchor point.

[0022] In a possible implementation manner of the second aspect, when the computer instructions are executed by the processor, the electronic device further performs the following steps: freezing an edge area of ​​the first image.

[0023] In a possible implementation of the second aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: in response to the user's second operation, a first interface is displayed, the first interface includes a first image, and the first interface also includes a preset deformation control, and the preset deformation control is used to trigger deformation processing of the image of the head of the person in the first image; wherein the first operation is a click operation on the preset deformation control in the first interface.

[0024] In a possible implementation of the second aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: detecting the rotation angle of the character's head in the first image; if the rotation angle of the character's head is greater than an angle threshold, displaying a prompt pop-up window; if the rotation angle of the character's head is less than or equal to the angle threshold, then in response to the first operation, displaying a second image obtained by deforming the first image.

[0025] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor in an electronic device, the electronic device executes the image deformation processing method of the first aspect and any possible design thereof.

[0026] In a fourth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method of the first aspect and any possible design thereof. The computer may be the electronic device described above.

[0027] It can be understood that the beneficial effects that can be achieved by the electronic device of any possible design of the second aspect, the computer-readable storage medium of the third aspect, and the computer program product of the fourth aspect can be referred to as the beneficial effects in the first aspect and any possible design of the electronic device, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A schematic diagram of an image to be processed provided in an embodiment of the present application;

[0029] Figure 2 A schematic diagram of a deformation image of a person's head deformation provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of a deformed image for overall deformation of an image provided in an embodiment of the present application;

[0031] Figure 4A schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of a process flow of an image deformation processing method provided in an embodiment of the present application;

[0033] Figure 6 An application interface diagram of an image deformation processing method provided in an embodiment of the present application;

[0034] Figure 7 A schematic diagram of an image edge region deformation provided in an embodiment of the present application;

[0035] Figure 8 A schematic diagram of image edge freezing provided in an embodiment of the present application;

[0036] Fig. 9 A schematic diagram of a deformation anchor point provided in an embodiment of the present application;

[0037] Fig.10 A schematic diagram of an image deformation direction provided in an embodiment of the present application;

[0038] Fig.11 A schematic diagram of the attenuation of deformation strength of each region of an image provided by an embodiment of the present application;

[0039] Fig.12 A schematic diagram of an image deformation prompt pop-up window provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The technical scheme of the embodiment of the present application will be described below in conjunction with the accompanying drawings of the embodiment of the present application. Among them, in the description of the embodiment of the present application, the terms used in the following embodiments are only for the purpose of describing a specific embodiment, and are not intended to limit the present application. In addition, in order to facilitate the clear description of the technical scheme of the embodiment of the present application, in the embodiment of the present application, the words "first", "second" and the like are used to define the same or similar items with substantially the same functions and effects. It can be understood by those skilled in the art that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not limit necessarily different. And, in the description of the embodiment of the present application, unless otherwise specified, the meaning of "multiple" means two or more.

[0041] Image processing is a technique that uses computers to analyze images to achieve the desired results. Image processing generally refers to digital image processing. Digital image processing refers to a two-dimensional array obtained by shooting with electronic devices such as industrial cameras, video cameras, scanners, and mobile phones. The elements of the array are called pixels, and their values ​​are called grayscale values.

[0042] With the continuous development of image processing technology, as well as the increasing requirements of users for captured images and the demand for effects, the ways of image processing are becoming more and more abundant. For example, image processing can not only include adjusting the clarity of the image, image denoising, image compression, image enhancement and image restoration, etc. It is also possible to perform beauty processing on images including faces, including skin grinding, whitening, makeup, face thinning, head reduction (microhead), etc. Among them, face thinning and microhead processing require adjustment of the size of the face or head, so it can be understood as a deformation processing of the image. In an embodiment of the present application, the deformation processing of the image can be understood as a processing that causes the morphology of the object in the image to change. For example, changing the shape and size of the face or head in the image.

[0043] At present, deformation processing such as face slimming or head reduction is mostly performed on the face of a person alone, that is, the face slimming or head reduction effect is mainly achieved inside the face of the person in the image, and other areas are not processed. However, deformation processing performed on the face or head alone is likely to cause the surrounding areas to follow the deformation, which not only easily leads to facial disproportion, but also easily causes obvious distortion of the surrounding image area, affecting the overall effect of the image. Especially for head reduction, since the deformation range involved in head reduction is wider than that of face slimming, the distortion of the surrounding area of ​​the head after head reduction is very serious.

[0044] In order to solve the above problems, an embodiment of the present application provides an image deformation processing method. The image deformation processing method can be applied to electronic devices. The image deformation processing provided by the embodiment of the present application is described below using electronic devices as an example.

[0045] Specifically, the electronic device displays an image including a person's head in response to the user's operation, completing the display of the first image. Then, it waits to receive the user's first operation on the first image, and the first operation is used to trigger the deformation processing of the first image. The deformation processing in the embodiment of the present application includes at least one of face thinning and head reduction (microhead). After the electronic device receives the user's first operation on the first image, it responds to the first operation and displays the second image. The second image is an image obtained by deforming the first image. Moreover, in the embodiment of the present application, the deformation strength corresponding to each area of ​​the second image is in an attenuated state.

[0046] That is, compared with the various areas centered on the head of the person in the first image, the deformation strength of the corresponding area in the second image decays from the inside to the outside with the head of the person as the center. It can be understood that the electronic device deforms the image to the second image by applying deformation strength to each area of ​​the first image. The deformation strength applied to each area in the first image decays from the inside to the outside with the head of the person as the center, so that the corresponding area in the second image deformed thereby presents a progressive deformation effect relative to the first image. In other words, the deformation strength of the area closer to the head of the person is greater (the greater the degree of deformation), and the deformation strength of the area farther from the head of the person is smaller (the smaller the degree of deformation). Therefore, the embodiment of the present application can realize a progressive deformation of the entire image from the head of the person (the center of deformation) to the outside, so that the overall deformation of the image is a soft and smooth deformation. Thereby, while realizing the deformation of the head of the person in the image, it is possible to ensure that other areas outside the head of the person, especially the area around the head, do not have obvious distortion, thereby improving the overall effect of the image.

[0047] like Figure 1-3 As shown, the present application embodiment provides some schematic diagrams of the effects of image deformation processing. Figure 2 and Figure 3 They are respectively for Figure 1 The second image is a first image after image deformation processing is performed. Figure 2 The image deformation method used in the second image is the traditional deformation processing performed only on the head. Figure 3 The image deformation method used in the second image is the image deformation processing method provided in the embodiment of the present application. Figure 3 The second image shown is a deformed image obtained by applying a deformation force that decays in sequence to each area in the first image from the inside out with the head of the person as the center. Compared with the first image, each area in the second image presents a gradual deformation, and no deformation occurs. Figure 2 The lines shown are obviously distorted.

[0048] That is, reference Figure 2 and Figure 3 It can be seen that when the head is processed alone, the lines in the area around the head are obviously distorted. However, when the image is deformed gradually as a whole, the lines in the area around the head are not obviously distorted after the small head processing because the image is deformed to different degrees towards the deformation anchor point.

[0049] Exemplarily, the electronic device described in the embodiments of the present application may include at least one of a mobile phone, a camera, a video camera, a foldable electronic device, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device, or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.

[0050] like Figure 4 As shown, an embodiment of the present application provides a structural schematic diagram of an electronic device 100.

[0051] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) connector 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera module 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0052] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The processor may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0053] In the embodiment of the present application, after receiving the first operation of the user on the displayed first image, the electronic device 100 can deform the first image into a second image in response to the first operation through the processor 110. Then, the display screen 194 displays the second image obtained after the deformation processing by the processor 110, thereby completing the deformation processing of the first image and obtaining the deformed second image.

[0054] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory. The memory may store instructions or data that have been used or are frequently used by the processor 110. If the processor 110 needs to use the instruction or data, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0055] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 may be connected to a touch sensor, an audio module, a wireless communication module, a display, a camera, and other modules through at least one of the above interfaces.

[0056] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0057] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card. Or files such as music and videos are transferred from the electronic device to the external memory card.

[0058] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional methods or data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0059] The USB connector 130 is an interface that complies with USB standard specifications and can be used to connect the electronic device 100 and peripheral devices. Specifically, it can be a Mini USB connector, a Micro USB connector, a USB Type C connector, etc. The USB connector 130 can be used to connect a charger to enable the charger to charge the electronic device 100, and can also be used to connect other electronic devices to enable data transmission between the electronic device 100 and other electronic devices. It can also be used to connect headphones to output audio stored in the electronic device through the headphones. The connector can also be used to connect other electronic devices, such as VR devices. In some embodiments, the standard specifications of the universal serial bus can be USB1.x, USB2.0, USB3.x and USB4.

[0060] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB connector 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0061] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera module 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0062] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0063] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0064] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0065] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0066] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), bluetooth low energy (BLE), ultra wide band (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0067] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other electronic devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0068] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0069] The key 190 may include a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0070] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0071] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0072] The electronic device 100 can realize the camera function through the camera module 193, ISP, video codec, GPU, display screen 194, application processor AP, neural network processor NPU, etc.

[0073] The camera module 193 can be used to collect color image data and depth data of the photographed object. The ISP can be used to process the color image data collected by the camera module 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera module 193.

[0074] In some embodiments, the camera module 193 may be composed of a color camera module and a 3D sensing module.

[0075] In some embodiments, the photosensitive element of the camera of the color camera module can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.

[0076] In some embodiments, the 3D sensing module may be a time of flight (TOF) 3D sensing module or a structured light 3D sensing module. Among them, structured light 3D sensing is an active depth sensing technology, and the basic components of the structured light 3D sensing module may include an infrared emitter, an IR camera module, etc. The working principle of the structured light 3D sensing module is to first emit a light spot of a specific pattern to the object being photographed, and then receive the light spot pattern coding (light coding) on ​​the surface of the object, and then compare the similarities and differences with the original projected light spot, and use the triangulation principle to calculate the three-dimensional coordinates of the object. The three-dimensional coordinates include the distance between the electronic device 100 and the object being photographed. Among them, TOF 3D sensing may be an active depth sensing technology, and the basic components of the TOF 3D sensing module may include an infrared emitter, an IR camera module, etc. The working principle of the TOF 3D sensing module is to calculate the distance (i.e., depth) between the TOF 3D sensing module and the object being photographed by the time when the infrared rays return to obtain a 3D depth map.

[0077] The structured light 3D sensing module can also be applied to face recognition, somatosensory game consoles, industrial machine vision inspection and other fields. The TOF 3D sensing module can also be applied to game consoles, augmented reality (AR) / virtual reality (VR) and other fields.

[0078] In other embodiments, the camera module 193 may also be composed of two or more cameras. The two or more cameras may include a color camera, which can be used to collect color image data of the photographed object. The two or more cameras may use stereo vision technology to collect depth data of the photographed object. Stereo vision technology is based on the principle of human eye parallax. Under natural light, two or more cameras are used to capture images of the same object from different angles, and then triangulation and other operations are performed to obtain the distance information between the electronic device 100 and the photographed object, that is, depth information.

[0079] In some embodiments, the electronic device 100 may include one or more camera modules 193. Specifically, the electronic device 100 may include one front camera module 193 and one rear camera module 193. The front camera module 193 may generally be used to collect color image data and depth data of the photographer facing the display screen 194, and the rear camera module may be used to collect color image data and depth data of the subject (such as a person, scenery, etc.) facing the photographer.

[0080] In some embodiments, the CPU or GPU or NPU in the processor 110 can process the color image data and depth data collected by the camera module 193. In some embodiments, the NPU can identify the color image data collected by the camera module 193 (specifically the color camera module) through a neural network algorithm based on the skeleton point recognition technology, such as a convolutional neural network algorithm (CNN), to determine the skeleton points of the photographed person. The CPU or GPU can also run a neural network algorithm to determine the skeleton points of the photographed person according to the color image data. In some embodiments, the CPU or GPU or NPU can also be used to confirm the figure of the photographed person (such as body proportions, fatness and thinness of body parts between skeleton points) according to the depth data collected by the camera module 193 (which can be a 3D sensing module) and the identified skeleton points, and can further determine the body beautification parameters for the photographed person, and finally process the photographed image of the photographed person according to the body beautification parameters, so that the body shape of the photographed person in the photographed image is beautified. The subsequent embodiments will describe in detail how to perform body beautification processing on the image of the photographed person based on the color image data and depth data collected by the camera module 193, which will not be elaborated here.

[0081] The digital signal processor is used to process digital signals and can also process other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0082] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0083] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0084] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support one or more SIM card interfaces. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0085] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0086] The following, combined Figure 5 The flowchart of the image deformation processing method provided in the embodiment of the present application is described in detail. Figure 5 The image deformation processing method of the embodiment of the present application includes steps S501-S503.

[0087] S501: The electronic device displays a first image.

[0088] S502: The electronic device receives a first operation performed by a user on a first image.

[0089] S503, the electronic device responds to the first operation and displays a second image obtained by deforming the first image; wherein, compared with various areas centered on the character's head in the first image, the deformation strength of the corresponding areas in the second image decays from the inside to the outside centered on the character's head.

[0090] Among them, the first image is an image including a person's head, which is currently displayed on a corresponding display screen of the electronic device waiting for deformation processing. The first operation is used to trigger an operation for deforming the first image, that is, for triggering an image of the person's head. In an embodiment of the present application, the deformation processing includes at least one of face thinning and head reduction. That is, the first operation can trigger a face thinning process for the image of the person's head, and can also trigger a head reduction process for the image of the person's head.

[0091] Specifically, after the electronic device displays the first image on the display screen in response to the user's operation, it enters a state of waiting for the user's next operation. Further, after the electronic device receives the user's first operation on the displayed first image, in response to the first operation, the first image is deformed into a second image, and the second image is displayed on the display screen in place of the first image. Compared with the various areas centered on the character's head in the first image, the deformation strength of the corresponding area of ​​the second image decays from the inside to the outside with the character's head as the center. That is, the degree of deformation of each area in the second image matches the deformation strength that decays from the inside to the outside, and also decays from the inside to the outside with the character's head as the center.

[0092] It can be understood that when the electronic device deforms the first image in response to the first operation, it adaptively attenuates the acquired deformation force in sequence and applies it to different areas in the image to cause each area to deform. Moreover, the sequential attenuation satisfies the condition of attenuation from the inside to the outside with the head of the person as the center. For example, assuming that the deformation force is 60, the deformation force of the head area of ​​the person is the maximum value of 60. Starting from the inside to the outside with the head of the person as the center, the deformation force 60 is attenuated in sequence based on the different distances between each area and the head of the person and then applied to the corresponding area. In other words, starting from the head of the person outward, the deformation force of each area starts with 60 as the initial value and decreases in sequence until the deformation force decays to 0. Among them, the deformation force can be a force value that meets the user's deformation needs and is obtained by the electronic device based on the user's operation, or it can be a fixed configuration deformation force.

[0093] In addition, when the electronic device sequentially attenuates the given deformation force to each area, it needs to be done under certain constraints to prevent excessive or insufficient attenuation from causing obvious image distortion. For example, a force value that makes the image distortion least obvious can be selected based on the degree of image distortion caused by the attenuated deformation force. Assume that the deformation force of the area of ​​the person's head is 60, and if the distortion phenomenon of applying a deformation force of 58 to the surrounding area closest to the head area is more obvious than the distortion phenomenon of applying a deformation force of 57, then the deformation force of the surrounding area closest to the head area is determined to be 57.

[0094] It can be seen that in the embodiment of the present application, based on the deformation force corresponding to the deformation operation, the first image as a whole is gradually deformed into the second image based on the deformation force attenuating from the inside to the outside with the character's head as the center. While deforming the character's head in the image, it can ensure that other areas outside the character's head do not undergo obvious distortion, thereby improving the overall effect of the image.

[0095] In some embodiments, S501 includes: displaying a first interface in response to a second operation of the user, the first interface including a first image, the first interface also including a preset deformation control, the preset deformation control being used to trigger deformation processing of an image of the head of the object in the first image; wherein the first operation is a click operation on the preset deformation control in the first interface.

[0096] The second operation is an operation for displaying the first interface, and the first interface is an interface including the first image and a preset deformation control. The first interface can be an interface of a system application, such as a gallery application. It can also be an interface of a third-party photo editing application. The preset deformation control is a button / control for triggering deformation processing of the image of the head of the person in the first image, and the first operation can be regarded as a click operation on the preset deformation control.

[0097] Specifically, the electronic device receives a second operation of the user. In response to the second operation, a first interface including a first image and a preset deformation control is displayed. For example, the electronic device may display an image thumbnail interface of a gallery application in response to the second operation. Then, the electronic device may respond to the user's click operation on the thumbnail corresponding to the first image in the image thumbnail interface, and display a large image interface including the first image. In addition, the large image interface may include a plurality of controls for processing images (including preset deformation controls, such as buttons / controls such as face thinning and small head). That is, the large image interface may be regarded as the first interface of an embodiment of the present application. Alternatively, the electronic device may respond to the second operation to display the homepage interface of a third-party photo editing application. Then, the electronic device responds to the user's click operation on the import image control in the homepage interface, and displays the image thumbnail interface of the gallery application. In response to the user's click operation on the thumbnail of the first image in the image thumbnail interface, the first image is imported into the photo editing interface of the third-party photo editing application for display, and the photo editing interface includes a plurality of controls, and also includes the preset deformation control described in the embodiment of the present application.

[0098] For example, the electronic device is a mobile phone. In response to a user's click operation on a third-party photo editing application, the mobile phone displays the homepage interface of the beauty application. Then, in response to a user's click operation on the homepage interface to import an image, the mobile phone displays the first image in the photo editing interface of the third-party photo editing application, thereby displaying the following: Figure 6 The first interface shown in the figure includes the first image specified by the user to be imported and the preset deformation control. Figure 6 The "small head" or "thin face" button / control in the figure can be regarded as a preset deformation control in the embodiment of the present application. Figure 6 A click operation (ie, a first operation) on the "small head" or "thin face" button / control triggers the mobile phone to perform image deformation processing of a small head or thin face on the first image displayed on the application interface.

[0099] In some embodiments, when the first image is gradually deformed as a whole based on the deformation force that decays from the inside to the outside with the head of the person as the center, if the electronic device applies the deformation force to the edge area of ​​the first image, the edge area of ​​the first image will also deform in the direction of the head of the person. Then, because the edge of the image is deformed inward, the edge area of ​​the second image obtained by deforming the first image will appear blank, such as Figure 7 Reference Figure 7 , where the dotted line is the original edge of the first image, and the solid line is the edge of the second image after deformation. It can be seen that although deforming the edges of the image together can ensure that there is no obvious distortion in the area outside the head of the person in the image, the change of the image edge also affects the integrity of the image.

[0100] Based on this, S503 may include: in response to the first operation, detecting the edge area of ​​the first image; taking the character's head as the center, deforming other areas in the first image except the edge area in a manner that the deformation strength decays from the inside to the outside, to obtain and display the second image.

[0101] Specifically, after the electronic device responds to the first operation, it can first detect the edge area of ​​the first image. The edge detection of the image can be implemented using any existing image edge detection technology. For example, any one or more of the Roberts edge detection operator, the Sobel edge detection operator, the Laplace edge detection operator, and the Canny edge detection. Then, the electronic device bypasses the edge area of ​​the first image, performs deformation processing on other areas of the first image except the edge area to obtain a second image and display it. In an embodiment of the present application, by bypassing the edge area of ​​the image for deformation processing, the edge area may not be deformed, thereby ensuring that the edge area is not deformed, thereby ensuring the integrity of the image.

[0102] In some embodiments, in order to avoid accidental deformation of the edge region of the image, after detecting the edge region of the first image, the method may further include: freezing the edge region of the first image.

[0103] That is, before bypassing the edge area for deformation processing, the electronic device can freeze the edge area first. By freezing the edge area of ​​the image, the frozen area can be prevented from being changed. Among them, the edge area freezing can be understood as similar to the freeze mask function in Photoshop. Figure 8 As shown, a schematic diagram of image edge freezing is provided. Figure 8 The black filled area in the image can be regarded as a frozen edge area. Therefore, even if the electronic device accidentally affects the edge area of ​​the image when performing attenuation deformation on the image, the edge can be prevented from being deformed. This strengthens the protection of the edge area and ensures the integrity of the image.

[0104] In some embodiments, in order to ensure uniformity of deformation and avoid deviation in deformation direction of each region of the image and thus affect the overall deformation effect of the image, the electronic device may determine a center point on the head of the person as a mark indicating the deformation direction, and subsequently use the mark to deform the first image into the second image.

[0105] Therefore, taking the character's head as the center, deforming the other areas in the first image except the edge area in a manner that the deformation force decays from the inside to the outside, and obtaining and displaying the second image may include: identifying the center point of the character's head in the first image as the deformation anchor point; taking the deformation anchor point as the center point, deforming the other areas in the first image except the edge area in a manner that the deformation force decays from the inside to the outside, and obtaining and displaying the second image.

[0106] Specifically, when the electronic device deforms the first image with the person's head as the center, it first identifies the center point of the person's head and uses the center point as the deformation anchor point. The deformation anchor point can be understood as a deformation mark set in the first image, which is used to indicate the direction of deformation of each area of ​​the image. Fig. 9 As shown in Figure 1, a schematic diagram of a deformation anchor point is provided. Fig. 9 , where the intersection of the two dotted lines is the deformation anchor point of the image.

[0107] After the electronic device determines the deformation anchor point, it deforms each region of the first image based on the direction of the deformation anchor point. That is, the direction of deformation of each region of the first image is the direction of the deformation anchor point. Fig.10 As shown, Fig. 9 Taking the deformation anchor point shown in the figure as an example, a schematic diagram of the image deformation direction is provided. Fig.10 , each arrow points to the deformation anchor point, and the direction pointed by the arrow in each region is the deformation direction of each region. Fig.10 Each region in the image is deformed in the direction of the deformation anchor point.

[0108] At the same time, since the electronic device needs to apply a certain deformation force when it is deformed, and in order to prevent obvious distortion of the image after deformation. Therefore, the deformation force of each area in the first image should be attenuated from the inside to the outside with the deformation anchor point as the center point. That is, the deformation force of each area is attenuated in turn based on the distance between each area and the deformation anchor point, so that the deformation force of each area is in an attenuated state. Among them, the closer the area is to the deformation anchor point, the greater the deformation force, and the farther the area is from the deformation anchor point, the smaller the deformation force.

[0109] In addition, since image deformation operations such as face thinning and small head are mainly processed for the entire head of the person. For example, small head processing requires the head to be reduced in size as a whole, rather than just a part of the head, otherwise it may cause disproportionate head proportions. Therefore, the deformation strength of the person's head should be consistent to achieve proportional reduction of the head to prevent disproportionate head area. Therefore, the area corresponding to the person's head needs to use the same deformation strength to ensure that the corresponding area of ​​the person's head has the same degree of deformation in the direction of the deformation anchor point to avoid disproportionate head proportions. The purpose of deformation of other areas outside the person's head (such as the background area of ​​the person's head) is to ensure as little distortion as possible. Therefore, the deformation strength of other areas can start from the person's head and decay from the inside to the outside, thereby achieving a progressive deformation of the background area of ​​the image person's head, and ensuring that the background lines have no obvious distortion as much as possible.

[0110] In some embodiments, the head of the person in the first image is not necessarily in a frontal and completely non-tilted state. In the case where the person's head is slightly tilted, for example, when the head is rotated less than 45 degrees, although it will not substantially affect the deformation process, the deformation anchor point will adaptively move based on the head tilt angle, resulting in a disproportionate proportion of the facial features after deformation. For example, the center point of a standard frontal head without an angle tilt is generally located in the area between the eyebrows and the nose. If the person's head is in a bowed state, it is easy for the deformation anchor point to be adaptively positioned on the forehead. Then, after the subsequent image deformation based on the deformation anchor point on the forehead, the chin area may be too close to the forehead, resulting in a disproportionate chin. Therefore, in order to avoid disproportionate proportions of the facial features after deformation, the determination of the deformation anchor point can constrain its detection based on the facial features.

[0111] Therefore, identifying the center point of the person's head in the first image as a deformation anchor point can include: identifying the position of the person's head in the first image; detecting the center point of the facial features in the area corresponding to the position of the person's head, and using the center point of the facial features as the deformation anchor point.

[0112] That is, in the process of determining the deformation anchor point, the electronic device first performs image recognition on the first image to determine the position of the person's head in the first image. Then, the electronic device confirms the image area corresponding to the position of the person's head in the first image, and then detects the center point of the facial features in the area as the deformation anchor point. Among them, the image recognition and the detection of the center point of the facial features in the embodiment of the present application can adopt any existing method, such as training a corresponding neural network as a face recognition network to identify and output the head position and the center point of the facial features.

[0113] In the embodiment of the present application, the center point of the facial features is used as the deformation anchor point, which can ensure that the facial features are deformed toward the center of the facial features as much as possible, thereby ensuring proportional deformation of the facial features and preventing disproportion of the facial features.

[0114] In some embodiments, the deformation of the image can be achieved by moving the coordinate points. Therefore, with the deformation anchor point as the center point, the deformation processing is performed on the other areas of the first image except the edge area in a manner that the deformation strength decays from the inside to the outside, and obtaining and displaying the second image may include: establishing a coordinate system in the first image; based on the deformation strength, the other coordinate points in the coordinate system except the coordinate points corresponding to the edge area are moved linearly toward the deformation anchor point; wherein the coordinate points corresponding to the head of the character use the same deformation strength; the deformation strength of the coordinate points other than the head of the character decays from the inside to the outside starting from the head of the character.

[0115] Specifically, when the electronic device realizes the deformation of the image by moving the coordinates, a coordinate system can be established in the first image first. The established coordinate system includes an X-axis and a Y-axis, forming an N*N coordinate network in the first image. It can be understood that by establishing a coordinate system, each area in the first image is represented by (X, Y) coordinate points. Among them, N can be set according to the actual demand for the coordinate network, for example, it can be determined according to the demand for the density of the distribution of each coordinate in the coordinate network. Then, the electronic device regards each coordinate point in the first image coordinate system as each area of ​​the first image, and moves all the coordinate points linearly toward the deformation anchor point based on the deformation force. The linear movement can be understood as that the movement trajectory of each coordinate point is a straight line between the coordinate point corresponding to the deformation anchor point. Among them, the deformation force determines the moving distance of the coordinate point. The greater the deformation force, the longer the coordinate movement distance, and vice versa, the smaller the deformation force, the shorter the coordinate movement distance. That is, the deformation force that causes each coordinate point to move decays from the inside to the outside with the deformation anchor point as the center.

[0116] At the same time, in order to avoid disproportion of the head proportions, the same deformation strength is used for the corresponding coordinate points of the character's head. The deformation strength of other coordinate points other than the corresponding coordinate points of the character's head can be attenuated from the inside to the outside starting from the character's head. This ensures that the head area is proportionally reduced while achieving a gradual deformation of the background area of ​​the character's head.

[0117] like Fig.11 As shown in FIG. 1 , a schematic diagram of image deformation strength attenuation is provided. Fig.11, the ellipses 1101, 1102, and 1103 shown in the figure can be roughly regarded as the regions of the image. Among them, the ellipse 1101 is the region corresponding to the head of the person, so all the coordinate points in the region adopt the same deformation strength to ensure that the head is proportionally reduced as a whole. The deformation strength of each coordinate point in the ellipse 1102 and the ellipse 1103 decays from the inside to the outside (in the direction of the arrow), so that the image area outside the head of the person is adaptively deformed to the region where the head is located based on the reduction of the head of the person, so as to minimize the distortion of the image background lines. That is, the deformation strength of each coordinate point in the ellipse 1102 region is smaller than the deformation strength of each coordinate point in the ellipse 1103 region. The deformation strength of the coordinate points in the region outside the ellipse 1103 is smaller than the deformation strength of the coordinate points in the ellipse 1103 region. In addition, the deformation strength of each coordinate point in the ellipse 1102 and the ellipse 1103 within the region can also decay from the inside to the outside (in the direction of the arrow). For example, the deformation strength of the coordinate point closest to the deformation anchor point in the ellipse 1102 is greater than the deformation strength of other coordinate points in the ellipse 1102, and thus the moving distance of the coordinate point can be greater than the moving distance of other coordinate points. Thus, the deformation strength presents a hierarchical progressive (attenuation) relationship based on each area of ​​the image, realizing a progressive deformation.

[0118] In some embodiments, if the deformation processing of the image is achieved by establishing a coordinate system to move corresponding coordinate points, then freezing the edge area can be further achieved by fixing the coordinate points. Therefore, freezing the edge area of ​​the first image may include: determining the edge coordinate points corresponding to the edge area of ​​the first image from the coordinate system of the first image; and fixing the coordinate values ​​of the edge coordinate points.

[0119] Specifically, when the electronic device freezes the edge area of ​​the image, it first determines the coordinate points corresponding to the edge area from the established image coordinate system and regards them as edge coordinate points. Then, the coordinate values ​​in the edge coordinate points are fixed, that is, the X value and Y value in the coordinate point (X, Y) are fixed. By fixing the coordinate values ​​so that the coordinate values ​​cannot be changed, the corresponding edge coordinate points cannot be moved, and the corresponding image edges will not be deformed. In this way, the image edges can be prevented from being deformed and affecting the integrity of the image.

[0120] In some embodiments, if the angle of the head of the person in the image is too tilted and no obvious facial features are displayed, it may result in the inability to accurately detect the center point as the deformation anchor point, which may easily lead to the failure of the deformation process. Therefore, before S503, it may also include: detecting the rotation angle of the head of the person in the first image; if the rotation angle of the head of the person is greater than the angle threshold, displaying a prompt pop-up window; if the rotation angle of the head of the person is less than or equal to the angle threshold, entering S503, in response to the first operation, displaying the second image obtained by deforming the first image.

[0121] Specifically, after acquiring the first image, the electronic device can detect the rotation angle of the head of the person in the image. For example, the rotation angle may include the head-up angle, head-down angle, left turn angle, and right turn angle of the person's head. Then, the detected rotation angle is compared with a preset angle threshold. The angle threshold can be set according to actual needs, for example, it can be 45 degrees.

[0122] If the rotation angle is greater than the angle threshold, it means that the angle of the head of the person in the first image is too large, and it may be impossible to detect a suitable center point as a deformation anchor point, which may affect the deformation processing. At this time, the electronic device may display a corresponding prompt pop-up window on the application interface to prompt the user to re-operate. For example, Fig.12 As shown, the display content of the pop-up window may be "the character angle does not meet the deformation requirements" or other similar text.

[0123] If it is determined that the rotation angle is less than or equal to the angle threshold, it means that the angle of the character's head in the first image is appropriate and will not affect the deformation processing. The electronic device can enter S503, respond to the user's first operation, deform the first image, and display the second image.

[0124] Another embodiment of the present application provides an electronic device, which includes one or more processors and a memory, wherein the memory is coupled to the processor. The memory stores one or more computer programs, and when the processor executes the computer program, the electronic device can execute the image deformation processing method described in any of the above embodiments. The structure of the electronic device can refer to Figure 4 The structure of the electronic device 100 is shown.

[0125] Another embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor in an electronic device, the electronic device implements the image deformation processing method described in any of the above embodiments.

[0126] The embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step in the image deformation processing method recorded in any of the above embodiments.

[0127] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0128] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0129] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0130] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0131] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0132] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for image deformation processing, characterized in that: include: Display a first image; wherein the first image is an image including a person's head; Receiving a first operation of the user on the first image; wherein the first operation is used to trigger deformation processing of the image of the head of the person, and the deformation processing includes at least one of the following: face thinning and head reduction; Detecting a rotation angle of the person's head in the first image; If the rotation angle of the person's head is less than or equal to the angle threshold, in response to the first operation, a first ellipse and at least two second ellipses are determined in the first image; the first ellipse is a minimum ellipse including the person's head; the at least two second ellipses are different in size, and each of the second ellipses includes the first ellipse; between the first ellipse and the at least two second ellipses, no two ellipses intersect; The first image is deformed based on the first ellipse and the at least two second ellipses, and a second image obtained by deforming the first image is displayed; wherein the area within the first ellipse corresponds to a first deformation strength; the non-intersecting area of ​​two adjacent ellipses outside the first ellipse corresponds to a second deformation strength, the second deformation strength is smaller than the first deformation strength, and different non-intersecting areas correspond to different second deformation strengths; compared with each area centered on the head of the person in the first image, the deformation strength of the corresponding area in the second image decays from the inside to the outside centered on the head of the person; The method further includes, in response to the first operation, detecting an edge region of the first image and freezing the edge region.

2. The method according to claim 1, characterized in that The deforming the first image based on the first ellipse and the at least two second ellipses, and displaying the second image obtained by deforming the first image, comprises: Identify the center point of the person's head in the first image as a deformation anchor point; Taking the deformation anchor point as the center point, the first image is deformed based on the first ellipse and the at least two second ellipses to obtain and display the second image; wherein the value of the second deformation strength decays from the inside to the outside with the character's head as the center.

3. The method according to claim 2, characterized in that The deforming the first image based on the first ellipse and the at least two second ellipses with the deformation anchor point as the center point to obtain and display the second image includes: establishing a coordinate system in the first image; Based on the deformation force, other coordinate points in the coordinate system except the coordinate points corresponding to the edge area are moved linearly toward the deformation anchor point; wherein, the greater the deformation force, the longer the moving distance of the coordinate point; the deformation force includes the first deformation force and the second deformation force.

4. The method according to claim 2, characterized in that: The step of identifying the center point of the person's head in the first image as a deformation anchor point includes: Identifying the position of the person's head in the first image; The center point of the facial features is detected in the area corresponding to the position of the head of the person, and the center point of the facial features is used as a deformation anchor point.

5. The method according to any one of claims 1 to 4, characterized in that: The displaying of the first image comprises: In response to a second operation of the user, a first interface is displayed, wherein the first interface includes the first image, and the first interface also includes a preset deformation control, wherein the preset deformation control is used to trigger deformation processing of the image of the head of the person in the first image; The first operation is a click operation on the preset deformation control in the first interface.

6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: If the rotation angle of the character's head is greater than the angle threshold, a prompt pop-up window is displayed.

7. An electronic device, characterized in that: include: One or more processors and a memory, wherein the memory is coupled to the processor; one or more computer program codes are stored in the memory, and the computer program codes include computer instructions; when the processor executes the computer instructions, the electronic device executes the image deformation processing method as described in any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor of an electronic device, the electronic device executes the image deformation processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image processing method and device, equipment and storage medium

    CN113781295A