CN111242074B - Certificate photo background replacement method based on image processing - Google Patents

Certificate photo background replacement method based on image processing Download PDF

Info

Publication number
CN111242074B
CN111242074B CN202010062489.0A CN202010062489A CN111242074B CN 111242074 B CN111242074 B CN 111242074B CN 202010062489 A CN202010062489 A CN 202010062489A CN 111242074 B CN111242074 B CN 111242074B
Authority
CN
China
Prior art keywords
certificate
processed
parameter
document
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.)
Active
Application number
CN202010062489.0A
Other languages
Chinese (zh)
Other versions
CN111242074A (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.)
Foshan University
Original Assignee
Foshan University
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 Foshan University filed Critical Foshan University
Priority to CN202010062489.0A priority Critical patent/CN111242074B/en
Publication of CN111242074A publication Critical patent/CN111242074A/en
Application granted granted Critical
Publication of CN111242074B publication Critical patent/CN111242074B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • 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/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • 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)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a certificate photo background replacement method based on image processing, which comprises the following steps: 1, obtaining a certificate to be processed; 2, extracting a plurality of face key points of the feature positions of the credentials to be processed; 3, correcting the face in the certificate to be processed and the edge area to be segmented according to the face key points; detecting the approximate edge of a human face in the certificate photo to be processed, performing morphological processing, and dividing a background area and a foreground area; 5, segmenting a background area, a foreground area and an uncertain area of the certificate to be processed by using threshold segmentation and edge segmentation; 6, performing color replacement on the foreground color of the certificate; 7, carrying out smooth treatment on the unnatural color replacement part in the certificate photo; and 8, increasing or decreasing pixels of the certificate photo to obtain the processed certificate photo. The invention can make the certificate photo processing faster, greatly save the time cost and reduce the memory loss of the smart phone or the computer.

Description

Certificate photo background replacement method based on image processing
Technical Field
The invention relates to the technical field of image processing, in particular to a certificate photo background replacement method based on image processing.
Background
Currently, there are three general approaches to the acquisition of credentials. One is to go to professional photography hall and shoot and acquire certificate photograph, and this kind of certificate photograph acquisition mode is comparatively traditional, and the shooting process is consuming time and labor, and its efficiency is lower. The other is shooting by a mobile phone, and then processing and acquiring credentials by using mobile phone P-graph software, however, the P-graph software occupies a large mobile phone memory, and the P-graph software has the problems of advertisement and garbage message pushing. The method for obtaining the credentials by using the professional computer image processing tool requires special study of a user, has high requirements on computer configuration, and is inconvenient for rapid and convenient processing of the credentials.
Through mass search, some typical prior art technologies are found, as shown in fig. 5, the patent with application number 201910164217.9 discloses a document photo background changing method, which solves the problems of time consuming and labor consuming of the prior art for photo background changing and realizes one-key document photo background changing. As shown in fig. 6, the patent application No. 201811032661.7 discloses a method, a system and a server for automatically replacing the background of a certificate photo, which reduces manual operation and effectively improves the efficiency of photo processing. As shown in fig. 7, the patent with application number 201810085180.6 discloses a method for automatically replacing the portrait background of a second-generation identity card photo, which can be used for the self-help photographing application equipment of the second-generation identity card and the certificate photo processing of the mobile phone mobile terminal.
As can be seen, for credential processing, there are many practical problems (e.g., saving time costs or reducing occupied memory, etc.) that need to be addressed in its practical application.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a certificate photo background replacement method based on image processing, which comprises the following specific technical scheme:
a certificate photo background replacement method based on image processing comprises the following steps:
step 1, obtaining a certificate to be processed;
step 2, extracting a plurality of face key points of the feature positions of the credentials to be processed;
step 3, correcting the face in the certificate to be processed and the edge area to be segmented according to the face key points;
step 4, detecting the approximate edge of the face in the certificate to be processed and carrying out morphological processing to divide a background area and a foreground area;
step 5, segmenting a background area, a foreground area and an uncertain area of the certificate to be processed by using threshold segmentation and edge segmentation;
step 6, performing color replacement on the foreground color of the certificate photo obtained in the step 5;
step 7, carrying out smooth treatment on the unnatural color replacement part in the certificate photo obtained in the step 6;
and 8, increasing or decreasing pixels of the certificate illumination obtained in the step 7 to obtain the processed certificate illumination.
Optionally, in step 1, the certificate to be processed is obtained by shooting through a mobile phone or a camera.
Optionally, in step 2, a plurality of face key points of the feature positions of the credentials to be processed are extracted by a target detection algorithm.
Optionally, in step 6, the foreground color of the credential illumination obtained in step 5 is color-replaced by a mask function.
Optionally, in step 7, the unnatural color replacement part in the certificate obtained in step 6 is rounded through corrosion treatment and expansion treatment.
Optionally, in step 8, the document obtained in step 7 is subjected to pixel scaling by a scaling function.
The beneficial effects obtained by the invention include:
1. the certificate illumination processing can be faster by calling image recognition algorithms such as threshold segmentation, key point detection, mask function processing and the like, and the time cost is greatly saved.
2. Compared with the quick and short tens of M image matting and beautifying software, the certificate photo background replacing method based on image processing only comprises 8 steps and a plurality of image recognition processing algorithms, occupies little memory, and can greatly reduce the memory loss of a smart phone or a computer.
3. The split and processed certificate illumination is smoothly processed and the pixels are changed through Gaussian noise reduction, edge processing, scaling processing and other methods, so that the effect of the certificate illumination is better and meets the requirements of users.
Drawings
The invention will be further understood from the following description taken in conjunction with the accompanying drawings, with emphasis instead being placed upon illustrating the principles of the embodiments.
FIG. 1 is a schematic flow chart of a method for replacing a background of a certificate based on image processing in an embodiment of the invention;
FIG. 2 is a schematic diagram of a face key point position according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of face anchor point correction in an embodiment of the present invention;
FIG. 4 is a schematic view of the effects of segmenting background, foreground and uncertainty regions of a credential to be processed using threshold segmentation and edge segmentation in an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a background replacement method for credentials in the prior art;
FIG. 6 is a schematic flow diagram of a method, system and server for automatic background replacement of credentials in the prior art;
fig. 7 is a schematic flow chart of a portrait background intelligent full-automatic replacement method for a second-generation identity card photo in the prior art.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the following examples thereof; it should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention. Other systems, methods, and/or features of the present embodiments will be or become apparent to one with skill in the art upon examination of the following detailed description. It is intended that all such additional systems, methods, features and advantages be included within this description, be within the scope of the invention, and be protected by the accompanying claims. Additional features of the disclosed embodiments are described in, and will be apparent from, the following detailed description.
The same or similar reference numbers in the drawings of embodiments of the invention correspond to the same or similar components; in the description of the present invention, it should be understood that, if there is an azimuth or positional relationship indicated by terms such as "upper", "lower", "left", "right", etc., based on the azimuth or positional relationship shown in the drawings, it is only for convenience of describing the present invention and simplifying the description, but it is not indicated or implied that the apparatus or component referred to must have a specific azimuth, be constructed and operated in a specific azimuth, and thus terms describing the positional relationship in the drawings are merely illustrative and should not be construed as limitations of the present patent, and specific meanings of the terms described above may be understood by those skilled in the art according to specific circumstances.
The invention relates to a certificate photo background replacement method based on image processing, which is based on the following embodiments according to the teaching shown in the attached drawings:
embodiment one:
a credential photograph is a photograph of a credential that is used to verify the identity of a holder, and has a fixed background and clothing requirements compared to other photographs. Because of the needs of various certificates, the certificates have wide markets and no small value. With the improvement of the living standard of people, more and more people need to transact various certificates, such as: passports, port australian passes, drivers' licenses, etc., and thus the market prospects for the license are not so great, with increasing market value.
There are three general ways to obtain credentials: one would be to go to a fixed photo studio by a witness, one would be to use mobile phone software for processing, such as a beauty show, a most beautiful certificate, etc., and the other would be by a professional computer image processing tool, such as Photoshop, etc.
The first way, photography often requires going to a fixed photography by a witness, the process of taking is time consuming and labor intensive, and the resulting photographs sometimes do not meet the requirements, resulting in the issuing authority having to set up a specialized studio at the department unit. Therefore, the traditional shooting mode is not only wasteful of manpower, but also can not improve the efficiency of certificate handling, and is gradually eliminated in the current informatization age.
In the second way, since the information age is entered, the mobile phone has more and more powerful functions and more clear shooting image quality, millions of pixels and even tens of millions of pixels are entered, so that the requirements of photos in credentials can be completely met, and many p-picture software appears, which can help users to synthesize credentials, but the software has a problem that the occupied memory is too large, tens of M and hundreds of M occupy memory, and messages are always pushed, so that people feel tired.
In the third way, in the age of rapid development of computer technology, a powerful image processing tool, photoshop, appears in a computer. The tool has complete functions on image processing, but needs special learning to know the operation of the software, and the software has too high requirement on computer configuration and is easy to cause the computer to be blocked during operation.
To this end, as shown in fig. 1, the present invention provides a method for replacing a background of a document based on image processing, comprising the steps of:
step 1, obtaining a certificate to be processed;
and 2, extracting a plurality of face key points of the feature positions of the credentials to be processed. As shown in fig. 2, the face key points include: the main contour of the face, eyes, nose and mouth feature positions. And the basic characteristics of the face of the user can be sketched through the key points of the face. Specifically, 68 human face key points are provided.
And 3, correcting the face in the certificate to be processed and the edge area to be segmented according to the face key points. Fig. 3 is a schematic diagram of correction of a face positioning point according to an embodiment of the present invention, where the correction process is divided into three parts: affine transformation matrix calculation, detection of whether transformation is out of range, and execution of affine transformation.
Affine transformation matrix calculation: determining that the longitudinal coordinates of the upper left corner point and the upper right corner point are the same according to the first target and the second target, wherein the distance from the upper edge to the middle point of the bottom is a set value, and determining that the distance from the longitudinal coordinates of the middle point of the bottom to the lower edge is a set value; and determining that the horizontal coordinate of the midpoint of the bottom is half of the width of the clipping diagram according to the target III, and determining the distance from the left and right vertexes to the center line according to the Euclidean distance proportion and the head proportion of the left and right vertexes to the head vertexes in the original diagram. By determining all coordinates of three face anchor points in the rectified image, an affine transformation matrix can be calculated.
Detecting whether the transformation crosses the boundary: when photographing, if the top of the head of the person is too close to the upper edge of the picture, transformation is still performed according to the previous transformation mode, and then a black edge appears on the top of the head. I.e. the rectified image contains some areas outside the original image before transformation. Specifically, it is necessary to detect whether the transformation is out of range before performing the position correction. The detecting whether the transformation crosses the boundary comprises: and calculating an inverse transformation matrix according to the positions before and after the feature point transformation, and detecting whether the original face image is completely contained in the original image after the full-image inverse transformation. For example: by performing inverse transformation on 4 vertexes (corresponding to an upper left vertex, an upper right vertex, a lower left vertex and a lower right vertex) of the corrected image, observing whether the transformed 4-point coordinates have the phenomenon that the horizontal coordinates are smaller than 0 or larger than the width of the original image and the longitudinal coordinates are smaller than 0 or larger than the height of the original image, if so, the server does not meet the cutting requirement of the corrected transformation, and determines that the corrected image does not meet the requirement and is unqualified.
Performing affine transformation: and when the detection is qualified, namely, when no out-of-range condition exists, executing forward affine transformation on the original image. When the face position is corrected, the face needs to be adjusted to a proper size and placed at a proper position of the picture. Taking the top of the head as an example, the upper boundary of the picture cannot be far away from the upper boundary of the picture, and the upper boundary cannot be clung to or surpassed by the upper boundary, so that the accuracy of the human face positioning point is very important. Referring to fig. 2 again, as shown in fig. 2, 68 feature points under the forehead of the human face can be accurately located, but the location of the vertex of the head cannot be directly detected due to the reasons such as hair. It is therefore necessary to determine the position of the head vertex. The vertex is used for describing the highest position height of the portrait area in the picture, and if the area of the portrait position in the picture can be separated from the background area, the highest point of the character, namely the vertex, can be well positioned.
To determine the position of the head vertex, it is first necessary to estimate the head vertex position. Specifically, after analyzing a large number of samples, the distance from the top of the head to the eyebrow is generally close to the distance from the chin to the eyebrow, and the symmetrical position of point No. 9 (chin point) with respect to point No. 28 (eyebrow point) in fig. 2 can be used to estimate the position of the top of the head.
However, in actual situations, the forehead width of the person is not constant, the eyebrow is not exactly positioned at the middle point of the top of the head and the chin, and the person hair ornaments are added, so that the position of the head vertex is often not exactly estimated directly by the estimation mode that the distance from the top of the head to the eyebrow is close to the distance from the chin to the eyebrow. But the estimated position of the vertex of the head still plays a role in calibrating the face area before the position of the vertex of the head is accurately calculated. In addition, after calculating the accurate head vertex positioning point, the reliability of the calculated value needs to be checked by using the estimated position of the head vertex.
Step 4, detecting the approximate edge of the face in the certificate to be processed and carrying out morphological processing to divide a background area and a foreground area;
step 5, segmenting the background area, the foreground area and the uncertain area of the certificate to be processed by using threshold segmentation and edge segmentation, as shown in fig. 4.
Step 6, performing color replacement on the foreground color of the certificate photo obtained in the step 5;
step 7, carrying out smooth treatment on the unnatural color replacement part in the certificate photo obtained in the step 6;
and 8, increasing or decreasing pixels of the certificate illumination obtained in the step 7 to obtain the processed certificate illumination.
The 8 steps are packaged into small software, so that manual operation can be reduced, time cost is saved, and the efficiency of credential illumination processing is effectively improved.
Embodiment two:
the embodiment provides a certificate photo background replacement method based on image processing, which comprises the following steps:
step 1, shooting by a mobile phone or a camera to obtain a certificate photo to be processed;
step 2, importing the certificate to be processed into a system, and extracting a plurality of face key points of the characteristic positions of the faces in the certificate to be processed by using a target detection algorithm;
step 3, correcting the face in the certificate to be processed and the edge area to be segmented according to the positions of the key points of the face;
step 4, detecting the approximate edge of the face in the certificate to be processed and carrying out morphological processing to divide a background area and a foreground area;
step 5, segmenting a background area, a foreground area and an uncertain area of the certificate to be processed by using threshold segmentation and edge segmentation;
step 6, performing color replacement on the foreground color of the certificate photo obtained in the step 5 through a mask function;
step 7, carrying out smooth treatment on the unnatural color replacement part in the certificate photo obtained in the step 6 through corrosion treatment and expansion treatment;
and 8, increasing or decreasing pixels of the certificate illumination obtained in the step 7 through a scaling function to obtain the processed certificate illumination.
The certificate illumination processing can be faster by calling image recognition algorithms such as threshold segmentation, key point detection, mask function processing and the like, and the time cost is greatly saved. Compared with the quick and short tens of M image matting and beautifying software, the certificate photo background replacing method based on image processing only comprises 8 steps and a plurality of image recognition processing algorithms, occupies little memory, and can greatly reduce the memory loss of a smart phone or a computer.
In addition, the split and processed certificate illumination is smoothly processed and pixels are changed through Gaussian noise reduction, edge processing, scaling processing and other methods, so that the effect of the certificate illumination is better and meets the requirements of users.
Embodiment III:
the embodiment provides a certificate photo background replacement method based on image processing, which comprises the following steps:
step 1, shooting by a mobile phone or a camera to obtain a certificate photo to be processed;
step 2, importing the certificate to be processed into a system, and extracting a plurality of face key points of the characteristic positions of the faces in the certificate to be processed by using a target detection algorithm;
step 3, correcting the face in the certificate to be processed and the edge area to be segmented according to the positions of the key points of the face;
step 4, detecting the approximate edge of the face in the certificate to be processed and carrying out morphological processing to divide a background area and a foreground area;
step 5, segmenting a background area, a foreground area and an uncertain area of the certificate to be processed by using threshold segmentation and edge segmentation;
step 6, performing color replacement on the foreground color of the certificate photo obtained in the step 5 through a mask function;
step 7, carrying out smooth treatment on the unnatural color replacement part in the certificate photo obtained in the step 6 through corrosion treatment and expansion treatment;
and 8, increasing or decreasing pixels of the certificate illumination obtained in the step 7 through a scaling function to obtain the processed certificate illumination.
The certificate illumination processing can be faster by calling image recognition algorithms such as threshold segmentation, key point detection, mask function processing and the like, and the time cost is greatly saved. Compared with the quick and short tens of M image matting and beautifying software, the certificate photo background replacing method based on image processing only comprises 8 steps and a plurality of image recognition processing algorithms, occupies little memory, and can greatly reduce the memory loss of a smart phone or a computer.
In addition, the split and processed certificate illumination is smoothly processed and pixels are changed through Gaussian noise reduction, edge processing, scaling processing and other methods, so that the effect of the certificate illumination is better and meets the requirements of users.
Before extracting a plurality of face key points of characteristic positions of faces in a certificate to be processed by using a target detection algorithm, gaussian noise reduction processing is performed on the certificate. The Gaussian noise reduction processing method specifically comprises the following steps:
the first step: initialization parameters and set target complexity C budget The method comprises the steps of carrying out a first treatment on the surface of the Assume that there are M parameters P to be optimized 1 ,P 2 ,…,P m ,…,P M The mth parameter has n m Discrete values of k m For the mth parameter P m Value index (km=1 to n) m A certain value of the above), the value of each parameter is recorded as V km . Taking the default value of the algorithm as the initial value of parameter tuning, and calculating the performance q and the complexity C of the default value combination
Secondly, calculating EER of each current parameter; for the current parameter combination, its performance q (k m ) And complexity C (k) m ). Under the condition of keeping the values of other parameters unchanged, changing the value of one parameter every time, changing the current value into the candidate value, and calculating the performance q (k' m ) And complexity C (k' m ) The method comprises the steps of carrying out a first treatment on the surface of the The ratio EER of the complexity and performance changes of the current value and its candidate value of each parameter, i.e., τ (k) m )=Δq(k m )/ΔC(k’ m );
Third step, τ (k) for each parameter m ) Sorting in a descending order; for τ (k) 1 ),τ(k 2 ),…,τ(k M ) After sorting, the index is changed from (1, 2, …, M) to (l) 1 ,l 2 ,…,l M ) Here (l) 1 ,l 2 ,…,l M ) A new ordering of (1, 2, …, M), i.e. l 1 Index for the parameter with the maximum energy efficiency ratio. Assuming i as the currently optimized parameter index, i=l 1 Performing first parameter value optimization P i
Calculating algorithm complexity C 'and performance q' of a parameter combination formed by candidate values of the ith parameter;
fifth, judging whether the calculation complexity C' is larger than the target complexity C budget The method comprises the steps of carrying out a first treatment on the surface of the If the condition is not satisfied, indicating that the current adjustment is effective, further adjusting according to the trend, and changing the ith parameter P i Change the current value of (C) to its candidate value, V ki =V k'i (i.e. k i =k’ m ) Entering a second step to continue adjustment; if the condition is met, ending the parameter value optimizing process, and outputting the current parameter values and the certificate to be processed after the noise reduction processing.
The certificate is subjected to noise reduction treatment through the steps, so that the complexity of an algorithm and the occupied memory can be greatly reduced on the basis of less performance and quality loss of the certificate.
In summary, the method for replacing the background of the certificate photo based on image processing disclosed by the invention has the following beneficial technical effects:
1. the certificate illumination processing can be faster by calling image recognition algorithms such as threshold segmentation, key point detection, mask function processing and the like, and the time cost is greatly saved.
2. Compared with the quick and short tens of M image matting and beautifying software, the certificate photo background replacing method based on image processing only comprises 8 steps and a plurality of image recognition processing algorithms, occupies little memory, and can greatly reduce the memory loss of a smart phone or a computer.
3. The split and processed certificate illumination is smoothly processed and the pixels are changed through Gaussian noise reduction, edge processing, scaling processing and other methods, so that the effect of the certificate illumination is better and meets the requirements of users.
While the invention has been described above with reference to various embodiments, it should be understood that many changes and modifications can be made without departing from the scope of the invention. That is, the methods, systems, and devices discussed above are examples, and various configurations may omit, replace, or add various procedures or components as appropriate. For example, in alternative configurations, the methods may be performed in a different order than described and/or various components may be added, omitted, and/or combined. Moreover, features described with respect to certain configurations may be combined in various other configurations, such as different aspects and elements of the configurations may be combined in a similar manner. Furthermore, as the technology evolves, elements therein may be updated, i.e., many of the elements are examples, and do not limit the scope of the disclosure or claims.
Specific details are given in the description to provide a thorough understanding of exemplary configurations involving implementations. However, the configuration may be practiced without these specific details, such as well-known circuits, processes, algorithms, structures, and techniques have been shown without unnecessary detail in order to avoid obscuring the configuration. This description provides only an example configuration and does not limit the scope, applicability, or configuration of the claims. Rather, the foregoing description of the configuration will provide those skilled in the art with an enabling description for implementing the described techniques. Various changes may be made in the function and arrangement of elements without departing from the spirit or scope of the disclosure.
It is intended that the foregoing detailed description be regarded as illustrative rather than limiting, and that it be understood that it is the following claims, including all equivalents, that are intended to define the spirit and scope of this invention. The above examples should be understood as illustrative only and not limiting the scope of the invention. Various changes and modifications to the present invention may be made by one skilled in the art after reading the teachings herein, and such equivalent changes and modifications are intended to fall within the scope of the invention as defined in the appended claims.

