Image processing method, mobile terminal and readable storage medium
By optimizing the skin color information of the portrait in the images captured by the mobile terminal camera, judging its uniformity and correcting it, the problem of uneven skin color of the image taken in environments such as uneven light is solved, and the image quality and user experience are improved.
Patent Information
- Application Number
- CN201911043021.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-30
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2039-10-30
AI Technical Summary
In the prior art, when the mobile terminal camera shoots in an environment with uneven light, colored light or shadow blocking, the skin color of the captured images is uneven and the image quality is poor.
By obtaining and optimizing the skin color information of the portrait in the image to be processed, it is judged. If it is not uniform, skin color correction will be performed for areas with uneven skin color according to preset rules. The specific steps include obtaining skin color information, segmenting the image and preset standard skin color model, calculating the skin color difference value, and correcting it based on the difference value.
It effectively improves the uneven skin tone of portraits caused by shooting environment factors, improves imaging quality, reduces users' need to make large-scale images trimming, saves time and improves user experience.
Smart Images

Figure CN110751610B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mobile terminal image technology, and in particular to an image processing method, a mobile terminal and a readable storage medium. Background Art
[0002] As the demand for better imaging effects increases, the types and number of terminals with both shooting and image processing functions are also growing rapidly, especially mobile phones, which, in addition to the advantages of simple shooting operations, also have the characteristics of diversified functions and easy portability, and are therefore attracting more and more attention from consumers. At present, when mobile phones with both shooting and image processing functions process portraits in images (images of people are referred to as portraits), the processing object is the entire portrait. It can be seen that the current image processing methods cover a large area and are not very targeted, resulting in poor image processing effects and poor user experience. Summary of the invention
[0003] The main purpose of the present invention is to provide an image processing method, a mobile terminal and a computer storage medium, aiming to solve the technical problem in the prior art that when the mobile terminal camera is shooting in an environment with uneven light, colored light, or when shooting with shadows, the image captured has uneven skin color and poor image quality.
[0004] To achieve the above object, an embodiment of the present invention provides an image processing method, which includes the following steps:
[0005] Acquire and optimize the skin color information of the portrait in the image to be processed to obtain an optimized portrait image;
[0006] Determining whether the skin color of the optimized portrait image is uniform;
[0007] If it is uneven, skin color correction is performed on the uneven skin color area in the optimized portrait image according to a preset rule.
[0008] Optionally, the step of correcting the skin color of the uneven skin color area in the optimized portrait image according to a preset rule includes:
[0009] Obtaining reference skin color information of the portrait according to the skin color information of the portrait;
[0010] Applying the reference skin color information of the portrait to the portrait to obtain the optimized portrait picture;
[0011] The uneven skin color area in the optimized portrait image is corrected according to a preset standard skin color model.
[0012] Optionally, the step of correcting the uneven skin color area in the optimized portrait image according to a preset standard skin color model includes:
[0013] Segmenting the optimized portrait image and the preset standard skin color model to obtain a one-to-one corresponding regional combination of the optimized portrait image skin color area and the preset standard skin color model skin color area, and then calculating the skin color difference between the two areas in each of the regional combinations;
[0014] According to the skin color difference, skin color correction is performed on the skin color area of each optimized portrait image in the optimized portrait image.
[0015] Optionally, the step of segmenting the optimized portrait image and the preset standard skin color model to obtain a one-to-one corresponding regional combination of the optimized portrait image skin color area and the preset standard skin color model skin color area, and then calculating the skin color difference between two areas in each of the regional combinations includes:
[0016] Acquire and use the skin color information of the skin color area of the optimized portrait picture in each of the area combinations as the first skin color information;
[0017] Acquire and use the skin color information of the preset standard skin color model skin color area in each of the area combinations as the second skin color information;
[0018] The difference between the second skin color information and the corresponding first skin color information in each of the area combinations is sequentially used as the skin color difference between the two areas in each of the area combinations.
[0019] Optionally, the step of performing skin color correction on uneven skin color areas of each optimized portrait image in the optimized portrait image according to the skin color difference to obtain the target portrait includes:
[0020] Compare the skin color difference values with the skin color threshold:
[0021] If the skin color difference is not greater than the skin color threshold, the skin color area of the optimized portrait picture to which the first skin color information belongs is a normal area, and the skin color information of each normal area is used as the third skin color information;
[0022] A mapping relationship between each piece of the third skin color information and each piece of the second skin color information is obtained.
[0023] Optionally, the step of performing skin color correction on the uneven skin color area of each optimized portrait image in the optimized portrait image according to the skin color difference further includes:
[0024] If the skin color difference is greater than the skin color threshold, determining that the skin color area of the optimized portrait image to which the first skin color information belongs is an abnormal area;
[0025] Obtaining each ideal skin color information of each abnormal area according to the second skin color information and the mapping relationship, and using each ideal skin color information of each abnormal area as fourth skin color information;
[0026] Removing the abnormal areas in sequence to obtain blank areas corresponding to the abnormal areas;
[0027] Applying each of the fourth skin color information to each of the blank areas to obtain each ideal skin color area;
[0028] The ideal skin color areas and the normal areas are smoothed to complete skin color correction.
[0029] Optionally, the step of obtaining and optimizing skin color information of a portrait in the image to be processed to obtain an optimized portrait image includes:
[0030] Acquire an image captured by a terminal camera, and save the image to a buffer area of the terminal as the image to be processed;
[0031] Detecting the number of portraits in the image to be processed;
[0032] intercepting each of the portraits and saving them in the terminal buffer area;
[0033] Obtaining attribute information of the portrait in the image to be processed;
[0034] Obtaining reference skin color information of the portrait according to the skin color information and the attribute information;
[0035] The reference skin color information is applied to the portrait to obtain an optimized portrait picture.
[0036] Optionally, the step of determining whether the skin color of the optimized portrait image is uniform includes:
[0037] Acquire the attribute information, and then select a target preset standard skin color model that matches the attribute information;
[0038] Acquire the reference skin color information, and then select a preset standard skin color model that matches the reference skin color information from among the target preset standard skin color models;
[0039] The optimized portrait image is compared with the preset standard skin color model.
[0040] Optionally, if the skin color is uneven, then after the step of correcting the skin color of the area with uneven skin color in the optimized portrait image according to a preset rule, the method further comprises:
[0041] Get the number of portraits after skin color correction:
[0042] If the number of the portraits after the skin color correction is one, then putting the portrait after the skin color correction back into the image taken by the terminal camera and performing smoothing processing, and outputting and displaying a new image;
[0043] If there are multiple portraits with corrected skin color, each portrait with corrected skin color is put back into the image taken by the terminal camera and smoothed, and a new image is output and displayed.
[0044] The present invention also provides a mobile terminal, which includes: a memory, a processor, and an image processing program stored in the memory and executable on the processor, wherein the image processing program implements the steps of the above-mentioned image processing method when executed by the processor.
[0045] The present invention also provides a computer storage medium, on which an image processing program is stored, and when the image processing program is executed by a processor, the steps of the image processing method described above are implemented.
[0046] In this embodiment, the skin color information of the portrait in the image to be processed is first obtained and optimized to obtain an optimized portrait image; then it is determined whether the skin color of the optimized portrait image is uniform; finally, if it is uneven, skin color correction is performed on the uneven skin color area in the optimized portrait image according to preset rules. When the user takes pictures in scenes with uneven lighting, colored light or shadows, such as when taking pictures in a KTV or taking selfies in the direction of the light, the shadow of the selfie stick or the arm will cause a partial shadow on the face, then the skin color of the captured image will be uneven and the imaging quality will be low. The present invention firstly segments the portrait (the image of the character part) in the captured image to obtain a series of skin color areas, and then compares each skin color area with the skin color area corresponding to the preset standard skin color model to find out the abnormal areas of the portrait in the captured image, such as exposure, arm shadow, etc.; finally, the abnormal areas in the portrait are processed to obtain a portrait with uniform skin color, and the portrait with uniform skin color is put back into the original captured image, and then the image is displayed, thereby effectively improving the uneven skin color problem of the portrait caused by factors such as the shooting environment and improving the imaging quality; at the same time, there is no need for the user to perform substantial trimming on the captured image, which saves valuable time and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0049] Figure 1 A schematic diagram of the hardware structure of an optional mobile terminal according to an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a flow chart of an embodiment of an image processing method of the present invention;
[0051] Figure 3 Schematic diagram of a detailed flow chart of step S30 of an embodiment of an image processing method of the present invention;
[0052] Figure 4 Schematic diagram of a detailed flow chart of step S33 of an embodiment of an image processing method of the present invention;
[0053] Figure 5 This is a detailed flowchart of step S331 of an embodiment of the image processing method of the present invention;
[0054] Figure 6 This is a detailed flowchart of step S332 of an embodiment of the image processing method of the present invention;
[0055] Figure 7 This is another detailed flowchart of step S332 of an embodiment of the image processing method of the present invention;
[0056] Figure 8 This is a detailed flowchart of step S10 of an embodiment of the image processing method of the present invention;
[0057] Fig. 9 Schematic diagram of a detailed flow chart of step S20 of an embodiment of an image processing method of the present invention;
[0058] Fig.10 This is a detailed flowchart of the steps after step S30 in an embodiment of the image processing method of the present invention;
[0059] Fig.11 A schematic diagram of an application scenario of an embodiment of the image processing method of the present invention;
[0060] Fig.12 The figure is another schematic diagram of an application scenario of the image processing method embodiment of the present invention.
[0061] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0062] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0063] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0064] The mobile terminal may be implemented in various forms. For example, the mobile terminal described in the present invention may include mobile terminals such as mobile phones, tablet computers, notebook computers, palmtop computers, personal digital assistants (PDAs), etc.
[0065] The following description will take the mobile terminal as an example. Figure 1 , which is a schematic diagram of the hardware structure of a mobile terminal for implementing various embodiments of the present invention, the mobile terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103, A / V (audio / video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111 and other components. Those skilled in the art can understand that Figure 1 The structure of the mobile terminal shown in the figure does not constitute a limitation on the mobile terminal. The mobile terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0066] Combine the following Figure 1 The following is a detailed introduction to the various components of the mobile terminal:
[0067] The radio frequency unit 101 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving the downlink information of the base station, it is sent to the processor 110 for processing; in addition, the uplink data is sent to the base station. Generally, the radio frequency unit 101 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 101 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division Duplexing-Long Term Evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution), etc.
[0068] WiFi is a short-range wireless transmission technology. Mobile terminals can help users send and receive emails, browse web pages, and access streaming media through WiFi module 102. It provides users with wireless broadband Internet access. Figure 1 The WiFi module 102 is shown, but it is understandable that it is not an essential component of the mobile terminal and can be omitted as needed without changing the essence of the invention.
[0069] The audio output unit 103 can convert the audio data received by the RF unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output it as sound when the mobile terminal 100 is in a call signal reception mode, a talk mode, a recording mode, a voice recognition mode, a broadcast reception mode, etc. Moreover, the audio output unit 103 can also provide audio output related to a specific function performed by the mobile terminal 100 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, etc.
[0070] The A / V input unit 104 is used to receive audio or video signals. The A / V input unit 104 may include a graphics processor (GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 106. The image frame processed by the graphics processor 1041 can be stored in the memory 109 (or other storage medium) or sent via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 can receive sound (audio data) via the microphone 1042 in a telephone call mode, a recording mode, a voice recognition mode, and other operating modes, and can process such sound into audio data. The processed audio (voice) data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 101 in the case of a telephone call mode. The microphone 1042 can implement various types of noise elimination (or suppression) algorithms to eliminate (or suppress) noise or interference generated in the process of receiving and sending audio signals.
[0071] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1061 and / or the backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can also be configured on the mobile phone, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0072] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0073] The user input unit 107 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 1071 or near the touch panel 1071 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 110, and can receive and execute the command sent by the processor 110. In addition, the touch panel 1071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1071, the user input unit 107 may also include other input devices 1072. Specifically, the other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, etc., which are not specifically limited here.
[0074] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of the touch event. Then, the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Figure 1 In the figure, the touch panel 1071 and the display panel 1061 are used as two independent components to implement the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to implement the input and output functions of the mobile terminal, which is not limited here.
[0075] The interface unit 108 serves as an interface through which at least one external device can be connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and an external device.
[0076] The memory 109 can be used to store software programs and various data. The memory 109 can be a computer storage medium, and the memory 109 stores the image processing program of the present invention. The memory 109 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 109 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0077] The processor 110 is the control center of the mobile terminal, and uses various interfaces and lines to connect various parts of the entire mobile terminal. By running or executing software programs and / or modules stored in the memory 109, and calling data stored in the memory 109, the processor 110 performs various functions of the mobile terminal and processes data, thereby monitoring the mobile terminal as a whole. For example, the processor 110 executes the image processing program in the memory 109 to implement the steps of each embodiment of the image processing method of the present invention.
[0078] The processor 110 may include one or more processing units; optionally, the processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 110.
[0079] The mobile terminal 100 may further include a power supply 111 (such as a battery) for supplying power to various components. Optionally, the power supply 111 may be logically connected to the processor 110 via a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system.
[0080] although Figure 1 Not shown, the mobile terminal 100 may also include a Bluetooth module, etc., which will not be described in detail herein. The mobile terminal 100 may be connected to other terminal devices via Bluetooth to achieve communication and information exchange.
[0081] Based on the above mobile terminal hardware structure, various embodiments of the method of the present invention are proposed.
[0082] The present invention provides an image processing method, which is applied to a mobile terminal. In an embodiment of the image processing method, referring to Figure 2 , the image processing method comprises:
[0083] Step S10, acquiring and optimizing the skin color information of the portrait in the image to be processed to obtain an optimized portrait image;
[0084] The skin color information of a portrait refers to the information that characterizes the skin color of the portrait, such as R / G / B channel values (red, green and blue values of the colors), HUE (hue), Sat (saturation), etc.; optimizing the portrait picture refers to combining the attribute information of the portrait in the picture with the taken picture, and the comprehensive result is a picture that is closer to the real skin color of the portrait in the picture.
[0085] Step S20, determining whether the skin color of the optimized portrait image is uniform;
[0086] Step S30: If it is uneven, then according to a preset rule, skin color correction is performed on the uneven skin color area in the optimized portrait image.
[0087] The preset rule refers to the rule that applies the reference skin color information of the portrait to the portrait and uses the preset standard skin color model as a reference. For details, please refer to Figure 3 The preset standard skin color model refers to a model obtained in advance through a large number of portrait analyses without overexposure, shadows and uniform skin color. This model is a reference for evaluating whether the skin color area of the portrait is normal; the preset standard skin color model is selected in a targeted manner according to the reference skin color information of each portrait to improve the accuracy of skin color information comparison; to determine whether the skin color of the optimized portrait image is uniform, the preset standard skin color model is used as a reference for comparison; after the comparison and the uneven area is obtained, the skin color correction is performed on the uneven skin color area in the optimized portrait image.
[0088] In this embodiment, the skin color information of the portrait in the image to be processed is obtained and optimized to obtain an optimized portrait image; then it is determined whether the skin color of the optimized portrait image is uniform; finally, if it is not uniform, skin color correction is performed on the uneven skin color area in the optimized portrait according to preset rules. When the user takes pictures in scenes with uneven lighting, colored light or shadows, such as when taking pictures in a KTV or taking selfies in the direction of the light, the shadow of the selfie stick or the arm will cause a partial shadow on the face, then the skin color of the captured image will be uneven and the imaging quality will be low. The present invention firstly segments the portrait (the image of the character part) in the captured image to obtain a series of skin color areas, and then compares each skin color area with the skin color area corresponding to the preset standard skin color model to find out the abnormal areas of the portrait in the captured image, such as exposure, arm shadow, etc.; finally, the abnormal areas in the portrait are processed to obtain a portrait with uniform skin color, and the portrait with uniform skin color is put back into the original captured image, and then the image is displayed, thereby effectively improving the uneven skin color problem of the portrait caused by factors such as the shooting environment and improving the imaging quality; at the same time, there is no need for the user to perform substantial trimming on the captured image, which saves valuable time and improves the user experience.
[0089] Further, based on an embodiment of the image processing method of the present invention, referring to Figure 4 , step S33 comprises:
[0090] Step S331, segmenting the optimized portrait image and the preset standard skin color model to obtain a one-to-one corresponding regional combination of the optimized portrait image skin color area and the preset standard skin color model skin color area, and then calculating the skin color difference between the two areas in each regional combination;
[0091] The optimized portrait picture skin color area refers to the skin color area of the optimized portrait picture obtained after the optimized portrait picture is divided; the preset standard skin color model skin color area refers to the skin color area of the preset standard skin color model obtained after the preset standard skin color model is divided; each optimized portrait picture skin color area and the corresponding preset standard skin color model skin color area are taken as an area combination, and the skin color difference between the two areas in each area combination is the difference between the skin color information of the preset standard skin color model skin color area and the skin color information of the optimized portrait picture skin color area in the same area combination.
[0092] Step S332: performing skin color correction on the uneven skin color areas of each optimized portrait image in the optimized portrait image according to the skin color difference.
[0093] By comparing the skin color difference between the skin color area of the optimized portrait image and the skin color area of the preset standard skin color model, the skin color correction is then performed on the uneven skin color area of the optimized portrait image, and a portrait is obtained by correcting the skin color of the optimized portrait image using the preset standard skin color model as a reference.
[0094] In this embodiment, the optimized portrait image and the preset standard skin color model are first segmented to obtain region combinations, and then the skin color difference between two regions in each region combination is calculated; finally, based on the skin color difference, skin color correction is performed on the skin color region of each optimized portrait image to prepare for the subsequent output of the portrait after skin color correction.
[0095] Further, based on an embodiment of the image processing method of the present invention, referring to Figure 5 , step S331 includes:
[0096] Step A10, obtaining and using the skin color information of the skin color area of the optimized portrait image in each area combination as the first skin color information;
[0097] Skin color information refers to information that characterizes the skin color presentation effect of a skin color area; the skin color information of the skin color area of the optimized portrait image in each area combination is used as the first skin color information.
[0098] Step A20, obtaining and using the skin color information of the skin color area of the preset standard skin color model in each area combination as the second skin color information;
[0099] The skin color information of the skin color area of the preset standard skin color model in each area combination is used as the second skin color information.
[0100] Step A30, sequentially taking the difference between the second skin color information and the corresponding first skin color information in each area combination as the skin color difference between two areas in each area combination.
[0101] The second skin color information in each area combination is subtracted from the corresponding first skin color information, and the obtained value is the skin color difference between the two areas in each area combination.
[0102] In this embodiment, the skin color information of the skin color area of the optimized portrait image and the skin color information of the skin color area of the preset standard skin color model are first obtained, and then the skin color difference between the two areas is obtained, so as to prepare for the subsequent step of performing skin color correction on the skin color areas of each optimized portrait image in the optimized portrait image according to the skin color difference to obtain the target portrait.
[0103] Further, based on an embodiment of the image processing method of the present invention, referring to Figure 6 , step S332 includes:
[0104] Step A40, comparing the skin color difference values with the skin color threshold:
[0105] The skin color threshold refers to the value used to evaluate whether the skin color needs to be evened out due to overexposure, shadows, or colored lighting.
[0106] Step A50, if the skin color difference is not greater than the skin color threshold, determining that the skin color area of the optimized portrait image to which the first skin color information belongs is a normal area, and using the skin color information of each normal area as the third skin color information;
[0107] The normal area refers to an area where the skin color may or may not have problems such as overexposure, shadow, colored lighting, etc., but does not need to be processed for skin color equalization; that is, the second skin color information is subtracted from the corresponding first skin color information; then the obtained value is subtracted from the skin color threshold. If the result is not greater than (less than or equal to) zero, the skin color difference is not greater than the skin color threshold, then the skin color area of the optimized portrait image to which the skin color information belongs is the normal area.
[0108] Step A60: Obtain a mapping relationship between each third skin color information and each second skin color information.
[0109] The mapping relationship refers to the one-to-one correspondence between the skin color information of the normal area of the portrait and the skin color information of the preset standard skin color model skin color area; after the normal area is obtained, the mapping relationship between the skin color information of the normal area and the skin color information of the preset standard skin color model skin color area is obtained.
[0110] In this embodiment, by comparing the skin color difference value with the skin color threshold, the mapping relationship between the skin color information of the normal area and the skin color area of the preset standard skin color model is obtained, which is conducive to subsequently obtaining the ideal skin color information (which should be presented but is not presented) of the abnormal area based on the skin color information and mapping relationship of the skin color area of the preset standard skin color model.
[0111] Further, based on an embodiment of the image processing method of the present invention, referring to Figure 7 , step S332 also includes:
[0112] Step A70, if the skin color difference is greater than the skin color threshold, determining that the skin color area of the optimized portrait image to which the first skin color information belongs is an abnormal area;
[0113] The abnormal area refers to the area where the skin color is overexposed, shadowed, colored light, etc. and needs to be processed for skin color uniformity; that is, the second skin color information is subtracted from the corresponding first skin color information; then the obtained value is subtracted from the skin color threshold. If the result is greater than zero, the skin color difference is greater than the skin color threshold, then the skin color area of the optimized portrait image to which the skin color information belongs is the abnormal area.
[0114] Step A80, obtaining each ideal skin color information of each abnormal area according to the second skin color information and the mapping relationship, and using each ideal skin color information of each abnormal area as fourth skin color information;
[0115] Ideal skin color information means that after the skin color information is applied to the abnormal area, the skin color in the abnormal area may still exist or not have problems such as overexposure, shadow, colored lighting, etc., but the undesirable conditions have been improved, and no skin color equalization processing is required, and the following relationship exists: the skin color difference between the skin color information of the preset standard skin color model and the ideal skin color information is not greater than the skin color threshold.
[0116] Step A90, removing each abnormal area in turn to obtain each blank area corresponding to each abnormal area;
[0117] The blank area refers to the area used to replace the abnormal area and has the same size and shape as the replaced abnormal area and has no skin color information; after removing each abnormal area in turn, the skin color area of each abnormal area in the optimized portrait image to which it originally belonged becomes a blank area, and each blank area corresponds to each abnormal area one by one; each blank area has no skin color information and has the same size and shape as the corresponding abnormal area.
[0118] Step A100, applying each fourth skin color information to each blank area to obtain each ideal skin color area;
[0119] The ideal skin color area refers to the area obtained after applying the above-mentioned ideal skin color information to the abnormal area; after obtaining the ideal skin color information of each abnormal area and the blank areas corresponding to each abnormal area through the above steps, since the blank areas have the same size and shape as the corresponding abnormal areas and do not have skin color information, the ideal skin color area can be obtained after applying each ideal skin color information to each blank area corresponding to the abnormal area.
[0120] Step A110, smoothing each ideal skin color area and each normal area to complete skin color correction.
[0121] Smoothing refers to the operation of blending and naturally transitioning two different areas; smoothing each ideal skin color area with each normal area so that the transition between each area is natural, which is conducive to improving the quality of the portrait.
[0122] In this embodiment, first, the ideal skin color information of each abnormal area is obtained according to the skin color information and mapping relationship of the skin color area of the preset standard skin color model; then, each abnormal area is removed in turn to obtain each blank area corresponding to each abnormal area, which is conducive to the subsequent application of each ideal skin color information to each blank area corresponding to each abnormal area to obtain each ideal skin color area. In this embodiment, first, each ideal skin color information is applied to each blank area corresponding to each abnormal area to obtain each ideal skin color area; then, each ideal skin color area and each normal area are smoothed, so as to obtain a portrait with a natural transition in each area.
[0123] Further, based on an embodiment of the image processing method of the present invention, referring to Figure 8 , step S10 comprises:
[0124] Step S11, obtaining an image captured by the terminal camera, and saving the image to a terminal buffer area as an image to be processed;
[0125] The present invention can be applied to mobile phone cameras; when a user opens a mobile phone camera application and clicks to confirm shooting, the present invention first obtains the image shot by the camera, and then saves the image as a to-be-processed image to a mobile phone buffer area for subsequent processing and display.
[0126] Step S12, detecting the number of portraits in the image to be processed;
[0127] After the image to be processed is saved in the mobile phone camera buffer, the number of portraits in the image to be processed is detected to facilitate the subsequent acquisition of skin color information and attribute information for each portrait.
[0128] Step S13, capturing each person's portrait and saving it in the terminal buffer area.
[0129] Each portrait in the image to be processed is cut out from the image and saved in the mobile phone cache area.
[0130] Step S14, obtaining attribute information of the portrait in the image to be processed;
[0131] The attribute information of a portrait refers to the information that characterizes the type and characteristics of the portrait, such as gender, age, face shape, etc.
[0132] Step S15, obtaining reference skin color information of the portrait according to the skin color information and the attribute information;
[0133] By weighting the skin color information and the attribute information, the portrait reference skin color information can be obtained, that is, the portrait reference skin color information refers to the reference information that is closest to the skin color of the portrait in the image, which is obtained by weighting the skin color information and the attribute information respectively; for example, if the skin color information C is obtained and the attribute information D is: gender female, age 20, oval face shape, then the reference skin color information is the gender female, age 20, oval face shape, which is obtained by weighting the attribute information and the skin color information C respectively, and the calculation method is: x*C+y*D, where x is the weight coefficient of the skin color information C, y is the weight coefficient of the attribute information D and x+y=1; the optimized portrait picture refers to the portrait with the highest degree of similarity to the photographed portrait; the reference skin color information, which is the reference information closest to the skin color of the portrait in the image, is applied to the portrait to obtain the optimized portrait picture.
[0134] Step S16, applying the reference skin color information to the portrait to obtain an optimized portrait image.
[0135] In this embodiment, the image taken by the camera is first obtained and saved as the image to be processed, and the number of portraits in the image is detected; then, each portrait is captured and saved separately, and each portrait is treated as an independent portrait. Finally, the reference skin color information is applied to the portrait to obtain an optimized portrait image, which is used to compare with the preset standard skin color model to confirm the uneven skin color area in the optimized portrait image.
[0136] Further, based on an embodiment of the image processing method of the present invention, referring to Fig. 9 , step S20 comprises:
[0137] Step S21, acquiring attribute information, and then selecting a target preset standard skin color model that matches the attribute information;
[0138] Attribute information refers to information that characterizes the type and characteristics of a portrait, such as gender, age, face shape, etc. First, a preset standard skin color model that meets the attribute characteristics is selected based on the attribute information, which is called the target preset standard skin color model.
[0139] Step S22, obtaining reference skin color information, and then selecting a preset standard skin color model that matches the reference skin color information from the target preset standard skin color model.
[0140] According to the reference skin color information of each portrait, the corresponding preset standard skin color model is selected from the target preset standard skin color model, which improves the accuracy of the selection of the preset standard skin color model. Therefore, the selected preset standard skin color model is closest to the actual skin color of the corresponding portrait. Using this preset standard skin color model as a reference for whether image adjustment is needed can improve the degree of similarity between the processed skin color and the actual skin color.
[0141] Step S23, comparing the optimized portrait image with a preset standard skin color model.
[0142] In this embodiment, the target preset standard skin color model is determined by the attribute information of the portrait; and the preset standard skin color model is then determined by the reference skin color information of the portrait. Then, a reference object for evaluating whether the skin color area is normal, namely, the preset standard skin color model, can be obtained. Finally, by comparing the optimized portrait image with the preset standard skin color model, the uneven skin color area in the optimized portrait image can be determined.
[0143] Further, based on an embodiment of the image processing method of the present invention, referring to Fig.10 , after step S30, comprising:
[0144] Step S40, obtaining the number of portraits with corrected skin color:
[0145] Acquiring the number of skin color corrected portraits is helpful to determine the number of skin color corrected portraits that need to be smoothed.
[0146] Step S50, if the number of the portraits after the skin color correction is one, then put the portrait after the skin color correction back into the image taken by the terminal camera and perform smoothing processing, and output and display the new image;
[0147] If the number of portraits with corrected skin color is one, the portrait with corrected skin color is put back into the image taken by the terminal camera and smoothed, and then a new image is output and displayed. The image viewed by the user is the new image including the portrait with corrected skin color.
[0148] Step S60: If there are multiple portraits with corrected skin color, each portrait with corrected skin color is put back into the image taken by the terminal camera and smoothed, and a new image is output and displayed.
[0149] If there are multiple portraits with corrected skin color, all the portraits with corrected skin color are put back into the image taken by the terminal camera and smoothed, and then a new image is output and displayed. The image viewed by the user is the new image including all the portraits with corrected skin color.
[0150] In this embodiment, by obtaining the number of portraits with corrected skin color, the number of portraits with corrected skin color that need to be smoothed is determined; then each portrait with corrected skin color is put back into the image taken by the terminal camera and smoothed to make the transition between the portrait and the image background natural.
[0151] To assist in understanding the overall technical solution of the embodiments of the present invention, please refer to Fig.11 , when it is detected that the number of portraits in the image to be processed is 1, it is assumed that the right face of this portrait has a shadow; the dotted line is the skin color area dividing line; the portrait is intercepted as a portrait and put into the mobile phone cache area; firstly, the skin color information and attribute information of the portrait are obtained and the reference skin color information of the portrait is determined based on the two information; then the reference skin color information is applied to the portrait to obtain an optimized portrait picture; then the optimized portrait picture and the preset standard skin color model are divided to obtain the skin color area of the optimized portrait picture and the skin color area of the preset standard skin color model, and the skin color information of the skin color area of the optimized portrait picture and the skin color area of the preset standard skin color model are obtained. Color information; calculate the skin color difference of the skin color information respectively, and compare the size of each difference with the skin color threshold: if the skin color difference is greater than the skin color threshold, the skin color area of the optimized portrait image to which the skin color information belongs is an abnormal area; if the skin color difference is not greater than the skin color threshold, the skin color area of the optimized portrait image to which the skin color information belongs is a normal area, then obtain the mapping relationship between the skin color information of each normal area and the skin color information of the preset standard skin color model skin color area; then process each abnormal area to obtain a portrait with corrected skin color, then put the portrait with corrected skin color back into the image and perform smoothing, output and display the processed image. Reference Fig.12 , Fig.12 This is the processed output image when it is a portrait, and the shadow on the right side of the portrait has been removed; finally, this image is displayed to the user for review.
[0152] When the number of portraits is greater than one, each portrait is processed separately. The specific processing method is the same as the processing method for the one portrait mentioned above. Then each portrait with corrected skin color is put back into the image and smoothed. Finally, the processed image is output and displayed.
[0153] In addition, the present invention also provides a mobile terminal, which includes: a memory 109, a processor 110, and an image processing program stored in the memory 109 and executable on the processor 110. When the mobile terminal display control program is executed by the processor 110, the steps of each embodiment of the above-mentioned image processing method are implemented.
[0154] In addition, the present invention also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can also be executed by one or more processors to implement the steps of each embodiment of the above-mentioned image processing method.
[0155] The extended contents of the specific implementation methods of the mobile terminal and the readable storage medium (ie, computer-readable storage medium) of the present invention are substantially the same as those of the above-mentioned image processing method embodiments, and are not elaborated herein.
[0156] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0157] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0158] 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 invention, 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, magnetic disk, optical disk), and includes a number of instructions for a mobile terminal (which can be a mobile phone) to execute the methods described in each embodiment of the present invention.
[0159] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. An image processing method, characterized in that: The image processing method comprises the following steps: Acquire and optimize the skin color information of the portrait in the image to be processed to obtain an optimized portrait image; Determining whether the skin color of the optimized portrait image is uniform; If it is uneven, then according to a preset rule, skin color correction is performed on the uneven skin color area in the optimized portrait image; The step of correcting the skin color of the uneven skin color area in the optimized portrait image according to the preset rule comprises: Obtaining reference skin color information of the portrait according to the skin color information of the portrait; Applying the reference skin color information of the portrait to the portrait to obtain the optimized portrait picture; Segmenting the optimized portrait image and the preset standard skin color model to obtain a one-to-one corresponding regional combination of the optimized portrait image skin color area and the preset standard skin color model skin color area, and then calculating the skin color difference between the two areas in each of the regional combinations; According to the skin color difference, performing skin color correction on the uneven skin color area of each optimized portrait picture in the optimized portrait picture; The step of segmenting the optimized portrait image and the preset standard skin color model to obtain a one-to-one corresponding regional combination of the optimized portrait image skin color area and the preset standard skin color model skin color area, and then calculating the skin color difference between two areas in each regional combination comprises: Acquire and use the skin color information of the skin color area of the optimized portrait picture in each of the area combinations as the first skin color information; Acquire and use the skin color information of the preset standard skin color model skin color area in each of the area combinations as the second skin color information; sequentially taking the difference between the second skin color information and the corresponding first skin color information in each of the area combinations as the skin color difference between the two areas in each of the area combinations; The step of correcting the skin color of the uneven skin color areas of each optimized portrait image in the optimized portrait image according to the skin color difference comprises: Compare the skin color difference values with the skin color threshold: If the skin color difference is not greater than the skin color threshold, the skin color area of the optimized portrait image to which the first skin color information belongs is a normal area, and the skin color information of each normal area is used as the third skin color information; a mapping relationship between each third skin color information and each second skin color information is obtained; If the skin color difference is greater than the skin color threshold, determining that the skin color area of the optimized portrait image to which the first skin color information belongs is an abnormal area; Obtaining each ideal skin color information of each abnormal area according to the second skin color information and the mapping relationship, and using each ideal skin color information of each abnormal area as fourth skin color information; Removing the abnormal areas in sequence to obtain blank areas corresponding to the abnormal areas; Applying each of the fourth skin color information to each of the blank areas to obtain each ideal skin color area; The ideal skin color areas and the normal areas are smoothed to complete skin color correction.
2. The image processing method according to claim 1, characterized in that: The step of obtaining and optimizing the skin color information of the portrait in the image to be processed to obtain an optimized portrait image includes: Acquire an image captured by a terminal camera, and save the image to a terminal buffer area as the image to be processed; Detecting the number of portraits in the image to be processed; intercepting each of the portraits and saving them in the terminal buffer area; Obtaining attribute information of the portrait in the image to be processed; Obtaining reference skin color information of the portrait according to the skin color information and the attribute information; The reference skin color information is applied to the portrait to obtain the optimized portrait picture.
3. The image processing method according to claim 2, characterized in that: The step of determining whether the skin color of the optimized portrait image is uniform comprises: Acquire the attribute information, and then select a target preset standard skin color model that matches the attribute information; Acquire the reference skin color information, and then select a preset standard skin color model that matches the reference skin color information from among the target preset standard skin color models; The optimized portrait image is compared with the preset standard skin color model.
4. The image processing method according to claim 1, wherein: If the skin color is uneven, then according to a preset rule, after the step of correcting the skin color of the uneven skin color area in the optimized portrait image, the method includes: Get the number of portraits after skin color correction: If the number of the portraits after the skin color correction is one, then putting the portrait after the skin color correction back into the image taken by the terminal camera and performing smoothing processing, and outputting and displaying the new image; If there are multiple portraits with corrected skin color, each portrait with corrected skin color is put back into the image taken by the terminal camera and smoothed, and a new image is output and displayed.
5. A mobile terminal, characterized in that: The mobile terminal comprises: a memory, a processor, and an image processing program stored in the memory and executable on the processor, wherein the image processing program implements the steps of the image processing method according to any one of claims 1 to 4 when executed by the processor.
6. A storage medium, characterized in that: The storage medium stores an image processing program, and when the image processing program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Method and system of image processing based on skin color detection, and server
CN106845455A
Face image processing method, device and electronic device
CN108229278A
Face beautifying method and device, electronic equipment and readable storage medium
CN108876709A