WO2021189850A1 - 证件鉴伪方法、装置、设备及可读存储介质 - Google Patents

证件鉴伪方法、装置、设备及可读存储介质 Download PDF

Info

Publication number
WO2021189850A1
WO2021189850A1 PCT/CN2020/125010 CN2020125010W WO2021189850A1 WO 2021189850 A1 WO2021189850 A1 WO 2021189850A1 CN 2020125010 W CN2020125010 W CN 2020125010W WO 2021189850 A1 WO2021189850 A1 WO 2021189850A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
average
document
difference
gradient
Prior art date
Application number
PCT/CN2020/125010
Other languages
English (en)
French (fr)
Inventor
张国辉
雷晨雨
宋晨
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021189850A1 publication Critical patent/WO2021189850A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/20Testing patterns thereon
    • G07D7/2008Testing patterns thereon using pre-processing, e.g. de-blurring, averaging, normalisation or rotation
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/20Testing patterns thereon
    • G07D7/2016Testing patterns thereon using feature extraction, e.g. segmentation, edge detection or Hough-transformation

Definitions

  • This application relates to the field of image processing technology, and in particular to a method, device, device, and readable storage medium for authenticating a certificate.
  • the embodiment of the present application provides a method for authenticating a certificate.
  • the method for authenticating a certificate includes the following steps:
  • This application also provides a certificate authentication device, which includes:
  • the obtaining module is used to obtain the first document picture and the second document picture taken under different light of the document to be authenticated, and to obtain the first document picture and the second document picture according to the preset authentication point of the document to be authenticated. Extracting the first forgery verification image and the second forgery verification image from the second certificate picture;
  • a determining module configured to determine a plurality of image gradient variances, gray average differences, and brightness average differences according to the first authenticating map and the second authenticating map;
  • the authentication module is configured to authenticate the document to be authenticated according to a plurality of the image gradient variances, the average gray level difference and the average brightness difference.
  • the application also provides a certificate authentication device, which includes a memory, a processor, and a certificate authentication program stored on the memory and running on the processor, and the certificate authentication program is The following steps are implemented when the processor is executed:
  • the present application also provides a readable storage medium having a certificate authentication program stored on the readable storage medium, and the following steps are implemented when the certificate authentication program is executed by a processor:
  • FIG. 1 is a schematic diagram of the structure of a credential authentication device in a hardware operating environment involved in a solution according to an embodiment of the application;
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for authenticating a certificate for an application
  • Fig. 3 is a schematic diagram of functional modules of a preferred embodiment of the credential authentication device of this application.
  • Fig. 1 is a schematic diagram of the structure of a credential authentication device in a hardware operating environment involved in a solution of an embodiment of the present application.
  • the forgery verification device in the examples of this application can be a PC, or a portable terminal device such as a tablet computer and a portable computer.
  • the certificate authentication device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • the structure of the document authentication device shown in FIG. 1 does not constitute a limitation on the document authentication device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components.
  • the layout of the components does not constitute a limitation on the document authentication device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components. The layout of the components.
  • the memory 1005 which is a readable storage medium, may include an operating system, a network communication module, a user interface module, and a detection program.
  • the network interface 1004 is mainly used to connect to the back-end server and communicate with the back-end server;
  • the user interface 1003 is mainly used to connect to the client (user side) and communicate with the client;
  • the processor 1001 can be used to call the detection program stored in the memory 1005 and perform the following operations:
  • the step of determining a plurality of image gradient variances, gray average differences, and brightness average differences according to the first authenticating map and the second authenticating map includes:
  • the average gray-scale difference and the average luminance difference are generated.
  • the step of determining a plurality of gradient variances of the images according to each of the first sub-pictures and each of the second sub-pictures includes:
  • vector calculation is performed on the pixels in each of the first sub-pictures to obtain a plurality of first gradient vectors
  • vector calculation is performed on the pixels in each of the second sub-pictures to obtain multiple second gradient vectors
  • a variance calculation is performed on the relative values of the multiple gradient vectors to generate multiple variances of the image gradients.
  • the step of generating the average gray level difference value and the average brightness difference value according to the pixels in the first authenticating image and the pixels in the second authenticating image includes:
  • the first gradient image and the first gradient image of the first forgery image and the second forgery image in the preset directions are calculated based on edge detection.
  • the gray average difference value is generated.
  • the processor 1001 may be used to call The detection program is stored in the memory 1005, and the following operations are performed:
  • the step of authenticating the document to be authenticated according to a plurality of the image gradient variances, the gray average difference value, and the brightness average difference value includes:
  • the multiple of the image gradient variances are respectively compared with a first preset threshold, the target image gradient variance of the multiple of the image gradient variances that is greater than the first preset threshold is determined, and the variance of the target image gradient variance is calculated quantity;
  • the step of authenticating the document to be authenticated according to the number of variances, the minimum value, the average gray level difference and the average brightness difference includes:
  • the average gray level difference is not less than the second preset difference, or the average brightness difference is not less than the third preset difference, then it is determined whether the variance amount is greater than or equal to the preset amount, and the Whether the minimum value is greater than the second preset threshold;
  • the number of variances is less than a preset number, and the minimum value is not greater than a second preset threshold, it is determined that the document to be forged is a false document.
  • the first embodiment of the present application provides a schematic flow chart of a method for authenticating a certificate.
  • the certificate authentication method includes the following steps:
  • Step S10 Obtain the first document picture and the second document picture taken under different light of the document to be authenticated, and according to the preset authentication point of the document to be authenticated, the first document picture and the Extract the first forgery verification image and the second forgery verification image from the second credential image;
  • the certificate authentication method in this embodiment is applied to the server, and the authenticity of the certificate is authenticated by the server.
  • the document that needs to be authenticated is used as the document to be authenticated, and the document pictures of the document to be authenticated under different lights are taken and uploaded to the server.
  • the ID pictures under different lights include pictures taken with the flash turned off and pictures taken with the flash turned on.
  • the server uses the picture taken with the flash turned off as the first certificate picture, and the picture taken with the flash turned on as the second certificate picture.
  • the first credential picture and the second credential picture can also be stored in a blockchain node.
  • the intermediate information and final information obtained can also be stored in a node of a blockchain.
  • the blockchain referred to in this embodiment is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • a preset authentication point for authentication is preset in the document to be authenticated, and the preset authentication point may be a set specific image, color, or raster area; this embodiment takes the raster area as an example. illustrate.
  • the white oval area set in the lower left corner is the grating area.
  • Both the first authentication image and the second authentication image include preset authentication points, and both of them are equivalent to the same position coordinates and size of the document to be authenticated; that is, the position of the first authentication image in the document to be authenticated
  • the position coordinates are the same as the position coordinates of the second authentication map in the document to be authenticated, so that the size formed by the respective position coordinates is also the same, such as a size of 170*110, to pass through the same area in the document to be authenticated , To deal with the authentication of falsified documents.
  • Step S20 Determine a plurality of image gradient variances, gray average differences, and brightness average differences according to the first authenticating map and the second authenticating map;
  • the pixels of the first authentication image and the pixels of the second authentication are respectively calculated and processed to obtain multiple image gradient variances, average grayscale differences, and average brightness differences.
  • the image gradient variance is the result of the variance calculation of the relative values of the gradient vectors obtained by the pixels in the first authenticating image and the pixels in the second authenticating image;
  • the average gray level difference is the first authenticating image and the second authenticating image.
  • the pixel average value of the false image is processed by gray scale and the result of the difference operation, and the average brightness difference is the result of the difference operation after the pixel average processing of the first false image and the second false image.
  • the pixels in the first authentication image and the pixels in the first authentication image may be difficult to accurately reflect their respective characteristics due to the influence of light.
  • the pixels of the first authentication image and the pixels of the second authentication are calculated, it is set to pass through the area of the document to be authenticated outside the preset authentication point to include the preset authentication point.
  • Regional correction mechanism before the step of determining the gradient variance, the average gray level difference, and the average brightness difference of the multiple images according to the first authentication map and the second authentication map, the steps include:
  • Step a extract a first correction image from the first document image according to the first authentication image, and extract a second correction image from the second image according to the second authentication image;
  • the first correction image is extracted from the first image, and the first correction image is located below the first authentication image, and the size is relative to The pseudo image is relatively small.
  • the size of the first modified image may be 170*55.
  • the second correction image is extracted from the second image.
  • the second correction image is located below the second authentication image, and the size is relative to the second image.
  • the pseudo image is small.
  • the size of the second modified image can be 170*55.
  • Step b After performing grayscale processing on the first correction map and the second correction map, calculate the first correction mean value of each pixel in the first correction map, and calculate the second correction of each pixel in the second correction map Mean
  • first correction map and the second correction map are respectively subjected to gray scale processing, and the average value of each pixel in the first correction map after the gray scale processing is calculated to obtain the first corrected average value.
  • the average value of each pixel in the second corrected image after the gray-scale processing is calculated to obtain the second corrected average value.
  • Step c Determine a first pixel smaller than the first corrected average value among the pixels of the first forgery image, and a second pixel smaller than the second corrected average value among the pixels of the second forgery image ;
  • each pixel in the first forgery image is compared with the first corrected average value to determine the first pixel in each pixel that is smaller than the first corrected average value.
  • each pixel in the second forgery image is compared with the second corrected average value to determine the second pixel in each pixel that is smaller than the second corrected average value.
  • Step d Calling a preset pixel value to correct the first pixel and the second pixel respectively, so as to update the first authenticating map and the second authenticating map.
  • a preset pixel value for correction such as a pixel value of 0, is preset. After determining each first pixel in the first authenticating image and each second pixel in the second authenticating image, call the preset pixel value, and use the preset pixel value to correct the first pixel. The pixel value of the pixel is replaced with the preset pixel value to obtain the updated first counterfeit image. Similarly, the second pixel is corrected with the preset pixel value, and the pixel value of the second pixel is replaced with the preset pixel value to obtain the updated second counterfeit image. Further, the pixels in the updated first authenticating image and the pixels in the updated second authenticating image are calculated to obtain multiple image gradient variances, average gray-scale differences, and average brightness differences.
  • Step S30 Authenticate the document to be authenticated according to the plurality of image gradient variances, the average gray level difference and the average brightness difference.
  • multiple image gradients, average gray level differences, and average brightness differences reflect the authenticity of the document to be authenticated in terms of the contour difference, color change, and brightness change of the area where the preset authentication point is located; According to the variance of multiple image gradients, the average gray level difference and the average brightness difference, the authentication of the document to be authenticated is realized.
  • the document to be authenticated with authentication requirements first obtain the first document picture and the second document picture taken under different light, and according to the preset settings on the document to be authenticated
  • the first authentication image and the second authentication image are extracted from the first ID image and the second ID image respectively; and then based on the first authentication image and the second authentication image, multiple image gradient variances are determined , The average gray-scale difference and the average brightness difference; and then according to the multiple image gradient variance, the average gray-scale difference and the average brightness difference, the authenticating document is authenticated.
  • the authentication process is only related to The light is related to avoid the influence of other factors and improve the accuracy of forgery.
  • the steps of determining the gradient variance, the average gray level difference, and the average brightness difference of multiple images include:
  • Step S21 Extract a first sub-picture from at least two areas of the four corners of the first authenticating image, and extract a second sub-picture from at least two areas of the four-corner areas of the second authenticating image.
  • a plurality of image gradient variances are generated based on the pixels in the position areas of the four corners of the first authenticating image and the pixels in the position areas of the four corners of the second authenticating image.
  • a preset area size is set in advance according to requirements, such as 45*45.
  • the preset area size at least two areas of the four corner areas of the first forgery image are extracted respectively, and the extracted size is At least two first sub-pictures with a preset area size.
  • the extraction operation of all four regions is taken as an example for description, that is, four first sub-pictures are extracted.
  • the four first sub-pictures are respectively derived from the upper left corner, the lower left corner, the upper right corner and the lower right corner of the first counterfeit image.
  • the extraction operation on all four regions is taken as an example for description, that is, four second sub-pictures are extracted.
  • the four second sub-pictures are respectively derived from the upper left corner, the lower left corner, the upper right corner and the lower right corner of the second counterfeit image.
  • Step S22 determining a plurality of the image gradient variances according to each of the first sub-pictures and each of the second sub-pictures;
  • the pixels of the four first sub-pictures and the four second sub-pictures can be used.
  • the pixels of the sub-pictures are used to determine the gradient variance of the four pixels.
  • the step of determining the gradient variance of multiple images according to each first sub-picture and each second sub-picture includes:
  • Step S221 Perform vector calculation on the pixels in each of the first sub-pictures according to a preset formula to obtain a plurality of first gradient vectors;
  • a preset formula for calculating the gradient vector of each pixel in the picture is preset, and for each first sub-picture, the pixels in the first sub-picture are respectively vector-calculated through the preset formula to obtain the respective first gradient vector.
  • the preset formula is as shown in formula (1), and formula (1) is:
  • each pixel in the first sub-picture forms a matrix of matrix n*n, such as the first sub-picture with a size of 45*45, the row number of the i matrix, j is the column number of the matrix, and X i, j are Each pixel value in the matrix.
  • Step S222 Perform vector calculations on the pixels in each of the second sub-pictures according to the preset formula to obtain multiple second gradient vectors;
  • Step S223 Generate multiple relative values of gradient vectors according to the multiple first gradient vectors and the multiple second gradient vectors;
  • the difference operation is performed according to the positional relationship between the four first sub-pictures and the four second sub-pictures to generate four relative values of the gradient vectors.
  • the first gradient vector for the first sub-picture and the second gradient vector for the second sub-picture Calculate the difference and generate the relative value of the gradient vector. After the first gradient vector and the second gradient vector between the first sub-picture and the second sub-picture at the four corner positions are calculated by difference, the relative value of the generated gradient vector is generated.
  • Step S224 Perform variance calculation on multiple relative values of the gradient vectors to generate multiple variances of the image gradients.
  • the variance calculation is performed on the relative values of the four gradient vectors through the variance calculation function to generate four image gradient variances.
  • the four first gradient vectors in the upper left corner, the upper right corner, the lower left corner, and the lower right corner are x1, x2, x3, and x4, respectively
  • the four second gradient vectors are y1, y2, y3, and y4
  • the relative values of the four gradient vectors are (x1-y1), (x2-y2), (x3-y3) and (x4-y4)
  • the relative values of the four gradient vectors are calculated to obtain four images
  • the gradient variances are std(x1-y1), std(x2-y2), std(x3-y3), and std(x4-y4), where std is the variance calculation function.
  • Step S23 according to the pixels in the first authenticating image and the pixels in the second authenticating image, generating the average gray level difference and the average luminance difference.
  • the average value of the respective pixels is calculated after the grayscale processing according to the first and second authenticating images, and the respective average values are used to generate the difference.
  • the average value of the respective pixels is directly calculated according to the first and second authentication images, and the respective average values are used as the difference value generation.
  • the steps of generating the average gray level difference and the average luminance difference include:
  • Step S231 Calculate a first average value of each pixel in the first forgery image and a second average value of each pixel in the second forged image;
  • the pixel values of the pixels in the first authenticating image are added, and the addition result is used as a ratio to the number of pixels to obtain the first average value of each pixel in the first authenticating image.
  • the pixel values of the pixels in the second authenticating image are added, and the addition result and the number of pixels are used as a ratio to obtain the second average value of each pixel in the second authenticating image.
  • Step S232 performing a difference calculation on the first average value and the second average value to generate the average brightness difference
  • Step S233 After graying the first forgery image and the second forgery image, based on edge detection, calculate the first and foremost values of the first forgery image and the second forgery image in a preset direction, respectively. Gradient map and second gradient map;
  • the edge detection is to detect the edge information on the image to form a gradient map
  • the preset direction is a preset direction
  • the y-axis direction is preferred.
  • Step S234 generating the average gray level difference value according to the pixels in the first gradient map and the pixels in the second gradient map.
  • the pixel values of the pixels in the first gradient map are added, and the addition result and the number of pixels are used as a ratio to obtain the first average value of each pixel in the first gradient map.
  • the pixel values of the pixels in the second gradient map are added, and the addition result and the number of pixels are used as a ratio to obtain the second average value of each pixel in the second gradient map.
  • a difference operation is performed between the first average value and the second average value, and the result of the operation is the average gray level difference.
  • the pixels of the four first sub-pictures located at the four corners of the first authentication image and the four second sub-images located at the four corners of the second authentication image are processed to obtain four image gradient variances, which represent the first authentication image.
  • the color difference and brightness change are reflected by the average brightness difference and the gray average difference between the first forgery image and the second forgery image. In order to combine contour differences, color changes, and brightness changes to accurately authenticate the forged documents.
  • the step of authenticating the document to be authenticated with the average difference between the gray scale and the average brightness includes:
  • Step S31 comparing the variances of a plurality of said image gradients with a first preset threshold respectively, determining a target image gradient variance of the plurality of said image gradient variances greater than said first preset threshold, and making statistics of said target image gradients The number of variances of variance;
  • a first preset threshold that represents the magnitude of the variance is preset, and the multiple image gradient variances are respectively compared with the first preset threshold, and the multiple image gradient variances are selected from the multiple image gradient variances that are greater than the first preset threshold.
  • the target image variance, and the number of variances of the target image variance is counted.
  • Step S32 comparing the gradient variances of the multiple images, determining the minimum value among the multiple gradient variances of the images
  • the gradient variances of the multiple images are compared, and the image gradient variance with the smallest value is found, and it is formed as the minimum value among the multiple image gradient variances.
  • Step S33 authenticating the document to be authenticated according to the number of variances, the minimum value, the average gray level difference, and the average brightness difference.
  • the steps of authenticating the document to be authenticated include:
  • Step S331 Determine whether the average gray level difference is greater than a first preset difference, and if it is greater than the first preset difference, determine that the document to be authenticated is a real document;
  • a first preset difference value such as 20, which represents a large difference in gray level, is preset.
  • the average gray-scale difference is compared with the first preset difference to determine whether the average gray-scale difference is greater than the first preset difference; if it is greater, it is determined that the document to be authenticated is a real document.
  • Step S332 if it is not greater than the first preset difference value, determine whether the gray average difference value is smaller than the second preset difference value, and whether the brightness average difference value is smaller than the third preset difference value;
  • a second preset difference value such as -15, which represents a small difference in gray level
  • a third preset difference value such as 8, which represents a small difference in brightness
  • the average gray-scale difference is compared with the second preset difference to determine whether the average gray-scale difference is less than the second preset difference.
  • the average brightness difference is compared with the third preset difference to determine whether the average brightness difference is less than the third preset difference.
  • Step S333 if the average gray level difference is less than the second preset difference value, and the average brightness difference is less than the third preset difference value, determine that the document to be authenticated is a false document;
  • Step S334 if the average gray level difference is not less than the second preset difference, or the average brightness difference is not less than the third preset difference, then it is determined whether the number of variances is greater than or equal to the preset number, And whether the minimum value is greater than a second preset threshold;
  • the average gray level difference is not less than the second preset difference, that is, it is located between the second preset difference and the first preset difference; or the average brightness difference is not less than the third preset difference.
  • the difference is combined with the number of variances and the minimum value for authentication. Specifically, a preset number representing the number, such as 3, and a second preset threshold representing the minimum value, such as -40 are preset.
  • the number of variances is compared with the preset number to determine whether the number of variances is greater than or equal to the preset number; at the same time, the minimum value is compared with the second preset threshold to determine whether the minimum value is greater than the second preset threshold.
  • step S335 if the number of variances is greater than or equal to a preset number, and the minimum value is greater than a second preset threshold, determine that the document to be authenticated is a real document;
  • the document to be forged is a real document.
  • step S3366 if the number of variances is less than a preset number and the minimum value is not greater than a second preset threshold, it is determined that the document to be authenticated is a false document.
  • This embodiment uses the gray average difference value, the brightness average difference value, the minimum value of the multiple image gradient variances, and the number of variances of the multiple image gradient variances that are greater than the first preset threshold to verify the authenticity of the certificate to be forged , It realizes the authentication combining various factors, and improves the accuracy of authentication.
  • this application also provides a certificate authentication device.
  • Fig. 3 is a schematic diagram of the functional modules of the first embodiment of the credential authentication device of this application.
  • the certificate authentication device includes:
  • the obtaining module 10 is used to obtain the first document picture and the second document picture taken under different light of the document to be authenticated, and to obtain the first document picture according to the preset authentication point of the document to be authenticated. Extracting a first forgery verification image and a second forgery verification image from the second certificate picture;
  • the determining module 20 is configured to determine a plurality of image gradient variances, gray average differences, and brightness average differences according to the first authenticating map and the second authenticating map;
  • the authentication module 30 is configured to authenticate the document to be authenticated according to a plurality of the image gradient variances, the average gray level difference and the average brightness difference.
  • the acquisition module 10 first obtains the first document picture and the second document picture taken under different light, and according to the settings on the document to be authenticated According to the preset authentication point, the first authentication image and the second authentication image are respectively extracted from the first authentication image and the second authentication image; , Determine a plurality of image gradient variances, average gray-scale differences, and average brightness differences; and then the authentication module 30 authenticates the certificate to be forged based on the multiple image gradient variances, average gray-scale differences, and average brightness differences. Pseudo.
  • the determining module 20 includes:
  • the extraction unit is configured to extract a first sub-picture from at least two areas of the four corners of the first authenticating image, and to extract a first sub-picture from at least two areas of the four-corner areas of the second authenticating image. Two sub-pictures;
  • a determining unit configured to determine a plurality of the image gradient variances according to each of the first sub-pictures and each of the second sub-pictures;
  • the generating unit is configured to generate the average gray level difference and the average brightness difference according to the pixels in the first authenticating image and the pixels in the second authenticating image.
  • the determining unit is also used for:
  • vector calculation is performed on the pixels in each of the first sub-pictures to obtain a plurality of first gradient vectors
  • vector calculation is performed on the pixels in each of the second sub-pictures to obtain multiple second gradient vectors
  • a variance calculation is performed on the relative values of the multiple gradient vectors to generate multiple variances of the image gradients.
  • the generating unit is also used for:
  • the first gradient image and the first gradient image of the first forgery image and the second forgery image in the preset directions are calculated based on edge detection.
  • the gray average difference value is generated.
  • the certificate authentication device further includes:
  • the extraction module is configured to extract a first correction image from the first document image according to the first authentication image, and extract a second correction image from the second document image according to the second authentication image picture;
  • the calculation module is used to calculate the first corrected mean value of each pixel in the first corrected image after performing grayscale processing on the first corrected image and the second corrected image, and calculate the first corrected average value of each pixel in the second corrected image 2.
  • Modified mean value
  • the determining module is further configured to determine a first pixel in each pixel of the first forgery image that is smaller than the first corrected average value, and a pixel of the second forgery image that is smaller than the second corrected average value The second pixel;
  • the correction module is configured to call a preset pixel value to correct the first pixel and the second pixel respectively, so as to update the first authentication map and the second authentication map.
  • the authentication module 30 further includes:
  • a statistical unit configured to compare the variances of the multiple image gradients with a first preset threshold, determine the target image gradient variances of the multiple image gradient variances that are greater than the first preset threshold, and count the target The number of variances of the image gradient variance;
  • a comparison unit configured to compare the gradient variances of the multiple images to determine the minimum value among the multiple gradient variances of the images
  • the authentication unit is configured to authenticate the document to be authenticated according to the number of variances, the minimum value, the average gray level difference, and the average brightness difference.
  • the authentication unit is also used for:
  • the average gray level difference is not less than the second preset difference, or the average brightness difference is not less than the third preset difference, then it is determined whether the variance amount is greater than or equal to the preset amount, and the Whether the minimum value is greater than the second preset threshold;
  • the number of variances is less than a preset number, and the minimum value is not greater than a second preset threshold, it is determined that the document to be forged is a false document.
  • the embodiment of the present application also proposes a readable storage medium, and the readable storage medium may be volatile or non-volatile.
  • a certificate authentication program is stored on the readable storage medium, and when the certificate authentication program is executed by the processor, the steps of the above-mentioned certificate authentication method are realized.

Landscapes

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

Abstract

一种证件鉴伪方法、装置、设备及可读存储介质,涉及人工智能,该方法包括:获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据待鉴伪证件的预设鉴伪点,分别从第一证件图片和第二证件图片中提取出第一鉴伪图和第二鉴伪图(S10);根据第一鉴伪图和第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值(S20);根据多个图像梯度方差、灰度平均差值和亮度平均差值,对待鉴伪证件鉴伪(S30)。此外,还涉及区块链技术,第一证件图片和第二证件图片可存储于区块链中。通过对不同光线下拍摄的第一证件图片和第二证件图片处理,确定多个图像梯度方差、灰度平均差值和亮度平均差值对证件鉴伪,提高了鉴伪的准确性。

Description

证件鉴伪方法、装置、设备及可读存储介质
本申请要求于2020年9月3日提交中国专利局、申请号为CN202010925576.4、名称为“证件鉴伪方法、装置、设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,尤其涉及一种证件鉴伪方法、装置、设备及可读存储介质。
背景技术
身份证、驾驶证、护照等该类与身份相关的证件,容易被不法分子伪造,在很多场景均需要对证件进行鉴伪,如金融业务的开户业务,通过鉴伪来确定身份证的真实性。当前证件的鉴伪包括线上鉴伪和线下鉴伪两种方式,对于线下鉴伪,通常由人工进行审核,整个流程繁琐,效率低。对于线上鉴伪,通过对证件所具有特征的识别,实现鉴伪;发明人意识到当前线上特征识别容易受各种因素的影响,识别结果具有较大的误差,影响了鉴伪的准确性。
因此,如何实现证件的线上准确鉴伪是当前亟待解决的技术问题。
发明内容
本申请实施例提供一种证件鉴伪方法,所述证件鉴伪方法包括以下步骤:
获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
本申请还提供一种证件鉴伪装置,所述证件鉴伪装置包括:
获取模块,用于获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
确定模块,用于根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
鉴伪模块,用于根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
本申请还提供证件鉴伪设备,所述证件鉴伪设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的证件鉴伪程序,所述证件鉴伪程序被所述处理器执行时实现如下步骤:
获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
本申请还提供一种可读存储介质,所述可读存储介质上存储有证件鉴伪程序,所述证件鉴伪程序被处理器执行时实现如下步骤:
获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
附图说明
图1为本申请实施例方案涉及的硬件运行环境的证件鉴伪设备结构示意图;
图2为本申请证件鉴伪方法第一实施例的流程示意图;
图3为本申请证件鉴伪装置较佳实施例的功能模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
如图1所示,图1是本申请实施例方案涉及的硬件运行环境的证件鉴伪设备结构示意图。
在后续的描述中,使用用于表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本申请的说明,其本身没有特定的意义。因此,“模块”、“部件”或“单元”可以混合地使用。
本申请实施例证件鉴伪设备可以是PC,也可以是平板电脑、便携计算机等可移动式终端设备。
如图1所示,该证件鉴伪设备可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
本领域技术人员可以理解,图1中示出的证件鉴伪设备结构并不构成对证件鉴伪设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种可读存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及检测程序。
在图1所示的设备中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的检测程序,并执行以下操作:
获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪 证件进行鉴伪。
进一步地,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤包括:
从所述第一鉴伪图的四角区域中的至少两个区域分别提取第一子图片,并从所述第二鉴伪图的四角区域中的至少两个区域分别提取第二子图片;
根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差;
根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值。
进一步地,所述根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差的步骤包括:
根据预设公式,对各所述第一子图片中的像素分别进行向量计算,得到多个第一梯度向量;
根据所述预设公式,对各所述第二子图片中的像素分别进行向量计算,得到多个第二梯度向量;
根据多个所述第一梯度向量和多个所述第二梯度向量,生成多个梯度向量相对值;
对多个所述梯度向量相对值分别进行方差计算,生成多个所述图像梯度方差。
进一步地,所述根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值的步骤包括:
计算所述第一鉴伪图中各像素的第一平均值,以及所述第二鉴伪图中各像素的第二平均值;
在所述第一平均值和所述第二平均值进行差值运算,生成所述亮度平均差值;
将所述第一鉴伪图和所述第二鉴伪图灰度化处理后,基于边缘检测,计算第一鉴伪图和第二鉴伪图分别在预设方向上的第一梯度图和第二梯度图;
根据所述第一梯度图中的像素和所述第二梯度图中的像素,生成所述灰度平均差值。
进一步地,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤之前,处理器1001可以用于调用存储器1005中存储的检测程序,并执行以下操作:
根据所述第一鉴伪图,从所述第一证件图中提取第一修正图,并根据所述第二鉴伪图,从所述第二证件图中提取第二修正图;
对所述第一修正图和所述第二修正图进行灰度处理后,计算第一修正图中各像素的第一修正均值,以及计算第二修正图中各像素的第二修正均值;
确定所述第一鉴伪图的各像素中小于所述第一修正均值的第一像素,以及所述第二鉴伪图的各像素中小于所述第二修正均值的第二像素;
调用预设像素值分别对所述第一像素和所述第二像素进行修正,以更新所述第一鉴伪图和所述第二鉴伪图。
进一步地,所述根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
将多个所述图像梯度方差分别和第一预设阈值对比,确定多个所述图像梯度方差中大于所述第一预设阈值的目标图像梯度方差,并统计所述目标图像梯度方差的方差数量;
在多个所述图像梯度方差对比,确定多个所述图像梯度方差中的最小值;
根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
进一步地,所述根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
判断所述灰度平均差值是否大于第一预设差值,若大于所述第一预设差值,则判定所 述待鉴伪证件为真实证件;
若不大于第一预设差值,则判断所述灰度平均差值是否小于第二预设差值,且所述亮度平均差值是否小于第三预设差值;
若所述灰度平均差值小于第二预设差值,且所述亮度平均差值小于第三预设差值,则判定所述待鉴伪证件为虚假证件;
若所述灰度平均差值不小于第二预设差值,或者所述亮度平均差值不小于第三预设差值,则判断所述方差数量是否大于或等于预设数量,且所述最小值是否大于第二预设阈值;
若所述方差数量大于或等于预设数量,且所述最小值大于第二预设阈值,则判断所述待鉴伪证件为真实证件;
若所述方差数量小于预设数量,且所述最小值不大于第二预设阈值,则判定所述待鉴伪证件为虚假证件。
本申请证件鉴伪设备的具体实施方式与下述证件鉴伪方法各实施例基本相同,在此不再赘述。
为了更好的理解上述技术方案,下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
为了更好的理解上述技术方案,下面将结合说明书附图以及具体的实施方式对上述技术方案进行详细的说明。
参照图2,本申请第一实施例提供一种证件鉴伪方法的流程示意图。该实施例中,所述证件鉴伪方法包括以下步骤:
步骤S10,获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
本实施例中的证件鉴伪方法应用于服务器,通过服务器来鉴定证件的真伪。具体地,将需要进行真伪鉴定的证件作为待鉴伪证件,并拍摄待鉴伪证件在不同光线下的证件图片上传到服务器。其中,不同光线下的证件图片包括关闭闪光灯拍摄的图片和开启闪光灯拍摄的图片。服务器在接收到上传的该类证件图片后,将关闭闪光灯拍摄的图片作为第一证件图片,并将开启闪光灯拍摄的图片作为第二证件图片。
需要强调的是,为进一步保证上述第一证件图片和第二证件图片的私密和安全性,上述的第一证件图片和第二证件图片还可以存储于一区块链的节点中。当然,在对第一证件图片和第二证件图片处理过程中,所得到的中间信息,以及最终信息也可以是存储于一区块链的节点中。
本实施例所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
进一步地,待鉴伪证件中预先设置有用于鉴伪的预设鉴伪点,该预设鉴伪点可以是设定的特定图像、颜色或者光栅区域等;本实施例以光栅区域为例进行说明。对于设定光栅区域用于鉴伪的证件,可以选择在证件的某个特定位置设定光栅区域,如香港居民身份证,在左下角设置的白色椭圆形区域即为光栅区域。服务器在获取到第一证件图片和第二证件图片后,依据待鉴伪证件所设定的预设鉴伪点位置,从第一证件图片中提取出第一鉴伪图,以及从第二证件图片中提取出第二鉴伪图。第一鉴伪图和第二鉴伪图均包含预设鉴伪点,且两者相当于待鉴伪证件具有相同的位置坐标以及尺寸大小;即第一鉴伪图在待鉴伪证件 中的位置坐标,与第二鉴伪图在待鉴伪证件中的位置坐标相同,使得由各自位置坐标所形成的尺寸大小也相同,如170*110的尺寸,以通过待鉴伪证件中的相同区域,来对待鉴伪证件鉴伪。
步骤S20,根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
进一步地,分别对第一鉴伪图的像素和第二鉴伪的像素进行计算处理,得到多个图像梯度方差,灰度平均差值和亮度平均差值。其中,图像梯度方差由第一鉴伪图中像素与第二鉴伪图中像素分别得到的梯度向量的相对值进行方差计算的结果;灰度平均差值则为第一鉴伪图和第二鉴伪图经灰度处理后进行像素均值并做差运算的结果,亮度平均差值则为第一鉴伪图和第二鉴伪图的像素均值处理后做差运算的结果。
更进一步地,考虑到待鉴伪证件拍摄过程中,可能因光线的影响,而使得第一鉴伪图中像素和第一鉴伪图中像素难以准确体现各自的特征。对于此,本实施在对第一鉴伪图的像素和第二鉴伪的像素进行计算处理前,设置有通过待鉴伪证件中位于预设鉴伪点以外的区域对包含预设鉴伪点区域的修正机制。具体地,根据第一鉴伪图和第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤之前包括:
步骤a,根据所述第一鉴伪图,从所述第一证件图中提取第一修正图,并根据所述第二鉴伪图,从所述第二证件图中提取第二修正图;
进一步地,依据第一鉴伪图在第一证件图中的位置,从第一证件图中提取出第一修正图,第一修正图位于第一鉴伪图的下方,尺寸相对于第一鉴伪图较小,如对于170*110的第一鉴伪图,第一修正图的尺寸大小可以是170*55。同样地,依据第二鉴伪图在第二证件图中的位置,从第二证件图中提取出第二修正图,第二修正图位于第二鉴伪图的下方,尺寸相对于第二鉴伪图较小,如对于170*110的第二鉴伪图,第二修正图的尺寸大小可以是170*55。
步骤b,对所述第一修正图和所述第二修正图进行灰度处理后,计算第一修正图中各像素的第一修正均值,以及计算第二修正图中各像素的第二修正均值;
更进一步地,对第一修正图和第二修正图分别进行灰度化处理,并对灰度化处理后第一修正图中各像素进行平均值计算,得到第一修正均值。同时,对灰度化处理后第二修正图中各像素进行平均值计算,得到第二修正均值。
步骤c,确定所述第一鉴伪图的各像素中小于所述第一修正均值的第一像素,以及所述第二鉴伪图的各像素中小于所述第二修正均值的第二像素;
进一步地,将第一鉴伪图中的各像素分别和第一修正均值对比,确定各像素中小于第一修正均值的第一像素。同时,将第二鉴伪图中的各像素分别和第二修正均值对比,确定各像素中小于第二修正均值的第二像素。
步骤d,调用预设像素值分别对所述第一像素和所述第二像素进行修正,以更新所述第一鉴伪图和所述第二鉴伪图。
更进一步地,预先设置有用于修正的预设像素值,如像素值0。在确定出第一鉴伪图中的各第一像素,以及第二鉴伪图中的各第二像素后,调用预设像素值,并用预设像素值对第一像素进行修正,将第一像素的像素值替换为预设像素值,得到更新的第一鉴伪图。同样用预设像素值对第二像素进行修正,将第二像素的像素值替换为预设像素值,得到更新的第二鉴伪图。进而对更新的第一鉴伪图中的像素和更新的第二鉴伪图中的像素进行计算处理,得到多个图像梯度方差,灰度平均差值和亮度平均差值。
步骤S30,根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
进一步地,多个图像梯度、灰度平均差值和亮度平均差值从预设鉴伪点所在区域的轮廓差异、颜色变化以及亮度变化方面,体现了待鉴伪证件的真伪性;故可依据多个图像梯 度方差,灰度平均差值和亮度平均差值,实现待鉴伪证件的鉴伪。
本实施例的证件鉴伪方法,对于具有鉴伪需求的待鉴伪证件,先获取其在不同光线下拍摄的第一证件图片和第二证件图片,并根据待鉴伪证件上设置的预设鉴伪点,分别从第一证件图片和第二证件图片中提取出第一鉴伪图和第二鉴伪图;再依据第一鉴伪图和第二鉴伪图,确定多个图像梯度方差、灰度平均差值和亮度平均差值;进而依据该多个图像梯度方差、灰度平均差值和亮度平均差值,对待鉴伪证件进行鉴伪。以此,通过对不同光线下拍摄的第一证件图片和第二证件图片进行处理,确定多个图像梯度方差、灰度平均差值和亮度平均差值对证件进行鉴伪,鉴伪过程仅与光线相关,避免了其他因素的影响,提高了鉴伪的准确性。
进一步的,基于本申请证件鉴伪方法第一实施例,提出本申请证件鉴伪方法第二实施例,在第二实施例中,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤包括:
步骤S21,从所述第一鉴伪图的四角区域中的至少两个区域分别提取第一子图片,并从所述第二鉴伪图的四角区域中的至少两个区域分别提取第二子图片;
本实施例基于第一鉴伪图四个角的位置区域的像素和第二鉴伪图四个角的位置区域的像素,来生成多个图像梯度方差。具体地,预先依据需求设定有预设区域大小,如45*45,依据该预设区域大小,对第一鉴伪图的四角区域中的至少两个区域分别进行提取操作,提取出大小为预设区域大小的至少两张第一子图片。本实施例以对四个区域全部进行提取操作为例进行说明,即提取到四张第一子图片。该四张第一子图片分别来源于第一鉴伪图的左上角、左下角、右上角和右下角。同时,依据预设区域大小,对第二鉴伪图的四角区域中的至少两个区域分别进行提取操作,提取出大小为预设区域大小的至少两张第二子图片。本实施例以对四个区域全部进行提取操作为例进行说明,即提取到四张第二子图片。该四张第二子图片分别来源于第二鉴伪图的左上角、左下角、右上角和右下角。
步骤S22,根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差;
进一步地,在分别从第一鉴伪图和第二鉴伪图中提取出各自四张第一子图片和第二子图片后,即可依据四张第一子图片的像素和四张第二子图片的像素,来确定四个像素梯度方差。具体地,根据各第一子图片和各第二子图片,确定多个图像梯度方差的步骤包括:
步骤S221,根据预设公式,对各所述第一子图片中的像素分别进行向量计算,得到多个第一梯度向量;
更进一步地,预先设置有用于计算图片中各像素的梯度向量的预设公式,针对每张第一子图片,通过预设公式对其中的像素分别进行向量计算,得到各自的第一梯度向量。其中,预设公式如公式(1)所示,公式(1)为:
Figure PCTCN2020125010-appb-000001
其中,第一子图片中的各个像素构成矩阵n*n的矩阵,如上述尺寸大小为45*45的第一子图片,i矩阵的行号,j为矩阵的列号,X i,j为矩阵中的各个像素值。在计算的过程中,对于矩阵中行号和列号相加等于某一值的像素进行加和,并用加和结果与该值做比值,得到各个结果形成第一梯度向量。如对于i+j=2的情况,像素X 0,2、X 2,0和X 1,1均满足该条件,故对三者加和后除以2,得到grad[2]的值。如此计算,得到grad[0]到grad[2n-2]的值,形成第一子图片的第一梯度向量。在每个第一子图片均经计算得到各自的第一梯度向量后,则得到四个第一梯度向量。
步骤S222,根据所述预设公式,对各所述第二子图片中的像素分别进行向量计算,得到多个第二梯度向量;
同样地,对于第二子图片,对其中的像素通过预设公式进行向量计算,得到第二梯度向量。在每个第二子图片均经计算得到各自的第二梯度向量后,则得到四个第二梯度向量。
步骤S223,根据多个所述第一梯度向量和多个所述第二梯度向量,生成多个梯度向量相对值;
进一步地,对于四个第一梯度向量和四个第二梯度向量,依据四张第一子图片和四张第二子图片的位置关系,进行差值运算,生成四个梯度向量相对值。当第一子图片和第二子图片的位置关系相同,如都对应位于待鉴伪证件的左上角,则对该第一子图片的第一梯度向量和该第二子图片的第二梯度向量进行差值计算,生成梯度向量相对值。在四个角位置上的第一子图片和第二子图片之间的第一梯度向量和第二梯度向量均经差值计算后,则生成的哥梯度向量相对值。
步骤S224,对多个所述梯度向量相对值分别进行方差计算,生成多个所述图像梯度方差。
更进一步地,通过方差计算函数,对四个梯度向量相对值分别进行方差计算,生成四个图像梯度方差。如在一具体实施例中,左上角、右上角、左下角和右下角的四个第一梯度向量分别为x1、x2、x3和x4,四个第二梯度向量分别为y1、y2、y3和y4,则四个梯度向量相对值为(x1-y1)、(x2-y2)、(x3-y3)和(x4-y4),对四个梯度向量相对值进行方差计算,得到的四个图像梯度方差分别为std(x1-y1)、std(x2-y2)、std(x3-y3)和std(x4-y4),其中,std为方差计算函数。
步骤S23,根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值。
进一步地,对于灰度平均差值,则依据第一鉴伪图和第二鉴伪图在灰度化处理后对各自的像素计算平均值,并用各自的平均值做差值运算生成。对于亮度平均差值,则依据第一鉴伪图和第二鉴伪图直接对各自的像素计算平均值后,用各自的平均值做差值生成。具体地,根据第一鉴伪图中的像素和第二鉴伪图中的像素,生成灰度平均差值和亮度平均差值的步骤包括:
步骤S231,计算所述第一鉴伪图中各像素的第一平均值,以及所述第二鉴伪图中各像素的第二平均值;
更进一步地,对第一鉴伪图中所具有像素的像素值相加,并用相加结果和所具有像素的数量做比值,得到第一鉴伪图中各像素的第一平均值。同时,对第二鉴伪图中所具有像素的像素值相加,并用相加结果和所具有像素的数量做比值,得到第二鉴伪图中各像素的第二平均值。
步骤S232,在所述第一平均值和所述第二平均值进行差值运算,生成所述亮度平均差值;
进一步地,在第一平均值和第二平均值之间进行差值运算,得到的运算结果即为亮度平均差值。
步骤S233,将所述第一鉴伪图和所述第二鉴伪图灰度化处理后,基于边缘检测,计算第一鉴伪图和第二鉴伪图分别在预设方向上的第一梯度图和第二梯度图;
更进一步地,对于灰度平均差值,先对第一鉴伪图和第二鉴伪图进行灰度化处理,并通过sobel边缘检测算法计算处理后两者在预设方向上的梯度,分别作为第一梯度图和第二梯度图。其中,边缘检测是检测出图像上的边缘信息,形成梯度图,预设方向为预先设定的方向,优先为y轴方向。
步骤S234,根据所述第一梯度图中的像素和所述第二梯度图中的像素,生成所述灰度平均差值。
进一步地,对第一梯度图中所具有像素的像素值相加,并用相加结果和所具有像素的数量做比值,得到第一梯度图中各像素的第一平均值。同时,对第二梯度图中所具有像素的像素值相加,并用相加结果和所具有像素的数量做比值,得到第二梯度图中各像素的第二平均值。进而在第一平均值和第二平均值之间进行差值运算,得到的运算结果即为灰度 平均差值。
本实施例对位于第一鉴伪图四角的四张第一子图片,和位于第二鉴伪图四角的四张第二子图片的像素进行处理,得到四个图像梯度方差,表征第一鉴伪图和第二鉴伪图之间轮廓的差异。同时通过第一鉴伪图和第二鉴伪图之间的亮度平均差值和灰度平均差值,来体现颜色差异和亮度变化。以便于结合轮廓差异、颜色变化以及亮度变化多个方面,来对待鉴伪证件准确鉴伪。
进一步的,基于本申请证件鉴伪方法第一实施例或第二实施例,提出本申请证件鉴伪方法第三实施例,在第三实施例中,所述根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
步骤S31,将多个所述图像梯度方差分别和第一预设阈值对比,确定多个所述图像梯度方差中大于所述第一预设阈值的目标图像梯度方差,并统计所述目标图像梯度方差的方差数量;
进一步地,预设设置有表征方差大小的第一预设阈值,将多个图像梯度方差分别和该第一预设阈值对比,从多个图像梯度方差中筛选出大于该第一预设阈值的目标图像方差,并且统计该目标图像方差的方差数量。
步骤S32,在多个所述图像梯度方差对比,确定多个所述图像梯度方差中的最小值;
更进一步地,在多个图像梯度方差之间对比,查找其中的数值最小的图像梯度方差,形成为多个图像梯度方差中的最小值。
步骤S33,根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
进一步地,在通过多个图像梯度方差,确定出大于第一预设阈值的方差数量和其中的最小值后,则将两者结合灰度平均差值和亮度平均差值,对待验证证件进行鉴伪操作。具体地,根据方差数量、最小值、灰度平均差值和亮度平均差值,对待鉴伪证件进行鉴伪的步骤包括:
步骤S331,判断所述灰度平均差值是否大于第一预设差值,若大于所述第一预设差值,则判定所述待鉴伪证件为真实证件;
更进一步地,预先设置有表征灰度差异较大的第一预设差值,如20。将灰度平均差值和该第一预设差值对比,判断灰度平均差值是否大于第一预设差值;若大于则判定待鉴伪证件为真实证件。
步骤S332,若不大于第一预设差值,则判断所述灰度平均差值是否小于第二预设差值,且所述亮度平均差值是否小于第三预设差值;
进一步地,预先设置有表征灰度差异较小的第二预设差值,如-15,以及表征亮度差异较小的第三预设差值,如8。若判定灰度平均差值不大于第一预设差值,则将灰度平均差值和第二预设差值对比,判断灰度平均差值是否小于第二预设差值。同时将亮度平均差值和第三预设差值对比,判断亮度平均差值是否小于第三预设差值。通过灰度平均差值与第二预设差值之间的大小关系,以及亮度平均差值与第三预设差值之间的大小关系,来对待鉴伪证件进行鉴伪。
步骤S333,若所述灰度平均差值小于第二预设差值,且所述亮度平均差值小于第三预设差值,则判定所述待鉴伪证件为虚假证件;
更进一步地,若经对比确定灰度平均差值小于第二预设差值,且亮度平均差值小于第三预设差值,则判定待鉴伪证件为虚假证件。
步骤S334,若所述灰度平均差值不小于第二预设差值,或者所述亮度平均差值不小于第三预设差值,则判断所述方差数量是否大于或等于预设数量,且所述最小值是否大于第二预设阈值;
进一步地,若经对比确定灰度平均差值不小于第二预设差值,即位于第二预设差值和 第一预设差值之间;或者亮度平均差值不小于第三预设差值,则结合方差数量和最小值进行鉴伪。具体地,预先设置有表征数量多少的预设数量,如3,以及表征最小值大小的第二预设阈值,如-40。将方差数量和预设数量对比,判断方差数量是否大于或等于预设数量;同时将最小值和第二预设阈值对比,判断最小值是否大于第二预设阈值。通过方差数量与预设数量之间的大小关系,以及最小值与第二预设阈值之间的大小关系,对待鉴伪证件进行鉴伪。
步骤S335,若所述方差数量大于或等于预设数量,且所述最小值大于第二预设阈值,则判断所述待鉴伪证件为真实证件;
更进一步地,若经确定方差数量大于或等于预设数量,且最小值大于第二预设阈值,则判定待鉴伪证件为真实证件。
步骤S336,若所述方差数量小于预设数量,且所述最小值不大于第二预设阈值,则判定所述待鉴伪证件为虚假证件。
进一步地,若经对比确定,方差数量小于预设数量,且最小值不大于预设阈值,则判定待鉴伪证件为虚假证件。
本实施例通过灰度平均差值、亮度平均差值、多个图像梯度方差中的最小值,以及多个图像梯度方差中大于第一预设阈值的方差数量,对待鉴伪证件进行真假鉴定,实现了结合多方面因素的鉴伪,提高了鉴伪的准确性。
进一步地,本申请还提供一种证件鉴伪装置。
参照图3,图3为本申请证件鉴伪装置第一实施例的功能模块示意图。所述证件鉴伪装置包括:
获取模块10,用于获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
确定模块20,用于根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
鉴伪模块30,用于根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
本实施例的证件鉴伪装置,对于具有鉴伪需求的待鉴伪证件,获取模块10先获取其在不同光线下拍摄的第一证件图片和第二证件图片,并根据待鉴伪证件上设置的预设鉴伪点,分别从第一证件图片和第二证件图片中提取出第一鉴伪图和第二鉴伪图;再由确定模块20依据第一鉴伪图和第二鉴伪图,确定多个图像梯度方差、灰度平均差值和亮度平均差值;进而由鉴伪模块30依据该多个图像梯度方差、灰度平均差值和亮度平均差值,对待鉴伪证件进行鉴伪。以此,通过对不同光线下拍摄的第一证件图片和第二证件图片进行处理,确定多个图像梯度方差、灰度平均差值和亮度平均差值对证件进行鉴伪,鉴伪过程仅与光线相关,避免了其他因素的影响,提高了鉴伪的准确性。
进一步地,所述确定模块20包括:
提取单元,用于从所述第一鉴伪图的四角区域中的至少两个区域分别提取第一子图片,并从所述第二鉴伪图的四角区域中的至少两个区域分别提取第二子图片;
确定单元,用于根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差;
生成单元,用于根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值。
进一步地,所述确定单元还用于:
根据预设公式,对各所述第一子图片中的像素分别进行向量计算,得到多个第一梯度向量;
根据所述预设公式,对各所述第二子图片中的像素分别进行向量计算,得到多个第二梯度向量;
根据多个所述第一梯度向量和多个所述第二梯度向量,生成多个梯度向量相对值;
对多个所述梯度向量相对值分别进行方差计算,生成多个所述图像梯度方差。
进一步地,所述生成单元还用于:
计算所述第一鉴伪图中各像素的第一平均值,以及所述第二鉴伪图中各像素的第二平均值;
在所述第一平均值和所述第二平均值进行差值运算,生成所述亮度平均差值;
将所述第一鉴伪图和所述第二鉴伪图灰度化处理后,基于边缘检测,计算第一鉴伪图和第二鉴伪图分别在预设方向上的第一梯度图和第二梯度图;
根据所述第一梯度图中的像素和所述第二梯度图中的像素,生成所述灰度平均差值。
进一步地,所述证件鉴伪装置还包括:
提取模块,用于根据所述第一鉴伪图,从所述第一证件图中提取第一修正图,并根据所述第二鉴伪图,从所述第二证件图中提取第二修正图;
计算模块,用于对所述第一修正图和所述第二修正图进行灰度处理后,计算第一修正图中各像素的第一修正均值,以及计算第二修正图中各像素的第二修正均值;
所述确定模块还用于确定所述第一鉴伪图的各像素中小于所述第一修正均值的第一像素,以及所述第二鉴伪图的各像素中小于所述第二修正均值的第二像素;
修正模块,用于调用预设像素值分别对所述第一像素和所述第二像素进行修正,以更新所述第一鉴伪图和所述第二鉴伪图。
进一步地,所述鉴伪模块30还包括:
统计单元,用于将多个所述图像梯度方差分别和第一预设阈值对比,确定多个所述图像梯度方差中大于所述第一预设阈值的目标图像梯度方差,并统计所述目标图像梯度方差的方差数量;
对比单元,用于在多个所述图像梯度方差对比,确定多个所述图像梯度方差中的最小值;
鉴伪单元,用于根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
进一步地,所述鉴伪单元还用于:
判断所述灰度平均差值是否大于第一预设差值,若大于所述第一预设差值,则判定所述待鉴伪证件为真实证件;
若不大于第一预设差值,则判断所述灰度平均差值是否小于第二预设差值,且所述亮度平均差值是否小于第三预设差值;
若所述灰度平均差值小于第二预设差值,且所述亮度平均差值小于第三预设差值,则判定所述待鉴伪证件为虚假证件;
若所述灰度平均差值不小于第二预设差值,或者所述亮度平均差值不小于第三预设差值,则判断所述方差数量是否大于或等于预设数量,且所述最小值是否大于第二预设阈值;
若所述方差数量大于或等于预设数量,且所述最小值大于第二预设阈值,则判断所述待鉴伪证件为真实证件;
若所述方差数量小于预设数量,且所述最小值不大于第二预设阈值,则判定所述待鉴伪证件为虚假证件。
本申请证件鉴伪装置具体实施方式与上述证件鉴伪方法各实施例基本相同,在此不再赘述。
此外,本申请实施例还提出一种可读存储介质,所述可读存储介质可以是易失性,也可以是非易失性。
可读存储介质上存储有证件鉴伪程序,证件鉴伪程序被处理器执行时实现如上所述的证件鉴伪方法的步骤。
本申请可读存储介质的具体实施方式与上述证件鉴伪方法各实施例基本相同,在此不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个可读存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种证件鉴伪方法,其中,所述证件鉴伪方法包括以下步骤:
    获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
    根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
    根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
  2. 如权利要求1所述的证件鉴伪方法,其中,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤包括:
    从所述第一鉴伪图的四角区域中的至少两个区域分别提取第一子图片,并从所述第二鉴伪图的四角区域中的至少两个区域分别提取第二子图片;
    根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差;
    根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值。
  3. 如权利要求2所述的证件鉴伪方法,其中,所述根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差的步骤包括:
    根据预设公式,对各所述第一子图片中的像素分别进行向量计算,得到多个第一梯度向量;
    根据所述预设公式,对各所述第二子图片中的像素分别进行向量计算,得到多个第二梯度向量;
    根据多个所述第一梯度向量和多个所述第二梯度向量,生成多个梯度向量相对值;
    对多个所述梯度向量相对值分别进行方差计算,生成多个所述图像梯度方差。
  4. 如权利要求2所述的证件鉴伪方法,其中,所述根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值的步骤包括:
    计算所述第一鉴伪图中各像素的第一平均值,以及所述第二鉴伪图中各像素的第二平均值;
    在所述第一平均值和所述第二平均值进行差值运算,生成所述亮度平均差值;
    将所述第一鉴伪图和所述第二鉴伪图灰度化处理后,基于边缘检测,计算第一鉴伪图和第二鉴伪图分别在预设方向上的第一梯度图和第二梯度图;
    根据所述第一梯度图中的像素和所述第二梯度图中的像素,生成所述灰度平均差值。
  5. 如权利要求1-4任一项所述的证件鉴伪方法,其中,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤之前包括:
    根据所述第一鉴伪图,从所述第一证件图中提取第一修正图,并根据所述第二鉴伪图,从所述第二证件图中提取第二修正图;
    对所述第一修正图和所述第二修正图进行灰度处理后,计算第一修正图中各像素的第一修正均值,以及计算第二修正图中各像素的第二修正均值;
    确定所述第一鉴伪图的各像素中小于所述第一修正均值的第一像素,以及所述第二鉴伪图的各像素中小于所述第二修正均值的第二像素;
    调用预设像素值分别对所述第一像素和所述第二像素进行修正,以更新所述第一鉴伪图和所述第二鉴伪图。
  6. 如权利要求1-4任一项所述的证件鉴伪方法,其中,所述根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
    将多个所述图像梯度方差分别和第一预设阈值对比,确定多个所述图像梯度方差中大于所述第一预设阈值的目标图像梯度方差,并统计所述目标图像梯度方差的方差数量;
    在多个所述图像梯度方差对比,确定多个所述图像梯度方差中的最小值;
    根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
  7. 如权利要求6所述的证件鉴伪方法,其中,所述根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
    判断所述灰度平均差值是否大于第一预设差值,若大于所述第一预设差值,则判定所述待鉴伪证件为真实证件;
    若不大于第一预设差值,则判断所述灰度平均差值是否小于第二预设差值,且所述亮度平均差值是否小于第三预设差值;
    若所述灰度平均差值小于第二预设差值,且所述亮度平均差值小于第三预设差值,则判定所述待鉴伪证件为虚假证件;
    若所述灰度平均差值不小于第二预设差值,或者所述亮度平均差值不小于第三预设差值,则判断所述方差数量是否大于或等于预设数量,且所述最小值是否大于第二预设阈值;
    若所述方差数量大于或等于预设数量,且所述最小值大于第二预设阈值,则判断所述待鉴伪证件为真实证件;
    若所述方差数量小于预设数量,且所述最小值不大于第二预设阈值,则判定所述待鉴伪证件为虚假证件。
  8. 一种证件鉴伪装置,其中,所述证件鉴伪装置包括:
    获取模块,用于获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
    确定模块,用于根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
    鉴伪模块,用于根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
  9. 一种证件鉴伪设备,其中,所述证件鉴伪设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的证件鉴伪程序,所述证件鉴伪程序被所述处理器执行时实现如下步骤:
    获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
    根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
    根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
  10. 如权利要求9所述的证件鉴伪设备,其中,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤包括:
    从所述第一鉴伪图的四角区域中的至少两个区域分别提取第一子图片,并从所述第二鉴伪图的四角区域中的至少两个区域分别提取第二子图片;
    根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差;
    根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值。
  11. 如权利要求10所述的证件鉴伪设备,其中,所述根据各所述第一子图片和各所述 第二子图片,确定多个所述图像梯度方差的步骤包括:
    根据预设公式,对各所述第一子图片中的像素分别进行向量计算,得到多个第一梯度向量;
    根据所述预设公式,对各所述第二子图片中的像素分别进行向量计算,得到多个第二梯度向量;
    根据多个所述第一梯度向量和多个所述第二梯度向量,生成多个梯度向量相对值;
    对多个所述梯度向量相对值分别进行方差计算,生成多个所述图像梯度方差。
  12. 如权利要求10所述的证件鉴伪设备,其中,所述根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值的步骤包括:
    计算所述第一鉴伪图中各像素的第一平均值,以及所述第二鉴伪图中各像素的第二平均值;
    在所述第一平均值和所述第二平均值进行差值运算,生成所述亮度平均差值;
    将所述第一鉴伪图和所述第二鉴伪图灰度化处理后,基于边缘检测,计算第一鉴伪图和第二鉴伪图分别在预设方向上的第一梯度图和第二梯度图;
    根据所述第一梯度图中的像素和所述第二梯度图中的像素,生成所述灰度平均差值。
  13. 如权利要求9-12任一项所述的证件鉴伪设备,其中,在所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤之前,所述证件鉴伪程序被所述处理器执行时还实现如下步骤:
    根据所述第一鉴伪图,从所述第一证件图中提取第一修正图,并根据所述第二鉴伪图,从所述第二证件图中提取第二修正图;
    对所述第一修正图和所述第二修正图进行灰度处理后,计算第一修正图中各像素的第一修正均值,以及计算第二修正图中各像素的第二修正均值;
    确定所述第一鉴伪图的各像素中小于所述第一修正均值的第一像素,以及所述第二鉴伪图的各像素中小于所述第二修正均值的第二像素;
    调用预设像素值分别对所述第一像素和所述第二像素进行修正,以更新所述第一鉴伪图和所述第二鉴伪图。
  14. 如权利要求9-12任一项所述的证件鉴伪设备,其中,所述根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
    将多个所述图像梯度方差分别和第一预设阈值对比,确定多个所述图像梯度方差中大于所述第一预设阈值的目标图像梯度方差,并统计所述目标图像梯度方差的方差数量;
    在多个所述图像梯度方差对比,确定多个所述图像梯度方差中的最小值;
    根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
  15. 如权利要求14所述的证件鉴伪设备,其中,所述根据所述方差数量、所述最小值、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪的步骤包括:
    判断所述灰度平均差值是否大于第一预设差值,若大于所述第一预设差值,则判定所述待鉴伪证件为真实证件;
    若不大于第一预设差值,则判断所述灰度平均差值是否小于第二预设差值,且所述亮度平均差值是否小于第三预设差值;
    若所述灰度平均差值小于第二预设差值,且所述亮度平均差值小于第三预设差值,则判定所述待鉴伪证件为虚假证件;
    若所述灰度平均差值不小于第二预设差值,或者所述亮度平均差值不小于第三预设差值,则判断所述方差数量是否大于或等于预设数量,且所述最小值是否大于第二预设阈值;
    若所述方差数量大于或等于预设数量,且所述最小值大于第二预设阈值,则判断所述待鉴伪证件为真实证件;
    若所述方差数量小于预设数量,且所述最小值不大于第二预设阈值,则判定所述待鉴伪证件为虚假证件。
  16. 一种可读存储介质,其中,所述可读存储介质上存储有证件鉴伪程序,所述证件鉴伪程序被处理器执行时实现如下步骤:
    获取待鉴伪证件在不同光线下拍摄的第一证件图片和第二证件图片,并根据所述待鉴伪证件的预设鉴伪点,分别从所述第一证件图片和所述第二证件图片中提取出第一鉴伪图和第二鉴伪图;
    根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值;
    根据多个所述图像梯度方差、所述灰度平均差值和所述亮度平均差值,对所述待鉴伪证件进行鉴伪。
  17. 如权利要求16所述的可读存储介质,其中,所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤包括:
    从所述第一鉴伪图的四角区域中的至少两个区域分别提取第一子图片,并从所述第二鉴伪图的四角区域中的至少两个区域分别提取第二子图片;
    根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差;
    根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值。
  18. 如权利要求17所述的可读存储介质,其中,所述根据各所述第一子图片和各所述第二子图片,确定多个所述图像梯度方差的步骤包括:
    根据预设公式,对各所述第一子图片中的像素分别进行向量计算,得到多个第一梯度向量;
    根据所述预设公式,对各所述第二子图片中的像素分别进行向量计算,得到多个第二梯度向量;
    根据多个所述第一梯度向量和多个所述第二梯度向量,生成多个梯度向量相对值;
    对多个所述梯度向量相对值分别进行方差计算,生成多个所述图像梯度方差。
  19. 如权利要求17所述的可读存储介质,其中,所述根据所述第一鉴伪图中的像素和所述第二鉴伪图中的像素,生成所述灰度平均差值和所述亮度平均差值的步骤包括:
    计算所述第一鉴伪图中各像素的第一平均值,以及所述第二鉴伪图中各像素的第二平均值;
    在所述第一平均值和所述第二平均值进行差值运算,生成所述亮度平均差值;
    将所述第一鉴伪图和所述第二鉴伪图灰度化处理后,基于边缘检测,计算第一鉴伪图和第二鉴伪图分别在预设方向上的第一梯度图和第二梯度图;
    根据所述第一梯度图中的像素和所述第二梯度图中的像素,生成所述灰度平均差值。
  20. 如权利要求16-19任一项所述的可读存储介质,其中,在所述根据所述第一鉴伪图和所述第二鉴伪图,确定多个图像梯度方差、灰度平均差值以及亮度平均差值的步骤之前,所述证件鉴伪程序被处理器执行时还实现如下步骤:
    根据所述第一鉴伪图,从所述第一证件图中提取第一修正图,并根据所述第二鉴伪图,从所述第二证件图中提取第二修正图;
    对所述第一修正图和所述第二修正图进行灰度处理后,计算第一修正图中各像素的第一修正均值,以及计算第二修正图中各像素的第二修正均值;
    确定所述第一鉴伪图的各像素中小于所述第一修正均值的第一像素,以及所述第二鉴伪图的各像素中小于所述第二修正均值的第二像素;
    调用预设像素值分别对所述第一像素和所述第二像素进行修正,以更新所述第一鉴伪图和所述第二鉴伪图。
PCT/CN2020/125010 2020-09-03 2020-10-30 证件鉴伪方法、装置、设备及可读存储介质 WO2021189850A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010925576.4A CN112017352B (zh) 2020-09-03 2020-09-03 证件鉴伪方法、装置、设备及可读存储介质
CN202010925576.4 2020-09-03

Publications (1)

Publication Number Publication Date
WO2021189850A1 true WO2021189850A1 (zh) 2021-09-30

Family

ID=73515909

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/125010 WO2021189850A1 (zh) 2020-09-03 2020-10-30 证件鉴伪方法、装置、设备及可读存储介质

Country Status (2)

Country Link
CN (1) CN112017352B (zh)
WO (1) WO2021189850A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113378878B (zh) * 2021-04-30 2022-08-16 长城信息股份有限公司 一种身份证鉴伪方法和电子设备
CN113240043B (zh) * 2021-06-01 2024-04-09 平安科技(深圳)有限公司 基于多图片差异性的鉴伪方法、装置、设备及存储介质
CN113705486B (zh) * 2021-08-31 2023-11-10 支付宝(杭州)信息技术有限公司 检测证件真伪的方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1426016A (zh) * 2001-12-13 2003-06-25 欧姆龙株式会社 证件真伪识别装置及真伪识别方法
US20150003717A1 (en) * 2011-08-01 2015-01-01 Samsung Electronics Co., Ltd. Method of identifying a counterfeit bill using a portable terminal
CN106803086A (zh) * 2016-12-30 2017-06-06 北京旷视科技有限公司 辨别证件真实性的方法、装置及系统
CN107085883A (zh) * 2017-03-15 2017-08-22 深圳怡化电脑股份有限公司 一种纸币识别的方法和装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005076230A1 (en) * 2004-02-05 2005-08-18 Nv Bekaert Sa Optical system for controlling value documents
JP4760973B2 (ja) * 2008-12-16 2011-08-31 カシオ計算機株式会社 撮像装置及び画像処理方法
CN104574424B (zh) * 2015-02-03 2016-03-23 中国人民解放军国防科学技术大学 基于多分辨率dct边缘梯度统计的无参照图像模糊度评价方法
CN106780962B (zh) * 2016-11-10 2019-04-12 深圳怡化电脑股份有限公司 一种纸币鉴伪的方法及装置
CN107832735A (zh) * 2017-11-24 2018-03-23 百度在线网络技术(北京)有限公司 用于识别人脸的方法和装置
CN109558903A (zh) * 2018-11-20 2019-04-02 拉扎斯网络科技(上海)有限公司 一种证照图像检测方法、装置、电子设备及可读存储介质
CN110490204B (zh) * 2019-07-11 2022-07-15 深圳怡化电脑股份有限公司 图像处理方法、图像处理装置及终端
CN110516739B (zh) * 2019-08-27 2022-12-27 创新先进技术有限公司 一种证件识别方法、装置及设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1426016A (zh) * 2001-12-13 2003-06-25 欧姆龙株式会社 证件真伪识别装置及真伪识别方法
US20150003717A1 (en) * 2011-08-01 2015-01-01 Samsung Electronics Co., Ltd. Method of identifying a counterfeit bill using a portable terminal
CN106803086A (zh) * 2016-12-30 2017-06-06 北京旷视科技有限公司 辨别证件真实性的方法、装置及系统
CN107085883A (zh) * 2017-03-15 2017-08-22 深圳怡化电脑股份有限公司 一种纸币识别的方法和装置