Claims (5)

1. The document background replacement method based on image processing is characterized by comprising the following steps:
step 1, obtaining a certificate to be processed;
step 2, extracting a plurality of face key points of the feature positions of the credentials to be processed;
step 3, correcting the face in the certificate to be processed and the edge area to be segmented according to the face key points;
step 4, detecting the edge of a human face in the certificate to be processed and carrying out morphological processing to divide a background area and a foreground area;
step 5, segmenting a background area, a foreground area and an uncertain area of the certificate to be processed by using threshold segmentation and edge segmentation;
step 6, performing color replacement on the foreground color of the certificate photo obtained in the step 5;
step 7, carrying out smooth treatment on the unnatural color replacement part in the certificate photo obtained in the step 6;
step 8, increasing or decreasing pixels of the certificate illumination obtained in the step 7 to obtain the treated certificate illumination;
in step 2, a plurality of face key points of feature positions of a document to be processed are extracted through a target detection algorithm, and before the plurality of face key points of feature positions of faces in the document to be processed are extracted through the target detection algorithm, gaussian noise reduction processing is performed on the document, wherein the gaussian noise reduction processing method specifically comprises the following steps:
the first step: initialization parameters and set target complexity C budget The method comprises the steps of carrying out a first treatment on the surface of the Assume that there are M parameters P to be optimized 1 ,P 2 ,…,P m ,…,P M The mth parameter has n m Discrete candidate values k m For the mth parameter P m The value of each parameter is recorded as V km Taking the default value of the algorithm as an initial value of parameter tuning, and calculating the performance q and the complexity C of the default value combination;
secondly, calculating EER of each current parameter; for the current parameter combination, its performance q (k m ) And complexity C (k) m ) Under the condition that the values of other parameters are kept unchanged, changing the value of one parameter every time, changing the current value into the candidate value, and calculating the performance q (k) , m ) And complexity C (k) , m ) The method comprises the steps of carrying out a first treatment on the surface of the The ratio EER of the complexity and performance changes of the current value and its candidate value of each parameter, i.e., τ (k) m )=Δq(k m )/ΔC(k , m );
Third step, τ (k) for each parameter m ) Sorting in a descending order; for τ (k) 1 ) ,τ(k 2 ) ,…,τ(k M ) After sorting, the index is changed from original 1,2, …, M toHere->A certain new ordering of 1,2, …, M, i.e. +.>For the parameter index with the maximum energy efficiency ratio, let i be the currently optimized parameter index, i= =>Performing first parameter value optimization P i
Calculating algorithm complexity C 'and performance q' of a parameter combination formed by candidate values of the ith parameter;
fifth, judging whether the calculation complexity C' is larger than the target complexity C budget The method comprises the steps of carrying out a first treatment on the surface of the If the condition is not satisfied, change the ith parameter P i Change the current value of (C) to its candidate value, V ki =V k'i Entering a second step to continue adjustment; if the condition is met, ending the parameter value optimizing process, and outputting the current parameter values and the certificate to be processed after the noise reduction processing.
2. The method for replacing background of document photo based on image processing as claimed in claim 1, wherein in step 1, the document photo to be processed is obtained by photographing through a mobile phone or a camera.
3. The image processing-based document background replacement method according to claim 2, wherein in step 6, the foreground color of the document obtained in step 5 is color-replaced by a mask function.
4. The method for replacing background of document photo based on image processing as claimed in claim 3, wherein in step 7, the unnatural color replacement part of the document photo obtained in step 6 is rounded by etching and swelling.
5. The image processing-based document illumination background replacement method of claim 4, wherein in step 8, the document illumination obtained in step 7 is subjected to pixel scaling by a scaling function.
CN202010062489.0A 2020-01-20 2020-01-20 Certificate photo background replacement method based on image processing Active CN111242074B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010062489.0A CN111242074B (en) 2020-01-20 2020-01-20 Certificate photo background replacement method based on image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010062489.0A CN111242074B (en) 2020-01-20 2020-01-20 Certificate photo background replacement method based on image processing

