CN114140928A - High-precision digital color unification ticket checking method, system and medium - Google Patents

High-precision digital color unification ticket checking method, system and medium Download PDF

Info

Publication number
CN114140928A
CN114140928A CN202111374404.3A CN202111374404A CN114140928A CN 114140928 A CN114140928 A CN 114140928A CN 202111374404 A CN202111374404 A CN 202111374404A CN 114140928 A CN114140928 A CN 114140928A
Authority
CN
China
Prior art keywords
text
image
probability
digital color
array
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.)
Granted
Application number
CN202111374404.3A
Other languages
Chinese (zh)
Other versions
CN114140928B (en
Inventor
倪健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Yiduoduo Information Technology Co ltd
Original Assignee
Suzhou Yiduoduo Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Yiduoduo Information Technology Co ltd filed Critical Suzhou Yiduoduo Information Technology Co ltd
Priority to CN202111374404.3A priority Critical patent/CN114140928B/en
Publication of CN114140928A publication Critical patent/CN114140928A/en
Application granted granted Critical
Publication of CN114140928B publication Critical patent/CN114140928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/20Testing patterns thereon
    • G07D7/2016Testing patterns thereon using feature extraction, e.g. segmentation, edge detection or Hough-transformation
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/20Testing patterns thereon
    • G07D7/202Testing patterns thereon using pattern matching
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The invention discloses a high-precision digital color unification ticket checking method, a system and a medium, wherein the method comprises the following steps: configuring an image detection model, a characteristic reference image, an image recognition model and a dynamic decoding algorithm to obtain a digital color image; identifying the image characteristics of the digital color image based on the image detection model and the characteristic reference image, and executing text identification operation on the digital color image based on the image identification model and the image characteristics to obtain a digital color text; performing recombination operation on the digital color text to obtain a text to be decoded; calling a dynamic decoding algorithm to process the text to be decoded to obtain digital color number information; the invention can realize high-precision text recognition operation on lottery images including but not limited to folded, worn, folded and bent lottery images, adopts a decoding algorithm which is independently developed, can perform the text decoding operation after recognition on digital colors of various styles, and has extremely wide integral application range and extremely strong applicability.

Description

High-precision digital color unification ticket checking method, system and medium
Technical Field
The invention relates to the technical field of digital color ticket checking, in particular to a high-precision digital color unified ticket checking method, a system and a medium.
Background
The digital lottery purchased by a user is paper lottery, and aiming at digital lottery such as double-color balls, big lotteries and the like, the user needs to check the information on the paper lottery and the digital information on the network one by one when drawing a prize, and then checks whether the prize is won or not; the method is extremely complicated, the ticket checking efficiency is low, and the user experience is poor, so in the prior art, text recognition is carried out on paper lottery images shot by the user, the information of the user is checked, but the paper lottery is not easy to store, and different shooting devices adopted by different users are different, finally the method has large limitation, the recognition accuracy of folded, worn, folded and bent lottery images is low, and meanwhile, the recognition accuracy of the lottery images with poor shooting quality is also low, so that the existing digital lottery ticket checking method has poor applicability, low recognition efficiency and recognition accuracy, and the user experience is influenced.
Disclosure of Invention
The invention mainly solves the problems that the existing digital lottery ticket checking method has poor applicability, low recognition efficiency and recognition accuracy and influences user experience.
In order to solve the technical problems, the invention adopts a technical scheme that: the provided high-precision digital color unification ticket checking method comprises the following steps:
an initial configuration step: configuring an image detection model, a characteristic reference image, an image recognition model and a dynamic decoding algorithm to obtain a digital color image;
a text recognition step: identifying the image characteristics of the digital color image based on the image detection model and the characteristic reference image, and executing text identification operation on the digital color image based on the image identification model and the image characteristics to obtain a digital color text;
text decoding step: performing recombination operation on the digital color text to obtain a text to be decoded; and calling the dynamic decoding algorithm to process the text to be decoded to obtain digital color number information.
As an improvement, the image features include: the first feature, the second feature, and the third feature; the feature reference image includes: a first thermal reference image, a second thermal reference image, and a third thermal reference image; the first feature is: the lottery image class in which the curvature and the inclination occur; the second feature is: lottery image classes with closely arranged parallel texts appear; the third feature is: lottery image class of low text probability value;
the step of identifying image features of the digital color image based on the image detection model and the feature reference image further comprises: inputting the digital color image into the image detection model to obtain a first text probability Gaussian heat image; and judging the image characteristics of the first text probability Gaussian heat image based on the first heat reference image, the second heat reference image and the third heat reference image.
As an improvement, the text recognition operation includes: a first operation, a second operation, and a third operation; the first operation is: performing positioning operation on the text; the second operation is: parallel text segmentation operation; the third operation is: text region review operation; the digital color text includes: a first digital color text, a second digital color text, and a third digital color text;
the step of performing text recognition operation on the digital color image based on the image recognition model and the image features to obtain a digital color text further comprises:
if the first feature exists in the image features of the first text probability Gaussian heat image, executing the first operation on the digital color image based on the image recognition model to obtain a first digital color text;
if the second feature exists in the image features of the first text probability Gaussian heat image, executing the second operation on the digital color image based on the image recognition model to obtain a second digital color text;
and if the third feature exists in the image features of the first text probability Gaussian heat image, executing the third operation on the digital color image based on the image recognition model to obtain a third digital color text.
As an improved solution, the first operation includes:
generating a plurality of text positioning boxes based on the hotspot distribution condition of the first text probability Gaussian heat image, and identifying a plurality of coordinate information respectively corresponding to the text positioning boxes in the first text probability Gaussian heat image;
configuring an array container, and setting a sorting direction and a sorting sequence; leading a plurality of text positioning boxes into the array container to obtain a first statistic group; sorting the text positioning boxes in the first statistical array according to the sorting direction and the sorting sequence according to the coordinate information to obtain a second statistical array; setting a comparison threshold, counting subdata values of the second statistical array, and if the subdata values are larger than the comparison threshold, executing a first circular screening operation;
the first cyclical screening operation comprises: creating a text line space array, and transferring a first text positioning box in the second statistical array to the text line space array to obtain a first same text line number array; setting a first screening direction, and executing circular screening operation of left-side same-line texts based on the first same-text-line array and the first screening direction to obtain a second same-text-line array; setting a second screening direction, and executing a right-side same-line text circular screening operation by adopting the same operation logic as the left-side same-line text circular screening operation based on the second same-text line array and the second screening direction to obtain a third same-text line array;
after the first circular screening operation is executed, the digital color image is cut according to the text positioning box in the third text row array to obtain a plurality of first cut images, and the first cut images are input into the image recognition model to be subjected to prediction processing to obtain a first text to be sorted; sequencing the first text to be sequenced based on the third text row array to obtain the first digital color text;
the left-side same-line text circular screening operation comprises the following steps: creating a left adjacent text empty array, setting the first text positioning box as a center reference, and executing a left side screening step based on the left adjacent text empty array, the first screening direction and the center reference;
the left side screening step comprises: transferring a second text positioning box which is in the same line with the first text positioning box in the second statistical array and is matched with the first screening direction to the left adjacent text empty array to obtain a first left-side same-line array; transferring the second text positioning box corresponding to second coordinate information with the minimum difference value with the first coordinate information of the first text positioning box in the first left-side same-line array to a position, which is positioned on the left side of the first text positioning box, in the first same-line array; and setting the second text positioning box in the first text row array as the center reference, and returning to the circular screening operation of the left text row array.
As an improved solution, the second operation includes:
executing a judgment step of parallel closely distributed texts;
the judging step of the parallel closely distributed texts comprises the following steps:
setting a first text probability benchmark threshold, adjusting the text probability value of a pixel point which is greater than the first text probability benchmark threshold in the first text probability Gaussian heat image to be a first probability value, and adjusting the text probability value of a pixel point which is not greater than the first text probability benchmark threshold in the first text probability Gaussian heat image to be a second probability value to obtain a first Gaussian heat image to be converted; carrying out binarization processing on the first Gaussian heat image to be converted to obtain a first binarized image;
identifying a first closed connected region in the first binarized image; setting the distribution quantity condition and a first ratio of the first pixel points; counting the number of the text probability values in the first closed connected region as the first probability values according to lines to obtain a plurality of first data; sequencing the plurality of first data according to rows to obtain a first connecting text array; analyzing the arrangement rule of a plurality of first data in the first communication text array to obtain the distribution quantity condition of second pixel points; identifying a width value and a height value of the first closed connected region, and calculating a second ratio of the height value to the width value; if the distribution quantity condition of the second pixel points is matched with the distribution quantity condition of the first pixel points or the second ratio is greater than the first ratio, judging that parallel closely distributed texts exist in the first closed connected region;
after the judgment step of the texts in the parallel close distribution is executed, if the texts in the parallel close distribution exist in the first closed communication area, a judgment step of a cutting area is executed;
the cutting region judging step includes:
setting a second text probability benchmark threshold, adjusting the text probability value of the pixel point which is greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to the first probability value, and adjusting the text probability value of the pixel point which is not greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to the second probability value to obtain a second Gaussian heat image to be converted; performing binarization processing on the second Gaussian heat image to be converted to obtain a second binarized image;
identifying a second closed connected region in the second binary image; counting the number of the text probability values in the second closed connected region as the first probability values according to lines to obtain a plurality of second data; sequencing a plurality of second data according to rows to obtain a second connected text array;
setting a first cutting threshold value and a second cutting threshold value; adjusting the first data, which are greater than the first cutting threshold value, in the first connected text array to be a first cutting value, and adjusting the first data, which are less than the first cutting threshold value, in the first connected text array to be a second cutting value, so as to obtain a first array to be calculated; adjusting the second data matched with the second cutting threshold value in the second connected text array to be the second cutting value, and adjusting the second data not matched with the second cutting threshold value in the second connected text array to be the first cutting value to obtain a second array to be calculated;
multiplying the first array to be calculated and the second array to be calculated to obtain a cutting area indicating array; analyzing the distribution rule of the first cutting value and the second cutting value in the cutting area indication array to obtain a cutting area; cutting the first closed connected region in the first binarized image based on the cutting region to obtain a third binarized image;
after the cutting area judging step is executed, converting the third binary image into a second text probability Gaussian heat image, and generating a plurality of third text positioning frames based on the hotspot distribution condition of the second text probability Gaussian heat image; cutting the digital color images according to the third text positioning boxes to obtain second cut images, inputting the second cut images into the image recognition model for prediction processing to obtain second texts to be sorted; and sequencing the second text to be sequenced based on the arrangement rule of the third text positioning boxes in the second text probability Gaussian heat image to obtain the second digital color text.
As an improved solution, the third operation includes:
setting a first text probability screening threshold and a second text probability screening threshold, and dividing the first text probability Gaussian heat image based on the first text probability screening threshold and the second text probability screening threshold to obtain a first text region;
setting a third text probability screening threshold value based on the first text probability screening threshold value, and setting a fourth text probability screening threshold value based on the second text probability screening threshold value; dividing the first text region based on the third text probability screening threshold and the fourth text probability screening threshold to obtain a second text region;
counting the number of first texts in the second text region based on the third text probability screening threshold and the fourth text probability screening threshold; counting a second text number of the second text region based on the first text probability screening threshold and the second text probability screening threshold;
setting a number ratio judgment threshold, calculating a first number ratio of the first text number and the second text number, judging whether the first number ratio is smaller than the number ratio judgment threshold, and if so, setting the second text area as a missed detection area;
executing the step of judging the parallel closely distributed texts based on a first heat image matched with the missed detection region in the first text probability Gaussian heat image to obtain a judgment result about the first heat image; if the judgment result is that the parallel closely distributed texts do not exist in the missed detection region, setting a text detection probability value of the image detection model based on the missed detection region; detecting the digital color image based on the text detection probability value and the image detection model to obtain a third text probability Gaussian heat image;
generating a plurality of fourth text positioning boxes based on the hot spot distribution condition of the third text probability Gaussian heat image; cutting the digital color images according to the fourth text positioning boxes to obtain third cut images, inputting the third cut images into the image recognition model for prediction processing to obtain third texts to be sorted; and sequencing the third text to be sequenced based on the arrangement rule of the fourth text positioning boxes in the third text probability Gaussian heat image to obtain the third digital color text.
As an improvement, the recombination operation comprises:
setting a character type, and removing characters matched with the character type in the digital color text to obtain a first text; setting a color type, setting character bits based on the color type, and setting character strings corresponding to the character bits in the first text as end character strings; removing the last character string and characters behind the first character bit in the first text to obtain a second text; and setting a recombination sequence, and sequencing the characters in the second text according to the recombination sequence to obtain the text to be decoded.
As an improved solution, the processing logic of the dynamic decoding algorithm for the text to be decoded includes:
configuring a number storage array and setting a first character arrangement rule; separating the text to be decoded according to a single character unit to obtain a first text to be analyzed; judging whether a second character arrangement rule of characters in the first text to be analyzed is matched with the first character arrangement rule;
if the number is matched with the color number, the characters in the first text to be analyzed are placed in the number storage array to obtain the digital color number information;
if not, separating the text to be decoded according to a double-character unit to obtain a second text to be analyzed; extracting a first character string positioned at the head in the second text to be analyzed; setting the last character string as a first character string of the first character string; carrying out reverse order processing on the first character string to obtain a first reverse order character string; setting a reference character string based on the lottery category; and judging whether the first reverse character string is smaller than the preceding character string and the reference character string, if so, adding the first reverse character string to the number storage array, and executing a circulating judgment step.
The invention also provides a digital color unification ticket checking system of the high-precision digital color unification ticket checking method, which comprises the following steps:
the system comprises an initial configuration module, a text recognition module and a text decoding module;
the initial configuration module is used for configuring an image detection model, a characteristic reference image, an image recognition model and a dynamic decoding algorithm, and is also used for acquiring a digital color image;
the text recognition module is used for recognizing the image characteristics of the digital color image according to the image detection model and the characteristic reference image, and the text recognition module executes text recognition operation on the digital color image based on the image recognition model and the image characteristics to obtain a digital color text;
the text decoding module is used for executing recombination operation on the digital color text to obtain a text to be decoded; and the text decoding module calls the dynamic decoding algorithm to process the text to be decoded to obtain digital color number information.
The invention also provides a computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, realizes the steps of the digital color unification ticket checking method with high precision.
The invention has the beneficial effects that:
1. the high-precision digital color unified ticket checking method can realize high-precision text recognition operation on lottery images including but not limited to folded, worn, folded and bent lottery images, can also realize high-precision text recognition on the lottery images with poor shooting quality, adopts an independently developed decoding algorithm, can perform text decoding operation after recognition on digital colors of various styles, has extremely wide overall application range, extremely high applicability, extremely high detection efficiency and detection precision, makes up for the defects of the prior art, and has extremely high application value and market value.
2. The digital color unification ticket checking system can realize high-precision text recognition operation on lottery images including but not limited to folded, worn, folded and bent lottery images through the mutual matching of the initial configuration module, the text recognition module and the text decoding module, can realize high-precision text recognition on the lottery images with poor shooting quality, adopts a decoding algorithm which is independently developed, can perform decoding operation on texts after recognition on digital colors of various styles, has extremely wide overall application range, extremely strong applicability, extremely high detection efficiency and detection precision, makes up the defects of the prior art, and has extremely high application value and market value.
3. The computer-readable storage medium can realize the cooperation of the initial configuration guiding module, the text recognition module and the text decoding module, further realize the high-precision text recognition operation on lottery images including but not limited to wrinkles, worn, folded and bent lottery images, realize the high-precision text recognition on the lottery images with poor shooting quality, and can perform the text decoding operation after recognizing digital colors of various styles.
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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flow chart of a high-precision digital color unification ticket checking method according to embodiment 1 of the present invention;
fig. 2 is a schematic flow chart of a high-precision digital color unification ticket checking method according to embodiment 1 of the present invention;
fig. 3 is a schematic diagram of a first thermal reference image according to embodiment 1 of the present invention;
fig. 4 is a schematic view of a second thermal reference image according to embodiment 1 of the present invention;
FIG. 5 is a schematic diagram of a third thermal reference image according to embodiment 1 of the present invention;
fig. 6 is an architecture diagram of the digital color unification ticket checking system according to embodiment 2 of the present invention.
Detailed Description
The following detailed description of the preferred embodiments of the present invention, taken in conjunction with the accompanying drawings, will make the advantages and features of the invention easier to understand by those skilled in the art, and thus will clearly and clearly define the scope of the invention.
In the description of the present invention, it should be noted that the described embodiments of the present invention are a part of the embodiments of the present invention, and not all embodiments; all other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "first", "second", "third", and "fourth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Example 1
The present embodiment provides a high-precision digital color unification ticket checking method, as shown in fig. 1 to 5, which includes the following steps:
s100, an initial configuration step, which specifically comprises:
s110, configuring an image detection model, a characteristic reference image, an image recognition model and a dynamic decoding algorithm to obtain a digital color image;
specifically, the feature reference image includes: a first thermal reference image, a second thermal reference image, and a third thermal reference image; in this embodiment, the first heat reference image represents a text probability gaussian heat map obtained by a paper lottery with folds, bends and tilts through an image detection model; the second heat reference image represents a text probability Gaussian heat map obtained by the paper lottery with the texts which are closely distributed up and down through an image detection model; the third heat reference image represents a text probability Gaussian heat map with lower text probability of the paper lottery in the partial area obtained by the image detection model; correspondingly, in the embodiment, in order to achieve better applicability and flexibility, a craft detection model is adopted for image detection, the training process of the model is based on the char level, and the accuracy and the applicability are much higher than those of the detection model based on the word level in the prior art center; in the embodiment, the image recognition model is built by crnn + ctc, the model performs image enhancement training by adopting Gaussian blur, random rotation, contrast adjustment and image stretching adjustment, and meanwhile, the model adopts a public data set, so that the diversity of data in the public data set is strong, and the applicability and flexibility of the image recognition model are further improved; correspondingly, after the initial configuration of the model and the data is completed, the corresponding image detection, text recognition and decoding steps can be started.
S200, text recognition, specifically comprising:
s210, recognizing the image characteristics of the digital color image based on the image detection model and the characteristic reference image, and executing text recognition operation on the digital color image based on the image recognition model and the image characteristics to obtain a digital color text; correspondingly, the digital color image is the image to be recognized, so the image characteristics of the image to be recognized need to be confirmed firstly, and then different solutions are adopted for image detection and text recognition according to the image characteristics;
specifically, the image features include: the first feature, the second feature, and the third feature; the first feature is: the lottery image class in which the curvature and the inclination occur; the second feature is: lottery image classes with closely arranged parallel texts appear; the third feature is: lottery image class of low text probability value; in this embodiment, the close arrangement of the parallel texts means that a case that font bundle with smaller interval between upper and lower rows appears in the digital color or a plurality of areas appears in the digital color exists; the lottery image class with the low text probability value represents a condition that after the detection of an image detection model, a certain region in the original digital lottery is found to have fonts, but the text probability value of the region in the detected Gaussian heat image is low, no fonts are displayed, and the detection is missed;
specifically, the digital color image is input into the image detection model to obtain a first text probability Gaussian heat image; determining the image feature of the first text probability Gaussian heat image based on the first heat reference image, the second heat reference image and the third heat reference image; in the present embodiment, referring to fig. 3 to 5, schematic diagrams of a first thermal reference image, a second thermal reference image and a third thermal reference image are respectively given;
specifically, the text recognition operation includes: a first operation, a second operation, and a third operation; the first operation is: performing positioning operation on the text; the second operation is: parallel text segmentation operation; the third operation is: text region review operation; the digital color text includes: a first digital color text, a second digital color text, and a third digital color text; correspondingly, the first operation is used for solving the situation that the first text probability Gaussian heat image has the first feature, the second operation is used for solving the situation that the second text probability Gaussian heat image has the second feature, and the third operation is used for solving the situation that the third text probability Gaussian heat image has the third feature; correspondingly, in the present embodiment, the method includes, but is not limited to, multiple cases, such as simultaneous occurrence of the first feature, the second feature, and the third feature in the first text probability gaussian heat image, simultaneous occurrence of the first feature and the second feature, simultaneous occurrence of the first feature and the third feature, simultaneous occurrence of the second feature and the third feature, separate occurrence of the first feature, separate occurrence of the second feature, and separate occurrence of the third feature; corresponding text recognition operation can be executed according to the condition of which characteristics appear;
specifically, if the first feature exists in the image features of the first text probability gaussian heat image, the first operation is performed on the digital color image based on the image recognition model to obtain the first digital color text; correspondingly, when the first characteristic occurs, the number area representing the digital lottery may have upward bending, downward bending, upward inclination, downward inclination, wave-shaped bending and other forms, so when image detection and text recognition are performed, the difficulty lies in that texts in different lines may be recognized as the same line, which causes a recognition error of the texts and reduces the accuracy, so in this embodiment, for this aspect, the first operation is performed to perform the same-line text correction recognition on the numbers in the digital lottery image corresponding to the first text probability gaussian heat image in the case of the first characteristic, so that the recognized texts and the line positions where the texts are located are all the same as those in the paper lottery of the digital lottery;
the first operation includes:
in the first operation, the problem of arrangement of the texts in the same line is solved based on an array arrangement form; because the position of the text in the original digital color image is displayed as the hot spot in the first text probability Gaussian heat image, a plurality of text positioning boxes can be generated based on the distribution condition of the hot spot in the first text probability Gaussian heat image, and the text line can be corrected by cutting, segmenting and sequencing the original digital color image through the text positioning boxes; therefore, a plurality of coordinate information respectively corresponding to the text positioning boxes in the first text probability Gaussian heat image is identified; the coordinate information is a coordinate grid corresponding to the first text probability Gaussian heat image, the division units all use vectors as units, an x axis and a y axis are designed, further, the coordinate grid matched with each text positioning box in the first text probability Gaussian heat image is generated, and the text positioning box in any unit can be positioned by the coordinate information of (x, y); configuring an array container, wherein the array container is an empty array and is used for storing data to form a new array; setting a sorting direction and an arrangement sequence, wherein the sorting direction is set as a y-axis direction in the embodiment, and the arrangement sequence is set as a small-to-large sorting; leading a plurality of text positioning boxes into the array container to obtain a first statistic group; sorting the text positioning boxes in the first statistical array according to the sorting direction and the sorting sequence according to the coordinate information to obtain a second statistical array, wherein the text positioning boxes in the second statistical array are the arrays sorted from small to large according to the y-axis magnitude of the coordinate information corresponding to the text positioning boxes; setting a comparison threshold, in this embodiment, if the comparison threshold is 0, counting the subdata numerical values of the second statistical array, and if the subdata numerical values are greater than the comparison threshold, executing a first circular screening operation; correspondingly, the circular screening operation needs to be circularly executed for multiple times until each row of the second statistical array is confirmed and sorted out;
the first cyclical screening operation comprises: creating a text line space array which is also a space array and used for storing texts in the same line; transferring the first text positioning box in the second statistical array to the text row empty array to obtain a first same text row number array; in this embodiment, the first text positioning box is the first text positioning box to the left in the second statistical array; the main principle of the circular screening operation is that firstly, a reference text positioning box is confirmed, then, a text positioning box positioned on the left side of the reference text positioning box and a text positioning box positioned on the right side of the reference text positioning box are respectively confirmed according to vector values, and finally, the text positioning box positioned on the left side of the reference text positioning box, the reference text positioning box and the text positioning box positioned on the right side of the reference text positioning box are spliced in sequence, so that data belonging to the reference text positioning box and a text line can be obtained; setting a first screening direction, wherein the first screening direction is to be screened leftwards from a reference text positioning frame, and executing circular screening operation of left-side same-line texts based on the first same-text line array and the first screening direction to obtain a second same-text line array; the second text-line array is an array with a reference text positioning box and all texts in the same line on the left side of the reference text positioning box;
specifically, the circular screening operation of the left-side same-line text comprises the following steps: creating a left adjacent text empty array which is also an empty array and used for storing intermediate associated data, setting the first text positioning box as a center reference, and executing a left-side screening step based on the left adjacent text empty array, the first screening direction and the center reference;
specifically, the left-side screening step includes: transferring a second text positioning box which is in the same line with the first text positioning box in the second statistical array and is matched with the first screening direction to the left adjacent text empty array to obtain a first left-side same-line array; in this embodiment, the first text positioning box is the reference text box; a plurality of second text positioning boxes matched with the first screening direction exist, so that the text box closest to the first text positioning box needs to be screened out from the text boxes, namely the text box is the left neighbor of the same line of the first text positioning box; transferring the second text positioning box corresponding to second coordinate information with the minimum difference value with the first coordinate information of the first text positioning box in the first left-side same-line array to a position, which is positioned on the left side of the first text positioning box, in the first same-line array; the second text positioning box corresponding to the second coordinate information with the minimum difference value with the first coordinate information of the first text positioning box is the left neighborhood with the closest left distance of the first text positioning box; correspondingly, after the left neighbor of the first text positioning box is found, the left-side continuous screening is needed, so that the second text positioning box in the first text line array is set as the center reference, the left-side text circular screening operation is returned, the left neighbor of the second text positioning box is found until all the text boxes in the same line on the left side of the first text positioning box are moved to the first text line array, and an array with the reference text positioning box and all the texts in the same line on the left side of the reference text positioning box, namely a second text line array, is obtained;
correspondingly, according to the same logic of the left-side same-line text circular screening operation, namely the same logic of the left-side screening step, a second screening direction is set, the first screening direction is screening from the reference text positioning frame to the right, and therefore, based on the second same-line text array and the second screening direction, the right-side same-line text circular screening operation is executed by adopting the same operation logic as the left-side same-line text circular screening operation, and a third same-line text array is obtained; the third same-text line array is an array with a reference text positioning box, all the same-line texts on the left side of the reference text positioning box and all the same-line texts on the right side of the reference text positioning box;
specifically, the circular screening operation of the right-side same-line text comprises the following steps: creating a right adjacent text empty array, setting the first text positioning box as a center reference, and executing a right-side screening step based on the right adjacent text empty array, the second screening direction and the center reference;
the right-side screening step comprises: transferring a second text positioning box which is in the same line with the first text positioning box in the second statistical array and is matched with the second screening direction to the right adjacent text empty array to obtain a first right-side same-line array; transferring the second text positioning box corresponding to second coordinate information with the minimum difference value with the first coordinate information of the first text positioning box in the first right-side same-line array to a position, positioned on the right side of the first text positioning box, in the second same-text line array; setting the second text positioning frame in the second text row array as the center reference, returning to the right text row circular screening operation, and finally obtaining the third text row array after circular execution;
finally, after the first circular screening operation is executed, the digital color image is cut according to the text positioning box in the third text row array to obtain a plurality of first cut images, and the first cut images are input into the image recognition model to be subjected to prediction processing to obtain a first text to be sorted; sequencing the first text to be sequenced based on the third text line array to obtain a first digital color text, wherein the first digital color text is relative to text information of each number on the digital color image after image detection and text recognition, and the first digital color text needs to be decoded subsequently through a decoding operation in the method to further obtain more accurate digital color number code information;
correspondingly, in the first operation, the circular screening operation is performed circularly and iteratively according to the number of lines in the digital color image, the left-side same-line text circular screening operation and the right-side same-line text circular screening operation are performed circularly and iteratively according to the number of each line of text, through the first operation, the detection and text recognition of the digital color image with inclination and bending conditions are solved to the greatest extent, and the applicability and flexibility of the method are improved;
correspondingly, part of core implementation codes of the first operation are as follows:
def find_left(current_stat, stats, row_data ):
"" is current _ stat finds the left neighbor node "";
if len(stats) > 0:
"" create an empty array left _ stands "";
left_stats = []
"traverse the array in order to find all left data" "that satisfy the current _ stat condition with the current _ stat;
for stat in stats:
"" if stat satisfies the condition to join the same row, it is added to left _ stats;
here, the judgment detail logic omits "";
left_stats.append(stat)
if len(left_stats) > 0:
"" nearest left neighbor "";
neighbour_stat = sorted(left_stats, key=lambda x: x[0], reverse=True)[0]
"" judges whether the left neighborhood meets the regulation, if meets the condition, it is passed;
the filter detail logic is omitted "";
is_accept = True
if is_accept:
"" clear the left node in the list "";
stats.pop(stats.index(neighbour_stat))
"" the left node is added in the row data "";
row_data.append(neighbour_stat)
the ' recursive call always finds the left node ' which meets the condition ';
find_left(neighbour_stat, stats, row_data)
if the second feature exists in the image features of the first text probability Gaussian heat image, executing the second operation on the digital color image based on the image recognition model to obtain a second digital color text; correspondingly, due to the fact that the arrangement modes of lottery numbers of all provinces are different, and some lotteries can design the space between the numbers to be small in order to save space, all numbers are piled up, one area of the first text probability Gaussian heat image with a large text positioning frame area can contain a plurality of hot spots, namely a plurality of texts, the area needs to be segmented, and the text arrangement rule in the original digital color image is met; correspondingly, the segmentation difficulty in this case is very high, and through the second operation in this embodiment, the regions where the numbers are bundled can be found and accurately cut, so as to realize accurate positioning and identification of the text in this case;
specifically, the second operation includes:
firstly, whether a text region in a first text probability Gaussian heat image is in close connection up and down needs to be judged, the text region in the first text probability Gaussian heat image is displayed in a larger mode due to a larger text, and in order to further improve the detection accuracy, a parallel close distribution text judgment step is executed;
the judging step of the parallel closely distributed texts comprises the following steps:
the display probability of the text probability Gaussian heat image is between 0 and 1, so that the redder each hot point, namely the pixel point, represents that the probability of the point as a text is higher, and meanwhile, the text probability value is closer to 1, so that the text area of the image is judged by taking the point as a starting point; firstly, a first text probability Gaussian heat image needs to be converted into a binary image, so that the analysis and the processing are facilitated; therefore, a first text probability benchmark threshold is set, and the first text probability benchmark threshold is used for screening pixel points in the binary image in the embodiment and is set to be 0.5 in the embodiment, and is specifically set in specific situations; adjusting the text probability value of a pixel point which is greater than the first text probability reference threshold value in the first text probability Gaussian heat image to be a first probability value, and adjusting the text probability value of a pixel point which is not greater than the first text probability reference threshold value in the first text probability Gaussian heat image to be a second probability value to obtain a first Gaussian heat image to be converted; in this embodiment, the first probability value is 1, and the second probability value is 0; carrying out binarization processing on the first Gaussian heat image to be converted to obtain a first binarized image; identifying a first closed connected region in the first binarized image; the first closed connected region is each connected region distributed in blocks in the first binary image; setting the distribution quantity condition and a first ratio of the first pixel points; the distribution quantity condition of the first pixel points is as follows: the arrangement rule of the number of the pixel points with the probability value of 1 in each row in the closed communication area is that the two ends are small and the middle is large; the distribution quantity condition of the first pixel points represents the condition that the texts are closely connected up and down; counting the number of the text probability values in the first closed connected region as the first probability values according to lines to obtain a plurality of first data; the first data is a specific numerical value of the text probability value in the first closed connected region, wherein the text probability value is the number of the first probability value; sequencing the plurality of first data according to rows to obtain a first connecting text array; analyzing the arrangement rule of a plurality of first data in the first communication text array to obtain the distribution quantity condition of second pixel points; identifying a width value and a height value of the first closed connected region, and calculating a second ratio of the height value to the width value; correspondingly, if the connected region is normal, the situation that the height value of the connected region is more than two times of the width value cannot occur, and if the height value of the connected region is more than two times of the width value, the situation that the texts are closely arranged up and down in the connected region inevitably occurs, so that the situation that whether the texts are closely arranged up and down in the connected region is accurately distinguished by combining the two ways of judging the distribution quantity situation of the first pixel points, the distribution quantity situation of the second pixel points and the height-width ratio of the connected region; if the distribution quantity condition of the second pixel points is matched with the distribution quantity condition of the first pixel points or the second ratio is greater than the first ratio, judging that the parallel closely-distributed texts exist in the first closed connected region; for example, if the first connected text array is [1,5,12,8,5,1,3,11,8,4,2,0], the distribution quantity of the second pixels represented by the first connected text array is small at both ends and large in the middle, the distribution quantity of the second pixels is gradually increased from 1 on the left side, then is decreased progressively, the number of the second pixels is large in the middle, then is increased progressively and decreased progressively, and the situation that the upper text and the lower text are closely connected inevitably occurs;
after the judgment step of the texts in the parallel close distribution is executed, if the texts in the parallel close distribution exist in the first closed communication area, the judgment step of the cutting area is executed;
the cutting region judging step includes:
because the parallel and closely distributed texts exist in the first closed connected region, a higher text probability reference threshold value needs to be set, and the first text probability Gaussian heat image is subjected to pixel point screening again; therefore, a second text probability benchmark threshold is set, and the second text probability benchmark threshold is surely guaranteed to be larger than the first text probability benchmark threshold, and in the embodiment, the second text probability benchmark threshold is set to be 0.7; adjusting the text probability value of the pixel point which is greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to be the first probability value, and adjusting the text probability value of the pixel point which is not greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to be the second probability value to obtain a second Gaussian heat image to be converted; performing binarization processing on the second Gaussian heat image to be converted to obtain a second binarized image; identifying a second closed connected region in the second binary image; counting the number of the text probability values in the second closed connected region as the first probability values according to lines to obtain a plurality of second data; sequencing a plurality of second data according to rows to obtain a second connected text array; for example, according to the above example, if the first connected text array is [1,5,12,8,5,1,3,11,8,4,2,0], then the first text probability gaussian heat image corresponding to the connected region under the pixel point distribution condition corresponding to the first connected text array is filtered again according to the second text probability reference threshold, and the obtained second connected text array is [0,3,12,7,3,0,0,9,6,2,0,0], it is obvious that the pixel point distribution condition reflected by the second connected text array is obviously reduced;
correspondingly, based on [1,5,12,8,5,1,3,11,8,4,2,0] and [0,3,12,7,3,0,0,9,6,2,0,0], the following operations are performed, which are calculation algorithms for the cutting area autonomously designed by the method: firstly, setting a first cutting threshold value and a second cutting threshold value; in this embodiment, the first cutting threshold is 3, and the second cutting threshold is 0; adjusting the first data which is greater than the first cutting threshold value in the first connected text array into a first cutting value, wherein the first cutting value is 1; adjusting the first data in the first connected text array, which is smaller than the first cutting threshold value, to be a second cutting value to obtain a first array to be calculated, wherein the second cutting value is 0; the first array to be calculated is [0,1,1,1,1,0,1,1,1,1,0,0 ]; adjusting the second data matched with the second cutting threshold value in the second connected text array to be the second cutting value, and adjusting the second data not matched with the second cutting threshold value in the second connected text array to be the first cutting value to obtain a second array to be calculated; the second array to be calculated is [0,1,1,1,1,0,0,1,1,1,0,0 ]; multiplying the first array to be calculated and the second array to be calculated, namely multiplying [0,1,1,1,1,0,1,1,1,1,0,0] and [0,1,1,1,1,0, 0] according to the position of each datum to obtain a cutting area indication array; the cutting area indication array is [0,1,1,1,1,0,0,1,1,1,0,0 ]; according to the calculation of the array, analyzing the distribution rule of the first cutting value and the second cutting value in the cutting area indication array to obtain a cutting area, wherein obviously, the cutting area is the middle position of a closed communication area; after the cutting area is obtained, cutting the closed communication area, and positioning the text box, cutting the original digital color image and identifying the image according to the cut Gaussian heat image; therefore, the first closed connected region in the first binary image is cut based on the cutting region, and a third binary image is obtained;
after the cutting area judging step is executed, converting the third binary image into a second text probability Gaussian heat image, and generating a plurality of third text positioning frames based on the hotspot distribution condition of the second text probability Gaussian heat image; cutting the digital color images according to the third text positioning boxes to obtain second cut images, inputting the second cut images into the image recognition model for prediction processing to obtain second texts to be sorted; sequencing the second text to be sequenced based on the arrangement rule of a plurality of third text positioning boxes in the second text probability Gaussian heat image to obtain a second digital color text;
correspondingly, through the second operation, the problem that characters in the digital color image are bundled and distributed or characters in the Gaussian heat image are closely connected up and down is solved to a great extent, and the detection accuracy of the method and the applicability and flexibility of the method are further improved;
correspondingly, part of the core implementation code of the second operation is as follows:
"normally detects whether a text default setting >0.5 is a text region" ";
ret, text_score = cv2.threshold(textmap, 0.5, 1, 0)
"harsh text detection, requiring >7 as a text region" ";
_, harsh_text_score_comb = cv2.threshold(textmap, 0.7, 1, 0)
"" generates a connected region "";
nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(text_score.astype(np.uint8),connectivity=4)
txt_up_down_num = 0
"traverse connected regions" ";
for k in range(1, nLabels):
"" acquiring a coordinate point at the upper left corner of a connected region and long frame information "";
x, y = stats[k, cv2.CC_STAT_LEFT], stats[k, cv2.CC_STAT_TOP]
w, h = stats[k, cv2.CC_STAT_WIDTH], stats[k, cv2.CC_STAT_HEIGHT]
sx, ex, sy, ey = x, x + w, y, y + h
"gaussian probability heatmap located on connected regions" ";
sub_text_score = text_score[sy:ey, sx:ex]
"harsh text detection area" ";
sub_harsh_text_score = harsh_text_score_comb[sy:ey, sx:ex]
"statistics" for not harsh detection, each line is the number of text "";
row_sum = np.sum(sub_text_score, axis=1)
"statistics" is directed to performing rigorous testing, each line is the number of texts "";
harsh_row_sum = np.sum(sub_harsh_text_score, axis=1)
"" parameter 1: setting a pixel occupied by the upper and lower connecting points to be 0.75, wherein the pixel exceeding 0.75 represents that the line is basically a character area, and then determining that the character area is 'marked';
w1 = row_sum <= int(max(row_sum) * 0.75)
"is directed to the connection of the upper and lower parts, if the judgment is strict, the middle part is definitely" with 0 "";
w2 = harsh_row_sum == 0
"" determines a divided region "";
w = w1 * w2
if the third feature exists in the image features of the first text probability Gaussian heat image, executing the third operation on the digital color image based on the image recognition model to obtain a third digital color text; correspondingly, because the redder color region in the text probability gaussian heat image represents that the hot spot, i.e. the pixel point, in the region is a text with a high probability, and the text probability value is closer to 1, according to the opposite logic, the bluer color region in the text probability gaussian heat image represents that the hot spot, i.e. the pixel point, in the region is a text with a low probability, and the text probability value is closer to 0; correspondingly, the third feature is that many regions with low text probability values appear in the image, and in order to further improve the detection accuracy, it is conceivable that in some cases, due to some factors of the detection model or the image ambiguity and the resolution, the detection result is affected, so that in order to avoid the situation that the text is in the original digital color image but the text probability value is displayed as a low text probability value in the first text probability gaussian heat image, that is, to solve the problem that the third feature exists in the image features of the first text probability gaussian heat image, a third operation is performed, and the main principle is to confirm the missed detection region in the first text probability gaussian heat image and detect again;
specifically, the third operation includes:
setting a first text probability screening threshold and a second text probability screening threshold, and dividing the first text probability Gaussian heat image based on the first text probability screening threshold and the second text probability screening threshold to obtain a first text region; in this embodiment, the first text probability gaussian heat image is divided based on the first text probability screening threshold and the second text probability screening threshold to obtain a first text region; correspondingly, after the division, the obtained pixel points in the first text region inevitably satisfy the following conditions: the text probability values of all the pixel points are greater than the first text probability screening threshold, and the text probability value of any one pixel point is greater than the second text probability screening threshold; because the setting of the first text probability screening threshold and the second text probability screening threshold cannot be adjusted at will, as long as the first text probability screening threshold and the second text probability screening threshold are changed, the confirmation of the first text region is affected, so that the text region needs to be reduced step by step, the precision of the text probability screening threshold is improved, and the confirmation of the high-precision text region is further achieved; firstly, in this embodiment, a first text probability screening threshold is set to 0.45; setting a second text probability screening threshold value to be 0.75; according to the value, the generated first text area is a preliminary text area;
then, a lower text probability screening threshold is further set, and a third text probability screening threshold is set based on the first text probability screening threshold, wherein the third text probability screening threshold is inevitably smaller than the first text probability screening threshold, and in the embodiment, the third text probability screening threshold is 0.3; setting a fourth text probability screening threshold value based on the second text probability screening threshold value; the fourth text probability screening threshold is inevitably smaller than the second text probability screening threshold, and in this embodiment, the fourth text probability screening threshold is 0.5; dividing the first text region based on the third text probability screening threshold and the fourth text probability screening threshold to obtain a second text region; the principle of dividing the first text region based on the third text probability screening threshold and the fourth text probability screening threshold is the same as the principle of dividing the first text probability Gaussian heat image based on the first text probability screening threshold and the second text probability screening threshold; correspondingly, the second text area is a text area with more rigorous screening conditions; whether the second text region really exists in the text or not is judged subsequently; counting the number of the first texts in the second text region based on the third text probability screening threshold and the fourth text probability screening threshold; counting a second text number of the second text region based on the first text probability screening threshold and the second text probability screening threshold; a number ratio determination threshold value is set, and the number ratio determination threshold value is empirically set in the present embodiment, and is set to 0.7 in the present embodiment; calculating a first ratio of the number of the first texts to the number of the second texts, judging whether the first ratio is smaller than a ratio judgment threshold value, if so, indicating that the text is missed, and setting the second text area as a missed area; however, if the upper and lower texts are closely connected, and at the same time, the first number ratio is smaller than the number ratio determination threshold, so to eliminate this situation, it is necessary to determine whether the upper and lower texts are closely connected in the undetected area according to the parallel closely distributed text determination step in the second operation, so the parallel closely distributed text determination step is performed based on the first heat image matching the undetected area in the first text probability gaussian heat image, and a determination result about the first heat image is obtained; if the judgment result is that the text which is closely distributed in parallel exists in the missed detection area, a second operation is required to be executed to cut the text area which is connected side by side up and down, and corresponding identification operation is carried out after cutting; if the judgment result indicates that the parallel closely distributed texts do not exist in the missed detection region, the missed detection is determined to exist, and therefore the text detection probability value of the image detection model is set based on the missed detection region; detecting the digital color image based on the text detection probability value and the image detection model to obtain a third text probability Gaussian heat image; generating a plurality of fourth text positioning boxes based on the hot spot distribution condition of the third text probability Gaussian heat image; cutting the digital color images according to the fourth text positioning boxes to obtain third cut images, inputting the third cut images into the image recognition model for prediction processing to obtain third texts to be sorted; sequencing the third text to be sequenced based on the arrangement rule of a plurality of fourth text positioning boxes in the third text probability Gaussian heat image to obtain a third digital color text;
correspondingly, through the third operation, the situation that text omission detection exists in the text heat probability image due to the detection model or the image resolution, definition and ambiguity is solved to a great extent, the detection accuracy of the method is further improved, and the applicability and flexibility of the method are further improved; correspondingly, the first operation, the second operation and the third operation can be correspondingly combined or transformed according to the image characteristic condition in the text probability Gaussian heat image;
correspondingly, part of core implementation codes of the third operation are as follows:
"" indicates that the probability value for all points must be greater than the lowest value "";
weak_low_text = 0.3
"" indicates that inside the text region, there must be a value that is greater than the threshold "";
weak_text_threshold = 0.5
"" weak text set lowest >0.3 as text region "";
_, weak_text_score_comb = cv2.threshold(textmap, weak_low_text, 1, 0)
nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(weak_text_score_comb.astype(np.uint8),
connectivity=4)
img_height = textmap.shape[0]
weak_txt_points = []
"traverse text regions generated using a low threshold" ";
for k in range(1, nLabels):
"acquire each text region" ";
stat = stats[k]
"" if the region is less than a given week _ text _ threshold, filter "";
if np.max(textmap[labels == k]) < weak_text_threshold:
continue
x, y, w, h = stat[cv2.CC_STAT_LEFT], stat[cv2.CC_STAT_TOP], stat[cv2.CC_STAT_WIDTH], stat[cv2.CC_STAT_HEIGHT]
sx, ex, sy, ey = x, x + w, y, y + h
"" locate a text _ score _ comb, a week _ text _ score _ comb binarization map region "" according to the location box;
sub_text_score = text_score_comb[sy:ey, sx:ex]
weak_sub_text_score = weak_text_score_comb[sy:ey, sx:ex]
if np.sum(weak_sub_text_score) > 0:
"" count the number of sub _ text _ score and the number of the text of the leaf _ sub _ text _ score, and calculate the proportion "";
s300, text decoding, specifically comprising:
s310, carrying out recombination operation on the digital color text to obtain a text to be decoded; calling the dynamic decoding algorithm to process the text to be decoded to obtain digital color number information; correspondingly, the step is based on the starting point that a uniform decoding mode is provided for the lottery of each style, so that the applicability and the flexibility of the method are improved; correspondingly, the following problems can be found out through repeatedly testing the numbers obtained after the bicolor ball images pass through the recognition model: the first and last digits of the identified number may have serial number identification; the identified number may have multiple marks at the last digit; there are two display modes for numbers smaller than 10, for example, 1 may be displayed as "1" or "01"; in a line number, the condition that no connection symbol and Chinese exists; the situation that digits are lost in the identified number can exist; therefore, aiming at the problems, the method adopts recombination operation combined with a dynamic decoding algorithm to decode the digital color number, and finally greatly improves the decoding accuracy;
specifically, the recombination operation comprises:
setting a character type, and removing characters matched with the character type in the digital color text to obtain a first text; in the present embodiment, the character type is set to a non-numeric character type; the first text is the text from which all non-numeric characters have been removed, e.g., if the numeric color text is a1311212532510 times, the first text is 1311212532510; setting a color type, setting character bits based on the color type, and setting character strings corresponding to the character bits in the first text as end character strings; in this embodiment, the color category is a two-color ball; the character position is the last number of the double-color sphere red area; therefore, according to the above operation, the last character string obtained in 1311212532510 is 32, and the last character string in the first text and the characters after the first character position are removed, so as to obtain a second text, that is, the second text is 13112125; setting a recombination sequence, and sequencing the characters in the second text according to the recombination sequence to obtain the text to be decoded; in this embodiment, the recombination sequence is a reverse order, and the obtained text to be decoded is 52121131; after the text to be decoded is obtained, carrying out dynamic decoding algorithm processing;
specifically, the processing logic of the dynamic decoding algorithm for the text to be decoded includes: firstly, according to the arrangement specification of numbers in the lottery, in order to perform decoding more accurately, whether the next digit to be decoded is a single character digit or a double character digit needs to be determined, namely whether the next digit to be decoded is a single digit or a double digit is determined; therefore, the number storage array is configured, and the number storage array is also a null array and is used for storing data; setting a first character arrangement rule; the first character arrangement rule is that the rest numbers are smaller than one another in the order from left to right; correspondingly, the first character arrangement rule is also subjected to adaptive setting matched with the color number distribution rule according to the color type; in this embodiment, the first character arrangement rule is in accordance with the situation when the next digit to be decoded is a single digit, so the text to be decoded is separated according to a single character unit to obtain a first text to be analyzed; judging whether a second character arrangement rule of characters in the first text to be analyzed is matched with the first character arrangement rule; if the number to be decoded is matched with the number to be decoded, the number to be decoded is in accordance with the requirement of the variety class, so that the characters in the first text to be analyzed are placed in the number storage array to obtain the digital color number information; correspondingly, for example: the first text to be analyzed is 5212; at this time, it is found that the third character bit "1" of the first text to be analyzed is smaller than the previous second character bit "2", so that the first text to be analyzed is not in accordance with the requirement of the variety class; meanwhile, for example, if the first text to be analyzed is 31; if 1 is less than 3, it indicates that the '31' is in accordance with the first character arrangement rule, so that all 31 can be added into the number storage array to obtain the digital color number information;
correspondingly, if the number to be decoded is not matched with the number to be decoded, the number to be decoded does not meet the requirement of the variety class, so that the next digit to be decoded can be two digits, and the text to be decoded is separated according to a double-character unit to obtain a second text to be analyzed; so the second text to be analyzed is 52121131; extracting a first character string positioned at the head in the second text to be analyzed; therefore, in the present embodiment, the first string is 52; setting a reference character string based on the color type, wherein in the embodiment, the reference character string is the maximum number of the corresponding digital color in the color type, and correspondingly, the reference character string is 33 because the color type is a bicolor ball in the embodiment; setting the last character string as a first character string of the first character string; carrying out reverse order processing on the first character string to obtain a first reverse order character string, wherein the first reverse order character string is 25; judging whether the first reverse character string is smaller than a former number, namely a former character string, namely a last character string, and judging whether the first reverse character string is simultaneously smaller than the reference character string, if so, 25 is smaller than 32 and is simultaneously smaller than 33, adding the first reverse character string into the number storage array, and executing a circulating judgment step; in this embodiment, the loop determination step is performed iteratively and repeatedly, since 121131 still exists in the second text to be analyzed after the first reverse-order character string is added to the number storage array, analysis and selection need to be performed again, 121131 is processed again from the part of "separating the text to be decoded according to a single character unit", if 121131 meets the first character arrangement rule, all 121131 is added to the number storage array to obtain the digital color number information, and then the loop is ended; therefore, if the process is carried out to the part of 'separating the text to be decoded according to the unit of double characters', taking 121131 as an example, the obtained first character string should be 12, and after the reverse order processing is carried out, the obtained first reverse order character string is 21, so 21 should be smaller than the former number, namely, the first reverse order character string is just added to 25 of the number storage array, and at this time, 25 should be set as 'the former character string'; meanwhile, the number is still smaller than 33, and at this time 21 meets the requirement, so 21 needs to be added to the number storage array, and the process is circulated again until the subsequent 1131 is completely added to the number storage array, and the final digital color number information is obtained; correspondingly, if no number meeting the condition exists in the two cases, the identification abnormality or the decoding abnormality is indicated to be stopped for error reporting; correspondingly, the restructuring operation and the dynamic decoding algorithm are applied to the lottery play setting of the double-color ball in the embodiment, and correspondingly, different color types are dealt with, and the logic flow of the restructuring operation and the dynamic decoding algorithm needs to be adaptively adjusted; through the recombination operation and the dynamic decoding algorithm, the decoding accuracy is greatly improved, a user can conveniently check the ticket by the digital lottery, the experience of the user is greatly improved, and the defects of the prior art are overcome;
correspondingly, part of the core implementation codes of step S300 are as follows:
param last _ number: last number hypothesis 32;
param loc is the current pointer 2;
param seq is a set of number strings 2352121131;
param res _ seq: final decoding "";
"" takes the remaining character string according to the pointer: 52121131 "";
left_seq = seq[loc:]
"condition 1, choose to go one step, satisfy each number of surplus one and be smaller than one" ";
if all([left_seq[i] > left_seq[i + 1] for i in
range(len(left_seq) - 1)]):
"" requires that the current number be smaller than the previous number "";
if left_seq[0] < last_number:
"" all numbers are added to the array "";
res_seq.extend(left_seq)
"" end decoding process "";
return
"" Condition 2: selecting to walk 2 steps "";
double_number = int(str(seq[loc + 1]) + str(seq[loc]))
""1. the current number must be less than the two-color ball maximum number 33;
2. the current number must be smaller than the number "" before it;
if double_number <= 33 and double_number < last_number:
"" add number to array "";
res_seq.append(double_number)
"" recursion calling, position 2 steps "";
generate_number(double_number, loc + 2, seq, res_seq)
else:
"problem occurs in" "and" "is directly ended" ";
return
example 2
The present embodiment provides a high-precision digital color unification ticket checking system based on the inventive concept of the high-precision digital color unification ticket checking method in embodiment 1, as shown in fig. 6, including: the system comprises an initial configuration module, a text recognition module and a text decoding module;
in the digital color unification ticket checking system, an initial configuration module is used for configuring an image detection model, a characteristic reference image, an image identification model and a dynamic decoding algorithm, and the initial configuration module is also used for acquiring a digital color image;
specifically, the feature reference image includes: a first thermal reference image, a second thermal reference image, and a third thermal reference image.
In the digital color unification ticket checking system, a text recognition module is used for recognizing the image characteristics of the digital color image according to the image detection model and the characteristic reference image, and the text recognition module executes text recognition operation on the digital color image based on the image recognition model and the image characteristics to obtain a digital color text;
specifically, the image features include: the first feature, the second feature, and the third feature; the first feature is: the lottery image class in which the curvature and the inclination occur; the second feature is: lottery image classes with closely arranged parallel texts appear; the third feature is: lottery image class of low text probability value; the text recognition operation includes: a first operation, a second operation, and a third operation; the first operation is: performing positioning operation on the text; the second operation is: parallel text segmentation operation; the third operation is: text region review operation; the digital color text includes: a first digital color text, a second digital color text, and a third digital color text;
specifically, the text recognition module inputs the digital color image into the image detection model to obtain a first text probability Gaussian heat image; the text recognition module judges the image features of the first text probability Gaussian heat image based on the first heat reference image, the second heat reference image and the third heat reference image;
specifically, if the first feature exists in the image features of the first text probability gaussian heat image, the text recognition module performs the first operation on the digital color image based on the image recognition model to obtain the first digital color text; if the second feature exists in the image features of the first text probability Gaussian heat image, the text recognition module executes the second operation on the digital color image based on the image recognition model to obtain a second digital color text; if the third feature exists in the image features of the first text probability Gaussian heat image, the text recognition module executes the third operation on the digital color image based on the image recognition model to obtain a third digital color text;
specifically, the first operation includes: the text identification module generates a plurality of text positioning boxes based on the hotspot distribution condition of the first text probability Gaussian heat image and identifies a plurality of pieces of coordinate information which correspond to the text positioning boxes in the first text probability Gaussian heat image respectively; the text recognition module is configured with an array container, and the text recognition module sets the sorting direction and the sorting sequence; the text recognition module leads the text positioning boxes into the array container to obtain a first statistic group; the text recognition module sorts the text positioning boxes in the first statistical array according to the sorting direction and the sorting sequence according to the coordinate information to obtain a second statistical array; the text recognition module sets a comparison threshold value, counts subdata numerical values of the second statistical array, and executes a first circular screening operation if the subdata numerical values are larger than the comparison threshold value;
the first cyclical screening operation comprises: the text recognition module creates a text line empty array, and transfers the first text positioning box in the second statistical array to the text line empty array to obtain a first same text line array; the text recognition module sets a first screening direction, and executes circular screening operation of left-side same-line texts based on the first same-text-line array and the first screening direction to obtain a second same-text-line array; the text recognition module sets a second screening direction, and based on the second same-line text array and the second screening direction, the text recognition module executes the right-side same-line text circular screening operation by adopting the same operation logic as the left-side same-line text circular screening operation to obtain a third same-line text array;
specifically, after the text recognition module executes the first circular screening operation, the text recognition module cuts the digital color image according to the text positioning box in the third text-line array to obtain a plurality of first cut images, and the text recognition module inputs the plurality of first cut images into the image recognition model for prediction processing to obtain a first text to be sorted; sequencing the first text to be sequenced based on the third text row array to obtain the first digital color text;
specifically, the circular screening operation of the left-side same-line text comprises the following steps: creating a left adjacent text empty array, setting the first text positioning box as a center reference, and executing a left side screening step based on the left adjacent text empty array, the first screening direction and the center reference;
specifically, the left-side screening step includes: transferring a second text positioning box which is in the same line with the first text positioning box in the second statistical array and is matched with the first screening direction to the left adjacent text empty array to obtain a first left-side same-line array; transferring the second text positioning box corresponding to second coordinate information with the minimum difference value with the first coordinate information of the first text positioning box in the first left-side same-line array to a position, which is positioned on the left side of the first text positioning box, in the first same-line array; setting the second text positioning box in the first text row array as the center reference, and returning to the circular screening operation of the left text row array;
specifically, the second operation includes:
the text recognition module executes the judgment step of the parallel closely distributed texts;
the judging step of the parallel closely distributed texts comprises the following steps: the text recognition module sets a first text probability benchmark threshold, adjusts the text probability value of a pixel point which is larger than the first text probability benchmark threshold in the first text probability Gaussian heat image to be a first probability value, and adjusts the text probability value of a pixel point which is not larger than the first text probability benchmark threshold in the first text probability Gaussian heat image to be a second probability value to obtain a first Gaussian heat image to be converted; the text recognition module carries out binarization processing on the first Gaussian heat image to be converted to obtain a first binarized image; a text recognition module recognizes a first closed connected region in the first binarized image; the text recognition module sets the distribution quantity condition and the first ratio of the first pixel points; the text recognition module counts the number of text probability values in the first closed connected region as the first probability values according to lines to obtain a plurality of first data; the text recognition module sorts the first data in rows to obtain a first connected text array; the text recognition module analyzes the arrangement rule of a plurality of first data in the first communication text array to obtain the distribution quantity condition of second pixel points; the text recognition module recognizes a width value and a height value of the first closed connected region and calculates a second ratio of the height value to the width value; if the distribution quantity condition of the second pixel points is matched with the distribution quantity condition of the first pixel points or the second ratio is larger than the first ratio, the text recognition module judges that parallel closely distributed texts exist in the first closed connected region;
after the text recognition module executes the step of judging the texts which are distributed in a parallel and close manner, if the texts which are distributed in a parallel and close manner exist in the first closed communication area, the text recognition module executes the step of judging the cutting area;
the cutting region judging step includes: the text recognition module sets a second text probability benchmark threshold, adjusts the text probability value of the pixel point which is greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to be the first probability value, and adjusts the text probability value of the pixel point which is not greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to be the second probability value to obtain a second Gaussian heat image to be converted; the text recognition module carries out binarization processing on the second Gaussian heat image to be converted to obtain a second binarization image; a text recognition module recognizes a second closed connected region in the second binary image; the text recognition module counts the number of text probability values in the second closed connected region, which are the first probability values, according to lines to obtain a plurality of second data; the text recognition module sorts the second data in rows to obtain a second connected text array; the text recognition module sets a first cutting threshold and a second cutting threshold; the text recognition module adjusts the first data, which are larger than the first cutting threshold value, in the first connected text array into a first cutting value, and adjusts the first data, which are smaller than the first cutting threshold value, in the first connected text array into a second cutting value, so that a first array to be calculated is obtained; the text recognition module adjusts the second data matched with the second cutting threshold value in the second connected text array into the second cutting value, and adjusts the second data not matched with the second cutting threshold value in the second connected text array into the first cutting value to obtain a second array to be calculated; the text recognition module multiplies the first array to be calculated and the second array to be calculated to obtain a cutting area indication array; the text recognition module analyzes the distribution rule of the first cutting value and the second cutting value in the cutting area indication array to obtain a cutting area; the text recognition module cuts the first closed connected region in the first binarized image based on the cutting region to obtain a third binarized image;
after the text recognition module executes the cutting area judgment step, the text recognition module converts the third binary image into a second text probability Gaussian heat image and generates a plurality of third text positioning frames based on the hotspot distribution condition of the second text probability Gaussian heat image; the text recognition module cuts the digital color images according to the third text positioning boxes to obtain a plurality of second cut images, and the text recognition module inputs the second cut images into the image recognition model for prediction processing to obtain a second text to be sorted; and the text recognition module sequences the second text to be sequenced on the basis of the arrangement rule of the third text positioning boxes in the second text probability Gaussian heat image to obtain the second digital color text.
Specifically, the third operation includes: the text recognition module sets a first text probability screening threshold and a second text probability screening threshold, and divides the first text probability Gaussian heat image based on the first text probability screening threshold and the second text probability screening threshold to obtain a first text region; the text recognition module sets a third text probability screening threshold value based on the first text probability screening threshold value and sets a fourth text probability screening threshold value based on the second text probability screening threshold value; the text recognition module divides the first text region based on the third text probability screening threshold and the fourth text probability screening threshold to obtain a second text region; the text recognition module counts the number of the first texts in the second text region based on the third text probability screening threshold and the fourth text probability screening threshold; the text recognition module counts a second text number of the second text region based on the first text probability screening threshold and the second text probability screening threshold; the text recognition module sets a number ratio judgment threshold value and calculates a first number ratio of the first text number to the second text number, the text recognition module judges whether the first number ratio is smaller than the number ratio judgment threshold value, and if the first number ratio is smaller than the number ratio judgment threshold value, the text recognition module sets the second text area as a missed detection area; the text recognition module executes the parallel closely-distributed text judgment step based on a first heat image matched with the missed detection region in the first text probability Gaussian heat image to obtain a judgment result about the first heat image; if the judgment result is that the parallel closely distributed texts do not exist in the undetected area, the text recognition module sets a text detection probability value of the image detection model based on the undetected area; the text recognition module detects the digital color image based on the text detection probability value and the image detection model to obtain a third text probability Gaussian heat image; the text recognition module generates a plurality of fourth text positioning boxes based on the hot spot distribution condition of the third text probability Gaussian heat image; the text recognition module cuts the digital color images according to the fourth text positioning boxes to obtain third cut images, and the text recognition module inputs the third cut images into the image recognition model for prediction processing to obtain a third text to be sorted; and the text recognition module sequences the third text to be sequenced on the basis of the arrangement rule of the fourth text positioning boxes in the third text probability Gaussian heat image to obtain a third digital color text.
In the digital color unification ticket checking system, a text decoding module is used for executing recombination operation on the digital color text to obtain a text to be decoded; the text decoding module calls the dynamic decoding algorithm to process the text to be decoded to obtain digital color number information;
specifically, the recombination operation comprises: the text decoding module sets character types and removes characters matched with the character types in the digital color text to obtain a first text; the text decoding module sets a color type, sets character bits based on the color type, and sets a character string corresponding to the character bits in the first text as an end character string; the text decoding module removes the last character string in the first text and characters behind the first character bit to obtain a second text; and the text decoding module sets a recombination sequence and sequences the characters in the second text according to the recombination sequence to obtain the text to be decoded.
Specifically, the processing logic of the dynamic decoding algorithm for the text to be decoded includes: the text decoding module configures a number storage array and sets a first character arrangement rule; the text decoding module separates the texts to be decoded according to a single character unit to obtain a first text to be analyzed; the text decoding module judges whether a second character arrangement rule of characters in the first text to be analyzed is matched with the first character arrangement rule; if the number is matched with the number, the text decoding module puts characters in the first text to be analyzed into the number storage array to obtain the digital color number information; if the two characters are not matched, the text decoding module separates the text to be decoded according to the unit of the two characters to obtain a second text to be analyzed; the text decoding module extracts a first character string positioned at the head in the second text to be analyzed; the text decoding module sets the last character string as a first character string of the first character string; the text decoding module carries out reverse order processing on the first character string to obtain a first reverse order character string; the text decoding module sets a reference character string based on the color type; and the text decoding module judges whether the first reverse character string is smaller than the preceding character string and the reference character string, and if so, the text decoding module adds the first reverse character string to the number storage array and executes a circulating judgment step.
Example 3
The present embodiments provide a computer-readable storage medium comprising:
the storage medium is used for storing computer software instructions for implementing the high-precision digital color unification ticket checking method according to the embodiment 1, and comprises a program for executing the high-precision digital color unification ticket checking method; specifically, the executable program may be embedded in the digital color unification ticket checking system described in embodiment 2, so that the digital color unification ticket checking system may implement the high-precision digital color unification ticket checking method described in embodiment 1 by executing the embedded executable program.
Furthermore, the computer-readable storage medium of the present embodiments may take any combination of one or more readable storage media, where a readable storage medium includes an electronic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof.
Different from the prior art, the high-precision digital color unification ticket checking method, the system and the medium can realize high-precision text recognition operation on folded, worn, folded and bent lottery images through the method, meanwhile, the recognition algorithm in the method can realize high-precision text recognition on the lottery images with poor shooting quality, and the method also adopts an independently developed decoding algorithm and can perform decoding operation on texts after recognition on digital colors of various styles.
The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be implemented by hardware, and a program that can be implemented by the hardware and can be instructed by the program to be executed by the relevant hardware may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic or optical disk, and the like.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A high-precision digital color unification ticket checking method is characterized by comprising the following steps:
an initial configuration step: configuring an image detection model, a characteristic reference image, an image recognition model and a dynamic decoding algorithm to obtain a digital color image;
a text recognition step: identifying the image characteristics of the digital color image based on the image detection model and the characteristic reference image, and executing text identification operation on the digital color image based on the image identification model and the image characteristics to obtain a digital color text;
text decoding step: performing recombination operation on the digital color text to obtain a text to be decoded; and calling the dynamic decoding algorithm to process the text to be decoded to obtain digital color number information.
2. The method as claimed in claim 1, wherein the image features include: the first feature, the second feature, and the third feature; the feature reference image includes: a first thermal reference image, a second thermal reference image, and a third thermal reference image; the first feature is: the lottery image class in which the curvature and the inclination occur; the second feature is: lottery image classes with closely arranged parallel texts appear; the third feature is: lottery image class of low text probability value;
the step of identifying image features of the digital color image based on the image detection model and the feature reference image further comprises: inputting the digital color image into the image detection model to obtain a first text probability Gaussian heat image; and judging the image characteristics of the first text probability Gaussian heat image based on the first heat reference image, the second heat reference image and the third heat reference image.
3. A high accuracy digital color unification ticket checking method as claimed in claim 2, wherein said text recognition operation comprises: a first operation, a second operation, and a third operation; the first operation is: performing positioning operation on the text; the second operation is: parallel text segmentation operation; the third operation is: text region review operation; the digital color text includes: a first digital color text, a second digital color text, and a third digital color text;
the step of performing text recognition operation on the digital color image based on the image recognition model and the image features to obtain a digital color text further comprises:
if the first feature exists in the image features of the first text probability Gaussian heat image, executing the first operation on the digital color image based on the image recognition model to obtain a first digital color text;
if the second feature exists in the image features of the first text probability Gaussian heat image, executing the second operation on the digital color image based on the image recognition model to obtain a second digital color text;
and if the third feature exists in the image features of the first text probability Gaussian heat image, executing the third operation on the digital color image based on the image recognition model to obtain a third digital color text.
4. A high precision digital color unification ticket checking method as claimed in claim 3, wherein said first operation comprises:
generating a plurality of text positioning boxes based on the hotspot distribution condition of the first text probability Gaussian heat image, and identifying a plurality of coordinate information respectively corresponding to the text positioning boxes in the first text probability Gaussian heat image;
configuring an array container, and setting a sorting direction and a sorting sequence; leading a plurality of text positioning boxes into the array container to obtain a first statistic group; sorting the text positioning boxes in the first statistical array according to the sorting direction and the sorting sequence according to the coordinate information to obtain a second statistical array; setting a comparison threshold, counting subdata values of the second statistical array, and if the subdata values are larger than the comparison threshold, executing a first circular screening operation;
the first cyclical screening operation comprises: creating a text line space array, and transferring a first text positioning box in the second statistical array to the text line space array to obtain a first same text line number array; setting a first screening direction, and executing circular screening operation of left-side same-line texts based on the first same-text-line array and the first screening direction to obtain a second same-text-line array; setting a second screening direction, and executing a right-side same-line text circular screening operation by adopting the same operation logic as the left-side same-line text circular screening operation based on the second same-text line array and the second screening direction to obtain a third same-text line array;
after the first circular screening operation is executed, the digital color images are cut according to the text positioning boxes in the third text row array to obtain a plurality of first cut images; inputting a plurality of first cutting images into the image recognition model for prediction processing to obtain a first text to be sequenced; sequencing the first text to be sequenced based on the third text row array to obtain the first digital color text;
the left-side same-line text circular screening operation comprises the following steps: creating a left adjacent text empty array, setting the first text positioning box as a center reference, and executing a left side screening step based on the left adjacent text empty array, the first screening direction and the center reference;
the left side screening step comprises: transferring a second text positioning box which is in the same line with the first text positioning box in the second statistical array and is matched with the first screening direction to the left adjacent text empty array to obtain a first left-side same-line array; transferring a second text positioning box corresponding to second coordinate information with the minimum difference value with the first coordinate information of the first text positioning box in the first left-side same-line array to a position, located on the left side of the first text positioning box, in the first same-line array; and setting the second text positioning box in the first text row array as the center reference, and returning to the circular screening operation of the left text row array.
5. The method as claimed in claim 4, wherein the second operation comprises:
executing a judgment step of parallel closely distributed texts;
the judging step of the parallel closely distributed texts comprises the following steps:
setting a first text probability benchmark threshold, adjusting the text probability value of a pixel point which is greater than the first text probability benchmark threshold in the first text probability Gaussian heat image to be a first probability value, and adjusting the text probability value of a pixel point which is not greater than the first text probability benchmark threshold in the first text probability Gaussian heat image to be a second probability value to obtain a first Gaussian heat image to be converted; carrying out binarization processing on the first Gaussian heat image to be converted to obtain a first binarized image;
identifying a first closed connected region in the first binarized image; setting the distribution quantity condition and a first ratio of the first pixel points; counting the number of the text probability values in the first closed connected region as the first probability values according to lines to obtain a plurality of first data; sequencing the plurality of first data according to rows to obtain a first connecting text array; analyzing the arrangement rule of a plurality of first data in the first communication text array to obtain the distribution quantity condition of second pixel points; identifying a width value and a height value of the first closed connected region, and calculating a second ratio of the height value to the width value; if the distribution quantity condition of the second pixel points is matched with the distribution quantity condition of the first pixel points or the second ratio is greater than the first ratio, judging that parallel closely distributed texts exist in the first closed connected region;
after the judgment step of the texts in the parallel close distribution is executed, if the texts in the parallel close distribution exist in the first closed communication area, a judgment step of a cutting area is executed;
the cutting region judging step includes:
setting a second text probability benchmark threshold, adjusting the text probability value of the pixel point which is greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to the first probability value, and adjusting the text probability value of the pixel point which is not greater than the second text probability benchmark threshold in the first text probability Gaussian heat image to the second probability value to obtain a second Gaussian heat image to be converted; performing binarization processing on the second Gaussian heat image to be converted to obtain a second binarized image;
identifying a second closed connected region in the second binary image; counting the number of the text probability values in the second closed connected region as the first probability values according to lines to obtain a plurality of second data; sequencing a plurality of second data according to rows to obtain a second connected text array;
setting a first cutting threshold value and a second cutting threshold value; adjusting the first data, which are greater than the first cutting threshold value, in the first connected text array to be a first cutting value, and adjusting the first data, which are less than the first cutting threshold value, in the first connected text array to be a second cutting value, so as to obtain a first array to be calculated; adjusting the second data matched with the second cutting threshold value in the second connected text array to be the second cutting value, and adjusting the second data not matched with the second cutting threshold value in the second connected text array to be the first cutting value to obtain a second array to be calculated;
multiplying the first array to be calculated and the second array to be calculated to obtain a cutting area indicating array; analyzing the distribution rule of the first cutting value and the second cutting value in the cutting area indication array to obtain a cutting area; cutting the first closed connected region in the first binarized image based on the cutting region to obtain a third binarized image;
after the cutting area judging step is executed, converting the third binary image into a second text probability Gaussian heat image, and generating a plurality of third text positioning frames based on the hotspot distribution condition of the second text probability Gaussian heat image; cutting the digital color images according to the third text positioning boxes to obtain second cut images, inputting the second cut images into the image recognition model for prediction processing to obtain second texts to be sorted; and sequencing the second text to be sequenced based on the arrangement rule of the third text positioning boxes in the second text probability Gaussian heat image to obtain the second digital color text.
6. The method as claimed in claim 5, wherein the third operation comprises:
setting a first text probability screening threshold and a second text probability screening threshold, and dividing the first text probability Gaussian heat image based on the first text probability screening threshold and the second text probability screening threshold to obtain a first text region;
setting a third text probability screening threshold value based on the first text probability screening threshold value, and setting a fourth text probability screening threshold value based on the second text probability screening threshold value; dividing the first text region based on the third text probability screening threshold and the fourth text probability screening threshold to obtain a second text region;
counting the number of first texts in the second text region based on the third text probability screening threshold and the fourth text probability screening threshold; counting a second text number of the second text region based on the first text probability screening threshold and the second text probability screening threshold;
setting a number ratio judgment threshold, calculating a first number ratio of the first text number and the second text number, judging whether the first number ratio is smaller than the number ratio judgment threshold, and if so, setting the second text area as a missed detection area;
executing the step of judging the parallel closely distributed texts based on a first heat image matched with the missed detection region in the first text probability Gaussian heat image to obtain a judgment result about the first heat image; if the judgment result is that the parallel closely distributed texts do not exist in the missed detection region, setting a text detection probability value of the image detection model based on the missed detection region; detecting the digital color image based on the text detection probability value and the image detection model to obtain a third text probability Gaussian heat image;
generating a plurality of fourth text positioning boxes based on the hot spot distribution condition of the third text probability Gaussian heat image; cutting the digital color images according to the fourth text positioning boxes to obtain third cut images, inputting the third cut images into the image recognition model for prediction processing to obtain third texts to be sorted; and sequencing the third text to be sequenced based on the arrangement rule of the fourth text positioning boxes in the third text probability Gaussian heat image to obtain the third digital color text.
7. The method as claimed in claim 6, wherein the reorganizing operation comprises:
setting a character type, and removing characters matched with the character type in the digital color text to obtain a first text; setting a color type, setting character bits based on the color type, and setting character strings corresponding to the character bits in the first text as end character strings; removing the last character string and characters behind the first character bit in the first text to obtain a second text; and setting a recombination sequence, and sequencing the characters in the second text according to the recombination sequence to obtain the text to be decoded.
8. The method as claimed in claim 7, wherein the processing logic of the dynamic decoding algorithm for the text to be decoded comprises:
configuring a number storage array and setting a first character arrangement rule; separating the text to be decoded according to a single character unit to obtain a first text to be analyzed; judging whether a second character arrangement rule of characters in the first text to be analyzed is matched with the first character arrangement rule;
if the number is matched with the color number, the characters in the first text to be analyzed are placed in the number storage array to obtain the digital color number information;
if not, separating the text to be decoded according to a double-character unit to obtain a second text to be analyzed; extracting a first character string positioned at the head in the second text to be analyzed; setting the last character string as a first character string of the first character string; carrying out reverse order processing on the first character string to obtain a first reverse order character string; setting a reference character string based on the lottery category; and judging whether the first reverse character string is smaller than the preceding character string and the reference character string, if so, adding the first reverse character string to the number storage array, and executing a circulating judgment step.
9. The digital color unification ticket checking system of the digital color unification ticket checking method with high precision according to any one of claims 1 to 8, comprising: the system comprises an initial configuration module, a text recognition module and a text decoding module;
the initial configuration module is used for configuring the image detection model, the feature reference image, the image recognition model and the dynamic decoding algorithm, and the initial configuration module is also used for acquiring the digital color image;
the text recognition module is used for recognizing the image characteristics of the digital color image according to the image detection model and the characteristic reference image, and the text recognition module executes the text recognition operation on the digital color image based on the image recognition model and the image characteristics to obtain the digital color text;
the text decoding module is used for executing the recombination operation on the digital color text to obtain the text to be decoded; and the text decoding module calls the dynamic decoding algorithm to process the text to be decoded to obtain the digital color number information.
10. A computer-readable storage medium, having a computer program stored thereon, which, when being executed by a processor, implements the steps of the high-precision digital color unification ticket checking method according to any one of claims 1 to 8.
CN202111374404.3A 2021-11-19 2021-11-19 High-precision digital color unified ticket checking method, system and medium Active CN114140928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111374404.3A CN114140928B (en) 2021-11-19 2021-11-19 High-precision digital color unified ticket checking method, system and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111374404.3A CN114140928B (en) 2021-11-19 2021-11-19 High-precision digital color unified ticket checking method, system and medium

Publications (2)

Publication Number Publication Date
CN114140928A true CN114140928A (en) 2022-03-04
CN114140928B CN114140928B (en) 2023-08-22

Family

ID=80390094

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111374404.3A Active CN114140928B (en) 2021-11-19 2021-11-19 High-precision digital color unified ticket checking method, system and medium

Country Status (1)

Country Link
CN (1) CN114140928B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4837842A (en) * 1986-09-19 1989-06-06 Holt Arthur W Character and pattern recognition machine and method
JPH1116020A (en) * 1997-06-24 1999-01-22 Glory Ltd Method and device for identifying merchandise coupon
US8428332B1 (en) * 2001-09-27 2013-04-23 Cummins-Allison Corp. Apparatus and system for imaging currency bills and financial documents and method for using the same
CN105957238A (en) * 2016-05-20 2016-09-21 聚龙股份有限公司 Banknote management method and system
WO2017016240A1 (en) * 2015-07-24 2017-02-02 广州广电运通金融电子股份有限公司 Banknote serial number identification method
CN110569830A (en) * 2019-08-01 2019-12-13 平安科技(深圳)有限公司 Multi-language text recognition method and device, computer equipment and storage medium
US20210240926A1 (en) * 2019-06-11 2021-08-05 Matthew M. Tonuzi Method and apparatus for improved analysis of legal documents

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4837842A (en) * 1986-09-19 1989-06-06 Holt Arthur W Character and pattern recognition machine and method
JPH1116020A (en) * 1997-06-24 1999-01-22 Glory Ltd Method and device for identifying merchandise coupon
US8428332B1 (en) * 2001-09-27 2013-04-23 Cummins-Allison Corp. Apparatus and system for imaging currency bills and financial documents and method for using the same
WO2017016240A1 (en) * 2015-07-24 2017-02-02 广州广电运通金融电子股份有限公司 Banknote serial number identification method
CN105957238A (en) * 2016-05-20 2016-09-21 聚龙股份有限公司 Banknote management method and system
US20210240926A1 (en) * 2019-06-11 2021-08-05 Matthew M. Tonuzi Method and apparatus for improved analysis of legal documents
CN110569830A (en) * 2019-08-01 2019-12-13 平安科技(深圳)有限公司 Multi-language text recognition method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN114140928B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
CN106529380B (en) Image recognition method and device
KR100248917B1 (en) Pattern recognizing apparatus and method
US5583949A (en) Apparatus and method for use in image processing
US5901239A (en) Skin pattern and fingerprint classification system
US7106904B2 (en) Form identification method
CN109740606B (en) Image identification method and device
CN106874909A (en) A kind of recognition methods of image character and its device
CN107862234A (en) A kind of recognition methods of color bar code, electronic equipment and storage medium
CN110659634A (en) Container number positioning method based on color positioning and character segmentation
CN113095267B (en) Data extraction method of statistical chart, electronic device and storage medium
EP0674794B1 (en) Method for classification of images using distribution maps
CN110852324A (en) Deep neural network-based container number detection method
WO2021159802A1 (en) Graphical captcha recognition method, apparatus, computer device, and storage medium
CN110598581B (en) Optical music score recognition method based on convolutional neural network
CN115862045A (en) Case automatic identification method, system, equipment and storage medium based on image-text identification technology
JP2007058882A (en) Pattern-recognition apparatus
JP4802176B2 (en) Pattern recognition apparatus, pattern recognition program, and pattern recognition method
CN114140928B (en) High-precision digital color unified ticket checking method, system and medium
CN111428446A (en) Questionnaire generation method, questionnaire identification method and questionnaire identification system
JP4176175B2 (en) Pattern recognition device
Koga et al. Segmentation of Japanese handwritten characters using peripheral feature analysis
JP4194309B2 (en) Document direction estimation method and document direction estimation program
CN109871910A (en) A kind of hand-written character recognition method and device
JP2007026470A (en) Pattern recognition device
CN114821134B (en) Method for identifying print style number of publication based on template matching

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant