important
Recently, a friend of mine saw this App launched in the App market and asked me if I did, but I said no.
I hereby declare that without my authorization, please do not submit the application market after modification, please respect the fruits of others’ labor.
I hereby declare that without my authorization, please do not submit the application market after modification, please respect the fruits of others’ labor
I hereby declare that without my authorization, please do not submit the application market after modification, please respect the fruits of others’ labor
I will get to the bottom of this infringement. Here admonish those who get for nothing, please don’t trample on the fruits of other people’s labor.
preface
Two days ago, I went to dinner. On my way back, I passed a lottery seller and bought a few tickets. I thought I would win 5 million. Ha ha, this morning think of this matter, looked at the blue number, no one is the same, and then, I think 6+0 seems to be good, at least is second prize, against the winning number one by one comparison, 15 groups of numbers looked at my head are big, I this temper…… And then it looks like this.
In order to make the lottery less painful in the future, I started to develop a special App to check whether the lottery has won the lottery – [Lucky lottery number comparison assistant], so that I don’t have to be silly to the winning number comparison in the future. Ha ha, after half a day’s efforts, the results are as follows:
Function and process introduction
-
Photo taking and cropping
The camera is called to take pictures of the purchased lottery tickets, and then the photos are cropped. The purpose of cutting is to highlight the key points. Our focus is the number area of the purchased lottery tickets and the drawing period. This reduces the need for users to manually enter lottery dates (which will be discussed later).
-
Picture text recognition
To just cut the picture for text recognition, text recognition or use baidu cloud text recognition, portal – Baidu cloud text recognition quick start, Link is https://cloud.baidu.com/doc/OCR/OCR-Java-SDK.html#.E5.BF.AB.E9.80.9F.E5.85.A5.E9.97.A8
-
Recognition after word processing
This part is quite troublesome, because after calling the text recognition of Baidu Cloud, the returned data is quite chaotic, so we need to screen out the text we need and process the text.
First of all, the text identified by Baidu Cloud will be returned to us in the form of string sets. It is mainly used for text recognition in blocks, and each small block of recognized text is returned as a whole, so we need to select the content we need from these blocks.
We only focus on two points, one is the purchase of sets of numbers, and the other is the lottery period.
Single note number
First of all, we found that no matter how many notes are purchased in a sheet, each note will be output in the following format:
A.02 03 07 12 13 17 + 16 X1
First of all, capital letters plus. It starts with six pairs of two-digit red numbers, followed by a “+”, followed by a two-digit blue number, followed by an “X” + the number of bets purchased. With these rules in mind, we can write the corresponding regular expression:
^[A-Z].[0-9]{12}+? [0-9]{2}x? [0-9] + $
Let’s start with a simple explanation of this re:
The character string is appended with one letter from A to Z. Start, and then there were 12 Numbers from 0 to 9 (this is six red number), then there is zero or one “+” (why is 0 to 1, because after the test, sometimes may couldn’t identify the “+”, in order to identify the accuracy, we don’t do force with the “+”), and then is two Numbers from 0 to 9 (this one is blue), This is followed by zero or one “X” (the same “+” as above, to improve the recognition rate), and finally the number of bets to buy the number, from one to more than one 0-9 (1 to N).
This regular expression can filter out the text we need. If this regular expression is satisfied, it means that the data is a set of numbers we bought.
The lottery period
For the lottery period is relatively simple, only need the first three of the string character is “the lottery” period, because if the recognition, the user can also manually enter, all ok, innocuous, if identified, we can help the user directly fill in the input box, so that users don’t have their input, as shown in the GIF.
-
Get the winning number of this lottery
We have identified the numbers on our tickets, now we need to get the winning numbers for this period and compare them to see if we win. We are using the showapi on a free interface, lottery query, link: https://www.showapi.com/api/lookPoint/44, using this interface, we can get the latest information, also can get refers to the number of the winning Numbers on a regular basis. Specific use you can click the link to go in quietly.
-
Compare the numbers to get the winning information
The winning number and the number you buy have been got, the rest is the comparison number is not in line with the, this is relatively simple, will not repeat, the following post lottery winning rules:
- First Prize: 7 matching numbers (6 red ball numbers and 1 blue ball number)
- Second prize: 6 red balls with matching numbers;
- Third prize: 5 red ball numbers matched with 1 blue ball number;
- Fourth prize: 5 red ball numbers, or 4 red ball numbers matching 1 blue ball number;
- Fifth prize: 4 red ball numbers, or 3 red ball numbers matching 1 blue ball number;
- Sixth prize: 1 blue ball with matching number (red ball with matching number is acceptable).
-
June 01, 2018 Updated to add the matching results of the reverse display effect, the winning result is more obvious, the effect is as follows:
A link to the
Project has been open source, I hope to help you, also hope that you love to buy lottery tickets as soon as possible. In addition, due to the tight time, so the code may be a bit messy, we will! LotteryHelper link is https://github.com/MZCretin/LotteryHelper
If you have friends around like to buy blessing lottery, you can recommend him to use, he must need, after all, efficient, green, pollution-free! You also can directly download the APK experience a wave, APK download address, please copy the link to open in a browser to download, links to http://jokesimg.cretinzp.com/common/lotteryhelper/apk/fcdhzs.apk, You can also use your mobile phone to scan the qr code below for download experience:
At 9:00 PM this evening, after the lottery drawing, I excitedly used the App to check the 15 lottery numbers I bought and won a blue one with only 5 yuan. I just remembered the picture at the beginning that I bought 5 lottery tickets as a young and ignorant person, ha ha ha.
About me
I just like to use code to solve problems in my life and feel happy, hahaha. I also like you to follow my simple book, Nuggets, Github and CSDN.
Jane books home page link is https://www.jianshu.com/u/123f97613b86
The nuggets home page, the link is https://juejin.cn/user/1099167356171918
Making the home page, the link is https://github.com/MZCretin
CSDN, home page link is http://blog.csdn.net/u010998327
I’m Cretin, a lovely little boy.