Publications (2)

Publication Number Publication Date
CN111242074A CN111242074A (en) 2020-06-05
CN111242074B true CN111242074B (en) 2023-11-07

Family

ID=70879611

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010062489.0A Active CN111242074B (en) 2020-01-20 2020-01-20 Certificate photo background replacement method based on image processing

Country Status (1)

Country Link
CN (1) CN111242074B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113780040A (en) * 2020-06-19 2021-12-10 北京沃东天骏信息技术有限公司 Lip key point positioning method and device, storage medium and electronic equipment
CN113837287B (en) * 2021-09-26 2023-08-29 平安科技(深圳)有限公司 Certificate abnormal information identification method, device, equipment and medium
CN114253451A (en) * 2021-12-21 2022-03-29 咪咕音乐有限公司 Screenshot method and device, electronic equipment and storage medium
CN114140655A (en) * 2022-01-29 2022-03-04 深圳市中讯网联科技有限公司 Image classification method and device, storage medium and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109344724A (en) * 2018-09-05 2019-02-15 深圳伯奇科技有限公司 A kind of certificate photo automatic background replacement method, system and server
CN110047053A (en) * 2019-04-26 2019-07-23 腾讯科技(深圳)有限公司 Portrait Picture Generation Method, device and computer equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109344724A (en) * 2018-09-05 2019-02-15 深圳伯奇科技有限公司 A kind of certificate photo automatic background replacement method, system and server
CN110047053A (en) * 2019-04-26 2019-07-23 腾讯科技(深圳)有限公司 Portrait Picture Generation Method, device and computer equipment

