Invoice seal identification method and device, computer equipment and storage medium

文档序号:1490759 发布日期:2020-02-04 浏览:6次 中文

阅读说明:本技术 ******识别的方法、装置、计算机设备和存储介质 (Invoice seal identification method and device, computer equipment and storage medium ) 是由 张凡 魏华 卢国庆 于 2019-09-16 设计创作,主要内容包括:本申请涉及一种发票印章识别的方法,该方法包括:提取发票上的待识别印章图像;获取发票上的开票方信息,根据所述开票方信息生成标准印章图像;计算所述发票上的待识别印章图像与所述标准印章图像的匹配度;根据所述匹配度确定所述待识别印章图像对应的识别结果。本发明根据票面的销方信息,生成标准发票印章图像,与发票内的待识别印章影像进行匹配,将独立识别转变为图像匹配检查,能够有效改善实际场景下的发票印章识别效果。(The application relates to an invoice seal identification method, which comprises the following steps: extracting a seal image to be identified on the invoice; acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party; calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal; and determining the identification result corresponding to the stamp image to be identified according to the matching degree. According to the receipt seal identification method and device, the standard receipt seal image is generated according to the receipt sales information, the standard receipt seal image is matched with the seal image to be identified in the receipt, independent identification is converted into image matching inspection, and the receipt seal identification effect in an actual scene can be effectively improved.)

1. A method for identifying an invoice seal, the method comprising:

extracting a seal image to be identified on the invoice;

acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party;

calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal;

and determining the identification result corresponding to the stamp image to be identified according to the matching degree.

2. The method according to claim 1, wherein the calculating the matching degree of the to-be-recognized stamp image on the invoice and the standard stamp image comprises:

normalizing the seal image to be identified and the standard seal image to obtain a normalized seal image to be identified and a normalized standard seal image;

respectively acquiring the normalized stamp image to be identified and the characteristic vector corresponding to the standard stamp image;

and calculating the matching degree of the stamp image to be identified and the standard stamp image according to the characteristic vector.

3. The method of claim 2, wherein the feature vector comprises: based on the line quantity characteristic value, the seal position characteristic value, the data distribution characteristic value and the color proportion characteristic value.

4. The method according to claim 2, wherein said calculating a degree of matching of said stamp image to said standard stamp image based on said feature vectors comprises:

calculating to obtain a first covariance value according to the characteristic vector corresponding to the stamp image to be identified and the characteristic vector corresponding to the standard stamp image;

acquiring a first preset threshold, and acquiring a first identification result according to the first covariance value and the first preset threshold;

when the first identification result meets the requirement, extracting tax area in the stamp image to be identified and the standard stamp image;

extracting a first tax characteristic vector corresponding to a tax area in the stamp image to be identified, and extracting a second tax characteristic vector corresponding to the tax area in the standard stamp image;

calculating to obtain a second covariance value according to the first tax characteristic vector and the second tax characteristic vector;

the step of determining the identification result corresponding to the stamp image to be identified according to the matching degree comprises the following steps:

and acquiring a second preset threshold value, and determining an identification result corresponding to the stamp image to be identified according to the second covariance value and the second preset threshold value.

5. The method according to claim 4, wherein the determining the recognition result corresponding to the stamp image to be recognized according to the second covariance value and the second preset threshold value comprises:

when the second covariance value is smaller than a second preset threshold value, determining that the stamp image to be identified is inconsistent with the standard stamp image;

and when the second covariance value is larger than a second preset threshold value, determining that the stamp image to be identified is consistent with the standard stamp image.

6. The method of claim 1, wherein the invoicer information on the invoice comprises: name of the seller, tax number of the seller;

the step of generating a standard seal image according to the invoicer information comprises the following steps:

acquiring a template of an invoice seal;

and generating a standard seal image according to the invoice seal template and the information of the invoicing party.

7. The method according to claim 1, wherein the extracting the stamp image to be recognized on the invoice further comprises:

extracting a seal area in a preset invoice area according to the seal color;

and identifying the seal image in the seal area by adopting Hough transform, and extracting to obtain the seal image to be identified.

8. An invoice stamp identification apparatus, the apparatus comprising:

the extraction module is used for extracting the seal image to be identified on the invoice;

the obtaining module is used for obtaining information of a invoicing party on an invoice and generating a standard seal image according to the information of the invoicing party;

the calculation module is used for calculating the matching degree of the seal image to be identified on the invoice and the standard seal image;

and the determining module is used for determining the identification result corresponding to the stamp image to be identified according to the matching degree.

9. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 7.

Technical Field

The invention relates to the field of image recognition, in particular to a method and a device for identifying an invoice seal, computer equipment and a storage medium.

Background

