Nothing Special   »   [go: up one dir, main page]

CN113591630A - Certificate photo automatic processing method, system, terminal equipment and storage medium - Google Patents

Certificate photo automatic processing method, system, terminal equipment and storage medium Download PDF

Info

Publication number
CN113591630A
CN113591630A CN202110809144.1A CN202110809144A CN113591630A CN 113591630 A CN113591630 A CN 113591630A CN 202110809144 A CN202110809144 A CN 202110809144A CN 113591630 A CN113591630 A CN 113591630A
Authority
CN
China
Prior art keywords
photo
face
template
picture
color
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.)
Pending
Application number
CN202110809144.1A
Other languages
Chinese (zh)
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.)
China Picture Service Co ltd
Original Assignee
China Picture Service 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 China Picture Service Co ltd filed Critical China Picture Service Co ltd
Priority to CN202110809144.1A priority Critical patent/CN113591630A/en
Publication of CN113591630A publication Critical patent/CN113591630A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • 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/13Edge detection
    • 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 relates to an automatic processing method of a certificate photo, which comprises the steps of adjusting a photo to be processed to be a uniform size based on a preset template photo to obtain a first photo; carrying out face recognition processing on the preset template picture and the first picture to respectively obtain a template face picture and a first face picture; adjusting the color temperature and the color level of the first photo based on the difference between the template face photo and the first face photo to obtain a second photo; performing black correction and white correction on the second photo to obtain a third photo; and performing highlight treatment on the third photo to obtain a final photo. The method has the advantages that the photo can be processed into the standardized photo requirement to the maximum extent, and the possibility of over-explosion and color temperature deviation is reduced.

Description

Certificate photo automatic processing method, system, terminal equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an automatic certificate photo processing method, system, terminal device, and storage medium.
Background
When the certificate photos from all over the country are collected, the problems of great difference of the certificate photos and the like caused by complex photographing environments, different light environments, different photographing equipment and different photographers are often encountered, and the standardization and unification of images are difficult to ensure.
At present, the skin color is processed by mainstream image processing software in the industry mainly through a method of comparing and adjusting target photos. The processing principle is as follows: selecting a standard photo, identifying the skin color of the standard photo to set the skin color as a standard skin color, identifying the skin color of the input certificate photo, automatically selecting a skin color area to compare with the standard skin color, and adjusting the color, the brightness and the like of the whole photo to enable the skin color area to approach the standard skin color.
In the related art, the inventor considers that the scheme is simple and rough, and the processed photos are easy to generate the situations of explosion, color temperature deviation and the like.
Disclosure of Invention
In order to process the photos into standardized photo requirements to the maximum extent and reduce the possibility of generating over-explosion and color temperature deviation, the application provides an automatic identification photo processing method, a system, terminal equipment and a storage medium.
In a first aspect, the present application provides an automatic processing method for identification photographs, which adopts the following technical scheme:
an automatic processing method for identification photo comprises
Adjusting the photos to be processed into uniform size based on the preset template photos to obtain a first photo;
carrying out face recognition processing on the preset template picture and the first picture to respectively obtain a template face picture and a first face picture;
adjusting the color temperature and the color level of the first photo based on the difference between the template face photo and the first face photo to obtain a second photo;
performing black correction and white correction on the second photo to obtain a third photo;
and performing highlight treatment on the third photo to obtain a final photo.
By adopting the technical scheme, the size of the photo to be processed is adjusted to be the same as the size of the preset template photo, and a first photo is obtained; the method comprises the steps of extracting a template face photo of a preset template photo and a first face photo of the first photo, sequentially carrying out color level adjustment and color temperature adjustment on the first photo based on the difference between the template face photo and the first face photo to obtain a second photo, carrying out black correction and white correction on the second photo due to adjustment to change a black part and a white part in the photo to obtain a third photo, and carrying out highlight processing on the third photo to obtain a final photo.
Optionally, the performing face recognition processing on the preset template photo and the first photo, and respectively obtaining the template face photo and the first face photo includes:
recognizing the face parts of the preset template picture and the first picture based on a face recognition technology, and removing organs of the face parts;
and removing the face edge part of the face part through corrosion operation to obtain a template face picture and a first face picture.
By adopting the technical scheme, organs of the human face are removed, and the interference of other colors such as hair, clothes and the like can be eliminated; the face edge part of the face part is removed through corrosion operation, so that the face edge part which may influence calculation and judgment can be removed.
Optionally, a template color level intermediate value of the template face photo is obtained, and a first color level intermediate value of the first face photo is obtained;
performing a tone scale adjustment on the first photograph based on a difference between the template tone scale median and the first tone scale median;
acquiring a template color temperature value of the template face photo, and acquiring a first color temperature value of the first face photo;
and adjusting the color temperature of the first photo after the color level adjustment based on the difference between the color temperature value of the template and the first color temperature value to obtain a second photo.
By adopting the technical scheme, the tone scale of the first photo is adjusted, so that the gray value of the face in the first photo after the tone scale adjustment is consistent with the gray value of the face in the preset template photo; and adjusting the first photo after the color level adjustment to enable the color temperature value of the second photo to be consistent with the color temperature value of the preset template photo.
Optionally, the adjusting of color temperature and color level is performed on the first photo based on the difference between the template face photo and the first face photo, and the following steps are further included after the second photo is obtained:
adjusting the template photo and the second photo to a "Lab" format;
obtaining the mean values of three channels of 'L', 'a' and 'b' of the template picture, and obtaining the mean values of three channels of 'L', 'a' and 'b' of the second picture;
and performing white balance adjustment on the second picture based on the average difference between each channel of the template picture and each channel of the second picture.
By adopting the technical scheme, the second photo after color temperature adjustment is subjected to white balance adjustment, so that the skin color of the second photo after color temperature adjustment is closer to that of the preset template photo.
Optionally, after performing white balance adjustment on the second photo based on the mean difference between each channel of the template photo and each channel of the second photo, the method further includes the following steps:
and adjusting lightness color levels of the second photo after the white balance adjustment.
By adopting the technical scheme, the second photo after white balance adjustment is subjected to lightness color level adjustment, so that the photo looks fuller and the visual perception is improved.
Optionally, performing black correction and white correction on the second photo, and obtaining a third photo includes:
extracting low-brightness parts in the second photo;
performing black correction on the low-brightness part based on a dark channel algorithm;
determining a white mask region of the second photo after black correction;
and adjusting channel parameters of the white mask area based on an HLS format, and performing white correction on the second photo after black correction to obtain a third photo.
By adopting the technical scheme, the black correction is used for performing defogging operation on the second photo, and the white correction is used for adjusting the part close to white in the second photo after the black correction to be white.
Optionally, the highlight processing on the third photo to obtain a final photo includes:
determining a highlight portion of the third photograph based on a "Lab" format;
and processing the highlight part based on a flood irrigation method to obtain a final photo.
By adopting the technical scheme, the problem of over exposure in a small range caused by reasons such as reflection or face oil bleeding in the photo to be processed is processed, so that the highlight part is softer.
In a second aspect, the present application provides an automatic processing system for identification photographs, which adopts the following technical scheme:
an automatic processing system for identification photo comprises
A pre-processing module for adjusting the size of the photograph;
the recognition module is used for extracting a face photo in the photo;
the adjusting module is used for adjusting the color level, the color temperature, the white balance and the brightness color level of the photo;
the correction module is used for correcting black and white in the photo;
a highlight processing module for processing highlight portions in a photograph.
By adopting the technical scheme, the size of the photo to be processed is adjusted, the face photo is extracted, the color level, the color temperature, the white balance and the lightness color level of the photo to be processed are sequentially adjusted based on the face photo of the preset template photo and the face photo of the photo to be processed, then the black and white are corrected, and finally the highlight processing is carried out, so that the photo can be processed into the standard photo requirement to the maximum extent, and the possibility of generating over-explosion and color temperature deviation is reduced.
In a third aspect, the present application provides a terminal device, which adopts the following technical solution:
the terminal equipment comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the processor adopts the certificate photo automatic processing method when loading and executing the computer program.
By adopting the technical scheme, the computer program is generated by the automatic certificate photo processing method and is stored in the memory so as to be loaded and executed by the processor, so that the terminal equipment is manufactured according to the memory and the processor, and the use is convenient.
In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solutions:
a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is loaded and executed by a processor, the certificate photo automatic processing method is adopted.
By adopting the technical scheme, the computer program is generated by the automatic certificate photo processing method and is stored in the computer readable storage medium to be loaded and executed by the processor, and the computer program can be conveniently read and stored through the computer readable storage medium.
Drawings
Fig. 1 is a schematic diagram of an overall structural framework of an automated processing method for identification photographs according to an embodiment of the present application.
Fig. 2 is a schematic structural framework diagram of step S200 in an automatic identification photograph processing method according to an embodiment of the present application.
Fig. 3 is a schematic structural framework diagram of steps S310 to S340 in an automatic identification photograph processing method according to an embodiment of the present application.
Fig. 4 is a schematic structural framework diagram of steps S350 to S380 in an automatic identification photograph processing method according to an embodiment of the present application.
Fig. 5 is a schematic structural framework diagram of step S400 in an automatic identification photograph processing method according to an embodiment of the present application.
Fig. 6 is a schematic structural framework diagram of step S500 in an automatic identification photograph processing method according to an embodiment of the present application.
Fig. 7 is a schematic diagram of an overall structure of an automated processing system for identification photographs according to an embodiment of the present application.
Reference numerals: 1. a preprocessing module; 2. an identification module; 3. an adjustment module; 31. a tone scale adjustment unit; 32. a color temperature adjusting unit; 33. a white balance adjustment unit; 34. a brightness level adjustment unit; 4. a correction module; 41. a black correction unit; 42. a white correction unit; 5. and a highlight processing module.
Detailed Description
The present application is described in further detail below with reference to figures 1-7.
The embodiment of the application discloses an automatic processing method of a certificate photo, which comprises the following steps with reference to fig. 1:
s100, adjusting the photo to be processed to be in a uniform size based on a preset template photo to obtain a first photo;
s200, carrying out face recognition processing on the preset template picture and the first picture to respectively obtain a template face picture and a first face picture;
s300, adjusting the color temperature and the color level of the first photo based on the difference between the template face photo and the first face photo to obtain a second photo;
s400, performing black correction and white correction on the second photo to obtain a third photo;
and S500, performing highlight processing on the third photo to obtain a final photo.
S100, adjusting the to-be-processed photos to be uniform in size based on the preset template photos to obtain a first photo:
specifically, before processing, a preset template photo is selected as a reference, and the selection criteria of the preset template photo are as follows: the face complexion meets the requirements; no glasses are worn. Because the sizes of the photos shot by different photographic equipment are different, the size of the photo to be processed needs to be adjusted to be the same as the size of the preset template photo before processing, and a first photo is obtained.
Referring to fig. 2, step S200 includes the following steps:
s210, recognizing the preset template picture and the face part of the first picture based on a face recognition technology, and removing organs of the face part;
s220, removing the face edge part of the face part through corrosion operation to obtain a template face picture and a first face picture.
Specifically, in step S210, the preset template picture and the face part of the first picture are identified by a face identification technology, each organ, such as eyes, nose, eyebrows, etc., of the face part is accurately found out, and each organ is removed, so that a mask of the face part with the organ removed is obtained, thereby eliminating interference of other colors, such as hair, clothes, etc., and facilitating subsequent processing.
Specifically, in step S220, since the skin color of the edge of the face portion on the preset template photo and the first photo is different from the skin color of the front face of the face, the mask needs to be eroded to remove the face edge portion that may affect the calculation and judgment, so as to obtain the template face photo of the preset template photo and the first face photo of the first photo.
More specifically, the positions of the pupil, the chin and the left and right cheeks of the face in the first photo are found through a face recognition technology, the inclination angle and the cutting frame of the first photo are calculated by combining the position ranges of the pupil, the chin and the key points of the left and right cheeks in the preset template photo, and if cutting needs exist, the first photo can be rotated and cut. And if the first picture is smaller than the cutting frame after rotation, stretching the positions of the two sides of the cheek and the outer side of the shoulder by an automatic color complementing method, and filling the blank area.
Referring to fig. 3, step S300 includes the following steps:
s310, obtaining a template color level middle value of the template face photo, and obtaining a first color level middle value of the first face photo;
s320, carrying out color level adjustment on the first photo based on the difference between the template color level intermediate value and the first color level intermediate value;
s330, obtaining a template color temperature value of the template face photo, and obtaining a first color temperature value of the first face photo;
s340, adjusting the color temperature of the first photo after the color level adjustment based on the difference between the color temperature value of the template and the first color temperature value to obtain a second photo.
Specifically, in step S310, the color level is an index standard representing the intensity of the image brightness, and in the digital image processing, refers to the gray scale resolution (also referred to as the gray scale resolution or the amplitude resolution). Respectively calculating a template color level intermediate value of the template face picture and a first color level intermediate value of the first face picture based on a program, wherein the calculation method of the color level intermediate value comprises the following steps: the sum of the color level values of all the pixels is divided by the total number of the pixels, and the average value is taken as the middle value of the color level. The middle value of the tone scale can be considered as the gray value of the face.
Specifically, in step S320, the gray scale value of the tone scale curve in the first photo is adjusted based on the difference between the template tone scale intermediate value and the first tone scale intermediate value, so that the gray scale value of the tone scale curve of the first photo is closer to the gray scale value of the tone scale curve of the template photo. In the process, the color level of the whole first photo is adjusted by calculating and comparing the template face photo and the first face photo.
More specifically, in order to improve the effect of the color level adjustment, in this embodiment, the first photo is subjected to two-side color level adjustment to obtain a color level adjusted first photo. Through adjustment of the color levels, the gray values of the face of the first photo after the color levels are adjusted are close to the gray values of the face of the preset template photo, and the gray values of the face are observed at the same level visually.
Specifically, the color temperature is a unit of measure representing the color component contained in the light. The color temperature values of the photos shot under the light rays with different color temperatures are also different, so that the overall photos are warmer or colder. In step S330, the first photo after the color level adjustment is converted from "BGR" format to "YUV" format, where "Y" in YUV "represents brightness (Luma or Luma), that is, gray level value, and" U "and" V "represent Chroma (Chroma or Chroma), which is used to describe image color and saturation and to specify the color of the pixel, and the color temperature value of the photo can be calculated through" U "and" V "channels. In this embodiment, the template color temperature value of the template face picture and the first color temperature value of the first face picture are obtained based on a program.
Specifically, in step S340, the first color temperature value and the gain value of the template color temperature value are obtained by comparing the template color temperature value and the first color temperature value, the channel values of "U" and "V" in the first picture after the color level adjustment are adjusted according to the calculated gain value, and the color temperature of the first picture after the color level adjustment is adjusted to obtain the second picture.
More specifically, in order to improve the effect of color temperature adjustment, the template color temperature value and the adjusted first color temperature value need to be calculated, compared and adjusted multiple times, so that the color temperature value of the second photo is approximately consistent with the color temperature value of the template photo. And converting the preset template picture and the second picture into a BGR format after the color temperature adjustment.
Referring to fig. 4, the following steps are included after step S340:
s350, adjusting the template photo and the second photo into a Lab format;
s360, obtaining the mean values of the three channels of L, a and b of the template picture, and obtaining the mean values of the three channels of L, a and b of the second picture;
and S370, performing white balance adjustment on the second picture based on the average value difference between each channel of the template picture and each channel of the second picture.
Specifically, after the color level and the color temperature are adjusted, the brightness and the color value of the second picture are changed, and in order to reduce the influence of the brightness and the color value change, the white balance of the second picture needs to be adjusted. In step S350, the preset template photo and the second photo are adjusted from "BGR" format to "Lab" format. In the "Lab" format, "L" represents the luminance channel, "a" and "b" represent the color channels, the "a" channel comprises colors from dark green to gray to bright pink, i.e., low to medium to high luminance values; the "b" channel is from bright blue to gray to yellow, i.e., low to medium to high luminance values.
Specifically, in step S360, the average values of the three channels "L", "a", and "b" of the template face picture are obtained through calculation, the second face picture of the second picture is obtained through step S200, and the average values of the three channels "L", "a", and "b" of the second face picture are obtained through calculation.
Specifically, in step S370, a difference between the mean value of the three channels of the preset template picture and the mean value of the three channels of the second face picture is calculated, and the values of the three channels "L", "a", and "b" of the second picture are adjusted based on the difference. And superposing the second picture after the channel value is adjusted and the second picture before the channel value is adjusted according to 50% +50%, so as to obtain the second picture after the white balance is adjusted. The skin color in the second picture after the white balance adjustment is closer to the preset template picture.
Referring to fig. 4, after step S370, the method further includes:
and step S380, adjusting lightness color levels of the second photo after white balance adjustment.
Specifically, if the difference between the first photo and the preset template photo is too large, for example: when the first photo is dark as a whole, has a large color temperature deviation, and the like, after the adjustment, a high-order part or a low-order part of the color level of the luminance channel appears blank, and the blank can cause the photo to have narrow luminance expression, such as a highlight or shadow part which is not good in expression, and the photo looks bright or dark as a whole. In step S380, the program reads the "L" channel color level of "Lab", performs high cut and low cut according to 1%, and then stretches the color level to 0-255, to obtain the second photograph after brightness color level adjustment. The brightness channel of the second picture after brightness level adjustment is more abundant compared with the second picture before white balance adjustment, and the visual perception is improved.
Referring to fig. 5, step S400 includes the following steps:
s410, extracting low-brightness parts in the second photo;
s420, performing black correction on the low-brightness part based on a dark channel algorithm;
s430, determining a white mask area of the second photo after black correction;
s440, adjusting channel parameters of the white mask area based on the HLS format, and performing white correction on the second photo after black correction to obtain a third photo.
Specifically, after the photo to be processed is processed in steps S100 to S300, some black parts (hair, black clothes) may change in brightness, resulting in the black color appearing grayish.
Specifically, in step S410, the second photograph is first separated into a "GARY" format image, "GARY" being the grayscale format of the second photograph.
Specifically, in step S420, the low-brightness portion (i.e., the portion having a color value lower than 128) in the "GARY" format image is processed based on the dark channel algorithm, so that the second photo is processed, and the specific calculation method is performed according to the dark channel algorithm
Figure 395489DEST_PATH_IMAGE001
Wherein, I (x) represents an input image, T (x) represents a gray image, and A represents a defogging parameter. The second photograph after black correction is obtained by the above processing.
Specifically, after the color temperature adjustment in steps S330 and S340, the color of the white portion (mainly clothes) in the photo changes, which appears to be reddish or bluish, and the white portion needs to be corrected.
Specifically, in step S430, it is first necessary to determine the white range, set the photo in "Lab" format, calculate the color difference from white through the "a" and "b" channels and calculate the white mask in the second photo after black correction under the condition that the "L" luminance channel is greater than 200, obtain the white mask region, and perform blurring processing on the white mask layer to achieve the feathering effect.
Specifically, in step S440, the black-corrected second photograph is converted from the "Lab" format to the "HLS" format. Wherein "HLS" represents hue, brightness, saturation, and adjusts the white mask region to be "S" channel, i.e. reduces saturation. Push buttonLight block
Figure 533210DEST_PATH_IMAGE002
And processing the identification photo mask area to obtain a third photo, wherein I (x) represents an input image, T (x) represents a mask, and A represents a saturation parameter. The highlighted near white portion of the third photograph will appear white.
Referring to fig. 6, step S500 includes the following steps:
s510, determining a highlight part of the third photo based on a Lab format;
s520, processing the highlight part based on a flood irrigation method to obtain a final photo.
In particular, the exposure transition problem of small range of face caused by reflection, face oil-spreading and the like on the photo to be processed needs to be removed by highlight.
Specifically, in step S510, the third photo is converted into "Lab" format, the color level of the third photo is calculated through the "L" channel in "Lab" format, and the range of highlight is determined by the 1% high cut.
Specifically, in step S520, the highlight portion is filled with surrounding colors based on the flood filling method, and then mixed with the original image by 50% to obtain the final photograph. The highlight part in the final photo after highlight treatment is softer.
The implementation principle of the automatic certificate photo processing method in the embodiment of the application is as follows: firstly, adjusting the size of a photo to be processed to be the same as the size of a preset template photo, and obtaining a first photo; extracting a template face photo of a preset template photo and a first face photo of the first photo, sequentially carrying out color level adjustment and color temperature adjustment on the first photo based on the difference between the template face photo and the first face photo to obtain a second photo, and then carrying out white balance adjustment and lightness color level adjustment on the second photo. And performing black correction and white correction on the second photo to obtain a third photo, and performing highlight treatment on the third photo to obtain a final photo. This application can be with the photo automated processing that different colour temperatures, different illumination environment, different equipment were shot, automatic tailor and automatic mixing of colors, and each step is complementary mutually between, and furthest handles into standardized photo requirement with the photo, reduces the possibility that produces the overexplosion and colour temperature deviation.
The embodiment of the application also discloses an automatic processing system of the identification photo, which refers to fig. 7 and comprises
The device comprises a preprocessing module 1, a display module and a control module, wherein the preprocessing module 1 is used for adjusting the size of a photo;
the recognition module 2 is used for extracting a face part in the photo;
the adjusting module 3 is used for adjusting the color level, the color temperature, the white balance and the brightness color level of the photo;
a correction module 4, wherein the correction module 4 is used for correcting black and white in the photo;
a highlight processing module 5, wherein the highlight processing module 5 is used for processing highlight parts in the photos.
The recognition module 2 is connected with the preprocessing module 1, the adjusting module 3 is connected with the recognition module 2, the correcting module 4 is connected with the adjusting module 3, and the highlight processing module 5 is connected with the correcting module 4.
Wherein, the preprocessing module 1: selecting a preset template photo as a reference, and adjusting the size of the photo to be processed in the preprocessing module 1 to obtain a first photo, wherein the size of the first photo is consistent with that of the preset template photo.
Wherein the identification module 2: the face recognition program is preset in the recognition module 2, the recognition module 2 recognizes the face part of the preset template picture and the first picture, accurately finds out various organs of the face part, such as eyes, nose, eyebrows and the like, and eliminates various organs to obtain the mask of the face part with the organs removed, so that the interference of other colors such as hair, clothes and the like is eliminated, and the subsequent processing is facilitated. Meanwhile, the identification module 2 carries out corrosion operation on the mask, removes face edge parts possibly influencing calculation and judgment in the face part, and obtains a template face picture of a preset template picture and a first face picture of the first picture.
Wherein, the adjusting module 3: the adjusting module 3 includes a color level adjusting unit 31, a color temperature adjusting unit 32, a white balance adjusting unit 33 and a brightness level adjusting unit 34, the color level adjusting unit 31 is connected to the identifying module 2 and the color temperature adjusting unit 32, the white balance adjusting unit 33 is connected to the color temperature adjusting unit 32, and the brightness level adjusting unit 34 is connected to the white balance adjusting unit 33.
Specifically, the tone scale adjustment unit 31: the tone scale adjusting unit 31 calculates a template tone scale intermediate value of the template face picture and a first tone scale intermediate value of the first face picture, and adjusts the tone scale of the first picture according to a difference between the template tone scale intermediate value and the first tone scale intermediate value, so that the gray level of the tone scale curve of the first picture is closer to the gray level of the tone scale curve of the template picture. In order to improve the effect of the color level adjustment, in this embodiment, the color level adjustment on both sides of the first photo is performed to obtain the first photo after the color level adjustment.
Specifically, the color temperature adjusting unit 32: the first photo after the color level adjustment is converted from a 'BGR' format into a 'YUV' format, wherein 'Y' in the 'YUV' format represents brightness (lightness or Luma), namely a gray level value, and 'U' and 'V' represent Chroma (Chroma or Chroma) and are used for describing the color and saturation of an image and specifying the color of a pixel, and the color temperature value of the photo can be calculated through a 'U' channel and a 'V' channel. In this embodiment, the template color temperature value of the template face picture and the first color temperature value of the first face picture are obtained based on a program.
The color temperature adjusting unit 32 compares the template color temperature value with the first color temperature value to obtain a gain value of the first color temperature value and the template color temperature value, and adjusts channel values of "U" and "V" in the first photograph after the color level adjustment according to the calculated gain value, and the color temperature adjusting unit 32 adjusts the color temperature of the first photograph after the color level adjustment based on the channel values to obtain a second photograph. In order to improve the effect of color temperature adjustment, the first color temperature value needs to be adjusted for multiple times, so that the color temperature value of the second photo is approximately consistent with the color temperature value of the template photo.
Specifically, the white balance adjustment unit 33: after the color level and the color temperature are adjusted, the brightness and the color value of the second picture are changed, and the white balance of the second picture needs to be adjusted in order to reduce the influence of the brightness and the color value change. And adjusting the preset template photo and the second photo from a BGR format to a Lab format. In the "Lab" format, "L" represents the luminance channel, "a" and "b" represent the color channels, the "a" channel comprises colors from dark green to gray to bright pink, i.e., low to medium to high luminance values; the "b" channel is from bright blue to gray to yellow, i.e., low to medium to high luminance values.
The white balance adjusting unit 33 obtains the average values of three channels "L", "a", and "b" of the template face picture and the face picture in the second picture through calculation, and the white balance adjusting unit 33 performs white balance adjustment on the second picture to obtain the white-balance-adjusted second picture. The skin color in the second picture after the white balance adjustment is closer to the preset template picture.
Specifically, the brightness level adjustment unit 34: if the difference between the first photo and the preset template photo is too large, for example: when the first photo is dark as a whole, has a large color temperature deviation, and the like, after the adjustment, a high-order part or a low-order part of the color level of the luminance channel appears blank, and the blank can cause the photo to have narrow luminance expression, such as a highlight or shadow part which is not good in expression, and the photo looks bright or dark as a whole. The brightness level adjustment unit 34 reads the "L" channel level of "Lab", performs high-cut and low-cut according to 1%, and then stretches the level to 0 to 255, to obtain a second photograph after brightness level adjustment. The brightness channel of the second picture after brightness level adjustment is more abundant compared with the second picture before white balance adjustment, and the visual perception is improved.
The correction module 4 includes a black correction unit 41 and a white correction unit 42, the black correction unit 41 is connected to the lightness gradation adjustment unit 34, and the white correction unit 42 is connected to the black correction unit 41.
Specifically, after the second photo is processed by the adjusting module 3, the brightness of the black part (hair, black clothes) changes after the adjustment of some part of the photo with lower brightness, so that the black looks grayish. The black correction unit 41 willThe two pictures separate out a "GARY" format image, "GARY" being the gray scale format of the second picture. The black correction unit 41 then processes the low-light portion (i.e., the portion having a color value lower than 128) in the "GARY" format image based on the dark channel algorithm, thereby processing the second photograph, in accordance with a specific calculation method
Figure 792153DEST_PATH_IMAGE001
Wherein, I (x) represents an input image, T (x) represents a gray image, and A represents a defogging parameter. The second photograph after black correction is obtained by the above processing.
Specifically, after the color temperature is adjusted, the color of the white part (mainly clothes) in the picture is changed to show that the white part is red or blue, and the white part needs to be corrected. The white correction unit 42 converts the picture into a "Lab" format, calculates the color difference from white through the "a" and "b" channels, and calculates the white mask in the second picture after black correction under the condition that the "L" luminance channel is greater than 200, to obtain a white mask region.
The white correction unit 42 then changes the black-corrected second photograph from the "Lab" format to the "HLS" format. Wherein "HLS" represents hue, brightness, saturation, and adjusts the white mask region to be "S" channel, i.e. reduces saturation. Baobai correction unit 42 according to
Figure 749744DEST_PATH_IMAGE002
And processing the identification photo mask area to obtain a third photo, wherein I (x) represents an input image, T (x) represents a mask, and A represents a saturation parameter. The highlighted near white portion of the third photograph will appear white.
In which, the problem of small exposure transition of the face due to reflection, face oil-spreading, etc. on the photo to be processed requires a highlight-removing operation.
The highlight processing module 5 converts the third picture into "Lab" format, calculates the color scale of the third picture through "L" channel in "Lab" format, and determines the range of the highlight through 1% high cut. The highlight processing module 5 fills the highlight portion with the surrounding colors based on the flood filling method, and then mixes the highlight portion with the original image by 50% to obtain the final photograph. The highlight part in the final photo after highlight treatment is softer.
The implementation principle of the automatic certificate photo processing system in the embodiment of the application is as follows: firstly, adjusting the size of a photo to be processed, extracting a face photo, sequentially adjusting color gradation, color temperature, white balance and lightness gradation on the basis of the face photo of a preset template photo and the face photo of the photo to be processed, then correcting black and white, and finally performing highlight processing. The method and the device can process the photos into the standardized photo requirements to the maximum extent, and reduce the possibility of over-explosion and color temperature deviation.
The embodiment of the application also discloses terminal equipment, which comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein when the processor executes the computer program, the certificate photo automatic processing method of the embodiment is adopted.
The terminal device may adopt a computer device such as a desktop computer, a notebook computer, or a cloud server, and the terminal device includes but is not limited to a processor and a memory, for example, the terminal device may further include an input/output device, a network access device, a bus, and the like.
The processor may be a Central Processing Unit (CPU), and of course, according to an actual use situation, other general processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like may also be used, and the general processor may be a microprocessor or any conventional processor, and the present application does not limit the present invention.
The memory may be an internal storage unit of the terminal device, for example, a hard disk or a memory of the terminal device, or an external storage device of the terminal device, for example, a plug-in hard disk, a smart card memory (SMC), a secure digital card (SD) or a flash memory card (FC) equipped on the terminal device, and the memory may also be a combination of the internal storage unit of the terminal device and the external storage device, and the memory is used for storing a computer program and other programs and data required by the terminal device, and the memory may also be used for temporarily storing data that has been output or will be output, which is not limited in this application.
The terminal device stores the certificate photo automatic processing method of the embodiment in a memory of the terminal device, and the certificate photo automatic processing method is loaded and executed on a processor of the terminal device, so that the terminal device is convenient to use.
The embodiment of the application also discloses a computer readable storage medium, and the computer readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the certificate photo automatic processing method of the embodiment is adopted.
The computer program may be stored in a computer readable medium, the computer program includes computer program code, the computer program code may be in a source code form, an object code form, an executable file or some intermediate form, and the like, the computer readable medium includes any entity or device capable of carrying the computer program code, a recording medium, a usb disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a Read Only Memory (ROM), a Random Access Memory (RAM), an electrical carrier signal, a telecommunication signal, a software distribution medium, and the like, and the computer readable medium includes but is not limited to the above components.
The certificate photo automatic processing method of the embodiment is stored in the computer readable storage medium through the computer readable storage medium, and is loaded and executed on the processor, so that the storage and the application of the method are facilitated.
The above embodiments are preferred embodiments of the present application, and the protection scope of the present application is not limited by the above embodiments, so: all equivalent changes made according to the structure, shape and principle of the present application shall be covered by the protection scope of the present application.