Also Published As

Publication number Publication date
CN111242074A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN111242074B (en) Certificate photo background replacement method based on image processing
CN109952594B (en) Image processing method, device, terminal and storage medium
US8170350B2 (en) Foreground/background segmentation in digital images
US8577099B2 (en) Method, apparatus, and program for detecting facial characteristic points
US8331619B2 (en) Image processing apparatus and image processing method
CN109344727B (en) Identity card text information detection method and device, readable storage medium and terminal
CN108537782B (en) Building image matching and fusing method based on contour extraction
EP1918872A2 (en) Image segmentation method and system
CN105243371A (en) Human face beauty degree detection method and system and shooting terminal
CN106326823B (en) Method and system for obtaining head portrait in picture
CN108810406B (en) Portrait light effect processing method, device, terminal and computer readable storage medium
WO2006081018A1 (en) Object-of-interest image capture
WO2019223068A1 (en) Iris image local enhancement method, device, equipment and storage medium
WO2022135574A1 (en) Skin color detection method and apparatus, and mobile terminal and storage medium
CN107153806B (en) Face detection method and device
CN112991159B (en) Face illumination quality evaluation method, system, server and computer readable medium
CN114565508A (en) Virtual reloading method and device
CN116309488A (en) Image definition detection method, device, electronic equipment and readable storage medium
RU2329535C2 (en) Method of automatic photograph framing
CN115514887A (en) Control method and device for video acquisition, computer equipment and storage medium
JP2001167273A (en) Method and device for detecting face and computer readable medium
CN114998115A (en) Image beautification processing method and device and electronic equipment
CN113724130B (en) Width-variable portrait fine matting method, device, equipment and storage medium
Ma et al. A lip localization algorithm under variant light conditions
CN117523233A (en) Certificate photo similarity comparison method, device, equipment and storage 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