CN117218654A - Bank card number identification method and device, storage medium and electronic equipment - Google Patents

Bank card number identification method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117218654A
CN117218654A CN202311170681.1A CN202311170681A CN117218654A CN 117218654 A CN117218654 A CN 117218654A CN 202311170681 A CN202311170681 A CN 202311170681A CN 117218654 A CN117218654 A CN 117218654A
Authority
CN
China
Prior art keywords
image
pixel
pixel point
value
bank card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311170681.1A
Other languages
Chinese (zh)
Inventor
张娜娜
李朝
訾新宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202311170681.1A priority Critical patent/CN117218654A/en
Publication of CN117218654A publication Critical patent/CN117218654A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Image Processing (AREA)

Abstract

The application discloses a method, a device, a storage medium and electronic equipment for identifying a bank card number, wherein the method is applied to the field of artificial intelligence, the field of financial science and technology or other technical fields, and comprises the following steps: removing noise from the target image by a median filtering technology to obtain a first image; processing the first image by adopting a multi-scale filter to obtain a second image; performing binarization processing on the second image to obtain a third image; and extracting the bank card number of the third image by the OCR technology to obtain the bank card number. According to the application, the problem of low accuracy in identifying the card number of the bank card in the image due to the fact that interference factors exist beside the card number of the bank card in the image when the card number of the bank card in the image is identified in the related technology is solved.

Description

