Summary of the invention
In view of this, the embodiment of the invention provides a kind of input method of identity information and terminal device, it is existing to solve
There is the problem of identification typing can not being carried out to identity information by headend equipment existing for technology.
The first aspect of the embodiment of the present invention provides a kind of input method of identity information, comprising:
Identity card picture is obtained, the identity card picture is converted based on HTML5, obtains standard picture;
The standard picture is divided into multiple images region, according to each described image region on the standard picture
Position, for each described image region distribute an information type;
Gray processing processing is carried out to described image region, it is raw according to the gray value of pixel each in described image region
At the condition code in described image region, and the character string for being included based on described document information identification described image region;
The character string that each described image region is included is inserted to the information type of the image-region in preset list
Corresponding position generates identity information table.
The second aspect of the embodiment of the present invention provides a kind of terminal device, including memory and processor, described to deposit
The computer program that can be run on the processor is stored in reservoir, when the processor executes the computer program,
Realize following steps:
Identity card picture is obtained, the identity card picture is converted based on HTML5, obtains standard picture;
The standard picture is divided into multiple images region, according to each described image region on the standard picture
Position, for each described image region distribute an information type;
Gray processing processing is carried out to described image region, it is raw according to the gray value of pixel each in described image region
At the condition code in described image region, and the character string for being included based on described document information identification described image region;
The character string that each described image region is included is inserted to the information type of the image-region in preset list
Corresponding position generates identity information table.
The third aspect of the embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage
Media storage has computer program, and the computer program realizes following steps when being executed by processor:
Identity card picture is obtained, the identity card picture is converted based on HTML5, obtains standard picture;It will be described
Standard picture is divided into multiple images region, is each according to position of each described image region on the standard picture
An information type is distributed in described image region;Gray processing processing is carried out to described image region, according in described image region
The gray value of each pixel generates the condition code in described image region, and identifies described image region based on described document information
The character string for being included;The character string that each described image region is included is inserted to the letter of the image-region in preset list
The corresponding position of type is ceased, identity information table is generated.
Optionally, described to be converted the identity card picture based on HTML5, obtain standard picture, comprising:
The identity card picture is converted to base64 data stream format, and passes through the canvas interface in the HTML5
The identity card picture of the base64 data stream format is converted into standard picture.
Optionally, the gray value according to pixel each in described image region generates the spy in described image region
Levy code, comprising:
The corresponding algebraic value setting of the pixel that gray value in described image region is greater than or equal to default gray threshold
It is 0;The corresponding algebraic value of pixel that gray value in described image region is less than the default gray threshold is set as 1;It presses
The corresponding algebraic value of each pixel in described image region is successively recorded according to preset traversal order, generates described image region
Condition code.
Optionally, the character string based on described document information identification described image region, comprising:
Described document information is divided into more than one feature subcode, the feature subcode includes the algebraic value of preset quantity;
The algebraic value for calculating the feature subcode and the standard code in preset character database is overlapped ratio, the character database packet
Corresponding relationship containing standard code and character, the standard code include the algebraic value of the preset quantity;From the character database
Middle selection is overlapped the highest standard code of ratio with the numerical value of the feature subcode as selected standard code, by the selected mark
The corresponding character setting of quasi- code is the corresponding character of the feature subcode;According to row of the feature subcode in described document information
Column sequence combines all corresponding characters of the feature subcode, generates the character string in described image region.
Optionally, further includes:
Described document information is converted into the corresponding two dimensional code of the identity card picture, and is added in the identity information table
The two dimensional code.
In embodiments of the present invention, the identity card picture is converted by the way that identity picture is based on HTML5, is obtained
The standard picture is divided into multiple images region by standard picture, according to each described image region in the standard picture
On position, for each described image region distribute an information type;Gray processing processing is carried out to described image region, according to
The gray value of each pixel in described image region is generated the condition code in described image region, and is known based on described document information
The character string that other described image region is included;The character string for being included by each described image region is inserted in preset list
The corresponding position of the information type of the image-region generates identity information table, so that user can not depend on back-end server
Under the premise of, intelligentized importing identity information data reduces the consumption degree to the computing resource of front end.
Specific embodiment
In being described below, for illustration and not for limitation, the tool of such as particular system structure, technology etc is proposed
Body details, to understand thoroughly the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specific
The present invention also may be implemented in the other embodiments of details.In other situations, it omits to well-known system, device, electricity
The detailed description of road and method, in case unnecessary details interferes description of the invention.
In order to illustrate technical solutions according to the invention, the following is a description of specific embodiments.
Fig. 1 shows the implementation process of the input method of identity information provided in an embodiment of the present invention, this method process packet
Include step S101 to S105.The specific implementation principle of each step is as follows.
S101: identity card picture is obtained, the identity card picture is converted based on HTML5, obtains standard picture.
In embodiments of the present invention, it is intended in the case where the back-end server for not depending on some specific APP, to identity card
The extraction of picture progress information.It is to be appreciated that the back-end server of traditional dependence APP carries out the technology of information extraction,
Weak net or without being just difficult to normally execute in the environment of network service.So all information extraction and typing of the embodiment of the present invention
Function is entirely to realize in front end, the processing independent of back-end server.
However, it can be appreciated that the data-handling capacity of headend equipment is with back-end server, there are no small gaps, if
Existing algorithm and code are only moved to headend equipment from back-end server to go to execute, a large amount of of headend equipment may be occupied
Process resource, even headend equipment can not execute relevant algorithm and code.Notably, based on above-mentioned reason,
After combining identity card picture feature itself, the embodiment of the present invention carries out the algorithm for the information for including in identification identity card picture
It improves, thus realize in weak net or in the environment of without network service, it is only by headend equipment, less occupying as far as possible
Typing is carried out to identity information in the case where process resource, specific method and principle will be explained below.
Optionally, in embodiments of the present invention, described to be converted the identity card picture based on HTML5, it is marked
Quasi- image, comprising:
The identity card picture is converted to base64 data stream format, and passes through the canvas interface in the HTML5
The identity card picture of the base64 data stream format is converted into standard picture.
It is to be appreciated that since the identity card picture of every kind of format has its corresponding coding rule, so in the present invention
In embodiment, it is necessary first to the file header data of identity card picture file are extracted, to determine which kind of format identity card picture is
File, then identity card picture is converted into standard picture.
It is to be appreciated that due in real life, the collected identity card picture of headend equipment often exist distortion or
The case where irregular display, so in embodiments of the present invention, converted first by the canvas interface in HTML5, it is raw
At compared to the preceding more unified standard picture of conversion, be conducive in subsequent steps carry out the information in identity card picture
More accurately extract.
The standard picture is divided into multiple images region by S102, according to each described image region in the standard
An information type is distributed for each described image region in position on image.
It is to be appreciated that there is the information of its fixed type in an each region of identity card, for example, a region dedicated for
Show name, a region is dedicated for showing address, and a region is dedicated for displaying gender etc..Therefore, the present invention is implemented
Standard picture is divided into multiple images region, and be each image-region for information arrangement situation fixed on identity card by example
Distribute an information type, such as information type are as follows: name, address and identification card number etc..
S103 carries out gray processing processing to described image region, according to the gray scale of pixel each in described image region
Value generates the condition code in described image region, and the character string for being included based on described document information identification described image region.
In embodiments of the present invention, it is contemplated that identity card picture is in identification process, it is only necessary to identify character, and these
Character only includes: Chinese character, English alphabet X and number, so these characters to be identified have the particularity in arrangement, and it is general
The diversity of logical picture recognition is very different.So the embodiment of the present invention is based primarily upon each pixel on a character
Gray value arranging situation, the character string in image-region each on standard picture is identified.
Optionally, gray value in described image region is greater than or equal to the corresponding algebra of pixel of default gray threshold
Value is set as 0;The corresponding algebraic value setting of the pixel that gray value in described image region is less than the default gray threshold
It is 1;The corresponding algebraic value of each pixel in described image region is successively recorded according to preset traversal order, generates the figure
As the condition code in region.
Optionally, preset traversal order may is that after the upper leftmost pixel of an image-region to
Lower section is mobile, and after being moved to bottom, move right a pixel, is then moving up, after being moved to top,
Move right a pixel, and side is mobile still further below, until being moved to bottom, and so on, in a manner of a similar serpentine
Mobile preset rectangular area.
S104, the character string for being included based on described document information identification described image region.
As an embodiment of the present invention, as shown in Fig. 2, above-mentioned S104 includes:
Described document information is divided into more than one feature subcode by S1041, and the feature subcode includes the generation of preset quantity
Numerical value.
It, in embodiments of the present invention can will be each according to the gray value of each pixel it is to be appreciated that according to described above
A pixel is corresponding with an algebraic value (0 or 1).
It is to be appreciated that in embodiments of the present invention, a condition code represents a character string, and a character string is
Be made of multiple characters, since each character includes the algebraic value of preset quantity (being assumed to be N), and each character it
Between have certain gap, according to coding rule described above, the gap is bound to be converted into several (M) and continuously arranges
The 0 of column.So in embodiments of the present invention, it can be by first algebraic value of condition code to the whole between n-th algebraic value
Algebraic value is then spaced M algebraic value, by the N+M algebraic value of condition code as the corresponding feature subgroup of first character
To whole algebraic values between the N+2M algebraic value as the corresponding feature subgroup of second character, and so on, by feature
Whole algebraic values between (t-1) (N+M) to tN+ (t-1) M of code are as the corresponding feature subgroup of t-th of character.
S1042, the algebraic value for calculating the feature subcode and the standard code in preset character database are overlapped ratio, institute
The corresponding relationship that character database includes standard code and character is stated, the standard code includes the algebraic value of the preset quantity.
Optionally, in embodiments of the present invention, since the information type of each image-region is different, so each image district
The corresponding preset character database in domain is different.Such as: if the information type of image-region are as follows: name, gender or nationality
When, the character in the image-region is only possible to be Chinese character;And if the information type of image-region are as follows: citizenship number, then
Character in the image-region is only possible to be number and English alphabet X.
So in embodiments of the present invention, according to the information type of image-region, selecting preset character database, and count
The algebraic value for calculating the feature subcode and the standard code in preset character database is overlapped ratio.
It is to be appreciated that in embodiments of the present invention, algebraic value is overlapped the calculating process of ratio are as follows: compare feature one by one
The algebraic value of same position in algebraic value and standard code in code, and count after the comparison one by one, identical algebraic value
Number generates algebraic value and is overlapped ratio by the number of identical algebraic value divided by the sum of algebraic value in feature subcode.
S1043 chooses from the character database and is overlapped the highest mark of ratio with the numerical value of the feature subcode
The corresponding character setting of the selected standard code is the corresponding character of the feature subcode as selected standard code by quasi- code.
S1044, according to feature subcode the putting in order in described document information, the whole feature subcodes pair of combination
The character answered generates the character string in described image region.
It is to be appreciated that not needing to calculate using traditional biggish pattern analysis of calculation amount in above-mentioned identification process
Method, but more unified characteristic is shown for character in identity card picture, it generates one and aims in identification identity card picture
The algorithm of character, for this algorithm compared to other traditional algorithms, the computing resource of occupancy is less.
S105, by the character string that each described image region is included insert in preset list with described image region
The corresponding position of information type generates identity information table.
It is to be appreciated that these information are directed into a preset table after extracting information in identity card picture
Dan Zhong, to complete the process of identity information importing.
Optionally, in order to improve identity information table in the convenience used later, the embodiment of the present invention is by described document information
The corresponding two dimensional code of the identity card picture is converted to, and adds the two dimensional code in the identity information table.
It is to be appreciated that the embodiment of the present invention is turned the identity card picture by the way that identity picture is based on HTML5
It changes, obtains standard picture, the standard picture is divided into multiple images region, according to each described image region in the mark
An information type is distributed for each described image region in position on quasi- image;Described image region is carried out at gray processing
Reason generates the condition code in described image region according to the gray value of pixel each in described image region, and is based on the spy
The character string that sign code identification described image region is included;The character string filling for being included by each described image region is preset
The corresponding position of the information type of the image-region in list generates identity information table, so that user can not depend on rear end
Under the premise of server, intelligentized importing identity information data reduces the consumption degree to the computing resource of front end.
Corresponding to the input method of identity information described in foregoing embodiments, Fig. 3 shows provided in an embodiment of the present invention
The structural block diagram of the input device of identity information, for ease of description, only parts related to embodiments of the present invention are shown.
Referring to Fig. 3, which includes:
Module 301 is obtained to convert the identity card picture for obtaining identity card picture based on HTML5, obtain
Standard picture;
Divide module 302, for the standard picture to be divided into multiple images region, according to each described image region
An information type is distributed for each described image region in position on the standard picture;
Generation module 303, for carrying out gray processing processing to described image region, according to picture each in described image region
The gray value of vegetarian refreshments generates the condition code in described image region;
Identification module 304, the character string for being included based on described document information identification described image region;
Recording module 305, the character string for being included by each described image region insert the figure in preset list
As the corresponding position of the information type in region, identity information table is generated.
Optionally, described to be converted the identity card picture based on HTML5, obtain standard picture, comprising:
The identity card picture is converted to base64 data stream format, and passes through the canvas interface in the HTML5
The identity card picture of the base64 data stream format is converted into standard picture.
Optionally, the gray value according to pixel each in described image region generates the spy in described image region
Levy code, comprising:
The corresponding algebraic value setting of the pixel that gray value in described image region is greater than or equal to default gray threshold
It is 0;
The corresponding algebraic value of pixel that gray value in described image region is less than the default gray threshold is set as
1;
The corresponding algebraic value of each pixel in described image region is successively recorded according to preset traversal order, generates institute
State the condition code of image-region.
Optionally, the character string based on described document information identification described image region, comprising:
Described document information is divided into more than one feature subcode, the feature subcode includes the algebraic value of preset quantity;
The algebraic value for calculating the feature subcode and the standard code in preset character database is overlapped ratio, the character
Database includes the corresponding relationship of standard code and character, and the standard code includes the algebraic value of the preset quantity;
It is chosen from the character database and is overlapped the highest standard code work of ratio with the numerical value of the feature subcode
It is the corresponding character of the feature subcode by the corresponding character setting of the selected standard code to be chosen standard code;
According to feature subcode the putting in order in described document information, all corresponding words of the feature subcode are combined
Symbol generates the character string in described image region.
Optionally, further includes:
Described document information is converted into the corresponding two dimensional code of the identity card picture, and is added in the identity information table
The two dimensional code.
It is to be appreciated that the embodiment of the present invention is turned the identity card picture by the way that identity picture is based on HTML5
It changes, obtains standard picture, the standard picture is divided into multiple images region, according to each described image region in the mark
An information type is distributed for each described image region in position on quasi- image;Described image region is carried out at gray processing
Reason generates the condition code in described image region according to the gray value of pixel each in described image region, and is based on the spy
The character string that sign code identification described image region is included;The character string filling for being included by each described image region is preset
The corresponding position of the information type of the image-region in list generates identity information table, so that user can not depend on rear end
Under the premise of server, intelligentized importing identity information data reduces the consumption degree to the computing resource of front end.
Fig. 4 is the schematic diagram for the terminal device that one embodiment of the invention provides.As shown in figure 4, the terminal of the embodiment is set
Standby 4 include: processor 40, memory 41 and are stored in the meter that can be run in the memory 41 and on the processor 40
Calculation machine program 42, such as the recording program of identity information.The processor 40 is realized above-mentioned when executing the computer program 42
Step in the input method embodiment of each identity information, such as step 101 shown in FIG. 1 is to 105.Alternatively, the processing
Device 40 realizes the function of each module/unit in above-mentioned each Installation practice when executing the computer program 42, such as shown in Fig. 3
The function of unit 301 to 305.
Illustratively, the computer program 42 can be divided into one or more module/units, it is one or
Multiple module/units are stored in the memory 41, and are executed by the processor 40, to complete the present invention.Described one
A or multiple module/units can be the series of computation machine program instruction section that can complete specific function, which is used for
Implementation procedure of the computer program 42 in the terminal device 4 is described.
The terminal device 4 can be the calculating such as desktop PC, notebook, palm PC and cloud server and set
It is standby.The terminal device may include, but be not limited only to, processor 40, memory 41.It will be understood by those skilled in the art that Fig. 4
The only example of terminal device 4 does not constitute the restriction to terminal device 4, may include than illustrating more or fewer portions
Part perhaps combines certain components or different components, such as the terminal device can also include input-output equipment, net
Network access device, bus etc..
Alleged processor 40 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
Deng.
The memory 41 can be the internal storage unit of the terminal device 4, such as the hard disk or interior of terminal device 4
It deposits.The memory 41 is also possible to the External memory equipment of the terminal device 4, such as be equipped on the terminal device 4
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodge
Deposit card (Flash Card) etc..Further, the memory 41 can also both include the storage inside list of the terminal device 4
Member also includes External memory equipment.The memory 41 is for storing needed for the computer program and the terminal device
Other programs and data.The memory 41 can be also used for temporarily storing the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing
The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also
To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated
Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list
Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system
The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load may refer to the associated description of other embodiments.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
If the integrated module/unit be realized in the form of SFU software functional unit and as independent product sale or
In use, can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-mentioned implementation
All or part of the process in example method, can also instruct relevant hardware to complete, the meter by computer program
Calculation machine program can be stored in a computer readable storage medium.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality
Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each
Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified
Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.