The camera identifies the phone number in the picture.

Source: Internet
Author: User

Use the Open Source feature library (need to be stored in the phone's SD card root directory); Get a picture of a scanned phone number box in the camera preview bitmap object, to the open source code identification number, the recognition of the number of digits into the mobile phone number of the regular expression matching

In the process of identifying the mobile phone number, in order to increase the recognition rate: you can refer to the article has: http://www.oschina.net/code/snippet_1422728_34167 landlord using C language written

But after the idea, you can refer to the numbers and letters in the image. BOBO2CJ posted on March 17, 2014 15 o'clock, 13 reviews/16261 read a picture recognition gadget, Originally mainly to identify the previous company's software registration code in the numbers and letters (each time a box to copy out paste into the registrar, very troublesome!). ), because the registration code appears in the letters and numbers are basically the few, so the scope of the recognition library is set to a relatively small.
The principles and algorithms are explained in detail in the code, the function has a great limitation, but my idea is to share this idea and the way to realize it.
Source:
Http://git.oschina.net/bobo2cj/iamge2text Tags:. Net Framework 1. [Picture] main interface. PNG 2. [Code] extracts the characters in the picture
1 /*2 * Development ideas: Image grayscale processing, binary, and then with the image of the word binary library accurate comparison3  *4 * Get the font: The following code in the Generatelicense (Bitmap singlepic) method obtained, the specific operation:5 * out of a picture (key out) a character, and then processed to obtain a two-dimensional binary matrix, such as the following character 1 corresponds to a two-dimensional matrix6 * 000007 * 001008 * 111009 * 00100Ten * 00100 One * 00100 A * 00100 - * 00100 - * 00100 the * 11111 - * 00000 - * 00000 -  *      + * Note: "The same characters, such as 1, different fonts, font size, different zoom size of the picture, get to the two-bit matrix 0, 1 permutations and the number are different!"  - * So according to this method to write a match all words, the font is big ... " + */ A ///<summary> at ///Extract the characters in the image (convert the grayscale-processed image into a two-bit array of 0, 1) - ///</summary> - ///<param name= "singlepic" > Picture source </param> -  Public voidgeneratelicense (Bitmap singlepic) - { -     Try in     { -         Char[,] Chararray =New Char[Singlepic. Height, Singlepic. Width];//A two- dimensional array that defines a chai type records a value of 0/1 on each pixel, forming a rectangle to         intimagewidth = 0;//to record the pixel width of a picture +         intImageHeight = 0;//record the pixel height of a picture -         intDggrayvalue = 128;//Grayscale Values the Color Piexl; *         //String code = ""; //store 0/1 for each pixel $          for(intposy = 0; Posy < Singlepic. Height; posy++)Panax Notoginseng{//from top to bottom -String codecache = "";//0/1 for storing pixels for each row the              for(intPOSX = 0; Posx < Singlepic. Width; posx++) +{//from left to right APIEXL =Singlepic. GetPixel (POSX, posy); the                 if(Piexl. R <dggrayvalue) +{//if the color of the pixel is black, the value is "1" -Codecache = Codecache + "1"; $                 } $                 Else -{//otherwise the color of the pixel is white and the value is "0" -Codecache = Codecache + "0";  the                 } -             }Wuyi             Char[] array = Codecache.tochararray ();//The value of 0/1 per row is saved with a number for Easy loop processing the             //code + = Codecache + "\ n"; -              for(imagewidth = 0; imagewidth < array.) Length; imagewidth++) WuChararray[imageheight, ImageWidth] = Array[imagewidth];//to dump each row of values into a two-dimensional array through a loop -imageheight++; About}//********************* The above code can be used to get a word of the picture binary array, that is, the font ***************************** $   -         //start a match with the font (only the following characters are required in my tool) -Findword (Chararray, Char0, ImageHeight, ImageWidth, BinaryWidth0, BinaryHeight0, ' 0 '); -Findword (Chararray, Char1, ImageHeight, ImageWidth, BinaryWidth1, BinaryHeight1, ' 1 '); AFindword (Chararray, Char2, ImageHeight, ImageWidth, BinaryWidth2, BinaryHeight2, ' 2 '); +Findword (Chararray, Char3, ImageHeight, ImageWidth, BinaryWidth3, BinaryHeight3, ' 3 '); theFindword (Chararray, CHAR4, ImageHeight, ImageWidth, BinaryWidth4, BinaryHeight4, ' 4 '); -Findword (Chararray, CHAR5, ImageHeight, ImageWidth, BinaryWidth5, BinaryHeight5, ' 5 '); $Findword (Chararray, CHAR6, ImageHeight, ImageWidth, BinaryWidth6, BinaryHeight6, ' 6 '); theFindword (Chararray, CHAR7, ImageHeight, ImageWidth, BinaryWidth7, BinaryHeight7, ' 7 '); theFindword (Chararray, Char8, ImageHeight, ImageWidth, BinaryWidth8, BinaryHeight8, ' 8 '); theFindword (Chararray, Char9, ImageHeight, ImageWidth, BinaryWidth9, BinaryHeight9, ' 9 '); theFindword (Chararray, CharA, ImageHeight, ImageWidth, Binarywidtha, Binaryheighta, ' a '); -Findword (Chararray, Charb, ImageHeight, ImageWidth, BINARYWIDTHB, BINARYHEIGHTB, ' B '); inFindword (Chararray, Charc, ImageHeight, ImageWidth, binarywidthc, BINARYHEIGHTC, ' C '); theFindword (Chararray, Chard, ImageHeight, ImageWidth, BINARYWIDTHD, BINARYHEIGHTD, ' d '); theFindword (Chararray, CharE, ImageHeight, ImageWidth, binarywidthe, Binaryheighte, ' e '); AboutFindword (Chararray, Charf, ImageHeight, ImageWidth, BINARYWIDTHF, BINARYHEIGHTF, ' F '); theFindword (Chararray, Charp, ImageHeight, ImageWidth, BINARYWIDTHP, BINARYHEIGHTP, ' P '); theFindword (Chararray, Chary, ImageHeight, ImageWidth, Binarywidthy, binaryheighty, ' Y '); the         //------------------------------------END--------------------------------------------- +Richtextboxlicense.text + = Identifysort ();//execute the Identifysort method to display the format I want in the Richtextboxlicense text box -Richtextboxlicense.selectionstart = Richtextboxlicense.textlength;//move the cursor to the last face the     }Bayi     Catch { } the}

3. [Image] The two-dimensional matrix corresponding to the single-word picture 0, 1 yards. png

The camera identifies the phone number in the picture.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.