Also Published As

Publication number Publication date
CN112017352A (zh) 2020-12-01
CN112017352B (zh) 2022-12-06

Similar Documents

Publication Publication Date Title
WO2021189850A1 (zh) 证件鉴伪方法、装置、设备及可读存储介质
JP6918148B2 (ja) 証明書の検証方法、装置、電子機器および記憶媒体
US10235550B2 (en) Methods and systems for capturing biometric data
JP7165746B2 (ja) Id認証方法および装置、電子機器並びに記憶媒体
US11080384B2 (en) Systems and methods for authentication using digital signature with biometrics
US10248954B2 (en) Method and system for verifying user identity using card features
AU2012200238B2 (en) Methods and Systems of Authentication
KR20200032206A (ko) 얼굴인식 잠금해제 방법 및 장치, 기기, 매체
US20140283113A1 (en) Efficient prevention of fraud
US11824851B2 (en) Identification document database
WO2021212873A1 (zh) 证件四角残缺检测方法、装置、设备及存储介质
CN113642639B (zh) 活体检测方法、装置、设备和存储介质
US11600130B2 (en) Validation method and apparatus for identification documents
CN112434727A (zh) 身份证明文件认证方法和系统
US11295437B2 (en) Authentication method and system
US20220019786A1 (en) Methods and systems for detecting photograph replacement in a photo identity document
US11872832B2 (en) Texture-based authentication of digital identity documents
CN112434747A (zh) 认证方法和系统
CN117746442A (zh) 手写签名验证方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20927668

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20927668

Country of ref document: EP

Kind code of ref document: A1