Bank card number identification method and device, storage medium and electronic equipment
Technical Field
The application relates to the technical field of artificial intelligence, the technical field of finance and technology or other technical fields, in particular to a method and a device for identifying a bank card number, a storage medium and electronic equipment.
Background
At present, along with the rapid development of science and technology, society also rapidly develops towards digitization and intellectualization, and great changes are brought to life of people. Specifically, the payment mode of the consumer in shopping gradually evolves from cash payment to mobile payment, and the consumer does not need to carry a bank card or a wallet when going out, so that the payment of the consumer is more convenient and quick, and is safer and more reliable. Before mobile payment is made, the user needs to fill in a bank card held by the user and personal information of the user on the third party payment platform, so that the bank card is bound into a user account of the third party payment platform.
The general user can manually input the bank card number in the bank card into the third party payment platform, but the efficiency of manual input of the user in the method is lower, and meanwhile, the error rate of inputting the bank card number by the user is increased. In addition, the user can also open the mobile phone camera through the third party payment platform, shoot the image containing the bank card, acquire the bank card number. However, when the bank card number in the image is identified in the prior art, the accuracy of identifying the bank card number is low due to a large number of interference factors (for example, a region with similar color exists beside the card number of the bank card) in the image.
Aiming at the problem that the accuracy of identifying the card number of the bank card in the image is low because of the interference factors existing beside the card number of the bank card in the image when the card number of the bank card in the image is identified in the related art, no effective solution is proposed at present.
Disclosure of Invention
The application mainly aims to provide a method, a device, a storage medium and electronic equipment for identifying a card number of a bank card, which are used for solving the problem that the accuracy of identifying the card number of the bank card in an image is lower because of interference factors existing beside the card number of the bank card in the image when the card number of the bank card in the image is identified in the related technology.
In order to achieve the above object, according to one aspect of the present application, there is provided a method for identifying a card number of a bank card, the method comprising: removing noise from a target image by a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified; processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function; performing binarization processing on the second image to obtain a third image; and extracting the bank card number of the third image by an OCR technology to obtain the bank card number.
Further, processing the first image with a multi-scale filter to obtain a second image includes: determining a scale space derivative according to the convolution property of the Gaussian filter and the coordinate of each pixel point; calculating a hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image; constructing a characteristic equation of a hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point; processing each first characteristic value through a linear filter and auxiliary characteristic values to determine a multi-scale filter corresponding to each pixel point; and iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining the second image according to the pixel value corresponding to each pixel point.
Further, processing each first eigenvalue through a linear filter and an auxiliary eigenvalue, and determining a multi-scale filter corresponding to each pixel point includes: redefining each first characteristic value through the linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for a target pixel point in the first image, and the target pixel point is the pixel point containing the bank card number to be identified; configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a spatial scale factor; and determining a pixel value corresponding to each pixel point according to the third characteristic value corresponding to each pixel point and the second characteristic value corresponding to each pixel point, and obtaining the multi-scale filter corresponding to each pixel point.
Further, iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, including: determining the value range of the spatial scale factor in the multi-scale filter to obtain a numerical value interval; determining the iteration step length of the space scale factor according to the numerical value interval; adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer; and determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
Further, performing binarization processing on the second image to obtain a third image includes: determining pixel points in the second image, wherein the pixel value of the pixel points is larger than or equal to a second preset pixel value, so as to obtain a first pixel point; determining the pixel points except the first pixel point in the second image as second pixel points; resetting the pixel value of the first pixel point in the second image to be 1, and resetting the pixel value of the second pixel point in the second image to be 0, so as to obtain the third image.
Further, before determining the pixel point with the pixel value greater than or equal to the second preset pixel value in the second image to obtain the first pixel point, the method further includes: determining the type of the bank card contained in the bank card number to be identified according to the service scene; determining the type of the bank card of the second image according to the type of the bank card to obtain a target type; cutting the second image according to the target type to obtain a cut second image; and replacing the second image by the cropped second image.
Further, extracting the bank card number of the third image by using an OCR technology, where obtaining the bank card number includes: creating an OCR object of the third image by means of an OCR function in matlab; and processing the OCR object by adopting the OCR function to obtain the bank card number.
Further, removing noise from the target image by a median filtering technique, and obtaining a first image includes: determining the window size of a filtering window according to the target image to obtain a preset window; placing the preset window at an ith pixel point in the target image, wherein i is a positive integer; calculating the median value of pixel values contained in the preset window to obtain a target median value; updating the pixel value of the ith pixel point according to the target median; moving the preset window to the (i+1) th pixel point according to a preset sequence, and taking the (i+1) th pixel point as the (i) th pixel point; and repeatedly executing the step of calculating the median of the pixel values contained in the preset window to obtain a target median until the (i+1) th pixel point is used as the (i) th pixel point, until the preset window traverses the pixel points in the target image, and obtaining the first image.
Further, before the noise removal processing is performed on the target image by the median filtering technology to obtain the first image, the method further includes: acquiring an image containing the bank card number to be identified, and obtaining a fourth image; determining a first pixel value and a second pixel value in the fourth image, wherein the first pixel value is a pixel value larger than or equal to a third preset pixel value, and the second pixel value is a pixel value smaller than or equal to a fourth preset pixel value; calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point; calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value; and calculating the ratio of the third pixel value corresponding to each pixel point to the fourth pixel value, and determining the target image according to the ratio corresponding to each pixel point.
In order to achieve the above object, according to another aspect of the present application, there is provided an identification device of a card number of a bank card, the device comprising: the first processing unit is used for removing noise from the target image through a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified; the second processing unit is used for processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function; the third processing unit is used for carrying out binarization processing on the second image to obtain a third image; and the extracting unit is used for extracting the bank card number of the third image through an OCR technology to obtain the bank card number.
Further, the second processing unit includes: a first determining subunit, configured to determine a scale space derivative according to the convolution property of the gaussian filter and the coordinate of each pixel point; the first calculating subunit is used for calculating the hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image; the second computing subunit is used for constructing a characteristic equation of the hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point; the first processing subunit is used for processing each first characteristic value through the linear filter and the auxiliary characteristic value and determining a multi-scale filter corresponding to each pixel point; and the third calculation subunit is used for iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining the second image according to the pixel value corresponding to each pixel point.
Further, the processing subunit includes: the first processing module is used for redefining each first characteristic value through the linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for a target pixel point in the first image, and the target pixel point is the pixel point containing the bank card number to be identified; the second processing module is used for configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a space scale factor; the first determining module is configured to determine a pixel value corresponding to each pixel according to the third feature value corresponding to each pixel and the second feature value corresponding to each pixel, so as to obtain the multi-scale filter corresponding to each pixel.
Further, the third calculation subunit includes: the second determining module is used for determining the value range of the spatial scale factors in the multi-scale filter to obtain a numerical value interval; the third determining module is used for determining the iteration step length of the space scale factor according to the numerical value interval; the calculation module is used for adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer; and the fourth determining module is used for determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
Further, the third processing unit includes: a second determining subunit, configured to determine a pixel point in the second image where a pixel value is greater than or equal to a second preset pixel value, to obtain a first pixel point; a third determining subunit configured to determine, as a second pixel, a pixel point in the second image other than the first pixel point; and the resetting subunit is used for resetting the pixel value of the first pixel point in the second image to be 1 and resetting the pixel value of the second pixel point in the second image to be 0 to obtain the third image.
Further, the third processing unit further includes: a fourth determining subunit, configured to determine, according to a service scenario, a type of a bank card included in the to-be-identified bank card number before determining a pixel point in the second image where a pixel value is greater than or equal to a second preset pixel value, to obtain a first pixel point; a fifth determining subunit, configured to determine a bank card type of the second image according to the bank card type, so as to obtain a target type; the clipping subunit is used for clipping the second image according to the target type to obtain a clipped second image; and the replacing subunit is used for replacing the second image by adopting the cropped second image.
Further, the extraction unit includes: a creation subunit for creating an OCR object of the third image by means of an OCR function in matlab; and the second processing subunit is used for processing the OCR object by adopting the OCR function to obtain the bank card number.
Further, the first processing unit includes: a fifth determining subunit, configured to determine a window size of a filtering window according to the target image, so as to obtain a preset window; a third processing subunit, configured to place the preset window at an ith pixel point in the target image, where i is a positive integer; a fourth calculating subunit, configured to calculate a median value of pixel values included in the preset window, to obtain a target median value; an updating subunit, configured to update a pixel value of the ith pixel point according to the target median; a fourth processing subunit, configured to move the preset window to an i+1th pixel point according to a preset sequence, and take the i+1th pixel point as an i-th pixel point; and a fifth calculating subunit, configured to repeatedly perform the step of calculating a median of pixel values included in the preset window to obtain a target median until the preset window traverses pixel points in the target image to obtain the first image, where the i+1th pixel point is used as the i-th pixel point.
Further, the apparatus further comprises: the acquisition unit is used for acquiring an image containing the bank card number to be identified before noise removal processing is carried out on the target image through a median filtering technology to obtain a first image, so as to obtain a fourth image; a determining unit, configured to determine a first pixel value and a second pixel value in the fourth image, where the first pixel value is a pixel value greater than or equal to a third preset pixel value, and the second pixel value is a pixel value less than or equal to a fourth preset pixel value; the first calculating unit is used for calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point; the second calculating unit is used for calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value; and the third calculation unit is used for calculating the ratio of the third pixel value corresponding to each pixel point to the fourth pixel value respectively and determining the target image according to the ratio corresponding to each pixel point.
In order to achieve the above object, according to one aspect of the present application, there is provided a computer readable storage medium, including a stored computer program, wherein the computer program, when executed, controls a device in which the computer readable storage medium is located to perform the method for identifying a card number of a bank card according to any one of the above.
In order to achieve the above object, according to one aspect of the present application, there is provided an electronic device including one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method for identifying a bank card number according to any one of the above.
According to the application, the following steps are adopted: removing noise from a target image by a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified; processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function; performing binarization processing on the second image to obtain a third image; the bank card number of the third image is extracted through the OCR technology, so that the bank card number is obtained, and the problem that the accuracy of identifying the bank card number in the image is low due to the fact that interference factors exist beside the bank card number in the image when the bank card number in the image is identified in the related technology is solved. The pixel value of each pixel point in the target image is calculated by adopting a median filtering technology and a method of combining the Gaussian function and the characteristic value of the Hessen matrix, so that interference factors of background information or irrelevant information in the target image are removed, the area containing the bank card number in the target image is highlighted, the irrelevant information in the target image is reduced, the contrast of the target image is enhanced, the effect of improving the accuracy of identifying the bank card number is achieved, and the effect of improving the service quality is further achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
FIG. 1 is a flowchart of a method for identifying a bank card number according to a first embodiment of the present application;
FIG. 2 is a schematic diagram I of an alternative method for identifying a bank card number according to the first embodiment of the present application;
FIG. 3 is a schematic diagram II of an alternative method for identifying a bank card number according to the first embodiment of the present application;
fig. 4 is a schematic diagram III of an alternative method for identifying a bank card number according to the first embodiment of the present application;
FIG. 5 is a schematic diagram IV of an alternative method for identifying a bank card number according to the first embodiment of the application;
fig. 6 is a schematic diagram of a device for identifying a card number of a bank card according to a second embodiment of the present application;
fig. 7 is a schematic diagram of an electronic device for identifying a card number of a bank card according to a fifth embodiment of the present application.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
It should be noted that, the method and apparatus for processing a file, the storage medium, and the method and apparatus for determining an electronic device according to the present application may be used in the field of financial technology to improve the accuracy of identifying a card number of a bank card when identifying a card number of a bank card in an image, and may also be used in any field other than the field of financial technology.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, user information stored in a financial institution, etc.) and the data (including, but not limited to, data for analysis, stored data, displayed data, user data stored in a financial institution, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the relevant laws and regulations and standards of the related area, and are provided with corresponding operation entries for the user to select authorization or rejection.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, the following will describe some terms or terminology involved in the embodiments of the present application:
OCR (Optical Character Recognition) is an optical character recognition technique, which is a technique for converting a printed or handwritten text into an editable text. It recognizes and converts the words in the image into computer readable text form by image processing, pattern recognition, machine learning, etc. OCR technology is widely used in a variety of settings such as automated processing of scanned documents, construction of digital libraries, license plate recognition, identification of identification cards, etc.
The median filtering is a nonlinear filtering technology operating in the image space domain, and is different from the mean filtering in that the intermediate value of the gray values of all pixels in a pixel and its neighborhood is taken as the pixel value of the point in the output image, so as to achieve the purpose of removing noise. The range of the pixel field is selected to be used as a template or a smooth window, and the shape and the size of a general template have great influence on the filtering effect, so that the template size is gradually adjusted when the template size is selected, and finally the most satisfactory effect is obtained. Common template shapes are rectangular, cross-shaped, circular, etc. The result of the median filtering is determined by the intermediate pixel values of the neighborhood pixels of the target pixel, so that pixels with larger differences from surrounding pixel values, i.e. isolated noise points, are easier to remove, and protection of image edge information can be achieved.
The Hessian matrix is composed of the second partial derivative I of each pixel point in the image xx ,I xy ,I yx ,I yy The specific expression of the Hessian matrix is shown in a formula I,
according to the magnitude relation of the two eigenvalues of the Hessian matrix, different characteristic structures in the image can be detected in a selected mode. Let lambda be 1 ,λ 2 Is two eigenvalues of Hessian matrix of a pixel point in the image, and is |lambda 1 |≤|λ 2 And carrying out structural detection of the corresponding geometric structure according to the magnitude relation between the two characteristic values, wherein the magnitude relation between the two characteristic values and the geometric structure are shown in a table I, L represents low (low), H represents high (high), and +represents the sign of the characteristic value.
Example 1
The present application will be described with reference to preferred implementation steps, and fig. 1 is a flowchart of a method for identifying a card number of a bank card according to an embodiment of the present application, as shown in fig. 1, and the method includes the following steps:
step S101, noise removal processing is carried out on a target image through a median filtering technology, and a first image is obtained, wherein the target image contains a bank card number to be identified.
In the first embodiment, the target image is an image including the card number of the bank card to be identified obtained by photographing the bank card by the photographing device. Fig. 2 is a schematic diagram of the target image in this embodiment, and "111111111111111111" in fig. 2 indicates the number of the bank card to be identified.
Because the target image often contains background information or information irrelevant to the card number of the bank card, in order to avoid that the background information or the irrelevant information interferes with the identification process of the card number of the bank card, a median filtering technology is required to remove noise information in the target image so as to remove interference information in the target image.
Step S102, a multi-scale filter is adopted to process the first image to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function.
In the first embodiment, the multi-scale filter is a filter constructed by combining the characteristic values of the hessian matrix and the gaussian function, and is used for calculating the pixel value of each pixel point in the first image so as to highlight the area of the bank card number in the first image, enhance the image contrast, and further obtain the second image beneficial to identifying the bank card number.
Step S103, binarizing the second image to obtain a third image.
In the first embodiment, the binarization processing refers to converting the second image into a black-and-white image, i.e. adjusting the pixel value of each pixel point in the second image to 0 or 1, so as to enhance the distinction between the bank card number and the pixel points in the nearby area, and obtain a third image beneficial to identifying the bank card number. Fig. 3 is a schematic diagram of a target image after median filtering, multi-scale filter and binarization processing in the present solution, and it can be seen that the bank card number to be identified in fig. 3 is clearer.
Step S104, extracting the bank card number of the third image by OCR technology to obtain the bank card number.
In the first embodiment, OCR (Optical Character Recognition) technology refers to optical character recognition technology, which can convert printed matter or handwritten characters into text data. The bank card number in the third image after binarization processing is greatly different from the pixel points in the nearby area, so that the bank card number in the third image can be extracted by adopting an optical character recognition technology.
After the bank card number is identified, the bank card number can be filled into a corresponding position according to a specific business scene, for example, when the third party payment software of the user binds the bank card, the identified bank card number can be directly filled into an input box of the user, so that the time of manual input of the user is saved, and the user experience is improved; or when the user inquires the bank card information from the business personnel of the financial institution, the identified bank card number can be filled in an inquiry frame in the financial institution inquiry system to inquire the information required by the user, so that the time of manual input of the business personnel is saved, and the working efficiency of the financial institution is improved.
In summary, in the identification method of the bank card number provided in the first embodiment of the present application, noise removal processing is performed on the target image through a median filtering technology to obtain the first image, where the target image includes the bank card number to be identified; processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function; performing binarization processing on the second image to obtain a third image; the bank card number of the third image is extracted through the OCR technology, so that the bank card number is obtained, and the problem that the accuracy of identifying the bank card number in the image is lower due to the fact that interference factors exist beside the bank card number in the image when the bank card number in the image is identified in the related technology is solved. The pixel value of each pixel point in the target image is calculated by adopting a median filtering technology and a method of combining the Gaussian function and the characteristic value of the Hessen matrix, so that interference factors of background information or irrelevant information in the target image are removed, the area containing the bank card number in the target image is highlighted, the irrelevant information in the target image is reduced, the contrast of the target image is enhanced, the effect of improving the accuracy of identifying the bank card number is achieved, and the effect of improving the service quality is further achieved.
Optionally, in the method for identifying a card number of a bank card provided in the first embodiment of the present application, processing the first image with a multi-scale filter to obtain the second image includes: determining a scale space derivative according to the convolution property of the Gaussian filter and the coordinate of each pixel point; calculating a hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image; constructing a characteristic equation of a hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point; processing each first characteristic value through a linear filter and auxiliary characteristic values to determine a multi-scale filter corresponding to each pixel point; and iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining a second image according to the pixel value corresponding to each pixel point.
In the first embodiment, the feature value of the Hessian matrix (Hessian matrix) and the gaussian function are combined with each other to construct a multi-scale filter, then the multi-scale filter is adopted to perform filtering processing on the first image, and finally the identification of the bank card number is performed on the filtered image.
In particular, according to the convolution properties of the Gaussian function, one can be derived from the inputConvolution of the first image of (1) with the second derivative of the gaussian filter yields the scale space derivative I The specific formula is shown as a formula II,
where σ is the standard deviation of the gaussian function, σ is the introduced spatial scale factor, I denotes the Hessian matrix,is a partial derivative symbol, G represents a gaussian function, and x and y represent coordinate values of each pixel point in the first image.
The Hessian matrix is composed of the second partial derivative I of each pixel point in the image xx ,I xy ,I yx ,I yy The specific formula is shown as formula one, wherein H represents Hessian matrix, x and y represent coordinates of each pixel point, I xx ,I xy ,I yx ,I yy Representing the second partial derivative of each pixel. According to the magnitude relation of the two eigenvalues of the Hessian matrix, different characteristic structures in the image can be detected in a selected mode. Let lambda be 1 ,λ 2 Is two eigenvalues of Hessian matrix of a pixel point in the image, and is |lambda 1 |≤|λ 2 And carrying out structural detection of the corresponding geometric structure according to the magnitude relation between the two characteristic values, wherein the magnitude relation between the two characteristic values and the geometric structure are shown in a table I, L represents low (low), H represents high (high), and +represents the sign of the characteristic value.
Then, use is made of the scale space derivative I Replacement of the second partial derivative I in the Hessian matrix xx ,I xy ,I yx ,I yy The resulting replaced hessian matrix is shown in equation three,
secondly, substituting the coordinates of each pixel point in the first image into the hessian matrix combined with the Gaussian function to obtain the hessian matrix of each pixel point, constructing a characteristic equation of the hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value (namely lambda) corresponding to each pixel point 1 And lambda (lambda) 2 )。
And finally, processing each first characteristic value through a linear filter and an auxiliary characteristic value, determining a multi-scale filter corresponding to each pixel point, iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining a second image according to the pixel value corresponding to each pixel point.
The multi-scale filter is obtained by combining the Gaussian function and the characteristic value of the Hessen matrix, and images of different scales of the multi-scale filter can be adopted for analysis, so that the characteristics of the different scales are extracted, the contrast of the images is improved, the identification of the bank card number in the images is facilitated, and the effect of improving the accuracy of identifying the bank card number is achieved.
Optionally, in the method for identifying a card number of a bank card according to the first embodiment of the present application, processing each first feature value through a linear filter and an auxiliary feature value, and determining a multi-scale filter corresponding to each pixel point includes: redefining each first characteristic value through a linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for a target pixel point in the first image, and the target pixel point is the pixel point containing a bank card number to be identified; configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a spatial scale factor; and determining a pixel value corresponding to each pixel point according to the third characteristic value corresponding to each pixel point and the second characteristic value corresponding to each pixel point, and obtaining a multi-scale filter corresponding to each pixel point.
In the first embodiment, in order to obtain the multi-scale filter, the eigenvalues of the hessian matrix need to be processed.
Specifically, because the application scenario of the scheme is identification of the bank card number, that is, identification of the dark number under the bright background, the characteristic value of the pixel point which can be determined to belong to the bank card number digital structure according to the table should conform to |lambda 1 |≤|λ 2 |。
Then redefining the characteristic value of each pixel, and adopting linear filter to make characteristic value lambda 1 And lambda (lambda) 2 The processing is carried out, the specific formula is shown as a formula IV,
where i represents the ith pixel, lambda i And the characteristic value of the ith pixel is represented, a dark structure under a bright background represents a pixel which belongs to the bank card number to be identified in the first image, and a bright structure under the dark background represents a pixel which does not belong to the bank card number to be identified in the first image.
Second, an auxiliary eigenvalue lambda is introduced for the eigenvalue of the hessian matrix for each pixel 3 ,λ 3 Is equal to lambda 2 And regularizing the values to obtain regularized characteristic value lambda ρ The specific formula is shown as a formula five,
wherein τ is a control response parameter, the value of the control response parameter τ is within the interval [0,1], and the control response parameter τ may be set to 0.5, or may be adjusted according to the actual production situation, which is not specifically limited in the first embodiment.
Finally, according to the obtained characteristic value lambda 1 、λ 2 And lambda (lambda) 3 Determining a final multiscale filter V ρ Multi-scale filter V ρ The specific formula of (c) is shown as formula six,
wherein lambda is ρ Is to introduce an auxiliary characteristic value lambda 3 Post characteristic value
The characteristic value of each pixel point can be adjusted according to the characteristics of the bank card number in the image, which is beneficial to enhancing the edge characteristic information in the image, and meanwhile, the multi-scale filter can process images containing the bank card number in various scenes, thereby achieving the effect of improving the accuracy of identifying the bank card number.
Optionally, in the method for identifying a card number of a bank card provided in the first embodiment of the present application, iterating the multi-scale filter corresponding to each pixel, to obtain a pixel value corresponding to each pixel includes: determining the value range of the spatial scale factors in the multi-scale filter to obtain a numerical value interval; determining the iteration step length of the space scale factor according to the numerical value interval; adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer; and determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
In the first embodiment, in order to obtain a suitable value of the spatial scale factor, the multi-scale filter corresponding to each pixel point may be iterated.
Specifically, the value range of the spatial scale factor is determined, for example, the value range of the spatial scale factor in the first embodiment may be set to [1.5,2]; then, determining an iteration step length of the spatial scale factor according to the numerical interval, for example, when the value range is [1.5,2], setting the iteration step length to be 0.1; secondly, determining the iteration times N according to the iteration step length and the numerical value interval, and calculating the multi-scale filter corresponding to each pixel point for N times according to the value of the time scale factor in each iteration to obtain N pixel values corresponding to each pixel point, for example, when the value range is [1.5,2], and the iteration step length is 0.1, each pixel point needs to be calculated for 6 times to obtain 6 pixel values corresponding to each pixel point, and the numerical value of the time scale factor in each calculation is 1.5, 1.6, 1.7, 1.8, 1.9 and 2.0 respectively; and finally, selecting a pixel value larger than a first preset threshold value from N pixel values corresponding to each pixel point as the pixel value of the pixel point, wherein the first preset threshold value can be set as the largest pixel value in the N pixel values corresponding to each pixel point.
The pixel value corresponding to each pixel point is calculated for many times according to the multi-scale filter by changing the value of the spatial scale factor, and when the output value of the multi-scale filter is maximum, the maximum output value is taken as the maximum pixel value of the pixel point.
Optionally, in the method for identifying a card number of a bank card provided in the first embodiment of the present application, performing binarization processing on the second image to obtain a third image includes: determining pixel points in the second image, wherein the pixel value of the pixel points is larger than or equal to a second preset pixel value, so as to obtain a first pixel point; determining the pixel points except the first pixel point in the second image as second pixel points; resetting the pixel value of the first pixel point in the second image to be 1, and resetting the pixel value of the second pixel point in the second image to be 0 to obtain a third image.
In the first embodiment, in order to more accurately identify the bank card number, the pixel value of each pixel point in the second image may be binarized. Specifically, when the pixel value in the second image is greater than or equal to a second preset threshold (which may be set to 0.2, without specific limitation in the first embodiment), the pixel value is set to 1; when the pixel value in the second image is smaller than the second preset threshold value, the pixel value is set to 0, the specific method is shown as a formula seven,
Wherein (x, y) represents the coordinates of each pixel point, I img (x, y) represents the pixel value of the coordinates (x, y) in the second image, thr represents a second preset threshold value, I out (x, y) represents the pixel value of the coordinates (x, y) in the output image.
Through carrying out binarization processing to the second image, can reduce the complexity of image, separate out the object in the image from the background, reduce the information in the image for the bank card number is more outstanding, has reached the effect of improving the rate of accuracy of discernment bank card number.
Optionally, in the method for identifying a card number of a bank card according to the first embodiment of the present application, before determining a pixel point in the second image where a pixel value is greater than or equal to a second preset pixel value, the method further includes: determining the type of the bank card contained in the bank card number to be identified according to the service scene; determining the type of the bank card of the second image according to the type of the bank card to obtain a target type; cutting the second image according to the target type to obtain a cut second image; and replacing the second image by the cropped second image.
In the first embodiment, in order to more accurately identify the card number of the bank card, the second image may be cut, an area containing the card number of the bank card in the second image is reserved, other areas in the second image are removed, and interference of irrelevant information is reduced.
Specifically, the bank cards can be classified according to the sizes of all the bank cards contained in the business scene, the positions of the areas where the bank card numbers are located and other bank card information, so that different types of bank cards can be obtained. Then, the bank card is cut according to the type of the bank card. For example, as shown in fig. 2, the first type of bank card is generally shown in the lower 1/2 portion of the image, so that the 1/2 portion above the image and the 1/4 portion below the image may not include the relevant area, and only the portion of the image including the card number may be left. Fig. 4 is a schematic diagram of a second image after clipping in this solution, where in fig. 4, only the area containing the card number of the bank card to be identified is clipped, and irrelevant information is clipped.
By cutting the second image before identifying the bank card number, the information irrelevant to the bank card number in the image can be removed, and the accuracy of identifying the bank card number is improved.
Optionally, in the method for identifying a bank card number provided in the first embodiment of the present application, extracting the bank card number of the third image by using OCR technology includes: creating an OCR object of the third image by means of an OCR function in matlab; and processing the OCR object by adopting an OCR function to obtain the bank card number.
In the first embodiment, an OCR object may be created for the binarized image (i.e., the third image described above), and then the bank card number in the OCR object is recognized and extracted by the OCR function in the matlab. The image can be converted into a bank card number by processing the third image through an OCR function in matlab.
Optionally, in the method for identifying a card number of a bank card according to the first embodiment of the present application, performing noise removal processing on a target image by using a median filtering technology, where obtaining a first image includes: determining the window size of a filtering window according to the target image to obtain a preset window; placing a preset window at an ith pixel point in a target image, wherein i is a positive integer; calculating the median value of pixel values contained in a preset window to obtain a target median value; updating the pixel value of the ith pixel point according to the target median; moving a preset window to the (i+1) th pixel point according to a preset sequence, and taking the (i+1) th pixel point as the (i) th pixel point; and repeatedly executing the step of calculating the median value of the pixel values contained in the preset window to obtain a target median value and taking the (i+1) th pixel point as the (i) th pixel point until the preset window traverses the pixel points in the target image to obtain a first image.
In the first embodiment, noise and interference factors in the target image are removed by a median filtering method, and edge characteristic information in the target image is reserved. The median filtering is a nonlinear smoothing technique, and its basic principle is to replace the pixel value of a pixel in a digital image or digital sequence with the median value of each pixel in a neighborhood of the pixel, so that surrounding pixel values are close to the true value, thereby eliminating isolated noise.
Specifically, the window size of the preset window in the scheme is critical to the effect of removing the image noise, so that the size of the preset window can be determined according to the distance factor and the pixel value difference, and the characteristic information of the image can be well reserved while the image noise is removed. In an alternative embodiment, the window size of the preset window may be set to 3*3, and it should be noted that the window size of the preset window may be adjusted according to the actual production situation, which is not specifically limited in the first embodiment.
Noise in the target image is removed through a median filtering technology, the problem that noise in the target image interferes with identification of the bank card number due to low contrast of the target image is avoided, and the effect of improving accuracy of identifying the bank card number is achieved.
Optionally, in the method for identifying a card number of a bank card according to the first embodiment of the present application, before noise removal processing is performed on a target image by using a median filtering technology to obtain a first image, the method further includes: acquiring an image containing a bank card number to be identified, and obtaining a fourth image; determining a first pixel value and a second pixel value in a fourth image, wherein the first pixel value is a pixel value larger than or equal to a third preset pixel value, and the second pixel value is a pixel value smaller than or equal to the fourth preset pixel value; calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point; calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value; and calculating the ratio of the third pixel value to the fourth pixel value corresponding to each pixel point, and determining the target image according to the ratio corresponding to each pixel point.
In the first embodiment, the image including the card number of the bank card to be identified, that is, the fourth image, may be obtained by photographing the bank card with the image capturing device. Then, the fourth image is normalized, the image is operated by using the maximum value and the minimum value of the pixels in the fourth image, so that the pixel value of each pixel in the fourth image is normalized to be within the range of the [0,1] interval, the fourth image to be processed is converted into a standard form, wherein the formula of the normalization is shown as a formula eight,
Wherein I is img Is the fourth image of the input, I out Is the normalized image of the output, min (I img ) Represents the minimum pixel value, max (I img ) Representing the maximum pixel value in the fourth image.
By carrying out normalization processing on the original image (namely the fourth image), the pixel value of the image can be scaled to a proper range, the difference between different images is reduced, the generalization capability of the identification method of the bank card number in the scheme is improved, and the accuracy of identifying the bank card number is improved.
Alternatively, in the first embodiment, the process of identifying the card number of the bank card according to the present embodiment may be as shown in fig. 5. Step S501, start; step S502, obtaining a target image containing a bank card number to be identified; step S503, carrying out normalization processing on the target image to obtain a fifth image; step S504, median filtering is carried out on the fifth image to obtain a sixth image; step S505, a multi-scale filter is obtained by combining the Gaussian function and the eigenvalue of the Hemson matrix, and each pixel point in the sixth image is adjusted by adopting the multi-scale filter to obtain a seventh image; step S506, intercepting an area containing the bank card number to be identified from the seventh image to obtain an eighth image; step S507, binarizing the eighth image to obtain a ninth image; step S508, extracting the bank card number in the ninth image by adopting an OCR function in matlab; step S509 ends.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
Example two
The second embodiment of the present application also provides a device for identifying a card number of a bank card, which needs to be described that the device for identifying a card number of a bank card of the second embodiment of the present application may be used to execute the method for identifying a card number of a bank card provided by the first embodiment of the present application. The following describes a device for identifying a card number of a bank card according to a second embodiment of the present application.
Fig. 6 is a schematic diagram of a device for identifying a card number of a bank card according to a second embodiment of the present application. As shown in fig. 6, the apparatus includes: a first processing unit 601, a second processing unit 602, a third processing unit 603, and an extraction unit 604.
Specifically, the first processing unit 601 is configured to perform noise removal processing on a target image by using a median filtering technology, so as to obtain a first image, where the target image includes a bank card number to be identified.
The second processing unit 602 is configured to process the first image with a multi-scale filter to obtain a second image, where the multi-scale filter is a filter constructed by combining eigenvalues of a hessian matrix and a gaussian function.
The third processing unit 603 is configured to perform binarization processing on the second image to obtain a third image.
And the extracting unit 604 is configured to extract the bank card number of the third image by using an OCR technology, so as to obtain the bank card number.
According to the identification device for the bank card number, provided by the embodiment II of the application, noise removal processing is performed on the target image through a median filtering technology by the first processing unit 601 to obtain a first image, wherein the target image contains the bank card number to be identified; the second processing unit 602 processes the first image by using a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining eigenvalues of a hessian matrix and a gaussian function; the third processing unit 603 performs binarization processing on the second image to obtain a third image; the extracting unit 604 extracts the bank card number of the third image by the OCR technology to obtain the bank card number, so as to solve the problem that the accuracy of identifying the bank card number in the image is low because of the interference factors existing beside the bank card number in the image when identifying the bank card number in the image in the related art. The pixel value of each pixel point in the target image is calculated by adopting a median filtering technology and a method of combining the Gaussian function and the characteristic value of the Hessen matrix, so that interference factors of background information or irrelevant information in the target image are removed, the area containing the bank card number in the target image is highlighted, the irrelevant information in the target image is reduced, the contrast of the target image is enhanced, the effect of improving the accuracy of identifying the bank card number is achieved, and the effect of improving the service quality is further achieved.
Optionally, in the identification device for a card number of a bank card according to the second embodiment of the present application, the second processing unit includes: a first determining subunit, configured to determine a scale space derivative according to the convolution property of the gaussian filter and the coordinate of each pixel point; the first calculating subunit is used for calculating the hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image; the second computing subunit is used for constructing a characteristic equation of the hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point; the first processing subunit is used for processing each first characteristic value through the linear filter and the auxiliary characteristic value and determining a multi-scale filter corresponding to each pixel point; and the third calculation subunit is used for iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining a second image according to the pixel value corresponding to each pixel point.
Optionally, in the identifying device for a bank card number provided in the second embodiment of the present application, the processing subunit includes: the first processing module is used for redefining each first characteristic value through the linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for the target pixel point in the first image, and the target pixel point is the pixel point containing the bank card number to be identified; the second processing module is used for configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a spatial scale factor; the first determining module is used for determining the pixel value corresponding to each pixel point according to the third characteristic value corresponding to each pixel point and the second characteristic value corresponding to each pixel point, and obtaining the multi-scale filter corresponding to each pixel point.
Optionally, in the identification device for a card number of a bank card according to the second embodiment of the present application, the third computing subunit includes: the second determining module is used for determining the value range of the spatial scale factors in the multi-scale filter to obtain a numerical value interval; the third determining module is used for determining the iteration step length of the space scale factor according to the numerical value interval; the calculation module is used for adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer; and the fourth determining module is used for determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
Optionally, in the identification device for a card number of a bank card according to the second embodiment of the present application, the third processing unit includes: the second determining subunit is used for determining pixel points with pixel values larger than or equal to a second preset pixel value in the second image to obtain a first pixel point; a third determining subunit configured to determine, as a second pixel point, a pixel point in the second image other than the first pixel point; and the resetting subunit is used for resetting the pixel value of the first pixel point in the second image to be 1 and resetting the pixel value of the second pixel point in the second image to be 0 to obtain a third image.
Optionally, in the identification device for a card number of a bank card according to the second embodiment of the present application, the third processing unit further includes: a fourth determining subunit, configured to determine, according to the service scenario, a type of a bank card included in the to-be-identified bank card number before determining a pixel point in the second image where the pixel value is greater than or equal to a second preset pixel value, to obtain a first pixel point; a fifth determining subunit, configured to determine a bank card type of the second image according to the bank card type, to obtain a target type; the clipping subunit is used for clipping the second image according to the target type to obtain a clipped second image; and a replacing subunit for replacing the second image with the cropped second image.
Optionally, in the identification device for a card number of a bank card provided in the second embodiment of the present application, the extracting unit includes: a creation subunit for creating an OCR object of the third image by means of an OCR function in the matlab; and the second processing subunit is used for processing the OCR object by adopting an OCR function to obtain the bank card number.
Optionally, in the identification device for a card number of a bank card according to the second embodiment of the present application, the first processing unit includes: a fifth determining subunit, configured to determine a window size of the filtering window according to the target image, so as to obtain a preset window; a third processing subunit, configured to place a preset window at an ith pixel point in the target image, where i is a positive integer; a fourth calculating subunit, configured to calculate a median value of pixel values included in the preset window, to obtain a target median value; an updating subunit, configured to update a pixel value of the ith pixel point according to the target median; a fourth processing subunit, configured to move the preset window to the (i+1) th pixel point according to a preset sequence, and take the (i+1) th pixel point as the (i) th pixel point; and a fifth calculating subunit, configured to repeatedly perform the steps of calculating a median value of pixel values included in the preset window, and obtaining a target median value to the i+1th pixel point as the i-th pixel point, until the preset window traverses the pixel points in the target image, so as to obtain a first image.
Optionally, in the identification device for a card number of a bank card provided in the second embodiment of the present application, the device further includes: the acquisition unit is used for acquiring an image containing a bank card number to be identified before noise removal processing is carried out on the target image through a median filtering technology to obtain a first image, so as to obtain a fourth image; a determining unit, configured to determine a first pixel value and a second pixel value in the fourth image, where the first pixel value is a pixel value greater than or equal to a third preset pixel value, and the second pixel value is a pixel value less than or equal to a fourth preset pixel value; the first calculating unit is used for calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point; the second calculating unit is used for calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value; the third calculation unit is used for calculating the ratio of the third pixel value to the fourth pixel value corresponding to each pixel point, and determining a target image according to the ratio corresponding to each pixel point.
The identification device of the bank card number comprises a processor and a memory, wherein the first processing unit 601, the second processing unit 602, the third processing unit 603, the extracting unit 604 and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be provided with one or more than one, and the accuracy of identifying the bank card number is improved by adjusting the kernel parameters.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The third embodiment of the invention provides a computer readable storage medium, on which a program is stored, which when executed by a processor, implements a method for identifying a card number of a bank card.
The fourth embodiment of the invention provides a processor, which is used for running a program, wherein the program runs to execute the identification method of the bank card number.
As shown in fig. 7, a fifth embodiment of the present invention provides an electronic device, where the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: removing noise from a target image by a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified; processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function; performing binarization processing on the second image to obtain a third image; and extracting the bank card number of the third image by the OCR technology to obtain the bank card number.
The processor also realizes the following steps when executing the program: processing the first image with a multi-scale filter to obtain a second image comprising: determining a scale space derivative according to the convolution property of the Gaussian filter and the coordinate of each pixel point; calculating a hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image; constructing a characteristic equation of a hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point; processing each first characteristic value through a linear filter and auxiliary characteristic values to determine a multi-scale filter corresponding to each pixel point; and iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining a second image according to the pixel value corresponding to each pixel point.
The processor also realizes the following steps when executing the program: processing each first characteristic value through the linear filter and the auxiliary characteristic value, and determining the multi-scale filter corresponding to each pixel point comprises the following steps: redefining each first characteristic value through a linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for a target pixel point in the first image, and the target pixel point is the pixel point containing a bank card number to be identified; configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a spatial scale factor; and determining a pixel value corresponding to each pixel point according to the third characteristic value corresponding to each pixel point and the second characteristic value corresponding to each pixel point, and obtaining a multi-scale filter corresponding to each pixel point.
The processor also realizes the following steps when executing the program: iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, wherein the steps of: determining the value range of the spatial scale factors in the multi-scale filter to obtain a numerical value interval; determining the iteration step length of the space scale factor according to the numerical value interval; adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer; and determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
The processor also realizes the following steps when executing the program: performing binarization processing on the second image to obtain a third image, wherein the step of obtaining the third image comprises the following steps: determining pixel points in the second image, wherein the pixel value of the pixel points is larger than or equal to a second preset pixel value, so as to obtain a first pixel point; determining the pixel points except the first pixel point in the second image as second pixel points; resetting the pixel value of the first pixel point in the second image to be 1, and resetting the pixel value of the second pixel point in the second image to be 0 to obtain a third image.
The processor also realizes the following steps when executing the program: before determining the pixel point with the pixel value greater than or equal to the second preset pixel value in the second image to obtain the first pixel point, the method further includes: determining the type of the bank card contained in the bank card number to be identified according to the service scene; determining the type of the bank card of the second image according to the type of the bank card to obtain a target type; cutting the second image according to the target type to obtain a cut second image; and replacing the second image by the cropped second image.
The processor also realizes the following steps when executing the program: extracting the bank card number of the third image by OCR technology, the obtaining the bank card number comprises: creating an OCR object of the third image by means of an OCR function in matlab; and processing the OCR object by adopting an OCR function to obtain the bank card number.
The processor also realizes the following steps when executing the program: removing noise from the target image by a median filtering technique, the obtaining a first image comprising: determining the window size of a filtering window according to the target image to obtain a preset window; placing a preset window at an ith pixel point in a target image, wherein i is a positive integer; calculating the median value of pixel values contained in a preset window to obtain a target median value; updating the pixel value of the ith pixel point according to the target median; moving a preset window to the (i+1) th pixel point according to a preset sequence, and taking the (i+1) th pixel point as the (i) th pixel point; and repeatedly executing the step of calculating the median value of the pixel values contained in the preset window to obtain a target median value and taking the (i+1) th pixel point as the (i) th pixel point until the preset window traverses the pixel points in the target image to obtain a first image.
The processor also realizes the following steps when executing the program: before the noise removal processing is performed on the target image through the median filtering technology to obtain the first image, the method further comprises the following steps: acquiring an image containing a bank card number to be identified, and obtaining a fourth image; determining a first pixel value and a second pixel value in a fourth image, wherein the first pixel value is a pixel value larger than or equal to a third preset pixel value, and the second pixel value is a pixel value smaller than or equal to the fourth preset pixel value; calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point; calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value; and calculating the ratio of the third pixel value to the fourth pixel value corresponding to each pixel point, and determining the target image according to the ratio corresponding to each pixel point.
The device herein may be a server, PC, PAD, cell phone, etc.
The application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: removing noise from a target image by a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified; processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function; performing binarization processing on the second image to obtain a third image; and extracting the bank card number of the third image by the OCR technology to obtain the bank card number.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: processing the first image with a multi-scale filter to obtain a second image comprising: determining a scale space derivative according to the convolution property of the Gaussian filter and the coordinate of each pixel point; calculating a hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image; constructing a characteristic equation of a hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point; processing each first characteristic value through a linear filter and auxiliary characteristic values to determine a multi-scale filter corresponding to each pixel point; and iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining a second image according to the pixel value corresponding to each pixel point.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: processing each first characteristic value through the linear filter and the auxiliary characteristic value, and determining the multi-scale filter corresponding to each pixel point comprises the following steps: redefining each first characteristic value through a linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for a target pixel point in the first image, and the target pixel point is the pixel point containing a bank card number to be identified; configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a spatial scale factor; and determining a pixel value corresponding to each pixel point according to the third characteristic value corresponding to each pixel point and the second characteristic value corresponding to each pixel point, and obtaining a multi-scale filter corresponding to each pixel point.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, wherein the steps of: determining the value range of the spatial scale factors in the multi-scale filter to obtain a numerical value interval; determining the iteration step length of the space scale factor according to the numerical value interval; adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer; and determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: performing binarization processing on the second image to obtain a third image, wherein the step of obtaining the third image comprises the following steps: determining pixel points in the second image, wherein the pixel value of the pixel points is larger than or equal to a second preset pixel value, so as to obtain a first pixel point; determining the pixel points except the first pixel point in the second image as second pixel points; resetting the pixel value of the first pixel point in the second image to be 1, and resetting the pixel value of the second pixel point in the second image to be 0 to obtain a third image.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: before determining the pixel point with the pixel value greater than or equal to the second preset pixel value in the second image to obtain the first pixel point, the method further includes: determining the type of the bank card contained in the bank card number to be identified according to the service scene; determining the type of the bank card of the second image according to the type of the bank card to obtain a target type; cutting the second image according to the target type to obtain a cut second image; and replacing the second image by the cropped second image.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: extracting the bank card number of the third image by OCR technology, the obtaining the bank card number comprises: creating an OCR object of the third image by means of an OCR function in matlab; and processing the OCR object by adopting an OCR function to obtain the bank card number.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: removing noise from the target image by a median filtering technique, the obtaining a first image comprising: determining the window size of a filtering window according to the target image to obtain a preset window; placing a preset window at an ith pixel point in a target image, wherein i is a positive integer; calculating the median value of pixel values contained in a preset window to obtain a target median value; updating the pixel value of the ith pixel point according to the target median; moving a preset window to the (i+1) th pixel point according to a preset sequence, and taking the (i+1) th pixel point as the (i) th pixel point; and repeatedly executing the step of calculating the median value of the pixel values contained in the preset window to obtain a target median value and taking the (i+1) th pixel point as the (i) th pixel point until the preset window traverses the pixel points in the target image to obtain a first image.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: before the noise removal processing is performed on the target image through the median filtering technology to obtain the first image, the method further comprises the following steps: acquiring an image containing a bank card number to be identified, and obtaining a fourth image; determining a first pixel value and a second pixel value in a fourth image, wherein the first pixel value is a pixel value larger than or equal to a third preset pixel value, and the second pixel value is a pixel value smaller than or equal to the fourth preset pixel value; calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point; calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value; and calculating the ratio of the third pixel value to the fourth pixel value corresponding to each pixel point, and determining the target image according to the ratio corresponding to each pixel point.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (12)

1. A method for identifying a card number of a bank card, comprising:
removing noise from a target image by a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified;
processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function;
performing binarization processing on the second image to obtain a third image;
and extracting the bank card number of the third image by an OCR technology to obtain the bank card number.
2. The method of claim 1, wherein processing the first image with a multi-scale filter to obtain a second image comprises:
determining a scale space derivative according to the convolution property of the Gaussian filter and the coordinate of each pixel point;
calculating a hessian matrix of each pixel point according to the scale space derivative and the coordinates of each pixel point in the first image;
constructing a characteristic equation of a hessian matrix of each pixel point, and solving each characteristic equation to obtain a first characteristic value corresponding to each pixel point;
Processing each first characteristic value through a linear filter and auxiliary characteristic values to determine a multi-scale filter corresponding to each pixel point;
and iterating the multi-scale filter corresponding to each pixel point to obtain a pixel value corresponding to each pixel point, and determining the second image according to the pixel value corresponding to each pixel point.
3. The method of claim 2, wherein the determining a multi-scale filter for each pixel by processing each first eigenvalue through a linear filter and auxiliary eigenvalues comprises:
redefining each first characteristic value through the linear filter to obtain a second characteristic value, wherein the linear filter is used for adjusting the sign of the first characteristic value of the pixel points except for a target pixel point in the first image, and the target pixel point is the pixel point containing the bank card number to be identified;
configuring an auxiliary characteristic value for each second characteristic value, adjusting the second characteristic value, and regularizing each adjusted second characteristic value to obtain a third characteristic value corresponding to each pixel point, wherein the auxiliary characteristic value comprises a spatial scale factor;
And determining a pixel value corresponding to each pixel point according to the third characteristic value corresponding to each pixel point and the second characteristic value corresponding to each pixel point, and obtaining the multi-scale filter corresponding to each pixel point.
4. A method according to claim 3, wherein iterating the multi-scale filter corresponding to each pixel to obtain a pixel value corresponding to each pixel comprises:
determining the value range of the spatial scale factor in the multi-scale filter to obtain a numerical value interval;
determining the iteration step length of the space scale factor according to the numerical value interval;
adjusting the value of the spatial scale factor according to the iteration step length and the numerical value interval, and respectively carrying out N iterations on the multi-scale filter corresponding to each pixel point to obtain N pixel values corresponding to each pixel point, wherein N is a positive integer;
and determining the pixel value which is larger than or equal to the first preset pixel value as the pixel value corresponding to each pixel point in N pixel values corresponding to each pixel point.
5. The method of claim 1, wherein binarizing the second image to obtain a third image comprises:
Determining pixel points in the second image, wherein the pixel value of the pixel points is larger than or equal to a second preset pixel value, so as to obtain a first pixel point;
determining the pixel points except the first pixel point in the second image as second pixel points;
resetting the pixel value of the first pixel point in the second image to be 1, and resetting the pixel value of the second pixel point in the second image to be 0, so as to obtain the third image.
6. The method of claim 5, wherein prior to determining the pixel in the second image having a pixel value greater than or equal to the second predetermined pixel value, obtaining the first pixel, the method further comprises:
determining the type of the bank card contained in the bank card number to be identified according to the service scene;
determining the type of the bank card of the second image according to the type of the bank card to obtain a target type;
cutting the second image according to the target type to obtain a cut second image;
and replacing the second image by the cropped second image.
7. The method of claim 1, wherein extracting the third image of the bank card number by OCR technology, the bank card number comprising:
Creating an OCR object of the third image by means of an OCR function in matlab;
and processing the OCR object by adopting the OCR function to obtain the bank card number.
8. The method of claim 1, wherein denoising the target image by median filtering technique to obtain the first image comprises:
determining the window size of a filtering window according to the target image to obtain a preset window;
placing the preset window at an ith pixel point in the target image, wherein i is a positive integer;
calculating the median value of pixel values contained in the preset window to obtain a target median value;
updating the pixel value of the ith pixel point according to the target median;
moving the preset window to the (i+1) th pixel point according to a preset sequence, and taking the (i+1) th pixel point as the (i) th pixel point;
and repeatedly executing the step of calculating the median of the pixel values contained in the preset window to obtain a target median until the (i+1) th pixel point is used as the (i) th pixel point, until the preset window traverses the pixel points in the target image, and obtaining the first image.
9. The method of claim 1, wherein prior to denoising the target image by median filtering, the method further comprises:
Acquiring an image containing the bank card number to be identified, and obtaining a fourth image;
determining a first pixel value and a second pixel value in the fourth image, wherein the first pixel value is a pixel value larger than or equal to a third preset pixel value, and the second pixel value is a pixel value smaller than or equal to a fourth preset pixel value;
calculating the difference value between the pixel value of each pixel point in the fourth image and the second pixel value to obtain a third pixel value corresponding to each pixel point;
calculating the difference value between the first pixel value and the second pixel value to obtain a fourth pixel value;
and calculating the ratio of the third pixel value corresponding to each pixel point to the fourth pixel value, and determining the target image according to the ratio corresponding to each pixel point.
10. A device for identifying a card number of a bank card, comprising:
the first processing unit is used for removing noise from the target image through a median filtering technology to obtain a first image, wherein the target image contains a bank card number to be identified;
the second processing unit is used for processing the first image by adopting a multi-scale filter to obtain a second image, wherein the multi-scale filter is a filter constructed by combining characteristic values of a hessian matrix and a Gaussian function;
The third processing unit is used for carrying out binarization processing on the second image to obtain a third image;
and the extracting unit is used for extracting the bank card number of the third image through an OCR technology to obtain the bank card number.
11. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored computer program, wherein the computer program, when run, controls a device in which the computer readable storage medium is located to perform the method of identifying a card number of a bank card according to any one of claims 1 to 9.
12. An electronic device comprising one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of identifying a bank card number of any of claims 1-9.
CN202311170681.1A 2023-09-11 2023-09-11 Bank card number identification method and device, storage medium and electronic equipment Pending CN117218654A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311170681.1A CN117218654A (en) 2023-09-11 2023-09-11 Bank card number identification method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311170681.1A CN117218654A (en) 2023-09-11 2023-09-11 Bank card number identification method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117218654A true CN117218654A (en) 2023-12-12

Family

ID=89036441

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311170681.1A Pending CN117218654A (en) 2023-09-11 2023-09-11 Bank card number identification method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117218654A (en)

Similar Documents

Publication Publication Date Title
Kou et al. Gradient domain guided image filtering
CN103946866B (en) The text detection that multilayer is connected component is used together with histogram
CN108090511B (en) Image classification method and device, electronic equipment and readable storage medium
CN110119741A (en) A kind of card card image information recognition methods having powerful connections
CN109815762B (en) Method and storage medium for remotely identifying two-dimensional code
US9111183B2 (en) Performing a comparison between two images which are scaled to a common resolution
CN107862235B (en) Two-dimensional code position positioning method and device and terminal equipment
Do et al. Automatic license plate recognition using mobile device
CN105405138B (en) Waterborne target tracking based on conspicuousness detection
CN110502977B (en) Building change classification detection method, system, device and storage medium
CN114255337A (en) Method and device for correcting document image, electronic equipment and storage medium
CN112101386B (en) Text detection method, device, computer equipment and storage medium
CN110781890A (en) Identification card identification method and device, electronic equipment and readable storage medium
CN113592776A (en) Image processing method and device, electronic device and storage medium
CN111899270A (en) Card frame detection method, device and equipment and readable storage medium
CN106599891A (en) Remote sensing image region-of-interest rapid extraction method based on scale phase spectrum saliency
CN112634288A (en) Equipment area image segmentation method and device
CN108877030B (en) Image processing method, device, terminal and computer readable storage medium
CN111199240A (en) Training method of bank card identification model, and bank card identification method and device
CN110766001B (en) Bank card number positioning and end-to-end identification method based on CNN and RNN
CN116798041A (en) Image recognition method and device and electronic equipment
Tong et al. QR code detection based on local features
Ghandour et al. Building shadow detection based on multi-thresholding segmentation
CN117218654A (en) Bank card number identification method and device, storage medium and electronic equipment
CN113283262A (en) Two-dimensional code positioning method and device, electronic equipment and machine readable 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