CN112581395A - Image processing method, image processing device, electronic equipment and storage medium - Google Patents

Image processing method, image processing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112581395A
CN112581395A CN202011484150.6A CN202011484150A CN112581395A CN 112581395 A CN112581395 A CN 112581395A CN 202011484150 A CN202011484150 A CN 202011484150A CN 112581395 A CN112581395 A CN 112581395A
Authority
CN
China
Prior art keywords
image
brightness
area
pixel points
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011484150.6A
Other languages
Chinese (zh)
Other versions
CN112581395B (en
Inventor
胡静婕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202011484150.6A priority Critical patent/CN112581395B/en
Publication of CN112581395A publication Critical patent/CN112581395A/en
Application granted granted Critical
Publication of CN112581395B publication Critical patent/CN112581395B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The application discloses an image processing method and device, electronic equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: dividing image areas of an image to be processed to obtain a plurality of image areas; determining the brightness type of each image area, including a bright part area and a dark part area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area; and performing matched brightness adjustment on target pixel points in each image area based on the brightness type of each image area, wherein the target pixel points are determined based on the brightness of all pixel points included in the image area. According to the image processing method, the image processing device, the electronic equipment and the storage medium, the bright and dark parts of the image to be processed are divided, so that the brightness in different regions is adjusted in a distinguishing mode, controllability of a skin grinding process is improved on the basis that details of facial textures are not lost, and the skin grinding effect is more real and natural.

Description

Image processing method, image processing device, electronic equipment and storage medium
Technical Field
The present application belongs to the field of computer technologies, and in particular, to an image processing method and apparatus, an electronic device, and a storage medium.
Background
The method for the terminal to polish the skin and beautify the face of the image including the face is generally realized by means of blurring, flaw repairing and the like on the whole image to be processed, and the image after polishing is often distorted, or the situations of unclean polishing, excessive polishing and the like occur.
Content of application
An object of the embodiments of the present application is to provide an image processing method, an image processing apparatus, an electronic device, and a storage medium, which can solve the problem in the prior art that a processed image is distorted or a peeling effect is not ideal.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides an image processing method, including:
dividing image areas of an image to be processed to obtain a plurality of image areas;
determining the brightness type of each image area, wherein the brightness type of each image area comprises a bright part area and a dark part area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area;
and performing matched brightness adjustment on target pixel points in each image area based on the brightness type of each image area, wherein the target pixel points are determined based on the brightness of all pixel points included in the image area.
In a second aspect, an embodiment of the present application provides an apparatus for image processing, including:
the image area dividing module is used for dividing the image area of the image to be processed to obtain a plurality of image areas;
the brightness type determining module is used for determining the brightness type of each image area, and the brightness type of each image area comprises a bright part area and a dark part area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area;
and the brightness adjusting module is used for carrying out matched brightness adjustment on target pixel points in each image area based on the brightness type of each image area, and the target pixel points are determined based on the brightness of all pixel points included in the image area.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the steps of the method according to the first aspect.
In the embodiment of the application, image area division is carried out on an image to be processed to obtain a plurality of image areas; determining the brightness type of each image area, wherein the brightness type comprises a bright part area and a dark part area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area; and performing matched brightness adjustment on target pixel points in each image area based on the brightness type of each image area, wherein the target pixel points are determined based on the brightness of all pixel points included in the image area. According to the embodiment of the application, the bright and dark part regions of the image to be processed are divided, so that the brightness in different regions is adjusted in a distinguishing mode, the controllability of the skin grinding process is improved on the basis that the details of facial textures are not lost, and the skin grinding effect is more real and natural.
Drawings
Fig. 1 is a schematic flowchart of an image processing method provided in an embodiment of the present application;
fig. 2 is a schematic structural diagram of an image processing apparatus provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 4 is a second schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application are capable of operation in sequences other than those illustrated or described herein. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The image processing method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
Fig. 1 is a schematic flowchart of an image processing method provided in an embodiment of the present application, and as shown in fig. 1, the method mainly includes, but is not limited to, the following steps:
step 11: and dividing the image area of the image to be processed to obtain a plurality of image areas.
The image to be processed may be pre-stored in the terminal, or may be obtained by instant shooting with a camera on the terminal. According to the image processing method provided by the embodiment of the application, the user can shoot through the terminal every time, and after the image to be processed is obtained, the face image contained in the image is automatically processed; or when the user wants to perform a skin beautifying process on the image to be processed, especially a buffing process, the user manually clicks a corresponding program icon on the current interface of the terminal to process the target image based on the image processing method provided by the embodiment of the present application, which is not specifically limited by the embodiment of the present application.
Since the image acquired by the terminal camera is generally a color image, but the black-and-white color relationship is more likely to highlight the uniformity of the light-dark contrast than the color relationship, as an optional embodiment, before the image to be processed is processed based on the image processing method provided by the embodiment of the present application, the image to be processed is subjected to the graying processing to convert the color image to be processed into the black-and-white image.
Furthermore, the face image can be recognized in the image to be processed (the object of the peeling process is mainly the region), the brightness of each pixel point in the face image is respectively determined, and then the image region of the image to be processed is divided according to the brightness distribution condition of each pixel point, so that a plurality of different image regions are obtained.
For example, if an image without skin polishing is used as an image to be processed (the image is grayed first), first, a face image in the image to be processed is identified; and then, analyzing the brightness value of each pixel point in the face image.
Further, different image area division can be realized according to the difference condition of the brightness average values of all pixel points between two adjacent image areas. Since there is a significant difference between the average luminance values of all the pixels in the area around the nose wing (the area where the image area a is located) and the average luminance values of all the pixels in the cheek area (the area where the image area B is located), it is equivalent to generate a dividing line between the image area a and the image area B by the difference in luminance, and the image area a and the image area B can be divided into different areas by the dividing line.
By dividing the entire face image into regions in the manner described above for the image region a and the image region B, a plurality of image regions can be acquired.
Step 12: the brightness type of each image area is determined.
Wherein the brightness type of the image area comprises a bright part area and a dark part area; and the brightness average value of all the pixel points included in the bright part area is larger than that of all the pixel points included in the dark part area.
After the image area of the image to be processed is divided in step 11, a plurality of different image areas may be obtained, and then whether the image area belongs to a bright portion area or a dark portion area may be determined according to the brightness of all the pixel points in each image area.
Alternatively, the brightness values of all the pixel points in the image area a and the image area B may be determined respectively, and then the average brightness values of all the pixel points included in the image area a and the image area B are calculated respectively and are marked as a and B respectively. Since the image area a and the image area B are two adjacent areas, and a is smaller than B, it can be determined that the image area a corresponding to a is a dark area, and correspondingly, the image area B corresponding to B is a bright area.
Optionally, a brightness threshold may also be set, and if the average brightness value of all pixel points included in an image region is greater than the brightness threshold, the brightness type of the image region is determined as a bright portion region; and if the average value of the brightness of all pixel points included in an image area is not greater than the brightness threshold value, determining the brightness type of the image area as a dark part area.
Step 13: and performing matched brightness adjustment on the target pixel points in each image area based on the brightness type of each image area.
And determining the target pixel point based on the brightness of all pixel points included in the image area.
The purpose of determining the brightness type of each image region in step 12 is to perform difference processing on abnormal pixel points (i.e., target pixel points) existing in different image regions.
The target pixel point in each image region may be determined by setting, as the target pixel point, a pixel point whose brightness is significantly different from the brightness of other pixel points. Specifically, in the case that the image region is a bright portion region, a pixel point in the image region whose luminance value is smaller than a preset luminance value may be set as a target pixel point; in the case that the image area is a dark portion area, a pixel point having a luminance value greater than a preset luminance value in the image area may be set as a target pixel point.
Taking the image area B divided in the above embodiment as an example, in the case that it is determined in step 12 to be the bright image area, because some defect points (e.g. pox marks) exist in the image area B, the brightness values of several pixel points constituting the defect point are obviously smaller than the brightness values of the pixel points in the peripheral area. Since one of the purposes of the buffing processing is to fade the flaws, in the embodiment of the present application, the brightness values of the pixel points corresponding to the flaws are increased to make the brightness values similar to the brightness values of the surrounding pixel points, so as to achieve the purpose of fading the acne marks.
Taking the image area a divided in the above embodiment as an example, in the case that it is determined in step 12 that it is a dark image area, because some blemishes (e.g. pimples) exist in the image area a, the brightness values of several pixel points constituting the pimples are obviously greater than the brightness values of the pixel points in the peripheral area. Since one of the purposes of the buffing processing is to fade comedones, in the embodiment of the present application, the brightness values of the pixel points corresponding to the comedones are reduced to be similar to the brightness values of the surrounding pixel points, so as to achieve the purpose of fading the comedones.
According to the image processing method provided by the embodiment of the application, the brightness in different regions is respectively adjusted in a distinguishing manner by dividing the light and shade region of the image to be processed, and particularly, the processing of the pixel points with light and shade impurities in the image region can be realized, so that the controllability of the skin grinding process is increased on the basis of not losing the details of facial textures, and the skin grinding effect is more real and natural.
Based on the content of the foregoing embodiment, as an optional embodiment, the dividing the image area of the image to be processed in step 11 to obtain a plurality of image areas may include, but is not limited to:
step 111: acquiring the brightness value of each pixel point in the image to be processed;
step 112: traversing all pixel points in the image to be processed, and dividing two adjacent pixel points into different areas under the condition that the brightness difference value between the two adjacent pixel points is greater than a first brightness difference threshold value;
step 113: and all the pixel points in the same region are constructed into an image region.
The calculation method for obtaining the brightness value of each pixel point in the image to be processed in step 111 may be executed by using a corresponding program inside the terminal, and the calculation principle may be that the RGB component of each pixel point is calculated first, and then the brightness value of the pixel point is calculated according to the RGB component of the pixel point, which is not specifically limited in this application.
In step 112, traversing all the pixel points in the image to be processed, and dividing two adjacent pixel points into different regions when the luminance difference between the two adjacent pixel points is greater than the first luminance difference threshold, specifically:
when an image to be processed is processed, in the process of traversing all pixel points in the image to be processed, when two pixel points adjacent to the boundary of an image area A and an image area B are traversed, the brightness difference between the brightness value of the pixel point located in the image area A and the brightness difference between the corresponding pixel points located in the image area B are obviously increased. In this embodiment, a brightness difference threshold (referred to as a first brightness difference threshold) may be preset, and when a brightness difference value between two adjacent pixel points is greater than the first brightness difference threshold, the two pixel points are divided into different regions. And traversing all pixel points in the image to be processed in sequence, namely calculating the brightness difference value of any pixel point and the adjacent pixel point, and comparing the obtained brightness difference value with a first brightness difference threshold value to determine whether the adjacent two pixel points are divided into two different areas.
After the processing in step 112, the partition relationship between the pixel points and the different partition regions formed by the pixel points can be obtained, so in step 113, all the pixel points in the same region are combined to form a plurality of different image regions.
Alternatively, the first brightness difference threshold may be set autonomously by the user according to actual needs. For example, when a user needs to perform beauty treatment on an image to be processed, a corresponding image processing interface is called by triggering a corresponding icon; then, clicking a parameter setting icon in the image processing interface to enter a parameter setting interface; and after clicking a brightness difference threshold value setting function button on the parameter setting interface, inputting a corresponding parameter value, namely finishing setting the first brightness difference threshold value. Alternatively, the first brightness difference threshold may also be configured by the terminal system, and thus, the embodiments of the present application are not particularly limited.
Under the condition that the first brightness difference threshold is set according to the use requirement of a user, if the skin grinding effect is weak, the first brightness difference threshold can be correspondingly increased; conversely, if the peeling effect is desired to be stronger, the first brightness difference threshold may be adjusted lower accordingly.
According to the image processing method provided by the embodiment of the application, the division of the image areas is carried out by combining the pixel traversal comparison mode with the preset brightness difference threshold value, so that a foundation is provided for carrying out pixel brightness adjustment in different image areas in the later period, the precision of the buffing processing is effectively improved, and the image effect after buffing is more real and natural.
Based on the content of the foregoing embodiments, as an alternative embodiment, the determining the brightness type of each image area in step 12 mainly includes, but is not limited to:
step 121: acquiring the average brightness value of all pixel points of each image area;
step 122: determining that an image area is a bright part area under the condition that the brightness average value of all pixel points of the image area is larger than the brightness average value of all pixel points of the image to be processed;
step 123: and under the condition that the brightness average value of all pixel points of an image area is not larger than the brightness average value of all pixel points of the image to be processed, determining that the image area is a dark part area.
According to the method and the device, after the brightness values of all the pixel points of each image area are obtained, the brightness average value of all the pixel points is calculated, the brightness average value of all the pixel points of each image area is compared with the brightness average value of all the pixel points of the whole image to be processed by using the brightness average value as a reference, and the light and dark areas are divided according to the comparison result.
Specifically, under the condition that the brightness average value of all pixel points of the image area is greater than the brightness average value of all pixel points of the image to be processed, the brightness type of the image area can be set as a bright area; and under the condition that the brightness average value of all pixel points of the image area is not greater than the brightness average value of all pixel points of the image to be processed, setting the brightness type of the image area as a dark area.
Optionally, the average brightness value of all the pixels in the image area may also be compared with a preset brightness threshold according to the personal preference of the user, so as to implement the division of the bright and dark areas. For example, the preset brightness threshold may be set to be slightly larger than the average brightness of all the pixels of the image to be processed, so that the divided bright regions are relatively reduced, and then the adjustment of the defects in the dark regions is emphasized in the result of the brightness adjustment of the image regions performed in the later stage. Correspondingly, the preset brightness threshold may be set to be slightly smaller than the average brightness value of all the pixels of the image to be processed, so that the dark area divided relatively decreases, and then the adjustment of the flaws in the bright area is emphasized in the result of the brightness adjustment of the image area in the later period.
According to the image processing method provided by the embodiment of the application, the image areas are subjected to light and shade division according to the brightness average values of all pixel points of the image areas, a foundation is provided for differentiated brightness adjustment according to different brightness types of different image areas in the later period, the buffing precision can be effectively improved, and the buffing effect is optimized.
Based on the content of the foregoing embodiment, as an optional embodiment, the determining, based on the brightness of all pixel points included in the image region, of the target pixel point in step 13 may specifically be:
under the condition that the brightness type of the image area is determined to be a dark part area, determining a pixel point, of which the brightness value is greater than the average brightness value of all pixel points included in the image area, in the image area as a first target pixel point; and under the condition that the brightness type of the image area is determined to be a bright part area, determining a pixel point of which the brightness value is smaller than the average brightness value of all pixel points included in the image area as a second target pixel point.
Specifically, the embodiment of the present application provides a method for determining a target pixel point in each image region.
Firstly, acquiring the brightness type of each image area, and taking a pixel point with the brightness value larger than the brightness average value of all pixel points included in the image area as a target pixel point, namely a first target pixel point, under the condition that the brightness type of the image area is a dark area; under the condition that the brightness type of the image area is a bright area, the pixel points in the image area, the brightness values of which are less than the average brightness value of all the pixel points included in the image area, are taken as target pixel points, and the embodiment of the present application is collectively referred to as second target pixel points.
Assuming that there is a acne (only one pixel) in the image area a, the brightness value of the acne is obviously greater than the average brightness value of all pixels in the whole image area a, so that the acne is set as a first target pixel. If the acne is composed of a plurality of pixel points, all the pixel points are set as first target pixel points.
Correspondingly, if there is a pox mark (it is only a pixel) in the image region B, its brightness value is significantly smaller than the average brightness value of all pixels in the whole image region B, so it is set as a second target pixel. And if the pox mark is formed by a plurality of pixel points, setting the pixel points as second target pixel points.
According to the image processing method provided by the embodiment of the application, different target pixel determination rules are formulated according to the brightness types of different image areas, so that the pixels mixed with light and shade in each image area are determined as the target pixels to perform corresponding brightness adjustment, the effect of buffing processing is effectively improved, and the image after buffing processing is more real.
Based on the content of the foregoing embodiment, as an optional embodiment, the performing, in step 13, the matched brightness adjustment on the target pixel point in each image region includes:
and setting the brightness value of the first target pixel point and the second target pixel point as the average brightness value of all pixel points of the image to be processed.
The embodiment of the application provides a method for adjusting the brightness of determined target pixel points, namely adjusting the brightness of all the target pixel points to the average value of the brightness of all the pixel points of an image to be processed so as to fade the target pixel points.
Optionally, a preset brightness value may also be set by the user according to personal preferences, or a preset brightness value is recommended by the system according to the actual style of the image to be processed, and the brightness of the target pixel point is adjusted to the preset brightness value, which is not specifically limited in the embodiments of the present application.
Further, the above adjusting the brightness of the target pixel point in each image region by matching may also be:
acquiring the average brightness value of all pixel points in a first preset area with the first target pixel point as the center;
reducing the brightness value of the first target pixel point to the average brightness value of all pixel points in the first preset area;
acquiring the average brightness value of all pixel points in a second preset area with the second target pixel point as the center;
and increasing the brightness value of the second target pixel point to the average brightness value of all pixel points in the second preset area.
The embodiment of the application provides another method for adjusting the brightness of each target pixel point. Specifically, different processing is performed according to the brightness type of the image region where each target pixel point is located.
When the brightness type of the image area is the dark area, the first target pixel point (bright point) needs to be dimmed. The criteria for adjustment may be: firstly, calculating the average brightness value of all pixel points in a first preset area where each first target pixel point is located, wherein the average brightness value is obviously smaller than the brightness of the first target pixel point; and then, reducing the brightness value of the first target pixel point to the average brightness value so as to realize the purpose of fading the first target pixel point.
The first predetermined area may be determined by centering the first target pixel point and rounding a predetermined radius (e.g., 5 pixel points). The first preset area can be determined by human or system setting according to the image processing requirement.
Accordingly, when the brightness type of the image area is the bright area, the second target pixel point (dark point) needs to be dimmed. The criteria for adjustment may be: firstly, calculating the average brightness value of all pixel points in a second preset area where each second target pixel point is located, wherein the average brightness value is obviously greater than the brightness of the second target pixel point; and then, increasing the brightness value of the second target pixel point to the average brightness value so as to realize the purpose of fading the second target pixel point.
The second predetermined area may be determined by centering on the second target pixel and rounding by a predetermined radius (e.g., 5 pixels). The second preset area can be determined by manual or system setting according to the image processing requirement.
The embodiment of the application provides a method for adjusting different brightness according to the brightness type of an image area where a target pixel point is located, further improves the processing effect of the target pixel point mixed with light and shade, ensures that a processed image is not distorted, and ensures that the brightness of each optimized area is more uniform.
Based on the content of the foregoing embodiment, as an optional embodiment, after performing the matched brightness adjustment on the target pixel point in each image region in step 13, the method may further include:
and adjusting the brightness of the image to be processed after the brightness adjustment is finished again according to a second brightness difference threshold value, wherein the second brightness difference threshold value is larger than the first brightness difference threshold value.
Since the brightness difference threshold is mainly used for realizing the division of the image area, setting different brightness difference thresholds can cause the divided areas to be different. Generally, the smaller the set brightness difference threshold is, the stronger the effect of the image peeling treatment is; the larger the set brightness difference threshold is, the weaker the effect of the image peeling process is.
In the embodiment of the application, a smaller first brightness difference threshold (for example, 5) is set, so that more image areas can be divided, the skin polishing effect is enhanced, and small-range unevenness including light and dark area inclusions (including spots, flaws, acne marks, pimples and the like) is removed. Then, a larger second brightness difference threshold (for example, 10) is set, a small number of image areas are divided, and then secondary brightness adjustment is performed on the image to be processed based on the image processing method provided by the application, so that the optimization of the large-block light and shadow light-dark relation of the whole face is realized, the integral effect of skin grinding is achieved, and the defect that the picture is not true due to skin grinding in the prior art is effectively overcome.
Based on the content of the foregoing embodiment, as an optional embodiment, before the dividing the image area of the image to be processed, the method further includes: and deleting the five sense organ regions in the image to be processed.
Wherein the five sense organ regions include an eye region, two ear regions, a nose region, and a mouth region. Since the main object of the buffing processing is the image of the human face skin color area, the image of the five sense organs area does not need to be subjected to the buffing processing. For example, if the eye region is treated as a skin polishing region, the treated image may be distorted. Therefore, in the image processing method provided in the embodiment of the present application, before performing image processing, preprocessing is performed on an image to be processed, and the preprocessing mainly includes operations of identifying and deleting an irrelevant area.
According to the image processing method provided by the embodiment of the application, the five sense organ areas are deleted, and then the image areas are obtained, so that the image optimization effect and the sense of reality can be effectively improved.
It should be noted that, in the image processing method provided in the embodiment of the present application, the execution subject may be an image processing apparatus, or alternatively, a control module in the image processing apparatus for executing a method for loading image processing. In the embodiment of the present application, a method for executing load image processing by an image processing apparatus is taken as an example, and the method for processing an image provided in the embodiment of the present application is described.
The buffing is one of the most basic beauty functions in apps such as a camera and a beauty camera of a terminal (such as a mobile phone end) at present, the application range of buffing is very wide, men, women, old and young need buffing when taking a picture or taking a picture, the buffing effect of the terminal is not ideal at present, and many people still select a later-stage manual image correction. However, when the terminal implements buffing, most of the terminals directly implement buffing by means of blurring, flaw repairing and the like on an image to be processed, so that the image after buffing is easy to have the defects of false, dirty, unclean buffing, excessive buffing and the like.
In view of this, an embodiment of the present invention provides an image processing apparatus, as shown in fig. 2, which is a schematic structural diagram of the image processing apparatus provided in this application, the apparatus mainly includes an image area dividing module 201, a brightness type determining module 202, and a brightness adjusting module 203, wherein:
the image area dividing module 201 is mainly used for dividing an image area of an image to be processed to obtain a plurality of image areas;
the brightness type determining module 202 is mainly configured to determine the brightness type of each image area, where the brightness type includes a bright area and a dark area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area;
the brightness adjustment module 203 is mainly configured to perform matching brightness adjustment on target pixel points in each image region based on the brightness type of each image region, where the target pixel points are determined based on the brightness of all pixel points included in the image region.
As an optional embodiment, after the terminal takes a picture to obtain the image to be processed, the image to be processed is generated into a JPEG format, the face image may be recognized first, and then the image to be processed is changed into an observation state, i.e. black and white, because the uniformity of the light and shade contrast is more easily highlighted due to the black and white color relationship. Further, the image area division module 201 performs face light and shadow detection on the image to be processed to identify the face image and determine the brightness values of all pixel points in the face image. Then, the areas of the bright part and the dark part are respectively calculated, and then the bright and dark regions of the face image are divided through a preset brightness threshold value. The preset brightness threshold may be an average brightness value of all pixel points of the image to be processed, or a brightness threshold preset manually or by a system.
According to the image processing method provided by the embodiment of the application, the bright and dark part regions of the image to be processed are divided, so that the brightness in different regions is respectively adjusted in a distinguishing manner, the controllability of the skin grinding process is increased on the basis of not losing the details of the facial texture, and the skin grinding effect is more real and natural.
Further, with the luminance type determination module 202, it is determined whether the divided image area belongs to a bright portion area or a dark portion area. Specifically, whether the image area belongs to a bright area or a dark area may be determined according to the brightness of all the pixel points in each image area.
Further, the brightness adjustment module 203 adjusts the brightness of the target pixel points in each image region according to the type of each image region determined by the brightness type determination module 202, so that the brightness of each target pixel point is similar to the brightness of the pixel points in a certain surrounding region, thereby fading the target pixel points.
Further, the image region dividing module 201 is specifically configured to: acquiring the brightness value of each pixel point in the image to be processed; traversing all pixel points in the image to be processed, and dividing two adjacent pixel points into different areas under the condition that the brightness difference value between the two adjacent pixel points is greater than a first brightness difference threshold value; and all the pixel points in the same region are constructed into an image region.
Further, the brightness type determining module 202 is specifically configured to: acquiring the average brightness value of all pixel points of each image area; determining that an image area is a bright part area under the condition that the brightness average value of all pixel points of the image area is larger than the brightness average value of all pixel points of the image to be processed; and under the condition that the brightness average value of all pixel points of an image area is not larger than the brightness average value of all pixel points of the image to be processed, determining that the image area is a dark part area.
Further, the brightness adjustment module 203 is further configured to determine a target pixel point, and specifically configured to: under the condition that the brightness type of the image area is determined to be a dark part area, determining a pixel point, of which the brightness value is greater than the average brightness value of all pixel points included in the image area, in the image area as a first target pixel point; and under the condition that the brightness type of the image area is determined to be a bright part area, determining a pixel point of which the brightness value is smaller than the average brightness value of all pixel points included in the image area as a second target pixel point.
Further, the brightness adjusting module 203 may be further specifically configured to: and setting the brightness value of the first pixel point and the second target pixel point as the average brightness value of all pixel points of the image to be processed.
Further, the brightness adjusting module 203 is further specifically configured to: acquiring the average brightness value of all pixel points in a first preset area with the first pixel point as the center; reducing the brightness value of the first pixel point to the average brightness value of all pixel points in the first preset area; acquiring the average brightness value of all pixel points in a second preset area with the second pixel point as the center; and increasing the brightness value of the second pixel point to the average brightness value of all pixel points in the second preset area.
Further, the image area dividing module 201 is further configured to perform image area division again on the to-be-processed image after the brightness adjustment is completed according to a second brightness difference threshold, and perform brightness adjustment again on the to-be-processed image after the brightness adjustment is completed by using the brightness type determining module and the brightness adjusting module; the second brightness difference threshold is greater than the first brightness difference threshold.
Further, the image processing apparatus provided in the embodiment of the present application further includes an image preprocessing module; the image preprocessing module is used for deleting the five sense organ areas in the image to be processed before the image area division is carried out on the image to be processed.
Furthermore, the brightness feathering can be carried out on the area around the target pixel in the debugged image area, so that the brightness feathering is excessively more uniform, and a buffing image without damaging the detail problem of the skin can be obtained.
The image processing apparatus in the embodiment of the present application may be an apparatus, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The image processing apparatus in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The image processing apparatus provided in the embodiment of the present application can implement each process implemented by the image processing apparatus in the method embodiment of fig. 1, and is not described herein again to avoid repetition.
On one hand, the image processing device provided by the embodiment of the application can efficiently optimize or solve the blurring effect of an unclear image, improve the imaging quality and solve the technical requirement that a user is easy to take a picture and is unclear; on the other hand, a large number of machines are not needed for the process of artificial learning, the realization is simple, and the operation of a user is convenient; in addition, the image processing device provided by the embodiment of the application does not need to increase hardware cost, is processed at a software end, and is easy to popularize in a large range.
Optionally, an electronic device 300 is further provided in this embodiment of the present application, as shown in fig. 3, and includes a processor 302, a memory 301, and a program or an instruction stored in the memory 301 and executable on the processor 302, where the program or the instruction is executed by the processor 302 to implement each process of the above-mentioned embodiment of the image processing method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and the non-mobile electronic devices described above.
Fig. 4 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 400 includes, but is not limited to: radio unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, and processor 410.
Those skilled in the art will appreciate that the electronic device 400 may further include a power source (e.g., a battery) for supplying power to various components, and the power source may be logically connected to the processor 410 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 4 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
It should be understood that, in the embodiment of the present application, the input Unit 404 may include a Graphics Processing Unit (GPU) 441 and a microphone 442, and the Graphics processor 441 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 406 may include a display panel 461, and the display panel 461 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 407 includes a touch panel 471 and other input devices 472. A touch panel 471, also referred to as a touch screen. The touch panel 471 can include two parts, a touch detection device and a touch controller. Other input devices 472 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 809 may be used to store software programs as well as various data including, but not limited to, application programs and operating systems. The processor 410 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 410.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the embodiment of the image processing method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and so on.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the embodiment of the image processing method, and can achieve the same technical effect, and the details are not repeated here to avoid repetition.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may 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 instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. An image processing method, comprising:
dividing image areas of an image to be processed to obtain a plurality of image areas;
determining the brightness type of each image area, wherein the brightness type of each image area comprises a bright part area and a dark part area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area;
and performing matched brightness adjustment on target pixel points in each image area based on the brightness type of each image area, wherein the target pixel points are determined based on the brightness of all pixel points included in the image area.
2. The image processing method according to claim 1, wherein the dividing the image area of the image to be processed to obtain a plurality of image areas comprises:
acquiring the brightness value of each pixel point in the image to be processed;
traversing all pixel points in the image to be processed, and dividing two adjacent pixel points into different areas under the condition that the brightness difference value between the two adjacent pixel points is greater than a first brightness difference threshold value;
and all the pixel points in the same region are constructed into an image region.
3. The image processing method according to claim 1 or 2, wherein the determining the brightness type of each image area comprises:
acquiring the average brightness value of all pixel points of each image area;
determining that an image area is a bright part area under the condition that the brightness average value of all pixel points of the image area is larger than the brightness average value of all pixel points of the image to be processed;
and under the condition that the brightness average value of all pixel points of an image area is not larger than the brightness average value of all pixel points of the image to be processed, determining that the image area is a dark part area.
4. The image processing method according to claim 1, wherein the target pixel point is determined based on brightness of all pixel points included in the image region, specifically:
under the condition that the brightness type of the image area is determined to be a dark part area, determining a pixel point, of which the brightness value is greater than the average brightness value of all pixel points included in the image area, in the image area as a first target pixel point;
and under the condition that the brightness type of the image area is determined to be a bright part area, determining a pixel point of which the brightness value is smaller than the average brightness value of all pixel points included in the image area as a second target pixel point.
5. The image processing method according to claim 4, wherein the performing the matched brightness adjustment on the target pixel point in each image region comprises:
and setting the brightness value of the first target pixel point and the second target pixel point as the average brightness value of all pixel points of the image to be processed.
6. The image processing method according to claim 4, wherein the performing the matched brightness adjustment on the target pixel point in each image region comprises:
acquiring the average brightness value of all pixel points in a first preset area with the first target pixel point as the center;
reducing the brightness value of the first target pixel point to the average brightness value of all pixel points in the first preset area;
acquiring the average brightness value of all pixel points in a second preset area with the second target pixel point as the center;
and increasing the brightness value of the second target pixel point to the average brightness value of all pixel points in the second preset area.
7. The image processing method according to claim 2, further comprising, after the performing the matched brightness adjustment on the target pixel in each image region:
and adjusting the brightness of the image to be processed after the brightness adjustment is finished again according to a second brightness difference threshold value, wherein the second brightness difference threshold value is larger than the first brightness difference threshold value.
8. The image processing method according to claim 1, further comprising, before the dividing the image area of the image to be processed: and deleting the five sense organ regions in the image to be processed.
9. An image processing apparatus characterized by comprising:
the image area dividing module is used for dividing the image area of the image to be processed to obtain a plurality of image areas;
the brightness type determining module is used for determining the brightness type of each image area, and the brightness type of each image area comprises a bright part area and a dark part area; the brightness average value of all pixel points included in the bright part area is larger than that of all pixel points included in the dark part area;
and the brightness adjusting module is used for carrying out matched brightness adjustment on target pixel points in each image area based on the brightness type of each image area, and the target pixel points are determined based on the brightness of all pixel points included in the image area.
10. An electronic device comprising a processor, a memory and a program or instructions stored on the memory and executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the image processing method according to any one of claims 1 to 8.
CN202011484150.6A 2020-12-15 2020-12-15 Image processing method, device, electronic equipment and storage medium Active CN112581395B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011484150.6A CN112581395B (en) 2020-12-15 2020-12-15 Image processing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011484150.6A CN112581395B (en) 2020-12-15 2020-12-15 Image processing method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112581395A true CN112581395A (en) 2021-03-30
CN112581395B CN112581395B (en) 2024-08-23

Family

ID=75135464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011484150.6A Active CN112581395B (en) 2020-12-15 2020-12-15 Image processing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112581395B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763284A (en) * 2021-09-27 2021-12-07 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN113781359A (en) * 2021-09-27 2021-12-10 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN114095656A (en) * 2021-11-17 2022-02-25 维沃移动通信有限公司 Image processing method and device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107610675A (en) * 2017-09-11 2018-01-19 青岛海信电器股份有限公司 A kind of image processing method and device based on dynamic level
CN111565261A (en) * 2020-06-02 2020-08-21 厦门美图之家科技有限公司 Image processing method and device and electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107610675A (en) * 2017-09-11 2018-01-19 青岛海信电器股份有限公司 A kind of image processing method and device based on dynamic level
CN111565261A (en) * 2020-06-02 2020-08-21 厦门美图之家科技有限公司 Image processing method and device and electronic equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763284A (en) * 2021-09-27 2021-12-07 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN113781359A (en) * 2021-09-27 2021-12-10 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN113781359B (en) * 2021-09-27 2024-06-11 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN113763284B (en) * 2021-09-27 2024-07-16 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN114095656A (en) * 2021-11-17 2022-02-25 维沃移动通信有限公司 Image processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN112581395B (en) 2024-08-23

Similar Documents

Publication Publication Date Title
CN112581395B (en) Image processing method, device, electronic equipment and storage medium
CN110689500B (en) Face image processing method and device, electronic equipment and storage medium
CN109584180A (en) Face image processing process, device, electronic equipment and computer storage medium
US8731248B2 (en) Method of performing eye circle correction an image and related computing device
US8406566B1 (en) Methods and apparatus for soft edge masking
CN112669197A (en) Image processing method, image processing device, mobile terminal and storage medium
CN112333385B (en) Electronic anti-shake control method and device
CN108494996A (en) Image processing method, device, storage medium and mobile terminal
CN111835937A (en) Image processing method and device and electronic equipment
CN113450431A (en) Virtual hair dyeing method and device, electronic equipment and storage medium
CN113379623B (en) Image processing method, device, electronic equipment and storage medium
CN112381737B (en) Image processing method, device, electronic equipment and storage medium
CN112511890A (en) Video image processing method and device and electronic equipment
CN112883821A (en) Image processing method and device and electronic equipment
CN117455753A (en) Special effect template generation method, special effect generation device and storage medium
CN110047126B (en) Method, apparatus, electronic device, and computer-readable storage medium for rendering image
CN111968605A (en) Exposure adjusting method and device
WO2023103813A1 (en) Image processing method and apparatus, device, storage medium, and program product
CN113673270A (en) Image processing method and device, electronic equipment and storage medium
CN115775215A (en) Image processing method, image processing device, electronic equipment and storage medium
CN111953905B (en) Beautifying function starting method and device, electronic equipment and readable storage medium
CN112529766A (en) Image processing method and device and electronic equipment
CN113962840A (en) Image processing method, image processing device, electronic equipment and storage medium
CN112446848A (en) Image processing method and device and electronic equipment
CN112581394B (en) Image processing method, device, equipment and medium

Legal Events

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