In order to ensure that the seal covered by the invoice is the same as the information of the issuing party, the manual check is needed after the receipt of the invoice by the financial department at present. Although the manual checking can ensure the compliance, the efficiency is low, so the judgment of the compliance of the seal is an urgent need of enterprises.

Disclosure of Invention

Therefore, in order to solve the above problems, it is necessary to provide a method, an apparatus, a computer device, and a storage medium for invoice seal recognition, which can obtain a better recognition effect even in a scene where a seal is blurred.

In a first aspect, an embodiment of the present invention provides a method for identifying an invoice seal, where the method includes:

extracting a seal image to be identified on the invoice;

acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party;

calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal;

and determining the identification result corresponding to the stamp image to be identified according to the matching degree.

In one embodiment, calculating the matching degree between the stamp image to be recognized on the invoice and the standard stamp image includes: normalizing the seal image to be identified and the standard seal image to obtain a normalized seal image to be identified and a normalized standard seal image; respectively acquiring the normalized stamp image to be identified and the characteristic vector corresponding to the standard stamp image; and calculating the matching degree of the stamp image to be identified and the standard stamp image according to the characteristic vector.

In one embodiment, the feature vector comprises: based on the line quantity characteristic value, the seal position characteristic value, the data distribution characteristic value and the color proportion characteristic value.

In one embodiment, calculating the matching degree between the stamp image and the standard stamp image according to the characteristic value includes: calculating to obtain a first covariance value according to the characteristic vector corresponding to the stamp image to be identified and the characteristic vector corresponding to the standard stamp image; acquiring a first preset threshold, and acquiring a first identification result according to the first covariance value and the first preset threshold; when the first identification result meets the requirement, extracting tax area in the stamp image to be identified and the standard stamp image; extracting a first tax characteristic vector corresponding to a tax area in the stamp image to be identified, and extracting a second tax characteristic vector corresponding to the tax area in the standard stamp image; calculating to obtain a second covariance value according to the first tax characteristic vector and the second tax characteristic vector; the step of determining the identification result corresponding to the stamp image to be identified according to the matching degree comprises the following steps: and acquiring a second preset threshold value, and determining an identification result corresponding to the stamp image to be identified according to the second covariance value and the second preset threshold value.

In one embodiment, the determining, according to the second covariance value and the second preset threshold, an identification result corresponding to the stamp image to be identified includes: and when the second covariance value is smaller than a second preset threshold value, determining that the stamp image to be identified is inconsistent with the standard stamp image. When the second covariance value is larger than a second preset threshold value, determining that the stamp image to be identified is consistent with the standard stamp image;

in one embodiment, the invoicer information on the invoice comprises: name of the seller, tax number of the seller; the step of generating a standard seal image according to the invoicer information comprises the following steps: acquiring a template of an invoice seal; and generating a standard seal image according to the invoice seal template and the information of the invoicing party.

In one embodiment, extracting the stamp image to be identified on the invoice further comprises: extracting a seal area in a preset invoice area according to the seal color; and identifying the seal image in the seal area by adopting Hough transform, and extracting to obtain the seal image to be identified.

In a second aspect, an embodiment of the present invention provides an invoice stamp identification apparatus, where the apparatus includes: the extraction module is used for extracting the seal image to be identified on the invoice;

the obtaining module is used for obtaining information of a invoicing party on an invoice and generating a standard seal image according to the information of the invoicing party;

the calculation module is used for calculating the matching degree of the seal image to be identified on the invoice and the standard seal image;

and the determining module is used for determining the identification result corresponding to the to-be-identified seal image according to the matching degree and determining whether the invoice seal is consistent with the sales party or not according to the matching degree.

In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and the computer program, when executed by the processor, causes the processor to execute the following steps:

extracting a seal image to be identified on the invoice;

acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party;

calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal;

and determining the identification result corresponding to the stamp image to be identified according to the matching degree.

In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is caused to execute the following steps:

extracting a seal image to be identified on the invoice;

acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party;

calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal;

and determining the identification result corresponding to the stamp image to be identified according to the matching degree.

According to the invoice seal identification method, the invoice seal identification device, the computer equipment and the storage medium, the seal image to be identified on the invoice is extracted, the standard seal image is generated according to the information of the invoice issuer on the invoice, then the matching degree of the seal image to be identified and the standard seal image is calculated, and finally the identification result corresponding to the seal image to be identified is determined according to the matching degree. Compared with the traditional identification method, the method has the advantages that independent identification is converted into image matching check, and the invoice seal identification effect in the actual scene can be effectively improved.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.

FIG. 1 is a flow diagram of a method of invoice stamp identification in one embodiment;

FIG. 2 is a schematic illustration of a standard stamp image in one embodiment;

FIG. 3 is a flowchart illustrating the calculation of the matching degree between the image of the stamp to be recognized and the image of the standard stamp according to an embodiment;

FIG. 4 is a flowchart illustrating the calculation of the degree of matching between a stamp image and a standard stamp image according to feature vectors according to an embodiment;

FIG. 5 is a flowchart illustrating an embodiment of determining an identification result corresponding to the image of the stamp to be identified;

FIG. 6 is a flowchart illustrating the generation of a standard stamp image based on the invoicer information in one embodiment;

FIG. 7 is a flow diagram of extracting an image of a seal to be recognized on an invoice according to one embodiment;

FIG. 8 is a block diagram of an invoice stamp identification apparatus according to one embodiment;

FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

As shown in fig. 1, a method for identifying an invoice stamp is provided, and the method for identifying an invoice stamp can be applied to a terminal, and this embodiment is exemplified by being applied to a terminal. The invoice seal identification method specifically comprises the following steps:

and 102, extracting the seal image to be identified on the invoice.

The seal image to be identified refers to the seal image stamped on the invoice, and the seal image refers to the image containing the seal. The stamp is covered in the stamp area set in the invoice, so that the position of the covered stamp can be directly detected in the stamp area set on the invoice, then the stamp image is extracted, and the extracted stamp image is used as the stamp image to be identified.

And 104, acquiring invoicing party information on the invoice, and generating a standard seal image according to the invoicing party information.

The invoicing party information refers to information of sellers required to be provided when invoicing. The information of the invoicing party on the invoice comprises: name of the seller and tax number of the seller. FIG. 2 shows a schematic representation of a standard stamp image, as shown, company ABC is the name of the seller and 12345678ABC9DEFG00 is the tax number of the seller. And generating a standard seal image by combining the template of the invoice seal according to the information of the invoicing party. Because the traditional method relies on the effect of the seal, the scene identification with complete seal content can obtain better identification effect in general; however, for some scenes with blurred seals, a good recognition effect cannot be obtained. Therefore, a standard stamp image is generated to be used as a template of the stamp to be identified, and a more accurate identification result of the stamp image to be identified can be obtained. The method comprises the steps of obtaining invoicing party information on an invoice through an identification technology (such as an OCR technology), taking the requirement of a country for a special value-added tax invoice stamp as a template of a standard stamp, generating a standard stamp image, and comparing the generated standard stamp image serving as a comparison image with a stamp image to be identified.

And 106, calculating the matching degree of the seal image to be identified on the invoice and the standard seal image.

The matching degree is the matching degree of the to-be-identified stamp image and the standard stamp image and is used for judging whether the to-be-identified stamp image is consistent with the standard stamp image. The matching degree can be reflected by calculating a covariance value related to the two images, and can also be reflected by a result value obtained by other algorithms, for example: (1) grayscale matching, comprising: MAD algorithm, SAD algorithm, SSD algorithm, MSD algorithm, NCC algorithm, SSDA algorithm; (2) and (5) matching the features. Feature matching is the calculation of the distance between feature vectors, and commonly used distances include euclidean distance, hamming distance, cosine distance, and the like. And judging whether the two images are matched or not by judging the result value obtained by calculation, thereby determining whether the image of the seal to be identified is consistent with the image of the standard seal or not and obtaining the identification result of the seal to be identified.

And 108, determining an identification result corresponding to the stamp image to be identified according to the matching degree.

The matching degree is the matching degree of the to-be-recognized stamp image and the standard stamp image, whether the result value meets the matching condition or not can be judged according to the result value obtained by calculating the image matching algorithm, and the matching degree of the two stamp images is obtained, so that the recognition result of the to-be-recognized stamp image is determined. The matching condition can be a threshold condition for setting the result value, and whether the two seal images are matched is judged according to the threshold condition: when the result value meets the threshold value condition, judging that the seal image to be identified is matched with the standard seal image; and when the result value does not meet the threshold condition, judging that the stamp image to be identified is not matched with the standard stamp image. Obtaining the identification result of the seal to be identified according to the matching degree: when the two seal images are matched, determining that the seal image to be identified is consistent with the standard seal image; and when the two seal images are not matched, determining that the seal image to be identified is not consistent with the standard seal image.

The matching degree of the two images is judged by calculating the covariance of the to-be-identified stamp image and the standard stamp image, so that an identification result is obtained: and setting different thresholds for the covariance values obtained by calculation, and determining the identification result corresponding to the stamp image to be identified according to the covariance values and the thresholds of the covariance values.

The matching degree of the stamp image to be recognized and the standard stamp image is judged only by the positive correlation principle of the covariance value, so that an accurate recognition result corresponding to the stamp image to be recognized cannot be obtained. Therefore, the covariance value obtained through calculation can be judged by setting a threshold of the covariance value, and whether the covariance value meets the threshold condition is judged, so that the identification result corresponding to the stamp image to be identified is obtained. For example, the judgment of the stamp image to be recognized may be: extracting the feature vector of the stamp image to be identified and the feature vector of the standard stamp image after normalization processing, and performing covariance calculation on the extracted feature vectors to obtain a first covariance value; and generating and extracting nearly 1000 sample images in the same way, comparing and calculating to obtain a covariance value sequence, normalizing the covariance value sequence, and finally obtaining an effective similarity threshold value of 0.61. When the first covariance value is less than 0.61, determining that the stamp image to be identified is inconsistent with the standard stamp image; when the first covariance value is larger than 0.61, further determining the matching degree of the two seal images: respectively extracting tax number characteristic vectors corresponding to tax number areas in the stamp image to be identified and the standard stamp image after normalization processing, and performing covariance calculation on the tax number characteristic vectors to obtain a second covariance value; and comparing the tax area of the sales party of a large number of samples to obtain a covariance value sequence, and normalizing the sequence to finally obtain a similarity threshold value of the covariance value of the tax area of the two images, wherein the similarity threshold value is 0.81. When the second covariance value is less than 0.81, determining that the stamp image to be identified is inconsistent with the standard stamp image; and when the second covariance value is larger than 0.81, determining that the stamp image to be identified is consistent with the standard stamp image.

According to the invoice seal identification method, the invoice seal identification device, the computer equipment and the storage medium, the seal image to be identified on the invoice is extracted, the standard seal image is generated according to the information of the invoice issuer on the invoice, then the matching degree of the seal image to be identified and the standard seal image is calculated, and finally the identification result corresponding to the seal image to be identified is determined according to the matching degree. Compared with the traditional identification method, the method has the advantages that independent identification is converted into image matching check, and the invoice seal identification effect in the actual scene can be effectively improved.

As shown in fig. 3, in an embodiment, calculating the matching degree between the stamp image to be recognized on the invoice and the standard stamp image includes:

step 302, normalizing the stamp image to be identified and the standard stamp image to obtain a normalized stamp image to be identified and a normalized standard stamp image.

The normalization processing refers to processing the stamp image to be identified and the standard stamp image into images with the same size and data format. The normalization process may be: firstly, normalizing a generated standard seal image and an extracted seal image to be identified to ensure that the height and the width of two images are consistent; and secondly, uniformly normalizing and scaling the two images to 64 × 48 pixels to obtain a normalized stamp image to be identified and a normalized standard stamp image.

And 304, respectively acquiring the feature vectors corresponding to the normalized stamp image to be identified and the standard stamp image.

The feature vector is a vector representing image information obtained by extracting features of an image. The feature vector represents information of the image in the form of data. The method for extracting the feature vector can also be as follows: extracting a feature vector based on an aHash algorithm, extracting a feature vector based on a pHash algorithm, extracting a feature vector based on a dHash algorithm, and extracting a feature vector based on a block mean algorithm. The feature vector contains many feature values, each of which can reflect the position, color and other image information of the stamp image to be recognized and the standard stamp image, for example: based on the line quantity characteristic value, the stamp position characteristic value, the color proportion characteristic value and the like.

And step 306, calculating the matching degree of the stamp image to be identified and the standard stamp image according to the characteristic vector.

The characteristic vector can be used for reflecting the image information of the stamp image to be identified and the image information of the standard stamp image, and the matching degree can be used for judging whether the stamp image to be identified is consistent with the standard stamp image. And carrying out covariance calculation on the feature vectors corresponding to the two images to obtain a corresponding covariance value. The covariance can measure the total error of the two images, and according to the positive correlation principle, the larger the covariance value is, the higher the matching degree of the two images is. Therefore, the matching degree of the to-be-recognized stamp image and the standard stamp image can be reflected by the size of the covariance value, so that whether the to-be-recognized stamp image is consistent with the standard stamp image or not is judged, and a recognition result corresponding to the to-be-recognized stamp image is obtained.

In one embodiment, the feature vector includes: based on the line quantity characteristic value, the seal position characteristic value, the data distribution characteristic value and the color proportion characteristic value.

The characteristic vector comprises a plurality of characteristic values, and each characteristic value represents the image information characteristic of the stamp image to be identified and the image information characteristic of the standard stamp image respectively. The characteristic value is a transformation rule of the characteristic vector, and the image information is converted into the data information to be reflected by obtaining the characteristic value contained in the characteristic vector.

As shown in fig. 4, in an embodiment, calculating the matching degree between the stamp image and the standard stamp image according to the feature vector includes:

step 402, calculating according to the characteristic vector corresponding to the stamp image to be identified and the characteristic vector corresponding to the standard stamp image to obtain a first covariance value.

The first covariance value is a result value obtained through covariance calculation according to a feature vector corresponding to the stamp image to be identified and a feature vector corresponding to the standard stamp image. The covariance is used to measure the degree of deviation of each dimension from its mean, and the covariance value can be obtained by a calculation formula: the covariance between two real random variables X and Y, whose expected values are e (X) μ and e (Y) ν, respectively, is defined as: COV (X, Y) ═ E [ (X-E (X)) (Y-E (Y)) ], and the equivalent formula is COV (X, Y) ═ E (xy) -E (X) E (Y)). If the covariance value is a positive value, the two are in positive correlation; negative results indicate a negative correlation; if 0, it is statistically said to be "independent from each other". And preliminarily judging the matching degree of the to-be-recognized stamp image and the standard stamp image according to the first covariance value to obtain an initial matching result of the to-be-recognized stamp image and the standard stamp image.

Step 404, obtaining a first preset threshold, and obtaining a first identification result according to the first covariance value and the first preset threshold.

The first preset threshold is a threshold of the first covariance and is used as a critical value for judging whether the two seal images are preliminarily matched. The first preset threshold may be obtained by: and generating and extracting nearly 1000 sample images, comparing and calculating to obtain a covariance value sequence, normalizing the covariance value sequence to finally obtain an effective similarity threshold value of 0.61, and setting the effective similarity threshold value of 0.61 as a first preset threshold value. According to the positive correlation principle, the larger the covariance value is, the higher the matching degree is, but only by the magnitude of the covariance value, the identification result corresponding to the stamp image to be identified cannot be accurately judged. Therefore, a first preset threshold value is set, and whether the two seal images are preliminarily matched or not is judged through the first preset threshold value, so that a first identification result is obtained: when the first covariance value is smaller than a first preset threshold value of 0.61, judging that the two seal images are not matched, and determining that the seal image to be identified is not consistent with the standard seal image; and when the first covariance value is larger than a first preset threshold value of 0.61, calculating the matching degree of the next step.

And 406, extracting a first tax characteristic vector corresponding to the tax area in the stamp image to be identified, and extracting a second tax characteristic vector corresponding to the tax area in the standard stamp image.

The tax area refers to a tax part image in the stamp image to be identified and the standard stamp image, the first tax characteristic vector is a characteristic vector of the tax area in the stamp image to be identified, and the second tax characteristic vector is a characteristic vector of the tax area in the standard stamp image. And when the first covariance value is larger than a first preset threshold value, judging that the two images are preliminarily consistent. In practical application, some blurred to-be-recognized stamp images exist, so after an initial consistent recognition result is obtained, the matching degree of the to-be-recognized stamp image and a standard stamp image needs to be further calculated. The tax number of the seller is important seal information in the invoice seal, and the identification result corresponding to the seal image to be identified can be obtained more accurately by calculating the matching degree of the partial image area of the tax number of the seller.

And 408, calculating to obtain a second covariance value according to the first tax characteristic vector and the second tax characteristic vector.

And the second covariance value is a result value obtained by calculating covariance according to the characteristic vector of the tax area of the stamp image to be identified and the characteristic vector of the tax area of the standard stamp image. The covariance is used to measure the degree of deviation of each dimension from its mean, and the covariance value can be obtained by a calculation formula: the covariance between two real random variables X and Y, whose expected values are e (X) μ and e (Y) ν, respectively, is defined as: COV (X, Y) ═ E [ (X-E (X)) (Y-E (Y)) ], and the equivalent formula is COV (X, Y) ═ E (xy) -E (X) E (Y)). If the covariance value is a positive value, the two are in positive correlation; negative results indicate a negative correlation; if 0, it is statistically said to be "independent from each other". And further judging the matching degree of the to-be-identified stamp image and the standard stamp image through the second covariance value to obtain a final matching result of the to-be-identified stamp image and the standard stamp image.

Determining the recognition result corresponding to the stamp image to be recognized according to the matching degree, wherein the recognition result comprises the following steps: and acquiring a second preset threshold value of a second covariance value, and determining an identification result corresponding to the stamp image to be identified according to the second covariance value and the second preset threshold value.

The second preset threshold is a threshold of the second covariance value and is used as a critical value for judging whether the two seal images are matched. The second preset threshold may be obtained by: and comparing and calculating the sales party tax identification number areas of a large number of samples to obtain a covariance value sequence, obtaining and normalizing the covariance value sequence, normalizing the sequence to finally obtain a similarity threshold value of the sales party tax identification number, wherein the similarity threshold value is 0.81, and 0.81 is set as a second preset threshold value. According to the positive correlation principle, the larger the covariance value is, the higher the matching degree is, but only by the magnitude of the covariance value, the identification result corresponding to the stamp image to be identified cannot be accurately judged; the obtained first identification result is the preliminary judgment of the matching degree of the image of the stamp to be identified and the image of the standard stamp; therefore, a second preset threshold value is set, and the matching degree of the two seal images is further judged: when the second covariance value is smaller than a second preset threshold value of 0.81, judging that the two seal images are not matched, and determining that the seal image to be identified is not consistent with the standard seal image; and when the second covariance value is larger than a second preset threshold value of 0.81, judging that the two seal images are matched, and determining that the seal image to be identified is consistent with the standard seal image to obtain an identification result corresponding to the seal image to be identified.

As shown in fig. 5, in an embodiment, determining an identification result corresponding to the to-be-identified stamp image according to the second covariance value and the second preset threshold includes:

step 502, comparing the second covariance value with a second preset threshold; when the second covariance is smaller than a second preset threshold, go to step 504; when the second covariance value is greater than the second preset threshold, go to step 506.

Step 504, when the second covariance value is smaller than a second preset threshold value, determining that the stamp image to be identified is inconsistent with the standard stamp image.

And the second covariance value is a result value obtained by calculating the covariance of the characteristic vector of the tax area of the stamp image to be identified and the characteristic vector of the tax area of the standard stamp image after the preliminary identification result is judged. Through setting a second preset threshold value, the identification result corresponding to the stamp image to be identified can be judged: for example, when the second preset threshold is 0.81, if the second covariance value is 0.7, since the second covariance value is 0.7 < the second preset threshold 0.81, the second preset threshold does not conform to the range of the second preset threshold, and it is determined that the stamp image to be recognized is inconsistent with the standard stamp image.

Step 506, when the second covariance value is larger than a second preset threshold value, determining that the stamp image to be identified is consistent with the standard stamp image.

And the second covariance value is a result value obtained by calculating the covariance of the characteristic vector of the tax area of the stamp image to be identified and the characteristic vector of the tax area of the standard stamp image. Through setting a second preset threshold value, the identification result corresponding to the stamp image to be identified can be judged: for example, when the second preset threshold is 0.81, if the second covariance value is 0.85, since the second covariance value 0.85 is greater than the second preset threshold 0.81, the second preset threshold conforms to the range of the second preset threshold, and it is determined that the stamp image to be recognized is consistent with the standard stamp image.

In one embodiment, the invoicer information on the invoice includes: name of the seller, tax number of the seller; as shown in fig. 6, the generating a standard seal image according to the invoicing party information includes:

step 602, a template of an invoice stamp is obtained.

The template of the invoice seal is obtained according to the national requirement on the special seal of the value-added tax invoice. The template requirements of the invoice stamp are as follows: (1) elliptical in shape and 40 × 30(mm) in size; (2) the side width is 1 mm; (3) the middle part is a tax number, the height of the 18-bit Arabic numerals is 3.7mm, the width of the characters is 1.3mm, and the total width of the 18-bit Arabic numerals is 26mm (the character is Araial); (4) the height of Chinese characters arranged in a circle above the tax recitations is 4.2mm, the angle (included angle) of the circle is 210-260 degrees, and the distance between the characters and the inner side of the sideline is 0.5mm (the characters are imitating Song dynasty); (5) the height of the character of the special invoice chapter in the lower horizontal row of tax stamp is 4.6mm, the width of the character is 3mm, and the distance from the central line of the extension chapter to the top end of the lower horizontal row of character is 4.2mm (the character style is the imitation Song dynasty); (6) the code word of the lower horizontal row number of the special seal for the invoice is 2.2mm high, 1.7mm wide, the distance from the central line of the extension seal to the top end of the lower horizontal row number is 10mm (the font is Arial), and the horizontal row number can be saved when no numbering is needed. According to the above requirements, the template of the invoice seal can be generated for generating the standard invoice seal.

And step 604, generating a standard seal image according to the invoice seal template and the information of the invoicing party.

Wherein, the information of the invoicing party comprises: name of the seller and tax number of the seller. According to the template of the invoice seal, the information of the invoicing party is combined, and a standard seal image can be generated. When the stamp image to be identified is identified, the authenticity of the stamp image to be identified needs to be judged. Therefore, according to the national requirement on the special seal for the value-added tax invoice, the extracted information of the invoicing party is combined to generate a standard seal image which is used as a contrast image to be matched with the seal image to be identified.

As shown in fig. 7, in an embodiment, extracting the image of the stamp to be recognized on the invoice further includes:

and step 702, extracting a seal area in a preset invoice area according to the seal color.

The preset invoice area refers to an image position area of an invoice seal on an invoice image; extracting the seal area according to the seal color is as follows: and judging the position of the seal in the preset invoice area according to the color of the seal, thereby extracting the seal area. Because the region position of the seal stamped on the invoice is fixed, a preset invoice region can be set, and the extracted image is the invoice seal image to be identified. The stamp region is extracted according to the stamp color, and the stamp region can be extracted according to the stamp red color. Because the stamp image on the invoice is red, the stamp area can be obtained by extracting the red stamp in the preset invoice area.

And 704, identifying the seal image in the seal area by adopting Hough transform, and extracting to obtain the seal image to be identified.

The Hough transform is adopted to separate the stamp image to be identified from the extracted stamp area. Because the seal image is composed of geometric figures, characters and numbers, the seal image in the seal region can be identified by Hough transform, and the seal image to be identified is extracted.

As shown in fig. 8, an embodiment of the present invention provides an invoice stamp identification apparatus, where the apparatus includes:

an extraction module 802, configured to extract a stamp image to be identified on an invoice;

the obtaining module 804 is used for obtaining information of a invoicing party on an invoice and generating a standard seal image according to the information of the invoicing party;

a calculating module 806, configured to calculate a matching degree between the stamp image to be identified on the invoice and the standard stamp image;

and the determining module 808 is configured to determine an identification result corresponding to the stamp image to be identified according to the matching degree.

In one embodiment, calculating the matching degree of the image of the stamp to be recognized on the invoice and the image of the standard stamp includes: normalizing the seal image to be identified and the standard seal image to obtain a normalized seal image to be identified and a normalized standard seal image; the obtaining module 804 is further configured to obtain feature vectors corresponding to the normalized to-be-identified stamp image and the standard stamp image, respectively; the calculating module 806 is further configured to calculate a matching degree between the stamp image to be recognized and the standard stamp image according to the feature vector.

In one embodiment, the feature vector comprises: based on the line quantity characteristic value, the seal position characteristic value, the data distribution characteristic value and the color proportion characteristic value.

In one embodiment, the calculating the matching degree between the stamp image and the standard stamp image according to the characteristic value includes: the calculating module 806 is further configured to calculate a first covariance value according to the feature vector corresponding to the to-be-identified stamp image and the feature vector corresponding to the standard stamp image; the obtaining module 804 is further configured to obtain a first preset threshold, and obtain a first recognition result according to the first covariance value and the first preset threshold; the extracting module 802 is further configured to extract a tax number area in the to-be-identified stamp image and the standard stamp image when the first identification result meets the requirement; the extraction module 802 is further configured to extract a first tax characteristic vector corresponding to a tax area in the stamp image to be identified, and extract a second tax characteristic vector corresponding to the tax area in the standard stamp image; the calculating module 806 is further configured to calculate a second covariance value according to the first tax characteristic vector and the second tax characteristic vector; the step of determining the identification result corresponding to the stamp image to be identified according to the matching degree comprises the following steps: the obtaining module 804 is further configured to obtain a second preset threshold, and determine an identification result corresponding to the stamp image to be identified according to the second covariance value and the second preset threshold.

In an embodiment, the determining, according to the second covariance value and the second preset threshold, an identification result corresponding to the stamp image to be identified includes: the determining module 808 is further configured to determine that the stamp image to be recognized is inconsistent with the standard stamp image when the second covariance value is smaller than a second preset threshold; the determining module 808 is further configured to determine that the stamp image to be recognized is consistent with the standard stamp image when the second covariance value is greater than a second preset threshold value.

In one embodiment, the invoicer information on the invoice comprises: name of the seller, tax number of the seller;

the step of generating a standard seal image according to the invoicer information comprises the following steps: the obtaining module 804 is further configured to obtain a template of the invoice seal; the obtaining module 804 is further configured to generate a standard seal image according to the invoice seal template and the invoicing party information.

In one embodiment, the extracting the image of the seal to be recognized on the invoice further includes: the extraction module 802 is further configured to extract a stamp area in the preset invoice area according to the stamp color; the extraction module 802 is further configured to identify the stamp image in the stamp region by hough transform, and extract the to-be-identified stamp image.

FIG. 9 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may be a terminal. As shown in fig. 9, the computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and also stores a computer program, and when the computer program is executed by a processor, the computer program can enable the processor to realize the invoice seal identification method. The internal memory may also have stored therein a computer program that, when executed by the processor, causes the processor to perform a method of invoice seal identification. The network interface is used for communicating with the outside. Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.

In one embodiment, the method for identifying an invoice stamp provided in the present application may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 9. The memory of the computer equipment can store various program templates of the invoice seal identification device. For example, the extracting module 802, the obtaining module 804, the calculating module 806, and the determining module 808.

A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of: extracting a seal image to be identified on the invoice; acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party; calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal; and determining the identification result corresponding to the stamp image to be identified according to the matching degree.

In one embodiment, the calculating the matching degree between the image of the stamp to be recognized on the invoice and the image of the standard stamp includes: normalizing the seal image to be identified and the standard seal image to obtain a normalized seal image to be identified and a normalized standard seal image; respectively acquiring the normalized stamp image to be identified and the characteristic vector corresponding to the standard stamp image; and calculating the matching degree of the stamp image to be identified and the standard stamp image according to the characteristic vector.

In one embodiment, the feature vector comprises: based on the line quantity characteristic value, the seal position characteristic value, the data distribution characteristic value and the color proportion characteristic value.

In one embodiment, the calculating the matching degree between the stamp image and the standard stamp image according to the characteristic value includes: calculating to obtain a first covariance value according to the characteristic vector corresponding to the stamp image to be identified and the characteristic vector corresponding to the standard stamp image; acquiring a first preset threshold, and acquiring a first identification result according to the first covariance value and the first preset threshold; when the first identification result meets the requirement, extracting tax area in the stamp image to be identified and the standard stamp image; extracting a first tax characteristic vector corresponding to a tax area in the stamp image to be identified, and extracting a second tax characteristic vector corresponding to the tax area in the standard stamp image; calculating to obtain a second covariance value according to the first tax characteristic vector and the second tax characteristic vector; the step of determining the identification result corresponding to the stamp image to be identified according to the matching degree comprises the following steps: and acquiring a second preset threshold value, and determining an identification result corresponding to the stamp image to be identified according to the second covariance value and the second preset threshold value.

In an embodiment, the determining, according to the second covariance value and the second preset threshold, an identification result corresponding to the stamp image to be identified includes: when the second covariance value is smaller than a second preset threshold value, determining that the stamp image to be identified is inconsistent with the standard stamp image; and when the second covariance value is larger than a second preset threshold value, determining that the stamp image to be identified is consistent with the standard stamp image.

In one embodiment, the invoicer information on the invoice comprises: name of the seller, tax number of the seller; the step of generating a standard seal image according to the invoicer information comprises the following steps: acquiring a template of an invoice seal; and generating a standard seal image according to the invoice seal template and the information of the invoicing party.

In one embodiment, the extracting the image of the seal to be recognized on the invoice further includes: extracting a seal area in a preset invoice area according to the seal color; and identifying the seal image in the seal area by adopting Hough transform, and extracting to obtain the seal image to be identified.

A computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of: extracting a seal image to be identified on the invoice; acquiring information of a invoicing party on an invoice, and generating a standard seal image according to the information of the invoicing party; calculating the matching degree of the image of the seal to be identified on the invoice and the image of the standard seal; and determining the identification result corresponding to the stamp image to be identified according to the matching degree.

In one embodiment, the calculating the matching degree between the image of the stamp to be recognized on the invoice and the image of the standard stamp includes: normalizing the seal image to be identified and the standard seal image to obtain a normalized seal image to be identified and a normalized standard seal image; respectively acquiring the normalized stamp image to be identified and the characteristic vector corresponding to the standard stamp image; and calculating the matching degree of the stamp image to be identified and the standard stamp image according to the characteristic vector.

In one embodiment, the feature vector comprises: based on the line quantity characteristic value, the seal position characteristic value, the data distribution characteristic value and the color proportion characteristic value.

In one embodiment, the calculating the matching degree between the stamp image and the standard stamp image according to the characteristic value includes: calculating to obtain a first covariance value according to the characteristic vector corresponding to the stamp image to be identified and the characteristic vector corresponding to the standard stamp image; acquiring a first preset threshold, and acquiring a first identification result according to the first covariance value and the first preset threshold; when the first identification result meets the requirement, extracting tax area in the stamp image to be identified and the standard stamp image; extracting a first tax characteristic vector corresponding to a tax area in the stamp image to be identified, and extracting a second tax characteristic vector corresponding to the tax area in the standard stamp image; calculating to obtain a second covariance value according to the first tax characteristic vector and the second tax characteristic vector; the step of determining the identification result corresponding to the stamp image to be identified according to the matching degree comprises the following steps: and acquiring a second preset threshold value, and determining an identification result corresponding to the stamp image to be identified according to the second covariance value and the second preset threshold value.

In an embodiment, the determining, according to the second covariance value and the second preset threshold, an identification result corresponding to the stamp image to be identified includes: when the second covariance value is smaller than a second preset threshold value, determining that the stamp image to be identified is inconsistent with the standard stamp image; and when the second covariance value is larger than a second preset threshold value, determining that the stamp image to be identified is consistent with the standard stamp image.

In one embodiment, the invoicer information on the invoice comprises: name of the seller, tax number of the seller; the step of generating a standard seal image according to the invoicer information comprises the following steps: acquiring a template of an invoice seal; and generating a standard seal image according to the invoice seal template and the information of the invoicing party.

In one embodiment, the extracting the image of the seal to be recognized on the invoice further includes: extracting a seal area in a preset invoice area according to the seal color; and identifying the seal image in the seal area by adopting Hough transform, and extracting to obtain the seal image to be identified.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.

The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:字符批量识别方法、装置和计算机设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!