Claims (10)

1. An automatic processing method of identification photo is characterized in that: comprises that
Adjusting the photos to be processed into uniform size based on the preset template photos to obtain a first photo;
carrying out face recognition processing on the preset template picture and the first picture to respectively obtain a template face picture and a first face picture;
adjusting the color temperature and the color level of the first photo based on the difference between the template face photo and the first face photo to obtain a second photo;
performing black correction and white correction on the second photo to obtain a third photo;
and performing highlight treatment on the third photo to obtain a final photo.
2. The method for automatically processing the identification photo as claimed in claim 1, wherein: carrying out face recognition processing on the preset template picture and the first picture, and respectively obtaining a template face picture and a first face picture comprises the following steps:
recognizing the face parts of the preset template picture and the first picture based on a face recognition technology, and removing organs of the face parts;
and removing the face edge part of the face part through corrosion operation to obtain a template face picture and a first face picture.
3. The method for automatically processing the identification photo as claimed in claim 2, wherein: adjusting the color temperature and the color level of the first photo based on the difference value of the template face photo and the first face photo, and obtaining a second photo comprises:
acquiring a template color level middle value of the template face photo, and acquiring a first color level middle value of the first face photo;
performing a tone scale adjustment on the first photograph based on a difference between the template tone scale median and the first tone scale median;
acquiring a template color temperature value of the template face photo, and acquiring a first color temperature value of the first face photo;
and adjusting the color temperature of the first photo after the color level adjustment based on the difference between the color temperature value of the template and the first color temperature value to obtain a second photo.
4. The method for automatically processing the identification photo as claimed in claim 3, wherein: the method comprises the following steps of adjusting the color temperature and the color level of the first photo based on the difference between the template face photo and the first face photo, and obtaining a second photo:
adjusting the template photo and the second photo to a "Lab" format;
obtaining the mean values of three channels of 'L', 'a' and 'b' of the template picture, and obtaining the mean values of three channels of 'L', 'a' and 'b' of the second picture;
and performing white balance adjustment on the second picture based on the average difference between each channel of the template picture and each channel of the second picture.
5. The method for automatically processing the identification photo as claimed in claim 4, wherein: the method also comprises the following steps after the white balance adjustment is carried out on the second photo based on the average value difference between each channel of the template photo and each channel of the second photo:
and adjusting lightness color levels of the second photo after the white balance adjustment.
6. The method for automatically processing the identification photo as claimed in claim 5, wherein: performing black correction and white correction on the second photo to obtain a third photo, wherein the third photo comprises:
extracting low-brightness parts in the second photo;
performing black correction on the low-brightness part based on a dark channel algorithm;
determining a white mask region of the second photo after black correction;
and adjusting channel parameters of the white mask area based on an HLS format, and performing white correction on the second photo after black correction to obtain a third photo.
7. The method for automatically processing the identification photo as claimed in claim 6, wherein: highlight processing is carried out on the third photo, and obtaining a final photo comprises the following steps:
determining a highlight portion of the third photograph based on a "Lab" format;
and processing the highlight part based on a flood irrigation method to obtain a final photo.
8. The automated credential production system of claim 1, wherein: comprises that
A pre-processing module (1), the pre-processing module (1) being configured to resize a photograph;
the recognition module (2) is used for extracting a face photo in the photo;
the adjusting module (3) is used for adjusting the color level, the color temperature, the white balance and the brightness color level of the photo;
a correction module (4), wherein the correction module (4) is used for correcting black and white in the photo;
a highlight processing module (5), the highlight processing module (5) being used for processing highlight parts in a photo.
9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: when loaded and executed by a computer program, the processor is adapted to carry out the method of any of claims 1-7.
10. A computer-readable storage medium having a computer program stored therein, characterized in that: when loaded and executed by a processor, the computer program implementing the method of any one of claims 1-7.
CN202110809144.1A 2021-07-16 2021-07-16 Certificate photo automatic processing method, system, terminal equipment and storage medium Pending CN113591630A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110809144.1A CN113591630A (en) 2021-07-16 2021-07-16 Certificate photo automatic processing method, system, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110809144.1A CN113591630A (en) 2021-07-16 2021-07-16 Certificate photo automatic processing method, system, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113591630A true CN113591630A (en) 2021-11-02

