CN109949407B - Head portrait generation method and device and electronic equipment - Google Patents

Head portrait generation method and device and electronic equipment Download PDF

Info

Publication number
CN109949407B
CN109949407B CN201910166944.9A CN201910166944A CN109949407B CN 109949407 B CN109949407 B CN 109949407B CN 201910166944 A CN201910166944 A CN 201910166944A CN 109949407 B CN109949407 B CN 109949407B
Authority
CN
China
Prior art keywords
portrait
user
head portrait
style
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910166944.9A
Other languages
Chinese (zh)
Other versions
CN109949407A (en
Inventor
宇哲伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201910166944.9A priority Critical patent/CN109949407B/en
Publication of CN109949407A publication Critical patent/CN109949407A/en
Application granted granted Critical
Publication of CN109949407B publication Critical patent/CN109949407B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the invention provides a head portrait generation method, a head portrait generation device and electronic equipment, wherein the method comprises the following steps: detecting whether video chat is started; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; selecting a current user portrait meeting a preset portrait selection standard from the captured user portraits; and according to a preset head portrait style, performing image processing on the current user portrait to generate a user head portrait. In the embodiment of the invention, the head portrait can be automatically generated for the user according to the preset head portrait selection standard and the head portrait style in the video chatting process of the user, so that the personalized head portrait can be generated for the user in a simpler and more convenient mode.

Description

Head portrait generation method and device and electronic equipment
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a method and an apparatus for generating a head portrait, and an electronic device.
Background
With the development and popularization of the internet, users use various application programs App every day. In general, when registering a user as a certain App, it is necessary to set information such as a nickname, a head portrait, a mail address, and hobbies of the user. Taking an instant messaging App as an example, when a new user registers, the new user needs to fill in the basic information of the new user and upload a user head portrait representing the virtual image of the new user. The user head portrait not only can play a role in identifying the user, but also can display the online or offline state of the user.
When setting up the head portrait, the user needs to browse the pictures in the photo album one by one, and find out the pictures suitable for making the head portrait according to the preference of the user. However, if the number of pictures stored in the album is large, the user takes a lot of time to search, and the searched pictures may not be set as the avatar due to an oversize or an unsatisfactory format; and if the user does not want to set the head portrait due to a complicated operation process, the discourse default head portrait has no diversity and can reduce the enjoyment of the user in using the APP.
Therefore, the cumbersome process of setting up the avatar affects the user experience.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for generating a head portrait and electronic equipment, which can generate a personalized head portrait for a user in a simpler and more convenient mode. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an avatar generation method, which is applied to a client, and the method includes:
detecting whether video chat is started;
when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval;
selecting a current user portrait meeting a preset portrait selection standard from the captured user portraits;
and according to a preset head portrait style, performing image processing on the current user portrait to generate a user head portrait.
Optionally, the preset head portrait selection criteria include: at least one of a lighting criterion, an angle criterion, a head portrait screen ratio criterion, or a head portrait position criterion.
Optionally, the preset avatar style includes: style, dimensions, size and resolution of the generated user avatar;
the step of processing the image of the current user portrait according to the preset head portrait style to generate the head portrait of the user comprises the following steps:
according to preset image preprocessing algorithms corresponding to different avatar dimensions, image preprocessing is carried out on the current user portrait to obtain an initial avatar with dimensions, size and resolution corresponding to preset avatar styles;
and converting the initial head portrait into the user head portrait with the style according to a preset image processing algorithm corresponding to the style of the generated head portrait.
Optionally, the step of performing image preprocessing on the current user portrait to obtain an initial portrait with a dimension, a size, and a resolution corresponding to a preset portrait style includes:
if the dimension corresponding to the portrait style is two-dimensional, performing normalization processing on the current user portrait according to the size and the resolution to obtain a two-dimensional image of the current user portrait as an initial portrait;
if the dimension corresponding to the head portrait style is three-dimensional, normalizing the current user portrait according to the size and the resolution to obtain a two-dimensional image of the current user portrait;
and establishing a 3D model by adopting a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and generating a three-dimensional face image as an initial head portrait by using the established 3D model.
Optionally, the step of establishing a 3D model by using a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and generating a three-dimensional face image as an initial head portrait by using the established 3D model includes:
if the number of the current user portraits is 1, establishing a 3D model according to the current user portraits by adopting a single-picture human face modeling algorithm;
and if the number of the current user portraits is multiple, establishing a 3D model according to the multiple current user portraits by adopting a multi-picture face modeling algorithm.
Optionally, the step of converting the initial avatar into the avatar having the style of the generated avatar according to a preset image processing algorithm corresponding to the style of the generated avatar includes:
obtaining a pre-trained style migration model corresponding to the style of the preset generated avatar;
and inputting the initial head portrait into the style migration model to obtain the user head portrait of the style.
Optionally, the preset avatar style is determined during a user registration process.
Optionally, after the step of generating the avatar of the user, the method further includes:
judging whether the video chat is finished or not; if not, returning to the step of capturing the user portrait from the images shot by the camera according to the preset time interval;
if yes, the user head portrait is saved.
Optionally, the step of saving the user avatar includes:
and outputting the user head portrait as a candidate head portrait to the user, and storing the candidate head portrait in the registration information after the user confirms.
In a second aspect, an embodiment of the present invention provides an avatar generation apparatus, which is applied to a client, and the apparatus includes:
an avatar generation apparatus applied to a client, the apparatus comprising:
the detection unit is used for detecting whether the video chat is started;
the image capturing unit is used for capturing the user image from the image shot by the camera at preset time intervals when the start of the video chat is detected;
the portrait selection unit is used for selecting a current user portrait meeting a preset portrait selection standard from the captured user portraits;
and the head portrait generating unit is used for carrying out image processing on the current user portrait according to a preset head portrait style to generate a user head portrait.
Optionally, the preset avatar style includes: style, dimensions, size and resolution of the generated user avatar;
the avatar generation unit includes:
the pre-processing module is used for pre-processing the image of the current user portrait according to preset image pre-processing algorithms corresponding to different portrait dimensions to obtain an initial portrait with the dimension, the size and the resolution corresponding to a preset portrait style;
and the style conversion module is used for converting the initial head portrait into the user head portrait with the style according to an image processing algorithm corresponding to the preset style of the generated head portrait.
Optionally, the preprocessing module includes:
the first initial head portrait obtaining submodule is used for carrying out normalization processing on the current user portrait according to the size and the resolution ratio if the dimension corresponding to the head portrait style is two-dimensional, and obtaining a two-dimensional image of the current user portrait as an initial head portrait;
the second initial head portrait obtaining submodule is used for carrying out normalization processing on the current user portrait according to the size and the resolution ratio to obtain a two-dimensional image of the current user portrait if the dimension corresponding to the head portrait style is three-dimensional; and establishing a 3D model by adopting a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and generating a three-dimensional face image as an initial head portrait by using the established 3D model.
Optionally, the second initial head portrait obtaining sub-module is specifically configured to:
if the number of the current user portraits is 1, establishing a 3D model according to the current user portraits by adopting a single-picture human face modeling algorithm;
and if the number of the current user portraits is multiple, establishing a 3D model according to the multiple current user portraits by adopting a multi-picture face modeling algorithm.
Optionally, the style conversion module includes:
the model obtaining submodule is used for obtaining a pre-trained style migration model corresponding to the style of the preset generated head portrait;
and the user head portrait obtaining sub-module is used for inputting the initial head portrait into the style migration model to obtain the style user head portrait.
Optionally, the avatar generation unit includes:
the judging module is used for judging whether the video chat is finished or not; if not, triggering the portrait capturing unit to capture the portrait of the user from the image shot by the camera at the preset time interval;
and the storage module is used for storing the user head portrait if the user head portrait is the head portrait.
Optionally, the saving module includes:
and the output sub-module is used for outputting the user head portrait as a candidate head portrait to the user, and the user stores the candidate head portrait in the registration information after determining.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the first aspect when executing a program stored in the memory.
According to the method, the device and the electronic equipment for generating the head portrait, provided by the embodiment of the invention, whether the video chat is started or not is detected; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; selecting a current user portrait meeting a preset portrait generation standard from the captured user portraits; and according to a preset head portrait style, performing image processing on the current user portrait to generate a user head portrait. In the embodiment of the invention, the head portrait can be automatically generated for the user according to the preset head portrait selection standard and the head portrait style in the video chatting process of the user, so that the personalized head portrait can be generated for the user in a simpler and more convenient mode.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic flow chart of a method for generating an avatar according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a registration process in the embodiment shown in FIG. 1;
fig. 3 is a schematic structural diagram of a head portrait generating apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
In order to generate a personalized avatar for a user in a simpler and more convenient manner, the embodiment of the invention provides an avatar generation method, an avatar generation device and electronic equipment. Firstly, detecting whether a video chat is started or not; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; then, selecting a current user portrait meeting a preset portrait generation standard from the captured user portraits, and carrying out image processing on the current user portrait according to a preset portrait style to generate a user portrait. In the embodiment of the invention, the head portrait can be automatically generated for the user according to the preset head portrait selection standard and the head portrait style in the video chatting process of the user, so that the personalized head portrait can be generated for the user in a simpler and more convenient mode.
As an implementation manner of the embodiment of the present invention, as shown in fig. 1, a method for generating an avatar according to the embodiment of the present invention is applied to a client, and specifically includes:
s101, whether the video chat is started or not is detected.
Specifically, for the video chat software, the start of the video chat can be confirmed by establishing a communication link of the video chat.
And S102, when the start of the video chat is detected, capturing the user portrait from the image shot by the camera according to the preset time interval.
Specifically, when the user chats in a video, a picture shot by the camera can be captured once at preset time intervals to serve as the user portrait.
And S103, selecting the current user portrait meeting the preset portrait selection standard from the captured user portraits.
In this embodiment, the preset avatar selection criteria may include: at least one of a lighting criteria, an angle criteria, an avatar to screen ratio criteria, or an avatar position criteria.
Specifically, the captured user portrait can be subjected to image processing, and illumination information, angle information, head portrait screen ratio or head portrait position information are extracted from the captured user portrait; and comparing the obtained information with a preset head portrait selection standard, and determining the user portrait meeting the standard as the current user portrait.
And S104, performing image processing on the current user portrait according to a preset portrait style to generate a user portrait.
In this embodiment, the preset avatar style may include: style, dimensions, size and resolution of the generated user avatar; the style of the head portrait of the user may include: a realistic style, an animation style, a watercolor style, etc.
Optionally, the image of the current user portrait is preprocessed according to preset image preprocessing algorithms corresponding to different portrait dimensions. When the dimension corresponding to the head portrait style is two-dimensional, normalizing the current user portrait according to the size and the resolution to obtain a two-dimensional image of the current user portrait as an initial head portrait; when the dimension corresponding to the head portrait style is three-dimensional, normalization processing is carried out on the current user portrait according to the dimension and the resolution ratio to obtain a two-dimensional image of the current user portrait, then a 3D model is established by adopting a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and a three-dimensional face image is generated by using the established 3D model to serve as an initial head portrait.
In this embodiment, the following two ways are used to establish a 3D model by using a preset three-dimensional face modeling algorithm and a two-dimensional image of a current user portrait:
the first mode is as follows: and if the number of the current user portraits is 1, inputting the current user portraits into a pre-trained convolutional neural network by adopting a single-picture human face modeling algorithm, and establishing a 3D model.
The second way is: and if the number of the current user portraits is multiple, establishing a 3D model according to the multiple current user portraits by adopting a multi-picture face modeling algorithm. Specifically, the multi-picture face modeling algorithm comprises the following steps:
according to a face alignment algorithm, key point positioning is carried out on each current user portrait in a plurality of current user portraits, and a face normal vector of a three-dimensional (3D) face template is obtained;
calculating an estimated surface normal vector of the 3D face template by adopting a photometric stereo vision algorithm according to the illumination condition in the portrait of the current user;
calculating a loss value according to the face normal vector, the estimated surface normal vector and the loss function of the obtained 3D face template;
judging whether the loss value meets the preset precision or not; if yes, obtaining a 3D model; and if not, adjusting the estimated surface normal vector of the 3D face template, and returning to the step of calculating the loss value according to the obtained face normal vector, the estimated surface normal vector and the loss function of the 3D face template.
And after the initial head portrait is obtained, further converting the initial head portrait into the user head portrait with the style according to a preset image processing algorithm corresponding to the style of the generated head portrait. Specifically, a pre-trained style migration model corresponding to a preset style of the generated avatar is obtained, and then the initial avatar is input into the style migration model to obtain the avatar of the user with the style of the generated avatar. For example, style migration models of a realistic style, a cartoon style and a watercolor style can be trained in advance respectively, if the avatar style is the cartoon style in the preset avatar styles, the initial avatar is input into the migration models of the cartoon style, and the output of the models is the avatar of the user in the cartoon style.
Optionally, after the head portrait of the user is obtained, whether the video chat is finished is judged; if not, returning to the step of capturing the user portrait from the image shot by the camera according to the preset time interval; if so, the user head portrait is taken as a candidate head portrait and displayed, and is stored in the registration information after the user confirms.
In this embodiment, the preset avatar selection criteria and the preset avatar style may be determined during user registration. The specific registration process is shown in fig. 2, and includes:
s201, displaying a registration interface.
S202, detecting whether permission to acquire the user portrait is allowed; if yes, go to step S203; if not, step S206 is executed to save the registration information.
S203, detecting whether default setting is used; if yes, executing step S204; if not, step S205 is performed.
S204, acquiring a default avatar selection standard and a default avatar style, and executing the step S206.
S205, acquiring the avatar selection standard and the avatar style selected by the user.
Specifically, if the user is detected to select default settings, acquiring default avatar selection criteria and default avatar styles as the preset avatar selection criteria and the preset avatar styles respectively; otherwise, acquiring the avatar selection standard selected by the user and the avatar style selected by the user, and respectively using the acquired avatar selection standard and the acquired avatar style as the preset avatar selection standard and the preset avatar style.
In this step, if the user determines not to use the default setting, a setting interface may be output first, and the selectable avatar standard and avatar style are displayed to the user; and then, acquiring the avatar selection standard and the avatar style selected by the user according to the selection result of the user on the setting interface.
S206, the registration information is saved.
After the registration is finished, when the user uses the video chat function, a personalized avatar can be generated for the user according to the method shown in fig. 1.
The embodiment of the invention provides a head portrait generation method, which detects whether a video chat is started; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; then, selecting a current user portrait meeting a preset portrait generation standard from the captured user portraits, and carrying out image processing on the current user portrait according to a preset portrait style to generate a user portrait. In the embodiment of the invention, the head portrait can be automatically generated for the user according to the preset head portrait selection standard and the head portrait style in the video chatting process of the user, so that the personalized head portrait can be generated for the user in a simpler and more convenient mode.
As an implementation manner of the embodiment of the present invention, as shown in fig. 3, a head portrait generating apparatus according to the embodiment of the present invention includes:
a detecting unit 310, configured to detect whether a video chat starts;
a portrait capturing unit 320 for capturing a user portrait from an image photographed by the camera at a preset time interval when the start of the video chatting is detected;
a portrait selection unit 330, configured to select a current user portrait meeting a preset portrait selection standard from the captured user portraits;
the avatar generation unit 340 is configured to perform image processing on the current user portrait according to a preset avatar style, so as to generate a user avatar.
The embodiment of the invention provides a head portrait generating device, which detects whether a video chat is started; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; then, selecting a current user portrait meeting a preset portrait generation standard from the captured user portraits, and carrying out image processing on the current user portrait according to a preset portrait style to generate a user portrait. In the video chat process of the user, the embodiment of the invention can automatically generate the head portrait for the user according to the preset head portrait selection standard and the head portrait style, thereby realizing the generation of the personalized head portrait for the user in a simpler and more convenient mode.
As an implementation manner of the embodiment of the present invention, the preset avatar style includes: style, dimensions, size and resolution of the generated user avatar;
the avatar generation unit 340 may include:
the pre-processing module is used for carrying out image pre-processing on the current user portrait according to image pre-processing algorithms corresponding to preset different portrait dimensions to obtain an initial portrait with the dimensions, the size and the resolution corresponding to a preset portrait style;
and the style conversion module is used for converting the initial head portrait into the user head portrait with the style according to an image processing algorithm corresponding to the preset style of the generated head portrait.
As an implementation manner of the embodiment of the present invention, the preprocessing module may include:
the first initial head portrait obtaining sub-module is used for carrying out normalization processing on the current user portrait according to the size and the resolution ratio if the dimension corresponding to the head portrait style is two-dimensional, and obtaining a two-dimensional image of the current user portrait as an initial head portrait;
the second initial head portrait obtaining submodule is used for carrying out normalization processing on the current user portrait according to the size and the resolution ratio to obtain a two-dimensional image of the current user portrait if the dimension corresponding to the head portrait style is three-dimensional; and establishing a 3D model by adopting a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and generating a three-dimensional face image as an initial head portrait by using the established 3D model.
As an implementation manner of the embodiment of the present invention, the second initial avatar obtaining sub-module is specifically configured to:
if the number of the current user portraits is 1, a single-picture human face modeling algorithm is adopted, and a 3D model is established according to the current user portraits;
and if the number of the current user portraits is multiple, establishing a 3D model according to the multiple current user portraits by adopting a multi-picture human face modeling algorithm.
As an implementation manner of the embodiment of the present invention, the style conversion module may include:
the model obtaining submodule is used for obtaining a pre-trained style migration model corresponding to the style of the preset generated head portrait;
and the user head portrait obtaining sub-module is used for inputting the initial head portrait into the style migration model to obtain the user head portrait with the style.
As an implementation manner of the embodiment of the present invention, the avatar generation unit may include:
the judging module is used for judging whether the video chat is finished or not; if not, triggering the portrait capturing unit to capture the portrait of the user from the image shot by the camera at the preset time interval;
and the storage module is used for storing the user head portrait if the user head portrait is the head portrait.
As an implementation manner of the embodiment of the present invention, the saving module includes:
and the output sub-module is used for outputting the user head portrait as a candidate head portrait to the user, and the user stores the candidate head portrait in the registration information after determining.
The embodiment of the invention provides a head portrait generating device, which detects whether a video chat is started; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; then, selecting a current user portrait meeting a preset portrait generation standard from the captured user portraits, and carrying out image processing on the current user portrait according to a preset portrait style to generate a user portrait. In the video chat process of the user, the embodiment of the invention can automatically generate the head portrait for the user according to the preset head portrait selection standard and the head portrait style, thereby realizing the generation of the personalized head portrait for the user in a simpler and more convenient mode.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401, when executing the program stored in the memory 403, implements the following steps:
detecting whether video chat is started;
when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval;
selecting a current user portrait meeting a preset head portrait selection standard from the captured user portraits;
and performing image processing on the current user portrait according to a preset portrait style to generate a user portrait.
According to the electronic equipment provided by the embodiment of the invention, the method for generating the head portrait is realized by detecting whether the video chat is started; when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval; selecting a current user portrait meeting a preset portrait generation standard from the captured user portraits; and according to a preset head portrait style, performing image processing on the current user portrait to generate a user head portrait. In the video chat process of the user, the embodiment of the invention can automatically generate the head portrait for the user according to the preset head portrait selection standard and the head portrait style, thereby realizing the generation of the personalized head portrait for the user in a simpler and more convenient mode.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also 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.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (13)

1. A method for generating an avatar, applied to a client, the method comprising:
detecting whether video chat is started;
when the start of the video chat is detected, capturing a user portrait from an image shot by a camera according to a preset time interval;
selecting a current user portrait meeting a preset portrait selection standard from the captured user portraits;
according to a preset head portrait style, performing image processing on the current user portrait to generate a user head portrait, wherein the preset head portrait style comprises the following steps: style, dimensions, size and resolution of the generated user avatar;
the step of processing the image of the current user portrait according to the preset head portrait style to generate the head portrait of the user comprises the following steps:
according to preset image preprocessing algorithms corresponding to different avatar dimensions, image preprocessing is carried out on the current user portrait to obtain an initial avatar with dimensions, size and resolution corresponding to preset avatar styles; converting the initial head portrait into a user head portrait with a style corresponding to the style of a preset head portrait generating according to an image processing algorithm;
the step of performing image preprocessing on the current user portrait to obtain an initial portrait with dimension, size and resolution corresponding to a preset portrait style comprises:
if the dimension corresponding to the portrait style is two-dimensional, performing normalization processing on the current user portrait according to the size and the resolution to obtain a two-dimensional image of the current user portrait as an initial portrait; if the dimension corresponding to the head portrait style is three-dimensional, normalizing the current user portrait according to the size and the resolution to obtain a two-dimensional image of the current user portrait; and establishing a 3D model by adopting a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and generating a three-dimensional face image as an initial head portrait by using the established 3D model.
2. The method of claim 1, wherein the pre-set avatar selection criteria comprise: at least one of a lighting criterion, an angle criterion, a head portrait screen ratio criterion, or a head portrait position criterion.
3. The method according to claim 1, wherein the step of creating a 3D model using a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait and generating a three-dimensional face image as an initial head portrait using the created 3D model comprises:
if the number of the current user portraits is 1, establishing a 3D model according to the current user portraits by adopting a single-picture human face modeling algorithm;
and if the number of the current user portraits is multiple, establishing a 3D model according to the multiple current user portraits by adopting a multi-picture face modeling algorithm.
4. The method according to claim 1, wherein the step of converting the initial avatar into the avatar having a style of the generated avatar according to a preset image processing algorithm corresponding to the style of the generated avatar comprises:
obtaining a pre-trained style migration model corresponding to the style of the preset generated head portrait;
and inputting the initial head portrait into the style migration model to obtain the user head portrait of the style.
5. The method of claim 1, wherein the predetermined avatar style is determined during a user registration process.
6. The method of claim 1, further comprising, after the step of generating a user avatar:
judging whether the video chat is finished or not; if not, returning to the step of capturing the user portrait from the image shot by the camera according to the preset time interval;
if yes, the user head portrait is saved.
7. The method of claim 6, wherein the step of saving the user's avatar comprises:
and outputting the user head portrait as a candidate head portrait to the user, and storing the candidate head portrait in the registration information after the user confirms.
8. An avatar generation apparatus applied to a client, the apparatus comprising:
the detection unit is used for detecting whether the video chat is started;
the image capturing unit is used for capturing the user image from the image shot by the camera at preset time intervals when the start of the video chat is detected;
the portrait selecting unit is used for selecting a current user portrait meeting a preset portrait selecting standard from the captured user portraits;
the head portrait generating unit is used for carrying out image processing on the current user portrait according to a preset head portrait style to generate a user head portrait, and the preset head portrait style comprises: style, dimensions, size and resolution of the generated user avatar;
the avatar generation unit includes:
the pre-processing module is used for pre-processing the image of the current user portrait according to preset image pre-processing algorithms corresponding to different portrait dimensions to obtain an initial portrait with the dimension, the size and the resolution corresponding to a preset portrait style;
the style conversion module is used for converting the initial head portrait into a user head portrait with a preset style according to an image processing algorithm corresponding to the style of the generated head portrait;
the preprocessing module comprises:
the first initial head portrait obtaining submodule is used for carrying out normalization processing on the current user portrait according to the size and the resolution ratio if the dimension corresponding to the head portrait style is two-dimensional, and obtaining a two-dimensional image of the current user portrait as an initial head portrait;
the second initial head portrait obtaining submodule is used for carrying out normalization processing on the current user portrait according to the size and the resolution ratio to obtain a two-dimensional image of the current user portrait if the dimension corresponding to the head portrait style is three-dimensional; and establishing a 3D model by adopting a preset three-dimensional face modeling algorithm and the two-dimensional image of the current user portrait, and generating a three-dimensional face image as an initial head portrait by using the established 3D model.
9. The apparatus of claim 8, wherein the second initial avatar acquisition sub-module is specifically configured to:
if the number of the current user portraits is 1, establishing a 3D model according to the current user portraits by adopting a single-picture human face modeling algorithm;
and if the number of the current user portraits is multiple, establishing a 3D model according to the multiple current user portraits by adopting a multi-picture face modeling algorithm.
10. The apparatus of claim 8, wherein the style conversion module comprises:
the model obtaining submodule is used for obtaining a pre-trained style migration model corresponding to the style of the preset generated head portrait;
and the user head portrait obtaining sub-module is used for inputting the initial head portrait into the style migration model to obtain the style user head portrait.
11. The apparatus according to claim 8, wherein the avatar generation unit includes:
the judging module is used for judging whether the video chat is finished or not; if not, triggering the portrait capturing unit to capture the portrait of the user from the image shot by the camera at the preset time interval;
and the storage module is used for storing the user head portrait if the user head portrait is the user head portrait.
12. The apparatus of claim 11, wherein the saving module comprises:
and the output sub-module is used for outputting the user head portrait as a candidate head portrait to the user, and the user stores the candidate head portrait in the registration information after determining.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 7 when executing a program stored in the memory.
CN201910166944.9A 2019-03-06 2019-03-06 Head portrait generation method and device and electronic equipment Active CN109949407B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910166944.9A CN109949407B (en) 2019-03-06 2019-03-06 Head portrait generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910166944.9A CN109949407B (en) 2019-03-06 2019-03-06 Head portrait generation method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109949407A CN109949407A (en) 2019-06-28
CN109949407B true CN109949407B (en) 2023-04-07

Family

ID=67009093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910166944.9A Active CN109949407B (en) 2019-03-06 2019-03-06 Head portrait generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109949407B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110446000B (en) * 2019-08-07 2021-04-16 三星电子(中国)研发中心 Method and device for generating dialogue figure image

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101102454A (en) * 2007-06-29 2008-01-09 中兴通讯股份有限公司 Method for setting personalized head image information of business card via mobile phone video phone
CN101945175A (en) * 2010-09-26 2011-01-12 宇龙计算机通信科技(深圳)有限公司 Method and device for automatically adding contact information and mobile terminal
CN102361493A (en) * 2011-10-28 2012-02-22 上海华勤通讯技术有限公司 Mobile terminal and method for setting address list head portrait
CN102821064A (en) * 2012-08-09 2012-12-12 上海量明科技发展有限公司 Method for setting real-time user icon for real-time communication tool, client and system
CN108833655A (en) * 2018-06-14 2018-11-16 深圳超多维科技有限公司 A kind of method and device generating three-dimensional head portrait in terminal device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101677390A (en) * 2008-09-19 2010-03-24 佛山普立华科技有限公司 Digital photographic arrangement and head portrait picture shooting method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101102454A (en) * 2007-06-29 2008-01-09 中兴通讯股份有限公司 Method for setting personalized head image information of business card via mobile phone video phone
CN101945175A (en) * 2010-09-26 2011-01-12 宇龙计算机通信科技(深圳)有限公司 Method and device for automatically adding contact information and mobile terminal
CN102361493A (en) * 2011-10-28 2012-02-22 上海华勤通讯技术有限公司 Mobile terminal and method for setting address list head portrait
CN102821064A (en) * 2012-08-09 2012-12-12 上海量明科技发展有限公司 Method for setting real-time user icon for real-time communication tool, client and system
CN108833655A (en) * 2018-06-14 2018-11-16 深圳超多维科技有限公司 A kind of method and device generating three-dimensional head portrait in terminal device

Also Published As

Publication number Publication date
CN109949407A (en) 2019-06-28

Similar Documents

Publication Publication Date Title
US11803345B2 (en) Gallery of messages from individuals with a shared interest
KR102476294B1 (en) Determining the Suitability of Digital Images for Creating AR/VR Digital Content
US11783862B2 (en) Routing messages by message parameter
US9854219B2 (en) Gallery of videos set to an audio time line
WO2019237745A1 (en) Facial image processing method and apparatus, electronic device and computer readable storage medium
US10592735B2 (en) Collaboration event content sharing
JP7231638B2 (en) Image-based information acquisition method and apparatus
CN110719327B (en) Interactive method and device for uploading image and storage medium
CN109949407B (en) Head portrait generation method and device and electronic equipment
CN117201883A (en) Method, apparatus, device and storage medium for image editing
CN109547678B (en) Processing method, device, equipment and readable storage medium
CN106846351B (en) Image processing method and client
CN115866238A (en) Feedback using coverage for object scanning
CN113890990A (en) Prompting method and device in information acquisition process, electronic equipment and readable medium
CN106101539A (en) A kind of self-shooting bar angle regulation method and self-shooting bar
US20230195856A1 (en) Method for media creation, sharing, and communication and associated system
US20240185530A1 (en) Information interaction method, computer-readable storage medium and communication terminal
CN113592731A (en) Image processing method, image processing device, electronic equipment and storage medium
CN113840085A (en) Vehicle source information acquisition method and device, electronic equipment and readable medium
CN116309951A (en) Virtual image-based interaction method and device, electronic equipment and storage medium
GB2483455A (en) Deriving Scene Information from Multiple Images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant