Image processing method, device and electronic device
By detecting and stretching the tooth area in the face video, the simulation of tooth growth special effects is realized, which solves the problem of unnatural tooth growth effects in the existing technology and improves the visual performance of short videos.
Patent Information
- Application Number
- CN202110376331.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-07
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-04-07
AI Technical Summary
It is difficult to achieve natural tooth growth effects in short videos with existing technology, and there is a lack of effective image processing methods to simulate the tooth growth process.
By acquiring the current frame in the face video, the tooth status is detected, a stretching information sequence is generated, and the tooth area is stretched using the stretching count value to simulate the tooth growth process.
It is possible to add special growth effects to teeth, simulate the natural tooth growth process, and improve the visual presentation effect of short videos.
Smart Images

Figure CN112990084B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to an image processing method, device, and electronic device. Background Art
[0002] As smartphone functions continue to improve, various short video shooting platforms have emerged. Users can use various short video shooting platforms to create short video works with personal characteristics. In order to make the short video function produce better visual presentation effects or meet the creative needs of users, these short video platforms have created a need to provide users with various special effects. Summary of the invention
[0003] This disclosure section is provided to introduce concepts in a brief form, which will be described in detail in the detailed description section below. This disclosure section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] The embodiments of the present disclosure provide an image processing method, device and electronic device, which realize the function of adding growth effects to teeth, thereby simulating the growth process of teeth.
[0005] In a first aspect, an embodiment of the present disclosure provides an image processing method, comprising: obtaining a face video to be processed; for a current frame in the face video, performing the following image processing steps: detecting the state of teeth in the current frame, wherein the state of teeth includes an exposed state or a non-exposed state; if the state of teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generating a stretching information sequence for stretching the target tooth area; obtaining a current stretching count value; using the current stretching count value, selecting stretching information from the stretching information sequence to obtain a stretching information subsequence; using the stretching information subsequence, stretching the target tooth area in the current frame; comparing the current stretching count value with the target count value; setting the stretching count value based on the comparison result; determining whether the current frame is the last frame of the face video; if the current frame is not the last frame of the face video, determining the next frame of the current frame as the current frame, and continuing to perform the image processing steps.
[0006] In a second aspect, an embodiment of the present disclosure provides an image processing device, comprising: an acquisition unit, configured to acquire a face video to be processed; a processing unit, configured to perform the following image processing steps for a current frame in the face video: detecting the state of teeth in the current frame, wherein the state of teeth includes an exposed state or a non-exposed state; if the state of teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generating a stretching information sequence for stretching the target tooth area; acquiring a current stretching count value; using the current stretching count value, selecting stretching information from the stretching information sequence to obtain a stretching information subsequence; using the stretching information subsequence, stretching the target tooth area in the current frame; comparing the current stretching count value with the target count value; setting the stretching count value based on the comparison result; determining whether the current frame is the last frame of the face video; a feedback unit, configured to determine the next frame of the current frame as the current frame if the current frame is not the last frame of the face video, and continue to perform the image processing steps.
[0007] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described in the first aspect.
[0008] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the image processing method as described in the first aspect.
[0009] The image processing method, device and electronic device provided by the embodiment of the present disclosure obtain a face video to be processed; then, for the current frame in the face video, perform the following image processing steps: detect the state of the teeth in the current frame, wherein the state of the teeth includes an exposed state or a non-exposed state; if the state of the teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generate a stretching information sequence for stretching the target tooth area; obtain the current stretching count value; use the current stretching count value to select the stretching information from the stretching information sequence to obtain a stretching information subsequence; use the stretching information subsequence to stretch the target tooth area in the current frame; compare the current stretching count value with the target count value; set the stretching count value based on the comparison result; determine whether the current frame is the last frame of the face video; if the current frame is not the last frame of the face video, determine the next frame of the current frame as the current frame, and continue to perform the above image processing steps. In this way, the function of adding growth effects to teeth is realized, thereby simulating the growth process of teeth. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0011] Figure 1 is an exemplary system architecture diagram in which various embodiments of the present disclosure may be applied;
[0012] Figure 2 is a flow chart of an embodiment of an image processing method according to the present disclosure;
[0013] Figure 3 is a schematic diagram of an application scenario of the image processing method according to the present disclosure;
[0014] Figure 4 is a flow chart of an embodiment of stretching a target tooth region in an image processing method according to the present disclosure;
[0015] Figure 5 is a flowchart of an embodiment of generating a stretching information sequence in an image processing method according to the present disclosure;
[0016] Figure 6 is a flowchart of an embodiment of detecting the state of teeth in the current frame in the image processing method of the present disclosure;
[0017] Figure 7 is a flowchart of an embodiment of extracting lip key point information according to the image processing method of the present disclosure;
[0018] Figure 8 is a schematic structural diagram of an embodiment of an image processing device according to the present disclosure;
[0019] Fig. 9 It is a schematic diagram of the structure of a computer system suitable for implementing the electronic device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0021] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0022] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0023] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0024] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0025] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0026] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the image processing method of the present disclosure may be applied.
[0027] like Figure 1 As shown, the system architecture 100 may include terminal devices 1011, 1012, 1013, a network 102, and a server 103. The network 102 is used to provide a medium for communication links between the terminal devices 1011, 1012, 1013 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0028] The user can use the terminal devices 1011, 1012, 1013 to interact with the server 103 through the network 102 to send or receive messages, etc. For example, the terminal devices 1011, 1012, 1013 can obtain a pre-trained lip key point extraction network from the server 103. Various communication client applications can be installed on the terminal devices 1011, 1012, 1013, such as image processing applications, short video social applications, instant messaging software, etc.
[0029] Terminal devices 1011, 1012, and 1013 can first obtain a face video to be processed; then, the following image processing steps can be performed for the current frame in the above face video: detect the state of the teeth in the current frame, wherein the state of the teeth includes an exposed state or a non-exposed state; if the state of the teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generate a stretching information sequence for stretching the above target tooth area; obtain the current stretching count value; use the current stretching count value to select stretching information from the above stretching information sequence to obtain a stretching information subsequence; use the above stretching information subsequence to stretch the above target tooth area in the current frame; compare the current stretching count value with the target count value; set the stretching count value based on the comparison result; determine whether the current frame is the last frame of the above face video; if the current frame is not the last frame of the above face video, determine the next frame of the current frame as the current frame, and continue to perform the above image processing steps.
[0030] Terminal devices 1011, 1012, 1013 can be hardware or software. When terminal devices 1011, 1012, 1013 are hardware, they can be various electronic devices with display screens and supporting information interaction, including but not limited to smart phones, tablet computers, laptop portable computers, etc. When terminal devices 1011, 1012, 1013 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0031] The server 103 may be a server that provides various services, for example, it may be a background server that provides a pre-trained lip key point extraction network to the terminal devices 1011 , 1012 , and 1013 .
[0032] It should be noted that the server 103 can be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0033] It should also be noted that the image processing method provided in the embodiments of the present disclosure is usually executed by the terminal devices 1011 , 1012 , and 1013 , and the image processing apparatus is usually arranged in the terminal devices 1011 , 1012 , and 1013 .
[0034] It should also be noted that if the terminal devices 1011, 1012, and 1013 have local storage of pre-trained lip key point extraction network and other information, the exemplary system architecture 100 may not have the network 102 and the server 103.
[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0036] Continue to refer Figure 2 , shows a process 200 of an embodiment of an image processing method according to the present disclosure. The image processing method comprises the following steps:
[0037] Step 201, obtaining a face video to be processed.
[0038] In this embodiment, the execution subject of the image processing method (for example Figure 1 The terminal device shown in the figure can obtain the face video to be processed. The face video can be a real-time video stream showing a face, or a pre-stored video showing a face.
[0039] Step 202, for the current frame in the face video, perform the following image processing steps: detect the state of the teeth in the current frame, wherein the state of the teeth includes an exposed state or a non-exposed state; if the state of the teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generate a stretching information sequence for stretching the target tooth area; obtain the current stretching count value; use the current stretching count value to select stretching information from the stretching information sequence to obtain a stretching information subsequence; use the stretching information subsequence to stretch the target tooth area in the current frame; compare the current stretching count value with the target count value; set the stretching count value based on the comparison result; determine whether the current frame is the last frame of the face video.
[0040] In this embodiment, for the current frame in the face video acquired in step 201, the execution subject may perform the following image processing steps.
[0041] In this embodiment, the image processing step 202 may include sub-steps 2021, 2022, 2023, 2024, 2025, 2026, 2027 and 2028. Among them:
[0042] Step 2021, detecting the state of the teeth in the current frame.
[0043] In this embodiment, the execution subject may detect the state of teeth in the current frame. The state of teeth may include an exposed state or a non-exposed state. Here, the execution subject may input the current frame into a pre-trained tooth state prediction model to obtain the state of teeth in the current frame. The tooth state prediction model may be used to characterize the correspondence between an image and the state of teeth in the image.
[0044] Step 2022: If the state of the teeth in the current frame is an exposed state, a stretching information sequence for stretching the target tooth area is generated based on the tooth key point information of the target tooth area in the current frame.
[0045] In this embodiment, if the state of the teeth in the current frame is an exposed state, the above-mentioned execution subject can obtain the tooth key point information of the target tooth area in the current frame, and then generate a stretching information sequence for stretching the above-mentioned target tooth area based on the tooth key point information of the target tooth area in the current frame. The above-mentioned target tooth area can be a pre-specified area of the teeth to be processed, for example, it can be the area where the central incisor (also called "front teeth") or the canine (also called "tiger teeth") is located. The tooth key point information of the above-mentioned target tooth area can be the position information of the key points of the teeth indicated by the target tooth area. As an example, the above-mentioned position information can be represented by coordinates (x, y). At this time, the coordinates of the first pixel point in the upper left corner of the above-mentioned target face image can be set to (0, 0).
[0046] Here, the shape of the tooth region can be approximated as a rectangle. As an example, the key point of the tooth can be the center point of the tooth.
[0047] In this embodiment, the execution subject may extract the contour curve of the target tooth area in the target face image through the active contour model algorithm, and then use the contour curve to obtain key point information of the target tooth area.
[0048] Here, the execution subject can input the tooth key point information of the target tooth area in the current frame into the pre-trained tooth stretching model to obtain a stretching information sequence for stretching the target tooth area. The tooth stretching model can be used to characterize the correspondence between the tooth key point information of the specified tooth area in the image and the stretching information sequence for stretching the specified tooth area.
[0049] In this embodiment, the stretching information sequence can be obtained by arranging the stretching information in sequence. If it is detected that the state of the teeth is exposed, the video frame in which the state of the teeth is exposed can be stretched and counted, and according to the corresponding stretching count value, the corresponding stretching information subsequence is selected from the stretching information sequence, so as to stretch the target tooth area in the current frame.
[0050] As an example, the stretching information in the stretching information sequence may include the stretching length of the edge points in the lower edge of the tooth indicated by the target tooth region. It should be noted that the more edge points the stretching lengths included in the stretching information correspond to, the better the stretching effect.
[0051] Step 2023, obtaining the current stretch count value.
[0052] In this embodiment, the execution subject may obtain the current stretch count value. The stretch count value may represent the position of the current frame in the video frame in which the teeth are exposed during this stretching process. For example, if there are 4 video frames in which the teeth are exposed before the current frame during this stretching process, if the initial value of the stretch count value is 0, the current stretch count value may be 4; if the initial value of the stretch count value is 1, the current stretch count value may be 5.
[0053] Step 2024: Using the current stretch count value, select stretch information from the stretch information sequence to obtain a stretch information subsequence.
[0054] In this embodiment, the execution subject may select stretch information from the stretch information sequence using the current stretch count value to obtain a stretch information subsequence. Specifically, if the initial value of the stretch count value is 0, the execution subject may select a target number of stretch information from the stretch information sequence in a front-to-back order to form a stretch information subsequence, wherein the target number is usually the sum of the current stretch count value and 1. If the initial value of the stretch count value is 1, the execution subject may select the current stretch count value of stretch information from the stretch information sequence in a front-to-back order to form a stretch information subsequence.
[0055] Step 2025: Utilize the stretching information subsequence to stretch the target tooth region in the current frame.
[0056] In this embodiment, the execution subject may use the stretching information subsequence to stretch the target tooth region in the current frame. As an example, the execution subject may count the sum of the stretching lengths in each stretching information in the stretching information subsequence as the total stretching length. Afterwards, the edge point in the lower edge of the tooth indicated by the target tooth region in the current frame may be stretched by the total stretching length. Then, the stretched points may be sequentially connected in a left-to-right or right-to-left order to obtain the stretched tooth region.
[0057] Step 2026, compare the current stretch count value with the target count value.
[0058] In this embodiment, the execution subject may compare the current stretching count value with a target count value (eg, 10). The target count value may be a preset maximum number of stretching times in a stretching cycle (stretching process).
[0059] Step 2027, based on the comparison result, set the stretch count value.
[0060] In this embodiment, the execution entity may set a stretch count value based on the comparison result.
[0061] Step 2028, determine whether the current frame is the last frame of the face video.
[0062] In this embodiment, the execution entity may determine whether the current frame is the last frame of the face video.
[0063] If it is determined that the current frame is not the last frame of the face video, the execution entity may execute step 203 .
[0064] If it is determined that the current frame is the last frame of the face video, the execution subject may end the processing of the face video.
[0065] Step 203: If the current frame is not the last frame of the face video, the next frame of the current frame is determined as the current frame, and the image processing step is continued.
[0066] In this embodiment, if it is determined in step 2028 that the current frame is not the last frame of the above-mentioned face video, the above-mentioned execution entity can determine the next frame of the current frame as the current frame and continue to execute the image processing steps (ie, sub-steps 2021-2028).
[0067] The method provided by the above embodiment of the present disclosure is to obtain a face video to be processed; then, for the current frame in the face video, the following image processing steps are performed: the state of the teeth in the current frame is detected, wherein the state of the teeth includes an exposed state or a non-exposed state; if the state of the teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, a stretching information sequence for stretching the target tooth area is generated; the current stretching count value is obtained; using the current stretching count value, the stretching information is selected from the stretching information sequence to obtain a stretching information subsequence; using the stretching information subsequence, the target tooth area in the current frame is stretched; the current stretching count value is compared with the target count value; based on the comparison result, the stretching count value is set; it is determined whether the current frame is the last frame of the face video; if the current frame is not the last frame of the face video, the next frame of the current frame is determined as the current frame, and the above image processing steps are continued. In this way, the function of adding growth effects to teeth is realized, thereby simulating the growth process of teeth.
[0068] In some optional implementations, the image processing step may further include: if the state of the teeth in the current frame is not exposed, the execution subject may set the current stretch count value to zero. In this way, when it is detected that the teeth are not exposed, the teeth are not stretched, so that the teeth stretching special effect disappears.
[0069] In some optional implementations, the execution subject may set the stretch count value based on the comparison result in the following manner: if the current stretch count value is less than the target count value, the execution subject may add 1 to the current stretch count value. By counting the stretch count value, the stretched tooth obtained by executing the image processing step next time may be longer than the tooth stretched this time, thereby presenting a dynamic effect of the tooth generation process.
[0070] In some optional implementations, the execution subject may set the stretch count value based on the comparison result in the following manner: if the current stretch count value is equal to the target count value, the execution subject may set the current stretch count value to the target count value. That is, the value of the current stretch count value may be kept unchanged. By stopping counting the stretch count value when the stretch count value reaches the target count value, the stretch count value may be maintained at the target count value, thereby maintaining the maximum stretching effect of the teeth presented until the tooth state is detected to be not exposed.
[0071] Continue to see Figure 3 , Figure 3 FIG. 1 is a schematic diagram of an application scenario of the image processing method according to this embodiment. Figure 3In the application scenario, the user terminal 301 can first obtain the face video 302 to be processed; then, for the current frame 303 in the face video 302, the user terminal 301 can perform the following image processing steps: if it is detected that the teeth in the current frame are exposed, a stretching information sequence for stretching the canine teeth can be generated based on the tooth key point information of the canine teeth in the current frame; then, the user terminal 301 obtains the current stretching count value, and can select stretching information from the above stretching information sequence to form a stretching information subsequence; using the above stretching information subsequence, the canine teeth in the current frame are stretched, and the stretched video frame is shown in icon 304; then, the current stretching count value can be compared with the target count value; based on the comparison result, the stretching count value is set; then, if it is determined that the current frame is not the last frame of the face video 302, the next frame 305 of the current frame 303 is determined as the current frame, and the above image processing steps are continued. For the current frame 305, by executing the above image processing steps, a stretched video frame can be generated as shown in icon 306. By executing the above image processing steps for the current frame 307, a stretched video frame can be generated as shown in icon 308. Thus, a human face video after teeth stretching consisting of stretched video frame 304, stretched video frame 306 and stretched video frame 308 can be obtained, thereby simulating the growth process of teeth.
[0072] Further references Figure 4 , which shows a flow chart 400 of an embodiment of stretching a target tooth region in an image processing method. The process 400 of stretching a target tooth region includes the following steps:
[0073] Step 401, taking the first stretching information in the stretching information subsequence as the target stretching information, and performing the following stretching steps based on the target stretching information and the target tooth area in the current frame: stretching the target tooth area in the current frame from the target stretching origin to the target stretching end point according to the target stretching radius; and determining whether the target stretching information is the last stretching information in the stretching information subsequence.
[0074] In this embodiment, the stretching information may include a stretching origin, a stretching end point, and a stretching radius. The stretching origin may be referred to as a stretching start point, the stretching end point may be referred to as a stretching target point, and the stretching radius may be equivalent to the brush size of liquefaction in image processing software (e.g., PS (Adobe Photoshop) software).
[0075] In this embodiment, the execution subject of the image processing method (for example Figure 1The terminal device shown in the figure can use the first stretching information in the stretching information subsequence as the target stretching information, and then perform the following stretching steps based on the target stretching information and the target tooth area in the current frame. The target tooth area can be a pre-specified area of the tooth to be processed, for example, it can be the area where the central incisor or canine is located. The target stretching information can include a target stretching origin, a target stretching end point, and a target stretching radius.
[0076] In this embodiment, the stretching step 401 may include sub-steps 4011 and 4012. Among them:
[0077] Step 4011, stretching the target tooth area in the current frame from the target stretching origin to the target stretching end point according to the target stretching radius.
[0078] In this embodiment, the execution subject may stretch the target tooth region in the current frame from the target stretching origin to the target stretching end point according to the target stretching radius.
[0079] Step 4012: determine whether the target stretching information is the last stretching information in the stretching information subsequence.
[0080] In this embodiment, the execution subject may determine whether the target stretching information is the last stretching information in the stretching information subsequence. If it is determined that the target stretching information is not the last stretching information in the stretching information subsequence, step 402 may be executed.
[0081] Step 402: if the target stretching information is not the last stretching information in the stretching information subsequence, the stretching information next to the target stretching information in the stretching information subsequence is used as the target stretching information, the stretched tooth area is used as the target tooth area, and the stretching step is continued.
[0082] In this embodiment, if it is determined in step 4012 that the target stretching information is not the last stretching information in the above-mentioned stretching information subsequence, the above-mentioned execution entity can use the next stretching information of the target stretching information in the above-mentioned stretching information subsequence as the target stretching information, and use the stretched tooth area as the target tooth area, and continue to execute the stretching steps (i.e., sub-steps 4011 and 4012).
[0083] The method provided by the above-mentioned embodiment of the present disclosure provides a tooth stretching method by stretching the target tooth area from the stretching origin to the stretching end point according to the stretching radius and the stretching steps performed.
[0084] Further references Figure 5, which shows a flowchart 500 of an embodiment of generating a stretching information sequence in an image processing method. The process 500 of generating a stretching information sequence includes the following steps:
[0085] Step 501, using the position information of the two lower end points of the tooth indicated by the target tooth region in the current frame, determine the width of the tooth indicated by the target tooth region.
[0086] Here, the tooth key point information of the target tooth area may include the position information of the two lower end points of the tooth indicated by the target tooth area. The stretching information may include a stretching origin, a stretching end point, and a stretching radius. The stretching origin may be referred to as a stretching starting point, the stretching end point may be referred to as a stretching target point, and the stretching radius may be equivalent to the brush size of liquefaction in image processing software (e.g., PS (Adobe Photoshop) software).
[0087] In this embodiment, the execution subject of the image processing method (for example Figure 1 The terminal device shown in the figure can determine the width of the tooth indicated by the target tooth area by using the position information of the two lower end points of the tooth indicated by the target tooth area in the current frame. Specifically, the execution subject can determine the distance between the two lower end points of the tooth indicated by the target tooth area (i.e., the length of the line connecting the two lower end points) as the width of the tooth indicated by the target tooth area.
[0088] Step 502, assigning a value of zero to the initial stretch count value, and executing the following stretch information generation steps based on the initial stretch count value: determining the midpoint of the line connecting the two lower endpoints of the tooth indicated by the target tooth area; determining a point below the midpoint and at a distance from the midpoint of a first target length as the stretch origin, wherein the first target length is determined based on the initial stretch count value; determining a point below the stretch origin and at a distance from the stretch origin of a second target length as the stretch end point, wherein the second target length is a preset first ratio of the width; determining a preset second ratio of the width as the stretch radius; determining whether the initial stretch count value is less than the target count value; if not, generating a stretch information sequence.
[0089] In this embodiment, the execution subject may assign zero to the initial stretch count value, and then, based on the initial stretch count value, perform the following stretch information generation steps.
[0090] In this embodiment, the stretching information generating step 501 may include sub-steps 5021, 5022, 5023, 5024, 5025 and 5026. Among them:
[0091] Step 5021, determine the midpoint of the line connecting the two lower end points of the tooth indicated by the target tooth region.
[0092] In this embodiment, the execution subject may determine the midpoint of a line connecting two lower end points of the tooth indicated by the target tooth region.
[0093] Step 5022: determine a point below the midpoint and at a distance from the midpoint equal to a first target length as the stretching origin.
[0094] In this embodiment, the execution entity may determine a point below the midpoint and at a distance of the first target length from the midpoint as the stretching origin. Here, the first target length may be determined based on the initial stretch count value. Specifically, the first target length is generally proportional to the current initial stretch count value. As an example, the first target length may be the product of the initial stretch count value and the preset reference length. For example, if the initial stretch count value is 1, the first target length may be the product of the initial stretch count value 1 and the preset reference length 0.1 cm, which is 0.1 cm; if the initial stretch count value is 3, the first target length may be the product of the initial stretch count value 3 and the preset reference length 0.1 cm, which is 0.3 cm.
[0095] Step 5023: determine a point below the stretching origin and at a distance from the stretching origin equal to a second target length as the stretching end point.
[0096] In this embodiment, the execution entity may determine a point below the stretching origin and at a distance from the stretching origin of the second target length as the stretching end point. Here, the second target length may be a preset first ratio of the width. For example, the second target length may be the width multiplied by 0.6.
[0097] Step 5024, determining a preset second ratio of the width as the stretching radius.
[0098] In this embodiment, the execution entity may determine the preset second ratio of the width as the stretching radius. For example, the stretching radius may be the width multiplied by 0.5.
[0099] Step 5025, determining whether the initial stretch count value is less than the target count value.
[0100] In this embodiment, the execution subject may determine whether the initial stretch count value is less than a target count value (eg, 10). The target count value may be a preset maximum stretch count of a stretch cycle.
[0101] If it is determined that the initial stretch count value is not less than the target count value, the execution entity may execute step 5026 .
[0102] Step 5026: If the initial stretch count value is not less than the target count value, a stretch information sequence is generated.
[0103] In this embodiment, if it is determined in step 5025 that the initial stretch count value is not less than the target count value, the execution entity may generate a stretch information sequence. The stretch information in the stretch information sequence may be sorted in ascending order according to the corresponding initial stretch count values.
[0104] The method provided by the above embodiment of the present disclosure determines the width of the tooth indicated by the target tooth area by using the position information of the two lower endpoints of the tooth indicated by the target tooth area in the current frame; then, determines the midpoint of the line connecting the two lower endpoints of the tooth indicated by the target tooth area; determines the point below the above midpoint and the distance between the point and the midpoint is the first target length as the stretching origin; determines the point below the stretching origin and the distance between the point and the stretching origin is the second target length as the stretching end point; determines the preset second ratio of the above width as the stretching radius. Therefore, the scheme described in this embodiment provides a method for determining the stretching origin, stretching end point and stretching radius.
[0105] In some optional implementations, if it is determined in step 5025 that the initial stretch count value is less than the target count value, the execution entity may add one to the initial stretch count value and use the new stretch count value as the initial stretch count value to continue executing the stretch information generation step (i.e., sub-steps 5021-5026).
[0106] Further references Figure 6 , which shows a flowchart 600 of an embodiment of detecting the state of teeth in the current frame in an image processing method. The process 600 of detecting the state of teeth in the current frame includes the following steps:
[0107] Step 601: extract key point information of at least one tooth region in the current frame to obtain a tooth key point information set.
[0108] In this embodiment, the execution subject of the image processing method (for example Figure 1 The terminal device shown in the figure can extract key point information of at least one tooth area in the current frame to obtain a set of tooth key point information. The above-mentioned at least one tooth area generally includes a target tooth area, and the above-mentioned target tooth area can be a pre-specified area of the teeth to be processed, for example, it can be the area where the central incisor or canine is located. The key point information of the tooth area can be the position information of the key point of the tooth indicated by the tooth area. As an example, the above-mentioned position information can be represented by coordinates (x, y), and the coordinate value of the first pixel point in the upper left corner of the image can be set to (0, 0).
[0109] Here, the shape of the tooth region can be approximated as a rectangle. As an example, the key point of the tooth can be the center point of the tooth.
[0110] As an example, the execution subject may extract a contour curve of at least one tooth region in the current frame by using an active contour model algorithm, and then use the contour curve to obtain key point information of each tooth region in the at least one tooth region, thereby forming a key point information set of at least one tooth region.
[0111] As another example, the execution subject may input the current frame into a pre-trained tooth key point extraction network to obtain key point information of the at least one tooth region. As an example, the current frame may be input into a trained regression neural network, such as ResNet (Residual Neural Network), VGG (Visual Geometry Group), ShuffleNet (lightweight neural network), etc.
[0112] Step 602: extract key point information of the lip area in the current frame to obtain lip key point information.
[0113] In this embodiment, the execution subject can extract the key point information of the lip area in the current frame to obtain the lip key point information.
[0114] As an example, the execution subject can detect key points of the lip area based on a traditional algorithm, such as ASM (Active Shape Model), to obtain position information of lip edge feature points. As an example, the lip edge feature points can be the intersection of the lip edge and the teeth.
[0115] Among them, the ASM model is a point distribution model. In the point distribution model, the geometric shapes of objects with similar appearances, such as the geometric shape of the lip area, are represented by a shape vector formed by connecting the coordinates of key feature points in series. Then, a shape model is obtained through training. Finally, the shape model is used to determine the key feature point information in the new image.
[0116] As another example, the execution subject inputs the current frame into a pre-trained lip key point extraction network to obtain lip key point information. The lip key point information includes: position information of the intersection of the lip edge and the teeth. As an example, the position information can be represented by coordinates (x, y), and the coordinate value of the first pixel in the upper left corner of the image can be set to (0, 0). As an example, the lip key point extraction network can be a trained regression neural network, such as ResNet, VGG, and ShuffleNet.
[0117] Step 603: Detect the state of the teeth in the current frame based on the teeth key point information set and the lip key point information.
[0118] In this embodiment, the execution subject may detect the state of the teeth in the current frame based on the teeth key point information set obtained in step 601 and the lip key point information obtained in step 602. The state of the teeth may include: an exposed state or a non-exposed state.
[0119] As an example, the above-mentioned execution subject can first select any tooth key point information from the tooth key point information set. As an example, the tooth key point information is the position information of the center point of each tooth area in at least one tooth area shown in the above-listed teeth, expressed by the coordinates (x, y), and the coordinate value of the first pixel point in the upper left corner of the current frame can be recorded as (0, 0). Randomly select a tooth key point information, and the selected tooth key point information can be (26, 20). Afterwards, the lip key point information whose x coordinate value in the lip key point information is close to a certain x coordinate value in the above-selected tooth key point information can be found from the lip key point information. As an example, the lip key point information can be the position information of the intersection of the upper lip edge and the teeth. Expressed by the coordinates (x, y). For example, the lip key point information is (13, 7), (19, 9), (27, 8), (34, 6). Select the one closest to the x coordinate value in the tooth key point information, such as (27, 8). Finally, the y coordinate value in the position information of the selected tooth key point information and the selected lip key point whose x coordinate value is closest to the y coordinate value in the selected lip key point information can be subtracted from the y coordinate value in the selected lip key point information to obtain a difference value. In response to determining that the absolute value of the difference value is greater than a preset first target value, the above-mentioned execution subject can determine that the teeth are in an exposed state. Otherwise, it can be determined that the teeth are not exposed.
[0120] As another example, the execution subject may first average the y coordinate values in the set of teeth key point information. Then, the information of a key point in the lip key point information may be selected. Finally, the average value may be subtracted from the y coordinate value in the selected key point information to obtain a difference value. In response to determining that the absolute value of the difference value is greater than a preset second target value, the execution subject may determine that the teeth are in an exposed state. Otherwise, it may be determined that the teeth are not exposed.
[0121] The method provided by the above embodiment of the present disclosure obtains a set of tooth key point information by extracting key point information of at least one tooth region in the current frame, which provides a basis for subsequent processing of a single tooth. Afterwards, the state of the tooth can be detected using the key point information of the lip region extracted in the current frame, thereby preparing for subsequent tooth special effects.
[0122] In some optional implementations, the execution subject may detect the state of the teeth in the current frame based on the tooth key point information set and the lip key point information in the following manner: the execution subject may determine the width of the preset tooth area in the at least one tooth area using the tooth key point information set and the lip key point information. As an example, the preset tooth area may be the lateral incisor of the upper teeth. In this case, the execution subject may determine the width of the lateral incisor of the upper teeth. Since there are usually two lateral incisors, the average value of the widths of the two lateral incisors may be calculated as the width of the lateral incisor of the upper teeth. The minimum value of the widths of the two lateral incisors may also be determined as the width of the lateral incisor of the upper teeth. Afterwards, the execution subject may determine whether the width of the preset tooth area is greater than a preset width threshold. If the width of the preset tooth area is greater than the width threshold, the execution subject may determine that the state of the teeth is an exposed state. If the width of the preset tooth area is less than or equal to the width threshold, the execution subject may determine that the state of the teeth in the current frame is a non-exposed state.
[0123] Further references Figure 7 , which shows a flowchart 700 of an embodiment of extracting lip key point information in an image processing method. The process 700 of extracting lip key point information includes the following steps:
[0124] Step 701, input the current frame into a pre-trained lip key point extraction network to obtain initial key point information of the lip area in the current frame.
[0125] In this embodiment, the execution subject of the image processing method (for example Figure 1 The terminal device shown in the figure can input the current frame into a pre-trained lip key point extraction network to obtain the initial key point information of the lip area in the current frame. The above-mentioned lip key point extraction network can be used to characterize the correspondence between the face image and the initial key point information of the lip area in the face image. Here, the initial key point information of the lip area can be the position information of the intersection of the upper lip edge and the teeth. The number of initial key points of the lip area can be a preset number.
[0126] Step 702: Determine the inner contour of the upper lip in the lip region using the initial key point information.
[0127] In this embodiment, the execution subject may determine the inner contour of the upper lip in the lip region by using the initial key point information. The execution subject may connect the initial key points in order from left to right or from right to left to obtain the inner contour of the upper lip in the lip region.
[0128] It should be noted that the more the initial key points are, the more accurate the inner contour of the upper lip is.
[0129] Step 703, determining whether the presentation direction of the lip region is the target direction.
[0130] In this embodiment, the execution entity can determine whether the presentation direction of the lip area is the target direction. The presentation direction of the lip area can be the direction of the line between the left and right corners of the lips. The target direction is usually the direction of the upper and lower edges of the face image. That is, the execution entity can determine whether the direction of the line between the left and right corners of the lip area is parallel to the directions of the upper and lower edges of the current frame. Generally speaking, if the direction of the line between the left and right corners of the lip area is parallel to the directions of the upper and lower edges of the current frame, it means that the presentation direction of the lip area is the standard direction.
[0131] If it is determined that the presentation direction of the lip region is the target direction, the execution entity may execute step 704 .
[0132] Step 704, if the presentation direction of the lip area is the target direction, a vertical upward ray is drawn with the two lower endpoints of the teeth indicated by at least one tooth area as the starting point, and the intersection of the ray and the inner contour is determined as the lip key point to generate the lip key point information.
[0133] Here, the tooth key point information set may include position information of two lower endpoints of each tooth in the upper row of teeth indicated by the at least one tooth region.
[0134] In this embodiment, if it is determined in step 703 that the presentation direction of the above-mentioned lip area is the above-mentioned target direction, the above-mentioned execution entity can draw a vertical upward ray with the lower two end points of the teeth indicated by the above-mentioned at least one tooth area as the starting point, and the intersection of the above-mentioned ray and the above-mentioned inner contour can be determined as the lip key point to generate the lip key point information.
[0135] Here, if there are 4 teeth in the tooth region, the number of the lip key points is usually 8.
[0136] The method provided by the above embodiment of the present disclosure obtains the initial key point information of the lip area in the current frame by inputting the current frame into a pre-trained lip key point extraction network; then, using the above initial key point information, the inner contour of the upper lip in the above lip area is determined; then, whether the presentation direction of the above lip area is the target direction is determined; if so, a vertical upward ray is made with the lower two endpoints of the teeth indicated by the above at least one tooth area as the starting point, and the intersection of the above ray and the above inner contour is determined as the lip key point to generate the lip key point information. Thus, a method for extracting lip key point information is provided.
[0137] In some optional implementations, if it is determined in step 703 that the presentation direction of the lip area is not the target direction, the execution entity may rotate the facial image to adjust the presentation direction of the lip area to the target direction. That is, the direction of the line between the left and right corners of the lip area may be made parallel to the directions of the upper and lower edges of the facial image. Afterwards, a vertical upward ray may be made starting from the lower two endpoints of the teeth indicated by at least one tooth area in the adjusted facial image, and the intersection of the ray and the inner contour of the lip area in the adjusted facial image may be determined as a lip key point to generate lip key point information.
[0138] Further references Figure 8 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an image processing device, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0139] like Figure 8 As shown, the image processing device 800 of this embodiment includes: an acquisition unit 801, a processing unit 802 and a feedback unit 803. The acquisition unit 801 is used to acquire a face video to be processed; the processing unit 802 is used to perform the following image processing steps for the current frame in the face video: detecting the state of the teeth in the current frame, wherein the state of the teeth includes an exposed state or a non-exposed state; if the state of the teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, a stretching information sequence for stretching the target tooth area is generated; acquiring the current stretching count value; using the current stretching count value, selecting the stretching information from the stretching information sequence to obtain a stretching information subsequence; using the stretching information subsequence, stretching the target tooth area in the current frame; comparing the current stretching count value with the target count value; setting the stretching count value based on the comparison result; determining whether the current frame is the last frame of the face video; the feedback unit 803 is used to determine the next frame of the current frame as the current frame if the current frame is not the last frame of the face video, and continue to perform the image processing steps.
[0140] In this embodiment, the specific processing of the acquisition unit 801, the processing unit 802 and the feedback unit 803 of the image processing device 800 can refer to Figure 2 This corresponds to step 201, step 202 and step 203 in the embodiment.
[0141] In some optional implementations, the stretching information includes a stretching origin, a stretching end point, and a stretching radius; and the above-mentioned processing unit 802 can be further used to stretch the target tooth area in the current frame using the stretching information subsequence in the following manner: taking the first stretching information in the stretching information subsequence as the target stretching information, and based on the target stretching information and the target tooth area in the current frame, performing the following stretching steps: stretching the target tooth area in the current frame from the target stretching origin to the target stretching end point according to the target stretching radius; determining whether the target stretching information is the last stretching information in the stretching information subsequence; if not, taking the next stretching information of the target stretching information in the stretching information subsequence as the target stretching information, taking the stretched tooth area as the target tooth area, and continuing to perform the stretching steps.
[0142] In some optional implementations, the above-mentioned image processing step may further include: if the state of the teeth in the current frame is not exposed, setting the current stretch count value to zero.
[0143] In some optional implementations, the processing unit 802 may be further configured to set the stretch count value based on the comparison result in the following manner: if the current stretch count value is less than the target count value, the current stretch count value is increased by one.
[0144] In some optional implementations, the processing unit 802 may be further configured to set the stretch count value based on the comparison result in the following manner: if the current stretch count value is equal to the target count value, the current stretch count value is set to the target count value.
[0145] In some optional implementations, the tooth key point information includes the position information of the two lower endpoints of the tooth indicated by the target tooth area, and the stretching information includes the stretching origin, the stretching end point and the stretching radius; and the processing unit 802 can be further used to generate a stretching information sequence for stretching the target tooth area based on the tooth key point information of the target tooth area in the current frame in the following manner: using the position information of the two lower endpoints of the tooth indicated by the target tooth area in the current frame to determine the width of the tooth indicated by the target tooth area; assigning an initial stretching count value to zero, and based on the initial stretching count value, performing the following stretching information generation steps: determining the target tooth The midpoint of the line connecting the two lower end points of the tooth indicated by the tooth area; determining a point below the midpoint and at a distance of a first target length from the midpoint as the stretching origin, wherein the first target length is determined based on the initial stretching count value; determining a point below the stretching origin and at a distance of a second target length from the stretching origin as the stretching end point, wherein the second target length is a preset first ratio of the width; determining a preset second ratio of the width as the stretching radius; determining whether the initial stretching count value is less than the target count value; if not, generating a stretching information sequence, wherein the stretching information in the stretching information sequence is sorted in ascending order according to the corresponding initial stretching count values.
[0146] In some optional implementations, the processing unit 802 can be further used to generate a stretching information sequence for stretching the target tooth area based on the tooth key point information of the target tooth area in the current frame in the following manner: if the initial stretching count value is less than the target count value, the initial stretching count value is increased by one, and the new stretching count value is used as the initial stretching count value to continue the stretching information generation step.
[0147] In some optional implementations, the processing unit 802 can be further used to detect the state of teeth in the current frame in the following manner: extract key point information of at least one tooth area in the current frame to obtain a tooth key point information set; extract key point information of the lip area in the current frame to obtain lip key point information; based on the tooth key point information set and the lip key point information, detect the state of teeth in the current frame.
[0148] In some optional implementations, the processing unit 802 can be further used to detect the state of the teeth in the current frame based on the tooth key point information set and the lip key point information in the following manner: using the tooth key point information set and the lip key point information, determine the width of a preset tooth area in at least one tooth area; determine whether the width of the preset tooth area is greater than a preset width threshold; if so, determine that the state of the teeth in the current frame is an exposed state.
[0149] In some optional implementations, the tooth key point information set includes the position information of the two lower endpoints of each tooth in the upper row of teeth indicated by at least one tooth region; and the above-mentioned processing unit 802 can be further used to extract the key point information of the lip region in the current frame in the following manner to obtain the lip key point information: input the current frame into a pre-trained lip key point extraction network to obtain the initial key point information of the lip region in the current frame; use the initial key point information to determine the inner contour of the upper lip in the lip region; determine whether the presentation direction of the lip region is the target direction; if so, make a vertical upward ray with the two lower endpoints of the teeth indicated by at least one tooth region as the starting point, determine the intersection of the ray and the inner contour as the lip key point, and generate the lip key point information.
[0150] In some optional implementations, the image processing device 800 may further include: a generating unit (not shown in the figure). If the presentation direction of the lip region is not the target direction, the generating unit may rotate the current frame to adjust the presentation direction of the lip region to the target direction, draw a vertical upward ray starting from the lower two endpoints of the teeth indicated by at least one tooth region in the adjusted current frame, determine the intersection of the ray and the inner contour of the lip region in the adjusted current frame as the lip key point, and generate the lip key point information.
[0151] Reference below Fig. 9 , which shows an electronic device (eg, Figure 1 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0152] like Fig. 9 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0153] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Fig. 9 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Fig. 9 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0154] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, the above functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus, or a device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus, or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0155] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a face video to be processed; performs the following image processing steps for the current frame in the face video: detects the state of teeth in the current frame, wherein the state of teeth includes an exposed state or a non-exposed state; if the state of teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generates a stretching information sequence for stretching the target tooth area; obtains the current stretching count value; uses the current stretching count value to select stretching information from the stretching information sequence to obtain a stretching information subsequence; uses the stretching information subsequence to stretch the target tooth area in the current frame; compares the current stretching count value with the target count value; sets the stretching count value based on the comparison result; determines whether the current frame is the last frame of the face video; if the current frame is not the last frame of the face video, determines the next frame of the current frame as the current frame, and continues to perform the image processing steps.
[0156] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0157] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0158] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes an acquisition unit, a processing unit, and a feedback unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the acquisition unit may also be described as a "unit for acquiring a face video to be processed".
[0159] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. An image processing method, characterized in that: include: Get the face video to be processed; For the current frame in the face video, the following image processing steps are performed: detecting the state of the teeth in the current frame, wherein the state of the teeth includes an exposed state or a non-exposed state; if the state of the teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generating a stretching information sequence for stretching the target tooth area; obtaining a current stretching count value; using the current stretching count value, selecting stretching information from the stretching information sequence to obtain a stretching information subsequence; using the stretching information subsequence, stretching the target tooth area in the current frame; comparing the current stretching count value with the target count value; setting the stretching count value based on the comparison result; determining whether the current frame is the last frame of the face video, and the target count value is a preset maximum number of stretches in a stretching cycle; If the current frame is not the last frame of the face video, the next frame of the current frame is determined as the current frame, and the image processing step is continued.
2. The method according to claim 1, characterized in that The stretching information includes the stretching origin, stretching end point and stretching radius; as well as The stretching of the target tooth region in the current frame by using the stretching information subsequence includes: The first stretching information in the stretching information subsequence is used as the target stretching information, and based on the target stretching information and the target tooth region in the current frame, the following stretching steps are performed: according to the target stretching radius, the target tooth region in the current frame is stretched from the target stretching origin to the target stretching end point; and it is determined whether the target stretching information is the last stretching information in the stretching information subsequence; If not, the next stretching information of the target stretching information in the stretching information subsequence is used as the target stretching information, and the stretched tooth area is used as the target tooth area, and the stretching step is continued.
3. The method according to claim 1, characterized in that The image processing step further comprises: If the state of the teeth in the current frame is not exposed, the current stretch count value is set to zero.
4. The method according to claim 1, characterized in that: The step of setting the stretch count value based on the comparison result includes: If the current stretch count value is less than the target count value, the current stretch count value is increased by one.
5. The method according to claim 1, characterized in that The step of setting the stretch count value based on the comparison result includes: If the current stretch count value is equal to the target count value, the current stretch count value is set to the target count value.
6. The method according to claim 1, characterized in that The tooth key point information includes the position information of the two lower end points of the tooth indicated by the target tooth area, and the stretching information includes the stretching origin, the stretching end point and the stretching radius; as well as The step of generating a stretching information sequence for stretching the target tooth region based on the tooth key point information of the target tooth region in the current frame includes: Determine the width of the tooth indicated by the target tooth region by using the position information of the lower two end points of the tooth indicated by the target tooth region in the current frame; The initial stretch count value is assigned a value of zero, and based on the initial stretch count value, the following stretch information generation steps are performed: determine the midpoint of the line connecting the two lower end points of the tooth indicated by the target tooth area; determine a point below the midpoint and at a distance of a first target length from the midpoint as the stretch origin, wherein the first target length is determined based on the initial stretch count value; determine a point below the stretch origin and at a distance of a second target length from the stretch origin as the stretch end point, wherein the second target length is a preset first ratio of the width; determine a preset second ratio of the width as the stretch radius; determine whether the initial stretch count value is less than the target count value; if not, generate a stretch information sequence, wherein the stretch information in the stretch information sequence is sorted in ascending order according to the corresponding initial stretch count value.
7. The method according to claim 6, characterized in that The step of generating a stretching information sequence for stretching the target tooth region based on the tooth key point information of the target tooth region in the current frame further includes: If the initial stretch count value is less than the target count value, the initial stretch count value is increased by one, and the new stretch count value is used as the initial stretch count value to continue to execute the stretch information generation step.
8. The method according to claim 1, characterized in that The detecting the state of the teeth in the current frame includes: Extract key point information of at least one tooth region in the current frame to obtain a tooth key point information set; Extract key point information of the lip area in the current frame to obtain lip key point information; Based on the tooth key point information set and the lip key point information, the state of the teeth in the current frame is detected.
9. The method according to claim 8, characterized in that The detecting the state of the teeth in the current frame based on the teeth key point information set and the lips key point information includes: Determine a width of a preset tooth region in the at least one tooth region by using the tooth key point information set and the lip key point information; Determining whether the width of the preset tooth area is greater than a preset width threshold; If so, it is determined that the state of the teeth in the current frame is an exposed state.
10. The method according to claim 8, characterized in that The tooth key point information set includes position information of two lower endpoints of each tooth in the upper row of teeth indicated by the at least one tooth region; as well as The step of extracting key point information of the lip region in the current frame to obtain the lip key point information includes: Input the current frame into the pre-trained lip key point extraction network to obtain the initial key point information of the lip area in the current frame; Determine the inner contour of the upper lip in the lip area by using the initial key point information; Determining whether the presentation direction of the lip region is a target direction; If so, a vertical upward ray is drawn with the two lower end points of the tooth indicated by the at least one tooth region as the starting point, and the intersection of the ray and the inner contour is determined as the lip key point to generate the lip key point information.
11. The method according to claim 10, characterized in that After determining whether the presentation direction of the lip region is the target direction, the method further includes: If the presentation direction of the lip area is not the target direction, the current frame is rotated to adjust the presentation direction of the lip area to the target direction, and a vertical upward ray is drawn with the two lower endpoints of the teeth indicated by the at least one tooth area in the adjusted current frame as the starting point, and the intersection of the ray and the inner contour of the lip area in the adjusted current frame is determined as the lip key point to generate the lip key point information.
12. An image processing device, characterized in that: include: An acquisition unit, used for acquiring a face video to be processed; A processing unit is used to perform the following image processing steps for the current frame in the face video: detecting the state of teeth in the current frame, wherein the state of teeth includes an exposed state or a non-exposed state; if the state of teeth in the current frame is an exposed state, then based on the tooth key point information of the target tooth area in the current frame, generating a stretching information sequence for stretching the target tooth area; obtaining a current stretching count value; using the current stretching count value, selecting stretching information from the stretching information sequence to obtain a stretching information subsequence; using the stretching information subsequence, stretching the target tooth area in the current frame; comparing the current stretching count value with the target count value; setting the stretching count value based on the comparison result; determining whether the current frame is the last frame of the face video, and the target count value is a preset maximum number of stretches in a stretching cycle; A feedback unit is used to determine the next frame of the current frame as the current frame if the current frame is not the last frame of the face video, and continue to perform the image processing step.
13. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 11.
14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