Family

ID=78248244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110809144.1A Pending CN113591630A (en) 2021-07-16 2021-07-16 Certificate photo automatic processing method, system, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113591630A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114095656A (en) * 2021-11-17 2022-02-25 维沃移动通信有限公司 Image processing method and device and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000165906A (en) * 1998-11-20 2000-06-16 Victor Co Of Japan Ltd Method and device for automatic white balance control
CN103985098A (en) * 2014-05-27 2014-08-13 广州商景网络科技有限公司 Method and system for removing highlight of certificate image
CN105120167A (en) * 2015-08-31 2015-12-02 广州市幸福网络技术有限公司 Certificate picture camera and certificate picture photographing method
CN107463074A (en) * 2017-07-27 2017-12-12 珠海赛纳打印科技股份有限公司 Imaging method and imaging device
CN107665074A (en) * 2017-10-18 2018-02-06 维沃移动通信有限公司 A kind of color temperature adjusting method and mobile terminal
CN110913210A (en) * 2019-12-11 2020-03-24 易诚高科(大连)科技有限公司 Automatic main viewing image quality evaluation method based on standard data acquisition
CN112887582A (en) * 2019-11-29 2021-06-01 深圳市海思半导体有限公司 Image color processing method and device and related equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000165906A (en) * 1998-11-20 2000-06-16 Victor Co Of Japan Ltd Method and device for automatic white balance control
CN103985098A (en) * 2014-05-27 2014-08-13 广州商景网络科技有限公司 Method and system for removing highlight of certificate image
CN105120167A (en) * 2015-08-31 2015-12-02 广州市幸福网络技术有限公司 Certificate picture camera and certificate picture photographing method
CN107463074A (en) * 2017-07-27 2017-12-12 珠海赛纳打印科技股份有限公司 Imaging method and imaging device
CN107665074A (en) * 2017-10-18 2018-02-06 维沃移动通信有限公司 A kind of color temperature adjusting method and mobile terminal
CN112887582A (en) * 2019-11-29 2021-06-01 深圳市海思半导体有限公司 Image color processing method and device and related equipment
CN110913210A (en) * 2019-12-11 2020-03-24 易诚高科(大连)科技有限公司 Automatic main viewing image quality evaluation method based on standard data acquisition

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
纪春光等: "大学生图像信息采集过程中的证件照自动处理技术探讨", 信息与电脑(理论版), no. 10, pages 125 - 127 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114095656A (en) * 2021-11-17 2022-02-25 维沃移动通信有限公司 Image processing method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN107424198B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
US6728401B1 (en) Red-eye removal using color image processing
CN107451969B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
US8525847B2 (en) Enhancing images using known characteristics of image subjects
US8355574B2 (en) Determination of main object on image and improvement of image quality according to main object
CN108876742B (en) Image color enhancement method and device
JP2001126075A (en) Method and device for picture processing, and recording medium
CN107507144B (en) Skin color enhancement processing method and device and image processing device
US9378564B2 (en) Methods for color correcting digital images and devices thereof
CN103973977A (en) Blurring processing method and device for preview interface and electronic equipment
CN113344836B (en) Face image processing method and device, computer readable storage medium and terminal
CN108230407B (en) Image processing method and device
US10455123B2 (en) Method for increasing the saturation of an image, and corresponding device
Pei et al. Effective image haze removal using dark channel prior and post-processing
CN103065334A (en) Color cast detection and correction method and device based on HSV (Hue, Saturation, Value) color space
CN107396079A (en) White balance adjustment method and device
CN113436284A (en) Image processing method and device, computer equipment and storage medium
US10909351B2 (en) Method of improving image analysis
US9092889B2 (en) Image processing apparatus, image processing method, and program storage medium
CN113591630A (en) Certificate photo automatic processing method, system, terminal equipment and storage medium
JP5203159B2 (en) Image processing method, image processing system, and image processing program
JP4742068B2 (en) Image processing method, image processing system, and image processing program
CN112699760A (en) Face target area detection method, device and equipment
JP5327766B2 (en) Memory color correction in digital images
CN113781330B (en) Image processing method, device and electronic system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20211102

RJ01 Rejection of invention patent application after publication