Image processing method, device and equipment
By obtaining the key colors in the image to generate multiple color layers and superimposing them on the target human eye model, the problem of a small selection range of eye makeup templates is solved, and rich eye makeup effects and natural overlay effects are achieved.
Patent Information
- Application Number
- CN202011504078.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-17
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-12-17
AI Technical Summary
The selection range of eye makeup templates in the existing technology is small, resulting in a single eye makeup effect that cannot meet the user's personalized needs and is unnatural.
By obtaining the key colors in the image, multiple color layers are generated and superimposed on the target human eye model in a preset order to generate an eye makeup template that is close to the color of the image environment, improving the color richness and adaptability of the eye makeup template.
It realizes the generation of eye makeup templates with different effects based on images of different colors, which improves the user's personalized selection ability. The generated eye makeup templates have better adaptability to the image environment, and the superposition effect is more natural.
Smart Images

Figure CN112541955B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and specifically relates to an image processing method, device and equipment. Background Art
[0002] Based on users' pursuit of beauty, their demand for online beauty makeup is becoming increasingly strong. Many image processing applications provide online beauty makeup processing functions, among which eye makeup is an important part of online beauty makeup processing.
[0003] However, when performing eye makeup processing, the application program in the related art directly applies the designed eye makeup template to the corresponding position of the human eye, that is, the user can only choose from the pre-designed eye makeup templates, and the user's selection range is small. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an image processing method, device and equipment that can solve the problem of a small selection range of eye makeup templates.
[0005] In order to solve the above technical problems, this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0007] acquiring a first image;
[0008] extracting a plurality of key colors in the first image;
[0009] Filling the plurality of key colors into corresponding color layers respectively;
[0010] Each of the color layers is superimposed on a corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layers and the filling areas are arranged in a one-to-one correspondence.
[0011] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0012] An acquisition module, used for acquiring a first image;
[0013] An extraction module, used for extracting a plurality of key colors in the first image;
[0014] A filling module, used to fill the plurality of key colors into corresponding color layers respectively;
[0015] The layer overlay module is used to overlay each of the color layers to the corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layers and the filling areas are set in a one-to-one correspondence.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0018] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0019] In an embodiment of the present application, multiple color layers can be generated according to multiple key colors in the first image, and then each color layer can be superimposed on the corresponding filling area in the target human eye model in the order commonly used for eye makeup, so as to obtain an eye makeup template that is closer to the ambient color in the first image. It can be seen that in this case, as long as the first image of different color systems is used, target eye makeup templates with different effects can be obtained, which improves the richness of the color of the eye makeup template. Users can also select the first image of the corresponding color tone to generate the target eye makeup template according to their own needs, so as to achieve the eye makeup effect they want. In addition, the eye makeup template generated according to the image color has better adaptability to the image, and when it is used as an eye makeup template and superimposed on an image with similar color, the superimposed effect is also more natural. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of a filling target human eye model provided in an embodiment of the present application;
[0022] Figure 3 is a flowchart of another image processing method provided in an embodiment of the present application;
[0023] Figure 4 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0024] Figure 5 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, the "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.
[0027] As the background technology, currently, if you want to perform eye makeup processing, you can only choose a fixed eye makeup template, and the selection range is narrow, resulting in a single and similar eye makeup effect, which cannot meet the personalized needs of users, and cannot ensure that the eye makeup effect is adapted to the environment. After using the eye makeup template, there is a possibility of unnaturalness. In order to solve the above technical problems, the image processing method provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings through specific embodiments and their application scenarios.
[0028] The present application embodiment provides an image processing method, see Figure 1 As shown, Figure 1 : is a flow chart of an image processing method provided in an embodiment of the present application; the method comprises:
[0029] S110, acquiring a first image;
[0030] The first image may include at least one of the following: a pre-saved image, an image in the shooting preview interface, a currently shot image, etc. That is, a pre-saved image may be called from an electronic device, and the operation of obtaining the first image may include: displaying the album interface of the electronic device; receiving a user's selection operation, and using the image corresponding to the selection operation as the first image. Alternatively, if the first image is the currently shot image, that is, when the shooting is completed, if the user triggers the operation of extracting the eye makeup template, the most recently shot image will be used as the first image, or an image shot within a preset time (e.g., within 1 minute) may be used as the first image.
[0031] S120: extract multiple key colors from the first image.
[0032] Among them, the extracted multiple key colors can form a rectangular color histogram from light to dark, such as Figure 2shown.
[0033] The color of an image is usually composed of the three primary colors RGB (red, green, blue). By assigning different proportions to the three primary colors and mixing them, pixels of different colors are obtained. Therefore, if you want to determine the number of colors contained in the first image and the area proportion of each color in the first image, you can use computer vision (i.e. RGB color channel values) to confirm. Since the overall impression of an image by the human eye depends on the colors with the largest area proportion in the image,
[0034] Therefore, this step may include: extracting N key colors whose color area ratio in the first image is greater than a preset threshold; wherein the color area ratio is: the ratio of the number of pixels of each color to the total number of pixels of the first image; and N is a positive integer. In this case, the target eye makeup template generated based on the extracted key colors can have a good color match with the first image. Optionally, four key colors can be selected here.
[0035] In addition, since the color of an image is mainly affected by the background area of the image, that is, the environment part, this step may include extracting the four key colors with the largest area in the background area of the first image through the RGB color channel values. In this case, the adaptability between the generated target eye makeup template and the first image can be further improved.
[0036] S130, filling the plurality of key colors into corresponding color layers respectively.
[0037] Since you want to build an eye makeup template, you need to overlay colors. If ordinary colors are overlaid directly, the overlaid colors may completely cover the previously overlaid colors. Therefore, in order to ensure the overlay effect, you need to fill the color in the color layer and then overlay it through the color layer.
[0038] Specifically, according to the order of applying eye makeup, the four key colors can be used to fill the base layer, overlay layer, darkening layer, and hair flow layer in order from light to dark.
[0039] S140, superimposing each color layer to the corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layer and the filling area are set in a one-to-one correspondence.
[0040] The preset order here is the normal eye makeup order, that is, first superimpose the base layer, then superimpose the overlay layer, then superimpose the darkening layer, and finally superimpose the hair flow layer. In addition, the fill area corresponding to each color layer is preset, for example, see Figure 2 As shown, Figure 2This is a schematic diagram of a filling target human eye model provided in an embodiment of the present application, wherein the base layer needs to be filled to the entire upper eyelid area and part of the lower eyelid area, the overlay layer needs to be filled to the lower half of the upper eyelid and the entire lower eyelid area, the darkening layer needs to be filled to the middle part of the upper eyelid area, and the hair flow layer needs to be filled to the boundary area between the upper and lower eyelids.
[0041] In an embodiment of the present application, multiple color layers can be generated according to multiple key colors in the first image, and then each color layer can be superimposed on the corresponding filling area in the preset target human eye model in the order commonly used for eye makeup, so as to obtain an eye makeup template that is closer to the ambient color in the first image. It can be seen that in this case, as long as the first image of different color systems is used, target eye makeup templates with different effects can be obtained, which improves the richness of the color of the eye makeup template. Users can also select the first image of the corresponding color tone to generate the target eye makeup template according to their own needs, so as to achieve the eye makeup effect they want. In addition, the eye makeup template generated according to the image color has better adaptability to the image, and when it is used as an eye makeup template and superimposed on an image with similar color, the superimposed effect is also more natural.
[0042] In some further embodiments of the present application, the method may further include:
[0043] The first positioning point of the target human eye model is displayed, wherein the first positioning point here refers to the key point used to locate each key position in the initial human eye model.
[0044] A fourth input for the first anchor point is received.
[0045] In response to the fourth input, the position of the first positioning point is adjusted to obtain an adjusted target human eye model.
[0046] In this embodiment, since the initial shape of the target human eye model is a standard shape, the shape may not match the eye shape of the user or the object to which the user wants to paste the eye makeup template. Therefore, based on the user's preferences or needs, the user can choose to adjust the position of the first positioning point of the target human eye model, so that the shape of the target human eye model is closer to the human eye shape the user wants, so that when the target eye makeup template is subsequently superimposed on the first human eye area in the second image, it can more accurately fit the eye contour of the first human eye area, achieving a better eye makeup superposition effect. Among them, the above operation can be performed before or after S140, and this application does not limit this.
[0047] In some embodiments, see Figure 3 As shown, Figure 3 It is a flowchart of another image processing method provided by an embodiment of the present application. After the above S140, it may also include:
[0048] S150, receiving a first input;
[0049] S160 , in response to the first input, superimpose the target eye makeup template onto the first human eye region in the second image to obtain a first target image.
[0050] The first input here is used to overlay the eye makeup template in the eye area of the second image. Optionally, the first input can be an input to the first eye makeup control in the image editing application, such as a click input to the eye makeup overlay button, or a gesture input to achieve the above function. This application does not limit the specific type of the first input.
[0051] The purpose of superimposing the eye makeup template is to make the eyes of the person in the second image have the eye makeup effect that the user wants. For example, the eyes of the person in the second image originally have no eye makeup, so in order to achieve the effect of beautification, the user chooses to superimpose the eye makeup template on the eyes of the person, which avoids the tediousness of manual makeup by the user.
[0052] In this embodiment, when the user wants to add eye makeup to the person in the second image, the target eye makeup template can be superimposed on the second image through the first input, because the target eye makeup template in the embodiment of the present application is generated according to the key color in the first image. It can be seen that in the embodiment of the present application, as long as the eye makeup template generated by the first image close to the key color in the second image is selected, the formed eye makeup effect can have a high adaptability to the environment of the second image. For example, if the target eye makeup template is a purple-toned eye makeup template and the second image is also a purple-toned image, the naturalness and beautification effect of the makeup will be better.
[0053] In some embodiments, the second image may be the same image as the first image, or the second image may be a different image from the first image.
[0054] In addition, based on the fact that the second image is the same as the first image, optionally, the operation of superimposing the target eye makeup template on the first eye area can also be automatically executed directly after completing S140, without receiving the first input before executing. For example, assuming that the first image is an image in the shooting preview interface, the key color in the current preview interface (such as the main color of the environment) can be extracted to generate a target eye makeup template, and the target eye makeup template is automatically superimposed on the preview interface, so that the user can preview the effect of superimposed eye makeup in real time in the preview interface. If the user clicks the shooting button later, the image after superimposed eye makeup will be directly captured.
[0055] In some other embodiments, the above S160 may be implemented in any of the following ways:
[0056] In one implementation, in response to the first input, the target eye makeup template associated with the second image may be directly called to perform the above-mentioned superposition operation. In this implementation, after the target eye makeup template is generated based on the first image, the target eye makeup template may be associated with the first image. If the second image subsequently has an eye makeup template associated with itself, the eye makeup target associated with itself may be directly called for superposition.
[0057] In another implementation, in response to the first input, the method may further include:
[0058] S161, displaying a plurality of pre-stored eye makeup templates;
[0059] That is, all pre-stored eye makeup templates previously saved in the electronic device are displayed. These pre-stored eye makeup templates include eye makeup templates previously generated according to the first image. Optionally, these pre-stored eye makeup templates may also include some eye makeup templates pre-installed in the image editing program, or may also include some eye makeup templates downloaded from the Internet, etc. This application does not limit the source of the pre-stored eye makeup templates.
[0060] S163, receiving a second input from the user regarding a first eye makeup template in the pre-stored eye makeup templates;
[0061] The second input here is a selection input of a pre-stored eye makeup template, which is used to select a pre-stored eye makeup template that the user wants to superimpose on the first person's eye area. The operation of the second input may include a click operation, a long press operation, a double-click operation, or any other operation mode, which is not limited in this application.
[0062] S165, in response to the second input, taking the first eye makeup as a target eye makeup template, and superimposing the target eye makeup template on the first human eye region in the second image to obtain a first target image.
[0063] In this way, the corresponding eye makeup template can be generated in advance according to some images downloaded from the Internet or taken by the user, and saved. In this way, not only can the user have a wider range of choices, avoiding the monotony of eye makeup effects and improving the personalized effect of eye makeup, but the user can also select a pre-stored eye makeup template generated by a key color similar to the environmental color of the second image, thereby improving the matching degree of the eye makeup effect with the environmental color in the current second image, and further improving the naturalness of the first target image.
[0064] Optionally, based on the above embodiment, after the target eye makeup template is generated, the target eye makeup template can also be uploaded to the target sharing platform so that other users can obtain the target eye makeup template from the target sharing platform. For example, the network sharing platform can be a cloud or a sharing community. Based on this, optionally, the pre-stored eye makeup template in S161 can be a template obtained from the target sharing platform.
[0065] In some other embodiments of the present application, the above S160 may include:
[0066] Matching the second positioning point in the target eye makeup template with the third positioning point in the first human eye region;
[0067] According to the matching result, the target eye makeup template is superimposed on the first person's eye area by correspondingly fitting the second positioning point with the matching third positioning point.
[0068] When the target eye makeup template is superimposed on the first eye region, since the shape of the target eye makeup template is not necessarily exactly the same as that of the first eye region, in order to ensure a better superimposition effect, during the superimposition process, it is necessary to match the second positioning point in the target eye makeup model with the third positioning point in the first eye region, thereby determining the second positioning point that matches each third positioning point. Subsequently, the target eye makeup template is superimposed on the first eye region in a one-to-one correspondence manner. In this case, it can be ensured that all parts of the target eye makeup template can be superimposed on the correct eye position, so that the superimposed eye makeup effect is natural enough.
[0069] In some further embodiments of the present application, after S160, the method may further include at least one of the following:
[0070] 1. Adjust the brightness of the color layer according to the brightness information of the second image, and adjust the transparency of the color layer according to the transparency information of the second image.
[0071] By adjusting the brightness and transparency of the color layer as a whole according to the transparency of the second image, the overall display effect of the generated target eye makeup template can be made more similar to the display effect of the second image. For example, if the environment of the second image is relatively bright, in this case, the brightness of the color layer is increased. Among them, the above adjustment can be made based on the first preset adjustment rule, where the first preset adjustment rule is a pre-set rule for adjusting the brightness of the color layer according to the image brightness and adjusting the transparency of the color layer according to the image transparency. For example, the first preset adjustment rule may include adjusting the brightness of the color layer to the average brightness of the second image, and adjusting the transparency of the color layer to the average transparency of the second image. Of course, the above is only an example, and the present application does not limit the specific content of the first preset adjustment rule.
[0072] 2. In response to receiving a second input to the first control, adjusting the brightness of the color layer.
[0073] The first control here is a control for adjusting the brightness of the color layer. The first control is displayed as a movable slider. The user's second input refers to the movement input of the slider, and the brightness of the color layer is adjusted according to the brightness information corresponding to the current position of the slider. Or the first control can also include buttons corresponding to different brightness values. This application does not limit the expression form of the first control, nor does it limit the specific content of the second input.
[0074] 3. In response to receiving a third input to the second control, adjusting the transparency of the color layer.
[0075] The second control here is a control for adjusting the transparency of the color layer. The second control is displayed as a movable slider. The user's third input refers to the movement input of the slider, and the transparency of the color layer is adjusted according to the transparency information corresponding to the current position of the slider. Or the second control can also include buttons corresponding to different transparency values. This application does not limit the expression form of the second control, nor does it limit the specific content of the third input.
[0076] 4. When the second image includes a face region, the grayscale of the color layer is adjusted according to the grayscale information of the face region.
[0077] The same eye makeup template will have different presentation effects on faces with different skin colors. Therefore, in order to ensure the naturalness of the subsequently generated eye makeup template after it is superimposed on the eye area, this embodiment adjusts the grayscale of the color layer according to the skin color of the face (that is, the grayscale information of the face area) when the second image includes a face area, so that the tone between the subsequently generated target eye makeup template and the face of the second image is more harmonious. Among them, the adjustment here can be based on the second preset adjustment rule, and the second preset adjustment rule here is a pre-set rule for the grayscale of the color layer according to the grayscale information of the face area, such as adjusting the grayscale of the color coating to the average grayscale value of the face area, etc. Of course, the above is only an example, and the present application does not limit the specific content of the second preset adjustment rule.
[0078] It should be noted that the image processing method provided in the embodiment of the present application can be executed by an image processing device or a control module in the image processing device for executing the loaded image processing method. In the embodiment of the present application, the image processing method provided in the embodiment of the present application is described by taking the image processing device executing the loaded image processing method as an example.
[0079] Based on the same inventive concept as the aforementioned method embodiment, the present application also provides an image processing device 200, see Figure 4 As shown, Figure 4: is a structural schematic diagram of an image processing device provided in an embodiment of the present application, the device comprising:
[0080] An acquisition module 210, configured to acquire a first image;
[0081] An extraction module 220, configured to extract a plurality of key colors from the first image;
[0082] A filling module 230 is used to fill multiple key colors into corresponding color layers respectively;
[0083] The layer overlay module 240 is used to overlay each color layer to the corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layer and the filling area are set in a one-to-one correspondence.
[0084] In an embodiment of the present application, multiple color layers can be generated according to multiple key colors in the first image, and then each color layer can be superimposed on the corresponding filling area in the target human eye model in the order commonly used for eye makeup, so as to obtain an eye makeup template that is closer to the ambient color in the first image. It can be seen that in this case, as long as the first image of different color systems is used, target eye makeup templates with different effects can be obtained, which improves the richness of the color of the eye makeup template. Users can also select the first image of the corresponding color tone to generate the target eye makeup template according to their own needs, so as to achieve the eye makeup effect they want. In addition, the eye makeup template generated according to the image color has better adaptability to the image, and when it is used as an eye makeup template and superimposed on an image with similar color, the superimposed effect is also more natural.
[0085] In some other embodiments of the present application, the above device may further include:
[0086] The positioning point display module is used to display the first positioning point of the target human eye model, wherein the first positioning point here refers to the key point used to locate each key position in the initial human eye model.
[0087] The fifth receiving module is used to receive a fourth input of the first positioning point.
[0088] The adjustment module is used to adjust the position of the first positioning point in response to the fourth input to obtain an adjusted target human eye model.
[0089] In this embodiment, since the initial shape of the target human eye model is a standard shape, the shape may not match the eye shape of the user or the object to which the user wants to paste the eye makeup template. Therefore, based on the user's preferences or needs, the user can choose to adjust the position of the first positioning point of the target human eye model, so that the shape of the target human eye model is closer to the human eye shape desired by the user, so that when the target eye makeup template is subsequently superimposed on the first human eye area in the first image, it can more accurately fit the eye contour of the first human eye area, achieving a better eye makeup superposition effect.
[0090] In some embodiments of the present application, the above device may further include:
[0091] A first receiving module, configured to receive a first input;
[0092] The template overlay module is used to respond to the first input and overlay the target eye makeup template onto the first human eye area in the second image to obtain a first target image.
[0093] In this embodiment, when the user wants to add eye makeup to the person in the second image, the target eye makeup template can be superimposed on the second image through the first input, because the target eye makeup template in the embodiment of the present application is generated according to the key color in the first image. It can be seen that in the embodiment of the present application, as long as the eye makeup template generated by the first image close to the key color in the second image is selected, the formed eye makeup effect can have a high adaptability to the environment of the second image. For example, if the target eye makeup template is a purple-toned eye makeup template and the second image is also a purple-toned image, the naturalness and beautification effect of the makeup will be better.
[0094] In some other embodiments, the template overlay module 320 may include:
[0095] a matching unit, configured to match a second positioning point in the target eye makeup template with a third positioning point in the first human eye region;
[0096] The superimposition unit is used to superimpose the target eye makeup template onto the first eye area according to the matching result and by correspondingly fitting the second positioning point with the matching third positioning point.
[0097] When the target eye makeup template is superimposed on the first eye region, since the shape of the target eye makeup template is not necessarily exactly the same as that of the first eye region, in order to ensure a better superimposition effect, during the superimposition process, it is necessary to match the second positioning point in the target eye makeup model with the third positioning point in the first eye region, thereby determining the second positioning point that matches each third positioning point. Subsequently, the target eye makeup template is superimposed on the first eye region in a one-to-one correspondence manner. In this case, it can be ensured that all parts of the target eye makeup template can be superimposed on the correct eye position, so that the superimposed eye makeup effect is natural enough.
[0098] In some embodiments of the present application, the above device may further include at least one of the following modules:
[0099] A first adjustment module, used for adjusting the brightness of the color layer according to the brightness information of the second image, and adjusting the transparency of the color layer according to the transparency information of the second image;
[0100] A second adjustment module, configured to adjust the brightness of the color layer in response to a second input received to the first control;
[0101] A third adjustment module, configured to adjust the transparency of the color layer in response to a third input received to the second control;
[0102] The fourth adjustment module is used to adjust the grayscale of the color layer according to the grayscale information of the face area when the second image includes the face area.
[0103] By adjusting the color layer according to the brightness, transparency and face grayscale of the second image, the naturalness of the subsequently generated eye makeup template after being superimposed on the human eye area can be improved, making the overall display effect of the generated target eye makeup template more similar to the display effect of the second image.
[0104] The image processing device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0105] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0106] The image processing device 200 provided in the embodiment of the present application can realize Figure 1 and Figure 3 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0107] Optionally, an embodiment of the present application also provides an electronic device, including a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0108] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0109] Figure 5 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0110] The electronic device 300 includes but is not limited to: a radio frequency unit 301, a network module 302, an audio output unit 303, an input unit 304, a sensor 305, a display unit 306, a user input unit 307, an interface unit 308, a memory 309, and a processor 310.
[0111] Those skilled in the art will appreciate that the electronic device 300 may also include a power source (such as a battery) for powering each component, and the power source may be logically connected to the processor 310 through a power management system, so as to manage charging, discharging, and power consumption management through the power management system. The input unit 304 may include a graphics processor, a microphone, etc. The display component 306 may include a display panel. The user input unit 307 may include a touch panel and other input devices, etc. The memory 309 may store applications and operating systems, etc. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0112] Among them, the processor 310 is used to obtain a first image; extract multiple key colors in the first image; fill the multiple key colors into corresponding color layers respectively; superimpose each color layer into the corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layer and the filling area are set in a one-to-one correspondence.
[0113] In an embodiment of the present application, multiple color layers can be generated according to multiple key colors in the first image, and then each color layer can be superimposed on the corresponding filling area in the target human eye model in the order commonly used for eye makeup, so as to obtain an eye makeup template that is closer to the ambient color in the first image. It can be seen that in this case, as long as the first image of different color systems is used, target eye makeup templates with different effects can be obtained, which improves the richness of the color of the eye makeup template. Users can also select the first image of the corresponding color tone to generate the target eye makeup template according to their own needs, so as to achieve the eye makeup effect they want. In addition, the eye makeup template generated according to the image color has better adaptability to the image, and when it is used as an eye makeup template and superimposed on an image with similar color, the superimposed effect is also more natural.
[0114] Optionally, the display unit 306 is further configured to display a first positioning point of the target human eye model;
[0115] The user input unit 307 is further used to receive a fourth input to the first positioning point;
[0116] The processor 310 is further configured to adjust the position of the first positioning point in response to a fourth input to obtain an adjusted target human eye model.
[0117] In this embodiment, since the initial shape of the target human eye model is a standard shape, the shape may not match the eye shape of the user or the object to which the user wants to paste the eye makeup template. Therefore, based on the user's preferences or needs, the user can choose to adjust the position of the first positioning point of the target human eye model, so that the shape of the target human eye model is closer to the human eye shape desired by the user, so that when the target eye makeup template is subsequently superimposed on the first human eye area in the first image, it can more accurately fit the eye contour of the first human eye area, achieving a better eye makeup superposition effect.
[0118] Optionally, the user input unit 307 is further configured to receive a first input;
[0119] The processor 310 is further configured to, in response to the first input, superimpose the target eye makeup template onto the first eye region in the second image to obtain a first target image.
[0120] In this embodiment, when the user wants to add eye makeup to the person in the second image, the target eye makeup template can be superimposed on the second image through the first input, because the target eye makeup template in the embodiment of the present application is generated according to the key color in the first image. It can be seen that in the embodiment of the present application, as long as the eye makeup template generated by the first image close to the key color in the second image is selected, the formed eye makeup effect can have a high adaptability to the environment of the second image. For example, if the target eye makeup template is a purple-toned eye makeup template and the second image is also a purple-toned image, the naturalness and beautification effect of the makeup will be better.
[0121] Optionally, the processor 310 is specifically used to: match the second positioning point in the target eye makeup template with the third positioning point in the first human eye area; based on the matching result, superimpose the target eye makeup template on the first human eye area by correspondingly fitting the second positioning point with the matching third positioning point.
[0122] When the target eye makeup template is superimposed on the first eye region, since the shape of the target eye makeup template is not necessarily exactly the same as that of the first eye region, in order to ensure a better superimposition effect, during the superimposition process, it is necessary to match the second positioning point in the target eye makeup model with the third positioning point in the first eye region, thereby determining the second positioning point that matches each third positioning point. Subsequently, the target eye makeup template is superimposed on the first eye region in a one-to-one correspondence manner. In this case, it can be ensured that all parts of the target eye makeup template can be superimposed on the correct eye position, so that the superimposed eye makeup effect is natural enough.
[0123] Optionally, the processor 310 may also be configured to perform at least one of the following: adjusting the brightness of the color layer according to the brightness information of the second image, and adjusting the transparency of the color layer according to the transparency information of the second image;
[0124] In response to receiving a second input to the first control, adjusting the brightness of the color layer;
[0125] In response to receiving a third input to the second control, adjusting the transparency of the color layer;
[0126] When the second image includes a face region, the grayscale of the color layer is adjusted according to grayscale information of the face region.
[0127] By adjusting the color layer according to the brightness, transparency and face grayscale of the second image, the naturalness of the subsequently generated eye makeup template after being superimposed on the human eye area can be improved, making the overall display effect of the generated target eye makeup template more similar to the display effect of the second image.
[0128] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned image processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0129] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0130] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0131] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0132] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0134] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An image processing method, It is characterized in that include: acquiring a first image; Extracting N key colors whose color area ratio is greater than a preset threshold in the first image; wherein the color area ratio is: the ratio of the number of pixels of each color to the total number of pixels of the first image; N is a positive integer; Fill the N key colors into corresponding color layers respectively; Each of the color layers is superimposed on a corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layers and the filling areas are arranged in a one-to-one correspondence.
2. The method according to claim 1, It is characterized in that After obtaining the target eye makeup template, the method further includes: receiving a first input; In response to the first input, the target eye makeup template is superimposed on a first human eye region in a second image to obtain a first target image.
3. The method according to claim 2, It is characterized in that After superimposing the target eye makeup template onto the first eye region in the second image to obtain the first target image, the method further includes at least one of the following: adjusting the brightness of the color layer according to the brightness information of the second image, and adjusting the transparency of the color layer according to the transparency information of the second image; In response to receiving a second input to the first control, adjusting the brightness of the color layer; In response to receiving a third input to the second control, adjusting the transparency of the color layer; In the case where the second image includes a face area, the grayscale of the color layer is adjusted according to grayscale information of the face area.
4. The method according to claim 1, It is characterized in that The method further comprises: Display a first positioning point of the target human eye model; receiving a fourth input of the first positioning point; In response to the fourth input, the position of the first positioning point is adjusted to obtain the adjusted target human eye model.
5. The method according to claim 2, It is characterized in that The step of superimposing the target eye makeup template onto the first eye region in the second image comprises: Matching a second positioning point in the target eye makeup template with a third positioning point in the first human eye region; According to the matching result, the target eye makeup template is superimposed on the first human eye area by correspondingly fitting the second positioning point with the matching third positioning point.
6. An image processing device, It is characterized in that include: An acquisition module, used for acquiring a first image; An extraction module, used to extract N key colors whose color area ratio is greater than a preset threshold in the first image; wherein the color area ratio is: the ratio of the number of pixels of each color to the total number of pixels of the first image; N is a positive integer; A filling module, used to fill the N key colors into corresponding color layers respectively; The layer overlay module is used to overlay each of the color layers to the corresponding filling area in the target human eye model in a preset order to obtain a target eye makeup template; wherein the color layers and the filling areas are set in a one-to-one correspondence.
7. The device according to claim 6, It is characterized in that The device also includes: A first receiving module, configured to receive a first input; The template superimposing module is used to superimpose the target eye makeup template onto the first human eye area in the second image in response to the first input to obtain a first target image.
8. The device according to claim 7, It is characterized in that The device further comprises at least one of the following modules: a first adjustment module, configured to adjust the brightness of the color layer according to the brightness information of the second image, and to adjust the transparency of the color layer according to the transparency information of the second image; A second adjustment module, configured to adjust the brightness of the color layer in response to a second input received to the first control; A third adjustment module, configured to adjust the transparency of the color layer in response to a third input received to the second control; The fourth adjustment module is used to adjust the grayscale of the color layer according to the grayscale information of the face area when the second image includes the face area.
9. An electronic device, It is characterized in that The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the image processing method according to any one of claims 1 to 5.
