A virtual image generation method and apparatus
By acquiring feature points of the target object and matching them with a sample library, a virtual avatar with a unified style is generated, which solves the problem of inconsistent styles of virtual avatars in existing technologies and improves the realism and style consistency of virtual avatars.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2022-09-30
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technology cannot generate virtual avatars with a consistent style, resulting in different users having virtual avatars whose styles change with facial expressions, failing to meet the need for a unified style.
By acquiring the feature points of the target object, determining the target feature information, and selecting target samples with similarity meeting the threshold from the preset sample library, the preset base model is modified using the parameters of the target samples to generate a virtual image with a unified style.
It improves the similarity between virtual avatars and target objects, enhances the realism and stylistic consistency of virtual avatars, and ensures that virtual avatars of different users have a unified style.
Smart Images

Figure CN117523077B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and apparatus for generating virtual images. Background Technology
[0002] Virtual avatars, as a new media character, are widely used in fields such as Virtual Reality (VR), Augmented Reality (AR), and the Metaverse. For example, in the Metaverse, different users can generate virtual avatars representing themselves by uploading two-dimensional images. That is, the generated virtual avatars have a certain similarity to the real users in the two-dimensional images, but the virtual avatars of different users usually need to have a unified style.
[0003] Existing technology directly inputs two-dimensional images into a three-dimensional reconstruction model for processing to generate a virtual image corresponding to the two-dimensional image. Although the generated virtual image is close to the real user in the two-dimensional image, the style of the virtual image will be different depending on the user's expression in the two-dimensional image, making it impossible to generate a virtual image with a consistent style. Summary of the Invention
[0004] This application provides a method and apparatus for generating virtual avatars, which to some extent solves the problem that technology cannot generate virtual avatars with a unified style.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, this application provides a method for generating a virtual image, the method comprising: acquiring feature points of a target object; determining target feature information of the target object based on the feature points, the target feature information including first feature information and second feature information of different dimensions; determining a target sample corresponding to the target feature information from a preset sample library; modifying a preset base model according to the target parameters of the target sample to obtain a virtual image of the target object.
[0007] Based on the virtual avatar generation method provided in this application, after obtaining the feature points of the target object, the target feature information of the target object is first determined based on the feature points. Then, a target sample is determined from a preset sample library based on the target feature information. Finally, the target parameters of the target sample are used to modify the preset base model to determine the virtual avatar corresponding to the target object. In practical applications, the design style of the preset base model can be fixed, and then virtual avatars with a consistent style corresponding to different target objects can be obtained based on this method.
[0008] Furthermore, since the target feature information obtained in this method is the feature of different dimensions corresponding to the feature points of the target object, the target sample determined by using the feature information of the target object in multiple different dimensions is a sample that is closer to the target object, which improves the reliability of the target sample, greatly increases the similarity between the virtual image and the target object, effectively reduces the difference between the virtual image and the target object, and enhances the realism of the virtual image.
[0009] Optionally, obtaining the feature points of the target object includes: obtaining a target image, the target image including the target object; performing feature point detection on the target image; and determining the feature points of the target object based on the feature point detection results.
[0010] In one possible implementation of the first aspect, the first feature information is determined based on the zeroth moment of the feature point, and the second feature information is determined based on the second moment of the feature point.
[0011] In one possible implementation of the first aspect, determining the target sample corresponding to the target feature information from a preset sample library includes:
[0012] The target sample is a sample from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold, and whose similarity to the second feature information meets a preset second feature similarity threshold.
[0013] In one possible implementation of the first aspect, determining the target sample as a sample from the sample library whose similarity to the first feature information satisfies a preset first feature similarity threshold and whose similarity to the second feature information satisfies a preset second feature similarity threshold includes:
[0014] Based on the first feature information, a first sample set is determined from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold.
[0015] Based on the second feature information, a second sample set is determined from the sample library whose similarity to the second feature information meets a preset second feature similarity threshold;
[0016] When the number of samples in the first sample set is greater than or equal to a preset first threshold, and the number of samples in the second sample set is greater than or equal to a preset second threshold, the intersection of the first sample set and the second sample set is determined.
[0017] If the number of samples in the intersection is greater than a preset third threshold, then the target sample is determined from the intersection.
[0018] In one possible implementation of the first aspect, if the number of samples in the intersection is less than or equal to the third threshold, then the first threshold and / or the second threshold are increased.
[0019] In one possible implementation of the first aspect, if the number of samples in the first sample set is less than the first threshold, then the first feature similarity threshold is increased.
[0020] In one possible implementation of the first aspect, if the number of samples in the second sample set is less than the second threshold, then the second feature similarity threshold is increased.
[0021] In one possible implementation of the first aspect, the target feature information further includes third feature information.
[0022] Based on the above possible implementation methods, by adding features of different dimensions in the target feature information, the accuracy of determining the target sample from the sample library based on the target feature information can be further increased, the reliability of the target sample can be improved, the similarity between the virtual image and the target object can be greatly increased, the difference between the virtual image and the target object can be reduced, and the realism of the virtual image can be enhanced.
[0023] In one possible implementation of the first aspect, the third feature information is determined based on the Hu moments of the feature points.
[0024] In one possible implementation of the first aspect, determining the target sample from the intersection includes:
[0025] Based on the target feature information, the similarity between each sample in the intersection and the target object is determined, and the sample with the highest similarity is determined as the target sample. The similarity is used to describe the first feature similarity value, the second feature similarity value, and the third feature similarity value between the sample and the target object.
[0026] In one possible implementation of the first aspect, the target object is the eye contour.
[0027] In one possible implementation of the first aspect, determining the target feature information of the target object based on the feature points includes:
[0028] The feature points are normalized.
[0029] The target feature information of the target object is determined based on the normalized feature points.
[0030] Secondly, this application provides a virtual avatar generation device, which includes:
[0031] The acquisition unit is used to acquire feature points of the target object;
[0032] The first determining unit is configured to determine the target feature information of the target object based on the feature points, wherein the target feature information includes first feature information and second feature information of different dimensions.
[0033] The second determining unit is used to determine the target sample corresponding to the target feature information from a preset sample library;
[0034] The modification unit is used to modify the preset base model according to the target parameters of the target sample to obtain the virtual image of the target object.
[0035] In one possible implementation of the second aspect, the first feature information is determined based on the zeroth moment of the feature point, and the second feature information is determined based on the second moment of the feature point.
[0036] In one possible implementation of the second aspect, the second determining unit is further used for:
[0037] The target sample is a sample from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold, and whose similarity to the second feature information meets a preset second feature similarity threshold.
[0038] In one possible implementation of the second aspect, determining the target sample as a sample from the sample library whose similarity to the first feature information satisfies a preset first feature similarity threshold and whose similarity to the second feature information satisfies a preset second feature similarity threshold includes:
[0039] Based on the first feature information, a first sample set is determined from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold.
[0040] Based on the second feature information, a second sample set is determined from the sample library whose similarity to the second feature information meets a preset second feature similarity threshold;
[0041] When the number of samples in the first sample set is greater than or equal to a preset first threshold, and the number of samples in the second sample set is greater than or equal to a preset second threshold, the intersection of the first sample set and the second sample set is determined.
[0042] If the number of samples in the intersection is greater than a preset third threshold, then the target sample is determined from the intersection.
[0043] In one possible implementation of the second aspect, if the number of samples in the intersection is less than or equal to the third threshold, then the first threshold and / or the second threshold are increased.
[0044] In one possible implementation of the second aspect, if the number of samples in the first sample set is less than the first threshold, then the first feature similarity threshold is increased.
[0045] In one possible implementation of the second aspect, if the number of samples in the second sample set is less than the second threshold, then the second feature similarity threshold is increased.
[0046] In one possible implementation of the second aspect, the target feature information further includes third feature information.
[0047] In one possible implementation of the second aspect, the third feature information is determined based on the Hu moments of the feature points.
[0048] In one possible implementation of the second aspect, determining the target sample from the intersection includes:
[0049] The similarity between each sample in the intersection and the target object is determined based on the target feature information;
[0050] The sample with the highest similarity is determined as the target sample, and the similarity is used to describe the first feature similarity value, the second feature similarity value, and the third feature similarity value between the sample and the target object.
[0051] In one possible implementation of the second aspect, the target object is the eye contour.
[0052] In one possible implementation of the second aspect, the acquiring unit is also used for:
[0053] Acquire a target image, wherein the target image includes a target object;
[0054] Feature point detection is performed on the target image;
[0055] The feature points of the target object are determined based on the feature point detection results.
[0056] In one possible implementation of the second aspect, determining the target feature information of the target object based on the feature points includes:
[0057] A normalization unit is used to normalize the feature points;
[0058] The third determining unit is used to determine the target feature information of the target object based on the normalized feature points.
[0059] Thirdly, this application provides an electronic device, including: a processor, the processor being configured to run a computer program stored in a memory to implement the method described in the first aspect or any alternative manner of the first aspect.
[0060] Fourthly, this application provides a chip system including a processor that executes a computer program stored in a memory to implement the method described in the first aspect or any optional manner of the first aspect.
[0061] Fifthly, this application provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method as described in the first aspect or any optional manner of the first aspect.
[0062] Sixthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the electronic device to perform the method described in the first aspect or any optional method of the first aspect.
[0063] The technical effects of the second to sixth aspects provided in this application can be found in the technical effects of the various possible implementations of the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0064] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0065] Figure 2 This is a schematic diagram of the software structure of an electronic device provided in an embodiment of this application.
[0066] Figure 3 This is a flowchart illustrating a virtual avatar generation method provided in an embodiment of this application.
[0067] Figure 4 This is a schematic diagram of a human face image including eye contours, provided as an embodiment of this application.
[0068] Figure 5 This is a flowchart for determining a target sample, provided as an embodiment of this application.
[0069] Figure 6 This is a schematic diagram illustrating a scenario for determining the intersection of a first sample set and a second sample set, provided as an embodiment of this application.
[0070] Figure 7 This is another flowchart for determining a target sample provided in an embodiment of this application.
[0071] Figure 8This is a schematic diagram illustrating another scenario for determining the intersection of a first sample set and a second sample set, provided as an embodiment of this application.
[0072] Figure 9 This is a structural block diagram of a virtual avatar generation device provided in an embodiment of this application. Detailed Implementation
[0073] Virtual avatars, as a new media character, are widely used in VR, AR, and metaverse fields. For example, in the metaverse, to differentiate between different virtual avatars and enrich their display effects, different users can upload two-dimensional images to generate virtual avatars representing themselves. That is, the generated virtual avatar has a certain similarity to the real user in the two-dimensional image. However, the virtual avatars of different users usually need to have a unified style.
[0074] Current methods for generating virtual avatars involve directly inputting a 2D image into a 3D reconstruction model for processing, generating a virtual avatar corresponding to the 2D image. If the target object's expression, hairstyle, head shape, etc., change in the 2D image, the generated virtual avatar's expression, hairstyle, head shape, etc., will change accordingly. Although the generated virtual avatar closely resembles the real user in the 2D image, it cannot generate a virtual avatar with a consistent style.
[0075] Therefore, to address the above problems, this application provides a virtual image generation method and apparatus, which uses target feature information corresponding to the feature points of the target object to determine a target sample from a preset sample library, and then uses the target parameters of the target sample to modify the preset base model to determine the virtual image of the target object, so that the style of the obtained virtual image of the target object is consistent with the style of the preset base model.
[0076] The technical solutions of the embodiments of this application are described below with reference to the accompanying drawings and related embodiments. In the description of the embodiments of this application, the terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to limit the application. As used in the specification and appended claims of this application, the singular expressions "a," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, "at least one" and "one or more" refer to one or more (including two). The term "and / or" is used to describe the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0077] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. The term "connection" includes direct connections and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0078] In the embodiments of this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0079] The virtual avatar generation method provided in this application can be applied to electronic devices. Electronic devices can be mobile phones, tablets, wearable devices, AR devices, VR devices, laptops, Ultra-Mobile Personal Computers (UMPCs), netbooks, Personal Digital Assistants (PDAs), in-vehicle devices, smart screens, etc. This application does not impose any restrictions on the specific type of electronic device.
[0080] See Figure 1This is a schematic diagram of the structure of an electronic device 100 provided in this application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 131, a Universal Serial Bus (USB) interface 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 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, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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.
[0081] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0082] For example, when the electronic device 100 is a mobile phone or a tablet computer, it may include all the components shown in the figure, or it may include only some of the components shown in the figure.
[0083] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0084] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0085] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0086] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an Inter-integrated Circuit (I2C) interface, an Inter-integrated CircuitSound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI) interface, a General-Purpose Input / Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and / or a Universal Serial Bus (USB) interface, etc.
[0087] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDL) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate via the I1C bus interface, thereby realizing the touch function of the electronic device 100.
[0088] The I1S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I1S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I1S interface.
[0089] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM bus interface.
[0090] In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface. Both the I2S interface and the PCM interface can be used for audio communication.
[0091] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus, converting the data to be transmitted between parallel and non-parallel communication.
[0092] In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback via Bluetooth headphones.
[0093] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a Camera Serial Interface (CSI) and a Display Serial Interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.
[0094] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0095] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0096] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0097] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0098] The power management module 141 connects 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, providing power to the processor 110, internal memory 131, external memory interface 120, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance).
[0099] In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be located in the same device.
[0100] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0101] 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 one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0102] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1.
[0103] In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be disposed in the same device.
[0104] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates 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 processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0105] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as Wireless Fidelity (Wi-Fi) networks), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR) technologies. 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 antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0106] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. 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 technologies, etc. GNSS can include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the Beidou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).
[0107] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0108] The display screen 194 is used to display images, videos, etc., such as the icon, folder, and folder name of the APP in this embodiment. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0109] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0110] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0111] Camera 193 is used to capture still images or videos. An object passes through the lens, generating an optical image that is projected onto a photosensitive element. The focal length of the lens indicates the camera's field of view; a smaller focal length indicates a larger field of view. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts light signals into electrical signals, which are then passed to the ISP (Image Signal Processor) for conversion into digital image signals. The ISP outputs the digital image signals to the DSP (Digital Signal Processor) for processing. The DSP converts the digital image signals into standard RGB, YUV, or other image signal formats.
[0112] In this application, the electronic device 100 may include two or more cameras 193 with different focal lengths.
[0113] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0114] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG1, MPEG3, MPEG4, etc.
[0115] NPU stands for Neural Network (NN) computing processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0116] In this embodiment of the application, the NPU or other processor can be used to perform operations such as analysis and processing of images in the video stored in the electronic device 100.
[0117] The external storage 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 storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0118] Internal memory 131 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 131. Internal memory 131 may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function (such as sound playback, image playback, etc.). The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.).
[0119] In addition, the internal memory 131 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0120] Electronic device 100 can implement audio functions through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0121] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and also to convert analog audio inputs into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0122] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or hands-free calls through the speaker 170A. For example, the speaker can play the comparison analysis results provided in the embodiments of this application.
[0123] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.
[0124] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0125] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0126] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When a force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch operation intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A.
[0127] In some embodiments, touch operations applied to the same touch location but with different touch intensity can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS message is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS message is executed.
[0128] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.
[0129] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0130] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover using the magnetic sensor 180D. Then, based on the detected opening and closing state of the cover or the flip cover, features such as automatic flip unlocking can be set.
[0131] The 180E accelerometer can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and is applicable to screen orientation switching, pedometers, and other applications.
[0132] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scene, electronic device 100 can utilize the distance sensor 180F to measure distance for rapid focusing.
[0133] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 may use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.
[0134] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0135] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.
[0136] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.
[0137] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touch screen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.
[0138] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from vibrating bone fragments in the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals.
[0139] In some embodiments, the bone conduction sensor 180M can also be integrated into the headphones to form bone conduction headphones. The audio module 170 can analyze the vibration signal of the sound-vibrating bone block acquired by the bone conduction sensor 180M to extract the voice signal and realize the voice function. The application processor can analyze the heart rate information based on the blood pressure fluctuation signal acquired by the bone conduction sensor 180M to realize the heart rate detection function.
[0140] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0141] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0142] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0143] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. 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 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also 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 communication. 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.
[0144] See Figure 2 This is a schematic diagram of the software structure of an electronic device according to an embodiment of this application. The operating system in the electronic device can be Android, Microsoft Windows, Apple iOS, or HarmonyOS, etc. Here, HarmonyOS is used as an example for illustration.
[0145] In some embodiments, the HarmonyOS system can be divided into four layers, including the kernel layer, system service layer, framework layer, and application layer, with the layers communicating with each other through software interfaces.
[0146] like Figure 2As shown, the kernel layer includes the Kernel Abstraction Layer (KAL) and the driver subsystem. The KAL contains multiple kernels, such as the Linux Kernel for the Linux system and the LiteOS kernel for lightweight IoT systems. The driver subsystem can include a Hardware Driver Foundation (HDF). The HDF provides unified peripheral access capabilities and a framework for driver development and management. A multi-kernel kernel layer can select the appropriate kernel for processing based on system requirements.
[0147] The system service layer is the core capability set of the HarmonyOS system. It provides services to applications through the framework layer. This layer may include a set of basic system capability subsystems, a set of basic software service subsystems, a set of enhanced software service subsystems, and a set of hardware service subsystems.
[0148] The system's basic capability subsystems provide foundational capabilities for the operation, scheduling, and migration of distributed applications on HarmonyOS devices. These may include subsystems such as distributed soft bus, distributed data management, distributed task scheduling, Ark multi-language runtime, common base libraries, multi-modal input, graphics, security, artificial intelligence (AI), and user program frameworks. Among these, the Ark multi-language runtime provides runtime environments for C, C++, or JavaScript (JS) languages and basic system class libraries. It can also provide a runtime environment for Java programs statically generated using the Ark compiler (i.e., the parts of the application or framework layer developed using the Java language).
[0149] The basic software service subsystem provides common and general software services for the HarmonyOS system. These may include subsystems such as event notification, telephony, multimedia, Design For X (DFX), and MSDP & DV.
[0150] The enhanced software service subsystem provides HarmonyOS with differentiated enhanced software services for different devices. It may include dedicated subsystems for smart screens, wearables, and the Internet of Things (IoT).
[0151] The hardware service subsystem provides hardware services for the HarmonyOS system. This may include subsystems such as location services, biometric recognition, wearable hardware services, and IoT hardware services.
[0152] The framework layer provides HarmonyOS application development with user program frameworks and capability frameworks in multiple languages, including Java, C, C++, and JS; two user interface (UI) frameworks (JavaUI framework for Java and JS UI framework for JS); and multi-language framework application programming interfaces (APIs) for various software and hardware services. The APIs supported by HarmonyOS devices will vary depending on the degree of system componentization.
[0153] The application layer includes system applications and third-party applications (or extended applications). System applications can include applications that are installed by default on electronic devices, such as the desktop, control bar, settings, and phone. Extended applications can be non-essential applications developed and designed by the electronic device manufacturer, such as applications for managing electronic devices, migrating between devices, note-taking, and weather. Third-party non-system applications can be applications developed by other manufacturers that can run on the HarmonyOS system, such as games, navigation, social networking, or shopping applications.
[0154] It provides the ability to run background tasks and a unified data access abstraction. PA mainly supports FA, for example, by providing computing power as a background service or providing data access capabilities as a data warehouse. Applications developed based on FA or PA can implement specific business functions, support cross-device scheduling and distribution, and provide users with a consistent and efficient application experience.
[0155] Multiple electronic devices running the HarmonyOS system can achieve hardware cooperation and resource sharing through distributed soft bus, distributed device virtualization, distributed data management, and distributed task scheduling.
[0156] The virtual avatar generation method provided in this application can be applied to any application scenario capable of generating virtual avatars. These application scenarios can include game scenarios, emoji scenarios, film and animation scenarios, virtual avatar endorsements, virtual avatar live streaming, etc. For example, assuming the application scenario is a game scenario, a preset base model can be determined based on the user's selection of a game character. After identifying the target object from the target image uploaded by the user, a virtual avatar corresponding to the target object and consistent with the style of the preset base model can be generated. This application does not limit the specific type of application scenario.
[0157] like Figure 3 The diagram shown is a flowchart illustrating a virtual avatar generation method provided in this application. (See attached diagram.) Figure 3 The method includes:
[0158] S301, Obtain the feature points of the target object.
[0159] It should be understood that the target object can be a target region determined based on the target image. Assuming the target image is a face image, the target object includes, but is not limited to, the contours of the eyes, eyebrows, nose, ears, etc. It should be noted that in practical applications, the target object can be a specific area corresponding to any limb of a person, such as the head, hands, or feet; for example, the area where a fingerprint is located. The target object can also be a specific area of any functional organ of a pet (such as a cat, dog, or bird). This application does not impose any limitations on the specific type of the target object.
[0160] Feature points can refer to a set of points used to characterize the contour of a target object, obtained through algorithms such as feature point detection. In the embodiments of this application, feature points of a target object can be obtained in the following ways: acquiring a target image containing the target object, performing feature point detection on the target object, and determining the feature points of the target object based on the feature point detection results.
[0161] In one example, assuming the target image is a face image and the target object is the eye contour, after obtaining the face image containing the eye contour, a feature point detection algorithm can be used to detect feature points in the face image to obtain the face feature point detection result, that is, to obtain the feature points of each part of the face contour (including the coordinates of each point and the classification result corresponding to each point), and further determine the feature points of the eye contour from the feature points of the face image.
[0162] It is worth noting that when the target object is a target image, feature point detection can be performed directly on the target object to determine its feature points.
[0163] S302, determine the target feature information of the target object based on the feature points. The target feature information includes first feature information and second feature information in different dimensions.
[0164] It should be understood that after obtaining the feature points of the target object, the target feature information of the target object can be further determined based on these feature points. The target feature information can be geometric feature information of the target object in multiple different dimensions.
[0165] Since the target object may be a partial region of the target image, in order to improve the accuracy of the virtual image of the target object in the target image, in this embodiment of the application, the target feature information determined based on the feature points of the target object may include first feature information and second feature information of different dimensions. For example, the first feature information and second feature information of different dimensions may be any two of the geometric feature information such as size feature information, shape feature information, and orientation feature information.
[0166] In order to increase the accuracy of the virtual model of the target object, in some embodiments, the target feature information may also include third feature information, depending on the specific application scenario. For example, the target feature information may include size feature information, shape feature information, and orientation feature information corresponding to the target object.
[0167] In one possible implementation, before determining the target feature information based on the feature points of the target object, the obtained feature points of the target object can be normalized so that the scale of the feature points of the target object is consistent with the scale of the feature points of each sample in the preset sample library, which facilitates the subsequent processing of the feature points of the target object and thus improves the processing efficiency.
[0168] Of course, before using algorithms such as feature point detection to detect feature points in the target image to obtain the feature points of the target object, after obtaining the target image containing the target object, the target image can be directly normalized to unify the scale of the target image with that of various samples in a preset sample library. This application does not impose any restrictions on the specific execution order of the normalization steps.
[0169] S303, determine the target sample corresponding to the target feature information from the preset sample library.
[0170] It should be understood that the sample library can pre-store various different samples corresponding to the target object, along with information corresponding to each sample. The information for each sample can include its category, feature information, and model parameters. The category is used to distinguish each sample in the sample library; the feature information is used to characterize the features corresponding to each sample, such as size, orientation, shape, and position features; the model parameters represent the specific coordinates of the feature points corresponding to each sample on a pre-defined schema.
[0171] S304, Modify the preset base model according to the target parameters of the target sample to obtain the virtual image of the target object.
[0172] It should be understood that the preset base model can also be called the baseline virtual image or the initial virtual image. The style of the preset base model can be predefined according to the actual application scenario. After modifying the preset base model according to the target parameters of the target sample, the virtual image of the target object obtained has the same style as the preset base model. In this way, a virtual image with a unified style can be generated according to target objects with different characteristics.
[0173] As an example rather than a limitation, it is assumed that in the metaverse, a preset base model can be predefined with a style close to a cartoon character (or anime character). Different users can upload two-dimensional images to generate virtual avatars that can represent themselves, and the generated virtual avatars of different users can all have a cartoon style (or anime style).
[0174] After determining the target sample from the preset sample library based on the target feature information of the target object, the preset basic model can be modified according to the target parameters (i.e. model parameters) corresponding to the target sample stored in the sample library to obtain the virtual image of the target object.
[0175] The following will provide an exemplary description of the process for generating a virtual image of an eye contour, using a scenario where the target object is the eye contour.
[0176] It should be understood that after identifying the target object as the eye contour, a face image including the eye contour can be obtained first, and feature point detection can be performed on the face image to obtain the feature points of the eye contour.
[0177] To accelerate the generation of a virtual image of the eye contour, in one possible embodiment, after obtaining the feature points of the eye contour, the feature points of the target object's eye contour can be normalized according to the size of various eye contour sample images pre-stored in the sample library; or, after obtaining a face image including the eye contour, the face image including the target object's eye contour can be normalized according to the image size corresponding to various different eye contour samples pre-stored in the sample library.
[0178] Specifically, such as Figure 4 The image shown is a schematic diagram of a human face image including eye contours provided in an embodiment of this application. See also... Figure 4 Assuming that after obtaining a face image including the eye contour, the first distance between the temples through the pupil in the face image is obtained (see...). Figure 4 The distance represented by the line segment with the arrow is 100. The second distance between the temples and through the pupil in the images corresponding to various eye contour samples pre-stored in the sample library is in the range of 0-1. Then, the face image including the eye contour can be reduced by 100 times proportionally to achieve normalization processing of the face image.
[0179] After obtaining the feature points of the eye contour, the target feature information corresponding to the eye contour can be determined based on the feature points of the eye contour. The target feature information can include first feature information and second feature information of different dimensions, or it can include first feature information, second feature information and third feature information of different dimensions.
[0180] If the determined target feature information corresponding to the eye contour includes first feature information and second feature information, then the first feature information can be determined based on the zeroth moment of the feature points corresponding to the eye contour. The first feature information is used to characterize the size feature of the eye contour. The second feature information can be determined based on the second moment (also called the moment of inertia) of the feature points corresponding to the eye contour. This second feature information is used to characterize the directional feature of the eye contour. If the determined target feature information corresponding to the eye contour also includes third feature information, then the third feature information can also be determined based on the Hu moment of the feature points corresponding to the eye contour. This third feature information is used to characterize the shape feature of the eye contour.
[0181] Specifically, based on the above example, the first feature information corresponding to the eye contour, namely the size feature of the eye contour, can be calculated by the following formula (1).
[0182]
[0183] In the above formula (1), (x,y) represents the coordinates of each feature point of the eye contour, and I(x,y) represents the pixel value at the location of the feature point, that is, the pixel value at the coordinates (x,y) of the feature point. In this embodiment, the value of the pixel value is 1.
[0184] The second feature information corresponding to the eye contour, namely the directional feature of the eye contour, can be calculated using the following formula (2).
[0185]
[0186] In the above formula (2), μ 11 μ 20 μ 02 The second central moment corresponding to the feature points of the eye contour is represented by the formula (3) below.
[0187]
[0188] In formula (3), M represents the centroid (or center of gravity) of the eye contour, determined by the feature points of the eye contour; 02 M 20 and M 11 This represents the second moment corresponding to each feature point, which can be expressed by the formula corresponding to formula (1). It is determined that i and j are positive integers, and i + j = 2.
[0189] If the target feature information corresponding to the eye contour also includes third feature information, the third feature information corresponding to the eye contour, i.e. the shape feature of the eye contour, can be calculated by the following formula (4).
[0190] h0=η 20 +η 02
[0191]
[0192] h2=(η 30 -3η 12 ) 2 +(3η 21 -η 03 ) 2
[0193] h3=(η 30 +η 12 ) 2 +(η 21 +η 03 ) 2
[0194] h4=(η 30 -3η 12 )(η 30 +η 12 )[(η 30 +η 12 ) 2 -3(η 21 +η 03 ) 2 ]+(3η 21 -η 03 )[3(η 30 +η 12 ) 2 -(η 21 +η 03 ) 2 ]
[0195] h5=(η 20 -η 02 )[(η 30 +η 12 ) 2 -(η 21 +η 03 ) 2 +4η 11 (η 30 +η 12 )(η 21 +η 03 )]
[0196] h6=(3η 21 -η 03)(η 30 +η 12 )[(η 30 +η 12 ) 2 -3(η 21 +η 03 ) 2 ]+(η 30 -3η 12 )(η 21 +η 03 )[3(η 30 +η 12 ) 2 -(η 21 +η 03 ) 2 (4)
[0197] In the above formula (4), η ij η represents the normalized central moments, which are normalized from the central distances. ij The specific calculation formula is as follows in, i and j are positive integers. and The value of can be referenced in formula (3) above. The corresponding value, I(x,y), also represents the pixel value at the location of the feature point.
[0198] After determining the target feature information corresponding to the feature points of the eye contour based on the feature points of the eye contour, the target sample can be determined from a preset sample library based on the determined target feature information. It is easy to understand that if the number of dimensions of the feature information in the target feature information is different, the method for determining the target sample may be different. The following will illustrate the method for determining the target sample corresponding to the target feature information from the preset sample library through two possible embodiments.
[0199] In Example 1, the target feature information includes feature information in two different dimensions. For example, the target feature information is first feature information and second feature information.
[0200] In Embodiment 1, after obtaining the feature points of the eye contour, the target feature information determined based on the feature points of the target object includes first feature information and second feature information. Samples from a preset sample library that satisfy a first feature similarity threshold with the first feature information and a second feature similarity threshold with the second feature information can be identified as target samples.
[0201] To ensure that at least one sample from a pre-defined sample library satisfies both the similarity to the first feature information and the similarity to the second feature information, satisfying the requirements of practical applications, in one possible implementation, such as... Figure 5 The diagram shown is a flowchart of a method for determining a target sample according to an embodiment of this application. See also... Figure 5 The system can determine a first sample set from the sample library based on the first feature information, whose similarity to the first feature information meets a preset first feature similarity threshold; determine a second sample set from the sample library based on the second feature information, whose similarity to the second feature information meets a preset second feature similarity threshold; when the number of samples in the first sample set is greater than or equal to the preset first threshold, and the number of samples in the second sample set is greater than or equal to the preset second threshold, determine the intersection of the first sample set and the second sample set; if the number of samples in the intersection is greater than a preset third threshold, then determine the target sample from the intersection. The specific values of the first feature similarity threshold, the second feature similarity threshold, the first threshold, the second threshold, and the third threshold can be set according to the actual application, and this application does not impose any limitations on them.
[0202] Based on the above possible implementation methods, if the number of samples in the intersection determined by the first sample set and the second sample set is less than or equal to the third threshold, then the first threshold and / or the second threshold are increased.
[0203] It is easy to understand that when the number of samples in the intersection determined by the first sample set and the second sample set is less than or equal to the third threshold, one can increase only the first threshold to increase the number of samples in the intersection determined by the first sample set; or one can increase only the second threshold to increase the number of samples in the intersection determined by the first sample set; or one can increase both the first and second thresholds to increase the number of samples in the intersection determined by the first and second sample sets.
[0204] For example, suppose the third threshold is set to 0. When the number of samples in the intersection of the first and second sample sets is greater than 0, such as... Figure 6As shown, if the intersection of the first and second sample sets identifies two samples, X and Y, then the target sample can be determined based on the intersection of the first and second sample sets; that is, at least one target sample can be determined from samples X and Y. Conversely, when the number of samples in the intersection of the first and second sample sets is less than or equal to 0, it indicates that the first and second sample sets do not intersect. In this case, the target sample cannot be determined based on the intersection of the first and second sample sets. In practical applications, this problem may arise because the values of the first threshold and / or the second threshold are too small. Therefore, the values of the first threshold and / or the second threshold can be appropriately increased to increase the number of samples in the first and / or second sample sets, thereby increasing the number of samples in the intersection of the first and second sample sets.
[0205] In practical applications, to improve the similarity (or matching degree) between each sample in the first sample set determined from the sample library based on the first feature information and the eye contour, optionally, if the number of samples in the first sample set whose similarity with the first feature information meets a preset first feature similarity threshold is less than the first threshold, the first feature similarity threshold between each sample in the sample library and the eye contour can be increased. That is, the number of samples in the first sample set is increased by increasing the first feature similarity threshold. It is understood that the smaller the first feature similarity threshold between each sample in the sample library and the eye contour, the smaller the size difference between the samples in the first sample set and the eye contour; conversely, the larger the first feature similarity threshold, the greater the size difference between the samples in the first sample set and the eye contour.
[0206] For example, suppose the value of the first feature information (i.e., size) corresponding to the feature points of the eye contour determined by the above formula (1) is 10, the first feature similarity threshold is set to 2, the first threshold is 1, and the number of samples with the value of the first feature information of 8 to 10 determined from the sample library according to the initial first feature similarity threshold is 0. That is, there are no samples in the sample library with the initial first feature similarity threshold of 2 with the eye contour. In other words, if the number of samples in the first sample set determined from the sample library according to the first feature information is less than the first threshold (i.e., 0 < 1), the initial first feature similarity threshold can be increased. Suppose the initial first feature similarity threshold is modified to 4, then the number of samples with the value of the first feature information of 6 to 10 determined from the sample library according to the modified first feature similarity threshold can be increased to increase the number of samples in the first sample set determined from the sample library.
[0207] It's worth noting that, to ensure the accuracy of each sample in the first sample set, the initial first feature similarity threshold can be set as small as possible, and then gradually increased. In other words, the specific value of the first feature similarity threshold can be gradually increased from small to large. Of course, in practical applications, the specific values of each threshold can also be gradually decreased from large to small to ensure that at least one target sample can be identified from the pre-defined sample library.
[0208] Similarly, if the number of samples in the second sample set whose similarity to the second feature information, determined from the sample library, meets the preset second feature similarity threshold is less than the second threshold, then the second feature similarity threshold between each sample in the sample library and the eye contour can be increased. It can be understood that the smaller the second feature similarity threshold between each sample in the sample library and the eye contour, the smaller the directional difference between the samples in the second sample set and the target object's eye contour, and the more similar each sample in the second sample set is to the target object's eye contour; conversely, the larger the second feature similarity threshold, the greater the directional difference between the samples in the second sample set and the target object's eye contour, and the more dissimilar each sample in the second sample set is to the target object's eye contour.
[0209] For example, suppose that the value of the second feature information (i.e., direction) corresponding to the feature point of the eye contour determined by the above formula (2) is 30°, the second feature similarity threshold is set to 3°, and the second threshold is 1. The number of samples with the value of the second feature information of 27° to 30° determined from the sample library according to the initial second feature similarity threshold is 0. That is, it is difficult to obtain samples from the sample library that satisfy the initial second feature similarity threshold of 3 for the second feature information between the eye contour and the second feature. This makes the number of samples in the second sample set determined from the sample library according to the second feature information less than the second threshold. Then the initial second feature similarity threshold can be increased. Suppose that the initial second feature similarity threshold is modified to 6°. Then the number of samples with the value of the second feature information of 24° to 30° determined from the sample library according to the modified second feature similarity threshold can be increased.
[0210] Based on the above embodiments, the method for determining the target sample from the intersection between the first sample set and the second sample set may specifically include: determining the similarity between each sample in the intersection and the target object based on the target feature information; determining the sample with the highest similarity as the target sample, whereby the similarity is used to describe the first feature similarity value and the second feature similarity value between each sample and the target object.
[0211] It should be understood that similarity can also be a matching degree. The first feature similarity value between each sample and the target object can refer to the difference in size between the feature points corresponding to the eye contour in each sample and the feature points corresponding to the eye contour in each sample; the second feature similarity value between each sample and the target object can refer to the difference in orientation between the feature points corresponding to the eye contour in each sample and the feature points corresponding to the eye contour in each sample.
[0212] In one example, suppose P represents the similarity between the eye contour in the sample and the eye contour of the target object, ΔS represents the first feature similarity value between the eye contour in the sample and the eye contour of the target object, and ΔA represents the second feature similarity value between the eye contour in the sample and the eye contour of the target object. The similarity between the eye contour in each sample in the intersection and the eye contour of the target object can be determined according to the following formula (5).
[0213] P = aΔA + bΔS (5)
[0214] In the above formula (5), a and b represent the weight coefficients of the first feature similarity value and the second feature similarity value, respectively, where a+b=1 and a and b are both positive numbers.
[0215] In another example, the similarity between the eye contour of each sample in the intersection and the eye contour of the target object can also be determined according to the following formula (6), where a and b in formula (6) represent the weight coefficients of the first feature similarity value and the second feature similarity value, respectively.
[0216] P=(aΔA+bΔS) / (a+b) (6)
[0217] Based on the two examples above, the similarity between the eye contour in each sample and the eye contour of the target object can be calculated, and the sample with the highest similarity value can be identified as the target sample.
[0218] It should be noted that if there are two or more samples with the highest similarity values obtained based on the above formula (5) or formula (6), the target sample can be determined according to the order of the first feature similarity value followed by the second feature similarity value (or the second feature similarity value followed by the first feature similarity value) in the target feature information; or, any sample with the highest similarity value can be randomly selected as the target sample.
[0219] In addition to the possible implementations described above, in order to shorten the time for obtaining the intersection between the first and second sample sets and accelerate the acquisition speed of target samples corresponding to the eye contour, in another possible implementation, such as... Figure 7 The diagram shown is another flowchart for determining a target sample according to an embodiment of this application. See also... Figure 7The method for determining the target sample may also include: determining a first sample set from the sample library based on the first feature information, wherein the similarity between the target sample and the first feature information satisfies a preset first feature similarity threshold; determining a second sample set from the first sample set based on the second feature information, wherein the similarity between the target sample and the second feature information satisfies a preset second feature similarity threshold; and determining the target sample from the second sample set if the number of samples in the first sample set is greater than the preset first threshold and the number of samples in the second sample set is greater than the preset second threshold.
[0220] In other embodiments, the method for determining a target sample may further include: determining a first sample set from a sample library based on second feature information, wherein the similarity between the sample set and the second feature information satisfies a preset second feature similarity threshold; determining a second sample set from the first sample set based on the first feature information, wherein the similarity between the sample set and the second sample set satisfies a preset first feature similarity threshold; and determining a target sample from the second sample set if the number of samples in the first sample set is greater than or equal to the preset second threshold and the number of samples in the second sample set is greater than or equal to the preset first threshold.
[0221] Similarly, the specific values of the first feature similarity threshold, the second feature similarity threshold, the first threshold, the second threshold, and the third threshold can be set according to the actual application situation, and this application does not impose any restrictions on them.
[0222] It is important to note that in the two possible implementations of determining the target sample described above, one method first determines the first sample set based on the first feature information, while the other method first determines the first sample set based on the second feature information. In application scenarios where the target object is the eye contour, multiple experiments have demonstrated that when the target object is the eye contour, using the second method to determine the target sample results in a more realistic and similar virtual image to the eye contour. Specifically, this method involves first determining the corresponding first sample set from a preset sample set based on the second feature information, then determining the corresponding second sample set from the first sample set based on the first feature information, and finally determining the target sample from the second sample set.
[0223] Based on the above implementation, after determining the second sample set from the preset sample library according to the first feature information and the second feature information, the method for determining the target sample from the second sample set can refer to the aforementioned method for determining the target sample based on the intersection of the first sample set and the second sample set, and will not be repeated here.
[0224] Example 2: The target feature information includes three different dimensions of feature information, for example, the target feature information is the first feature information, the second feature information and the third feature information.
[0225] In Embodiment 2, after obtaining the feature points of the eye contour of the target object, the target feature information determined based on the feature points of the eye contour of the target object includes the first feature information, the second feature information, and the third feature information corresponding to the feature points of the target object. Then, samples that meet the first feature information similarity threshold, the second feature information similarity threshold, and the third feature information similarity threshold can be determined from the preset sample library and identified as target samples.
[0226] In one optional approach, a first sample set whose similarity to the first feature information satisfies a preset first feature similarity threshold can be determined from the sample library based on the first feature information; a second sample set whose similarity to the second feature information satisfies a preset second feature similarity threshold can be determined from the sample library based on the second feature information; a third sample set whose similarity to the third feature information satisfies a preset third feature similarity threshold can be determined from the sample library based on the third feature information; when the number of samples in the first sample set is greater than or equal to the preset first threshold, the number of samples in the second sample set is greater than or equal to the preset second threshold, and the number of samples in the third sample set is greater than or equal to the preset third threshold, the intersection of the first sample set, the second sample set, and the third sample set is determined; if the number of samples in the intersection is greater than a preset fourth threshold, the target sample is determined from the intersection.
[0227] For example, such as Figure 8 As shown, the first sample set determined based on the first feature information includes 3 samples, the second sample set determined based on the second feature information includes 5 samples, and the third sample set determined based on the third feature information includes 3 samples. Assuming the preset fourth threshold is 0, a sample Z can be determined based on the intersection of the first, second, and third sample sets, and sample Z can be identified as the target sample. If the intersection of the first, second, and third sample sets indicates that there are multiple samples (i.e., the number of samples is greater than 1), the target sample can be determined from these multiple samples.
[0228] It should be noted that the first feature similarity threshold, the second feature similarity threshold, the third feature similarity threshold, the first threshold, the second threshold, the third threshold, and the fourth threshold in this embodiment can also be adjusted based on the number of samples in the first sample set, the second sample set, the third sample set, and the intersection of the sample sets, in order to improve the accuracy of the obtained target samples. The specific adjustment process can be understood by referring to the aforementioned Embodiment 1, and will not be repeated here. Similarly, the specific values of the first feature similarity threshold, the second feature similarity threshold, the third feature similarity threshold, the first threshold, the second threshold, the third threshold, and the fourth threshold in this embodiment can be determined according to different target objects or actual application needs, and this application does not impose any limitations on this.
[0229] For example, if the number of samples at the intersection of the determined first, second, and third sample sets is less than or equal to a fourth threshold, then at least one of the first, second, and third thresholds can be increased. If the number of samples in the first sample set is less than the first threshold, then the first feature similarity threshold can be increased; if the number of samples in the second sample set is less than the second threshold, then the second feature similarity threshold can be increased; and if the number of samples in the third sample set is less than the third threshold, then the third feature similarity threshold can be increased.
[0230] It's worth noting that, to ensure the accuracy of the samples in the intersection of the three sample sets, the initial values of the first, second, and third feature similarity thresholds can be set as small as possible. These thresholds can then be gradually increased based on the number of samples in the intersection. In other words, the specific values of the first, second, and third feature similarity thresholds can be gradually increased from small to large. Of course, in practical applications, the specific values of each threshold can also be gradually decreased from large to small, as long as at least one target sample can be identified from the pre-set sample library.
[0231] Based on the above example, if multiple samples are determined from the intersection of the first, second, and third sample sets, the specific method for determining the target sample can include: determining the similarity between each sample in the intersection of the first, second, and third sample sets and the target sample, and determining the sample with the highest similarity as the target sample. Here, the similarity is used to describe the first feature similarity value, second feature similarity value, and third feature similarity value between each sample and the target object, including size feature similarity value, orientation feature similarity value, and shape feature similarity value.
[0232] It should be understood that the first feature similarity value can refer to the difference in size between the feature points corresponding to the eye contour in each sample; the second feature similarity value can refer to the difference in orientation between the feature points corresponding to the eye contour in each sample; and the third feature similarity value can refer to the difference in shape between the feature points corresponding to the eye contour in each sample.
[0233] As an example and not a limitation, the method for determining the similarity between each sample and the target object can refer to the following formula (7). In formula (7), P represents the similarity between the eye contour in the sample and the eye contour of the target object, ΔS represents the first feature similarity value between the eye contour in the sample and the eye contour of the target object, ΔA represents the second feature similarity value between the eye contour in the sample and the eye contour of the target object, and ΔH represents the third feature similarity value between the eye contour in the sample and the eye contour of the target object, where a+b+c=1, and a, b and c are all positive numbers.
[0234] P = aΔA + bΔS + cΔH (7)
[0235] In another possible example, the similarity between each sample and the target object can also be determined according to formula (8).
[0236] P=(aΔA+bΔS+cΔH) / (a+b+c) (8)
[0237] In another alternative approach, a first sample set whose similarity to the first feature information meets a preset first feature similarity threshold can be determined from the sample library based on the first feature information; a second sample set whose similarity to the second feature information meets a preset second feature similarity threshold can be determined from the first sample set based on the second feature information; a third sample set whose similarity to the third feature information meets a preset third feature similarity threshold can be determined from the second sample set based on the third feature information; when the number of samples in the first sample set is greater than or equal to the preset first threshold, the number of samples in the second sample set is greater than or equal to the preset second threshold, and the number of samples in the third sample set is greater than the preset third threshold, the target sample is determined from the third sample set.
[0238] For example, if the number of samples in the third sample set is less than or equal to the third threshold, the first threshold and / or the second threshold, or the third feature similarity threshold, can be increased to increase the number of samples in the third sample set; if the number of samples in the first sample set is less than the first threshold, the first feature similarity threshold can be increased; if the number of samples in the second sample set is less than the second threshold, the second feature similarity threshold can be increased.
[0239] It is worth noting that when the target object is an object other than the eye contour, the influence of the first, second, and third feature information on the similarity of the target object can be determined based on actual experiments. Then, the target sample is determined sequentially from a preset sample library based on the order of the first, second, and third feature information. It is easy to understand that the specific values of the first, second, and third feature similarity thresholds, as well as the first, second, and third thresholds, can be dynamically adjusted based on the number of samples in the third sample set.
[0240] In this optional approach, the specific method for determining the target sample may include: determining the similarity between each sample in the third sample set and the target sample, and determining the sample with the highest similarity as the target sample, wherein the similarity is used to describe the first feature similarity value, the second feature similarity value, and the third feature similarity value between each sample in the third sample set and the target object.
[0241] It should be noted that the number of target samples determined from the preset sample library using the three target feature information of different dimensions may be small. Therefore, in practical applications, the method of Embodiment 1 or Embodiment 2 described above can be selected to determine the target samples according to the number of samples in the sample library.
[0242] It is understood that, in this embodiment, after obtaining the feature points of the target object, the target feature information of the target object is first determined based on the feature points, then the target sample is determined from a preset sample library based on the target feature information, and finally, the target parameters of the target sample are used to modify the preset base model to determine the virtual image corresponding to the target object. In practical applications, the design style of the preset base model can be fixed, and then virtual images with a consistent style corresponding to different target objects can be obtained based on this method.
[0243] Furthermore, since the target feature information obtained in this method is the feature of different dimensions corresponding to the feature points of the target object, the target sample determined by using the feature information of multiple different dimensions of the target object is a sample that is closer to the target object, which improves the reliability of the target sample, greatly increases the similarity between the part of the virtual image corresponding to the target object and the target object, effectively reduces the difference between the virtual image and the target object, and enhances the realism of the virtual image.
[0244] It should be understood that the embodiments in this application are merely specific implementations of this application, but the scope of protection of this application is not limited thereto. The order of the steps in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments in this application.
[0245] Corresponding to the virtual image generation method provided in the above embodiments, Figure 9 This is a structural block diagram of a virtual image generation device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown.
[0246] like Figure 9 As shown, the virtual avatar generation device 900 includes: an acquisition unit 901, a first determination unit 902, a second determination unit 903, and a modification unit 904.
[0247] Acquisition unit 901 is used to acquire feature points of the target object;
[0248] The first determining unit 902 is used to determine the target feature information of the target object based on the feature points, wherein the target feature information includes first feature information and second feature information of different dimensions.
[0249] The second determining unit 903 is used to determine the target sample corresponding to the target feature information from a preset sample library;
[0250] Modification unit 904 is used to modify the preset base model according to the target parameters of the target sample to obtain the virtual image of the target object.
[0251] Optionally, the first feature information is determined based on the zeroth moment of the feature point, and the second feature information is determined based on the second moment of the feature point.
[0252] Optionally, the second determining unit 903 is further configured to:
[0253] The target sample is a sample from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold, and whose similarity to the second feature information meets a preset second feature similarity threshold.
[0254] Optionally, determining the target sample from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold and whose similarity to the second feature information meets a preset second feature similarity threshold includes:
[0255] Based on the first feature information, a first sample set is determined from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold.
[0256] Based on the second feature information, a second sample set is determined from the sample library whose similarity to the second feature information meets a preset second feature similarity threshold;
[0257] When the number of samples in the first sample set is greater than or equal to a preset first threshold, and the number of samples in the second sample set is greater than or equal to a preset second threshold, the intersection of the first sample set and the second sample set is determined.
[0258] If the number of samples in the intersection is greater than a preset third threshold, then the target sample is determined from the intersection.
[0259] Optionally, if the number of samples in the intersection is less than or equal to the third threshold, the first threshold and / or the second threshold are increased.
[0260] Optionally, if the number of samples in the first sample set is less than the first threshold, the first feature similarity threshold is increased.
[0261] Optionally, if the number of samples in the second sample set is less than the second threshold, the second feature similarity threshold is increased.
[0262] Optionally, the target feature information may also include third feature information.
[0263] Optionally, the third feature information is determined based on the Hu moments of the feature points.
[0264] Optionally, determining the target sample from the intersection includes:
[0265] The similarity between each sample in the intersection and the target object is determined based on the target feature information;
[0266] The sample with the highest similarity is determined as the target sample, and the similarity is used to describe the first feature similarity value, the second feature similarity value, and the third feature similarity value between the sample and the target object.
[0267] Optionally, the target object is the eye contour.
[0268] Optionally, the acquisition unit 901 is further configured to: acquire a target image, the target image including a target object; perform feature point detection on the target image; and determine the feature points of the target object based on the feature point detection results.
[0269] Optionally, determining the target feature information of the target object based on the feature points includes:
[0270] A normalization unit is used to normalize the feature points;
[0271] The third determining unit is used to determine the target feature information of the target object based on the normalized feature points.
[0272] It should be understood that the description of the device embodiments can refer to the above description of the electronic device and the virtual image generation method embodiments. The implementation principle and technical effect are similar to those of the above method embodiments, and will not be repeated here.
[0273] Based on the virtual avatar generation methods provided in the above embodiments, this application also provides the following:
[0274] This embodiment provides a computer program product, which includes a program that, when run by an electronic device, enables the virtual image generation method shown in the above embodiments of the electronic device.
[0275] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the virtual avatar generation method shown in the above embodiments.
[0276] This application provides a chip including a memory and a processor. The processor executes a computer program stored in the memory to control the electronic device to perform the virtual image generation method shown in the above embodiments.
[0277] It should be understood that the processor mentioned in the embodiments of this application can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0278] It should also be understood that the memory mentioned in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0279] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0280] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0281] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0282] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.
[0283] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0284] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0285] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a large-screen device, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0286] Finally, it should be noted that the above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A virtual character generation method characterized by, The method includes: Obtain feature points of the target object; The target feature information of the target object is determined based on the feature points. The target feature information includes first feature information and second feature information of different dimensions. The first feature information is determined based on the zeroth moment of the feature points, and the second feature information is determined based on the second moment of the feature points. The target sample is determined from the preset sample library whose similarity with the first feature information meets a preset first feature similarity threshold and whose similarity with the second feature information meets a preset second feature similarity threshold. The virtual image of the target object is obtained by modifying the preset base model according to the target parameters of the target sample.
2. The avatar generation method of claim 1, wherein, The step of determining the target sample from the sample library that has a similarity to the first feature information that meets a preset first feature similarity threshold, and a similarity to the second feature information that meets a preset second feature similarity threshold, includes: Based on the first feature information, a first sample set is determined from the sample library whose similarity to the first feature information meets a preset first feature similarity threshold. Based on the second feature information, a second sample set is determined from the sample library whose similarity to the second feature information meets a preset second feature similarity threshold; When the number of samples in the first sample set is greater than or equal to a preset first threshold, and the number of samples in the second sample set is greater than or equal to a preset second threshold, the intersection of the first sample set and the second sample set is determined. If the number of samples in the intersection is greater than a preset third threshold, then the target sample is determined from the intersection.
3. The avatar generation method of claim 2, wherein, If the number of samples in the intersection is less than or equal to the third threshold, then the first threshold and / or the second threshold are increased.
4. The avatar generation method of claim 2, wherein, If the number of samples in the first sample set is less than the first threshold, then the first feature similarity threshold is increased.
5. The avatar generation method of claim 2, wherein, If the number of samples in the second sample set is less than the second threshold, then the second feature similarity threshold is increased.
6. The virtual avatar generation method according to any one of claims 2-5, characterized in that, The target feature information also includes third feature information.
7. The virtual avatar generation method according to claim 6, characterized in that, The third feature information is determined based on the Hu moments of the feature points.
8. The virtual avatar generation method according to claim 6, characterized in that, Determining the target sample from the intersection includes: The similarity between each sample in the intersection and the target object is determined based on the target feature information; The sample with the highest similarity is determined as the target sample, and the similarity is used to describe the first feature similarity value, the second feature similarity value, and the third feature similarity value between the sample and the target object.
9. The virtual avatar generation method according to any one of claims 1-5, characterized in that, The target object is the eye contour.
10. The virtual avatar generation method according to any one of claims 1-5, characterized in that, Determining the target feature information of the target object based on the feature points includes: The feature points are normalized. The target feature information of the target object is determined based on the normalized feature points.
11. A virtual avatar generation device, characterized in that, The device includes: The acquisition unit is used to acquire feature points of the target object; The first determining unit is configured to determine target feature information of the target object based on the feature points. The target feature information includes first feature information and second feature information of different dimensions. The first feature information is determined based on the zeroth moment of the feature points, and the second feature information is determined based on the second moment of the feature points. The second determining unit is used to determine, from a preset sample library, a sample whose similarity with the first feature information meets a preset first feature similarity threshold and whose similarity with the second feature information meets a preset second feature similarity threshold as a target sample; The modification unit is used to modify the preset base model according to the target parameters of the target sample to obtain the virtual image of the target object.
12. An electronic device, characterized in that, include: A processor for running a computer program stored in a memory to implement the method as claimed in any one of claims 1 to 10.
13. A chip system, characterized in that, The chip system includes a processor that executes a computer program stored in a memory to implement the method as described in any one of claims 1-10.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 10.