CN109740606A - A kind of image-recognizing method and device - Google Patents
A kind of image-recognizing method and device Download PDFInfo
- Publication number
- CN109740606A CN109740606A CN201811563632.3A CN201811563632A CN109740606A CN 109740606 A CN109740606 A CN 109740606A CN 201811563632 A CN201811563632 A CN 201811563632A CN 109740606 A CN109740606 A CN 109740606A
- Authority
- CN
- China
- Prior art keywords
- character
- region
- image
- pixel
- gradient
- 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
Links
Abstract
The embodiment of the invention provides a kind of image-recognizing method and devices, are related to image identification technical field, wherein the above method includes: to carry out Morphological Gradient calculating to images to be recognized, obtains first gradient figure;In first gradient figure, region corresponding with the image-region where character in images to be recognized is determined, as the first image-region;Determine the character quantity of character in the first image-region;Based on character quantity, the first organizational systems of character in the first image-region are determined;Based on the first organizational systems, Character segmentation is carried out to the first image-region, obtains monocase region;Character recognition is carried out to each monocase region, and then obtains the character identification result of images to be recognized.When identifying image using scheme provided in an embodiment of the present invention, the anti-interference and accuracy rate for improving image recognition can be improved.
Description
Technical field
The present invention relates to image identification technical fields, more particularly to a kind of image-recognizing method and device.
Background technique
In internet and big data era, demand of the enterprise to information data acutely increases, and acquires the mode of information data
Also increasingly diversification selects suitable mode typing information, can offer convenience for enterprise and user.
With being constantly progressive for image recognition technology, some links for needing user to be manually entered information can pass through bat
It takes the photograph and identifies the method for image to complete, bring convenience for user, while the feelings of user's input error can also be avoided the occurrence of
Condition.For example, bank's card number, the identification card number of the method typing user of image recognition can be passed through.
For identifying bank's card number, in the prior art, when identifying bank's card graphic, two-value first is carried out to bank's card graphic
Change processing, then card number field position is found by the upright projection of obtained binary map, then according to the level of above-mentioned binary map
Histogram peak after projection carries out Character segmentation to above-mentioned binary map, finally identifies each character zone divided and obtained, obtains
Card taking number.
Inventor has found that at least there are the following problems for the prior art in the implementation of the present invention: since bank card is carried on the back
The pattern of scape pattern is various, when identifying to some bank cards, it may appear that the situation of recognition failures or recognition result mistake.When
Preceding bank card image recognition technology, anti-interference is weak, and accuracy rate is low.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of image-recognizing method and device, improves image recognition to realize
Anti-interference and accuracy rate.Specific technical solution is as follows:
The embodiment of the present invention provides a kind of image-recognizing method, comprising:
Morphological Gradient calculating is carried out to images to be recognized, obtains first gradient figure;
In the first gradient figure, region corresponding with the image-region where character in images to be recognized is determined, make
For the first image-region;
Determine the character quantity of character in the first image region;
Based on the character quantity, the first organizational systems of character in the first image region are determined;
Based on first organizational systems, Character segmentation is carried out to the first image region, obtains monocase region;
Character recognition is carried out to each monocase region, and then obtains the character identification result of the images to be recognized.
In a kind of implementation of the invention, after the character identification result for obtaining the images to be recognized, institute
State method further include:
Verify whether the character identification result is effective recognition result, obtains verification result.
It is described that character recognition is carried out to each monocase region in a kind of implementation of the invention, and then described in acquisition
The character identification result of images to be recognized, comprising:
Obtained each monocase region is input to character recognition model and carries out character recognition, obtains each character zone
Character identification result, the first kind recognition result as each character zone, wherein the character recognition model are as follows: in advance
It is that convolutional neural networks model is trained using first sample character zone, for character included in detection zone
Model, the first sample character zone are as follows: in first sample gradient map indicate a character region region, it is described
First sample gradient map are as follows: the image that Morphological Gradient is calculated is carried out to first sample image;
The character identification result in each monocase region is determined based on the first kind recognition result.
It is described that each monocase region is determined based on the first kind recognition result in a kind of implementation of the invention
Character identification result, comprising:
Determine that each monocase region deviates preset quantity pixel along preset direction in the first image region
Corresponding region, the candidate region as each monocase region;
Obtained each candidate region is input to character judgment models and judges whether each candidate region is comprising character
Region, obtain the character judging result of each candidate region, wherein the character judgment models are as follows: in advance use the second sample
It is that this character zone is trained convolutional neural networks model, for judge in region whether include character model,
The second sample character zone are as follows: the region in the second sample gradient map where one character of expression or the area where non-character
Domain, the second sample gradient map are as follows: the image that Morphological Gradient is calculated is carried out to the second sample image;
Based on the character judging result of each candidate region obtained, determine that confidence level is highest in each candidate region
Correcting area of the candidate region as each candidate region;
The correcting area in each monocase region is input to the character recognition model and carries out character recognition, is obtained each
The character identification result of the correcting area in monocase region, the second class recognition result as each monocase region;
By the highest identification knot of confidence level in the first kind recognition result in each monocase region and the second class recognition result
Fruit is determined as the character identification result of the character zone.
In a kind of implementation of the invention, the character quantity of character in the determining the first image region, comprising:
Each pixel column in the first image region is input in character quantity detection model respectively detect it is each
The quantity of the affiliated character of pixel in pixel column, obtains the corresponding testing result of each pixel column, wherein the character quantity
Detection model are as follows: in advance using the affiliated character of pixel in each pixel column and each pixel column in third sample gradient map
Number that mark quantity is trained preset neural network model, for the affiliated character of pixel in detection pixel row
The neural network model of amount, the third sample gradient map are as follows: Morphological Gradient is carried out to third sample image and is calculated
Gradient map;
Based on obtained testing result, the character quantity of character in the first image region is obtained.
It is described to be based on the character quantity in a kind of implementation of the invention, determine word in the first image region
First organizational systems of symbol, comprising:
Determine organizational systems inspections corresponding with character quantity obtained, for character organizational systems in detection image
Survey model, wherein the organizational systems detection model are as follows: use each pixel column in the 4th sample gradient map and each in advance
In pixel column the mark organizational systems of the affiliated character of pixel preset neural network model is trained, for examining
Survey the neural network model of the organizational systems of character described in pixel in pixel column, the 4th sample gradient map are as follows: to the 4th
Sample image carries out the gradient map that Morphological Gradient is calculated;
Each pixel column in the first image region is input in the organizational systems detection model respectively and is detected
The organizational systems of the affiliated character of pixel in each pixel column, obtain the marshalling side of the affiliated character of pixel in each pixel column
Formula is the probability of default organizational systems;
For each organizational systems, the volume of the affiliated character of pixel in each pixel column in the first image region is calculated
Group mode is the probability and value of default organizational systems;
The maximum and corresponding organizational systems of value are determined as to the first organizational systems of character in the first image region.
In a kind of implementation of the invention, it is described be based on first organizational systems, to the first image region into
Line character segmentation, obtains monocase region, comprising:
Count the quantity of character pixels point in each pixel column in the first image region, wherein the character pixels
Point are as follows: belong to the pixel of character;
Obtain character pixels point in each character arrangements that organizational systems are first organizational systems first estimates number
Amount distribution, wherein the character width of character is predetermined width in each character arrangements, character group spacing is default spacing, different
Character width is different in character arrangements and/or character group spacing is different;
Determine obtains the first discreet distribution in first be distributed between the smallest first discreet of diversity factor divide
Cloth, wherein first distribution are as follows: by the distribution for the character pixels point quantity that the quantity counted determines;
Corresponding character arrangements are distributed according to identified first discreet, and character is carried out to the first image region
Segmentation, obtains monocase region.
It is described in the first gradient figure in a kind of implementation of the invention, character in determining and images to be recognized
The corresponding region of the image-region at place, as the first image-region, comprising:
Each pixel column of the first gradient figure is input in region detection model respectively, obtains each pixel column
Corresponding pixel column is located at the first probability of the image-region comprising character in the images to be recognized, wherein the region
Detection model are as follows: preset neural network model is trained using each pixel column in the 5th sample gradient map in advance
The two Classification Neural models arrived, the 5th sample gradient map are as follows: Morphological Gradient meter is carried out to the 5th sample image
Obtained gradient map;
Calculate the first probability of each continuous first preset quantity pixel column in the first gradient figure and value;
The maximum and the corresponding first preset quantity pixel column of value for determining obtained first probability are described to be identified
Corresponding region in image, as the first image-region.
It is described that Morphological Gradient calculating is carried out to images to be recognized in a kind of implementation of the invention, obtain first
Gradient map, comprising:
Obtain the gray component image and chromatic component image of images to be recognized;
Morphological Gradient calculating is carried out to the gray component image and the chromatic component image respectively, obtains gray scale
Component gradient map and chromatic component gradient map;
Difference operation is carried out to the gray component gradient map and the chromatic component gradient map, obtains first gradient figure.
In a kind of implementation of the invention, it is described to the gray component gradient map and the chromatic component gradient map into
Row difference operation obtains first gradient figure, comprising:
Binary conversion treatment is carried out to the chromatic component gradient map, obtains chromatic component binary map;
The pixel value for determining the first pixel in the gray component gradient map is the first presetted pixel value, obtains the first ladder
Degree figure, wherein the first presetted pixel value are as follows: represented gradient value is less than the pixel value of preset threshold, first picture
Vegetarian refreshments are as follows: with pixel value in the chromatic component binary map be that the pixel of the second presetted pixel value is corresponding, the gray scale
Pixel in component gradient map, the second presetted pixel value are as follows: the picture of background pixel point in the chromatic component binary map
Element value.
The embodiment of the present invention also provides a kind of pattern recognition device, comprising:
Gradient distribution computing module obtains first gradient figure for carrying out Morphological Gradient calculating to images to be recognized;
Area determination module, for the image in the first gradient figure, in determining and images to be recognized where character
The corresponding region in region, as the first image-region;
Quantity determining module, for determining the character quantity of character in the first image region;
Organizational systems determining module determines the of character in the first image region for being based on the character quantity
One organizational systems;
Region obtains module, for being based on first organizational systems, carries out Character segmentation to the first image region,
Obtain monocase region;
Recognition result obtains module, for carrying out character recognition to each monocase region, and then obtains described to be identified
The character identification result of image.
In a kind of implementation of the invention, described device further include:
Result verification module, for obtaining the character recognition knot that module obtains the images to be recognized in the recognition result
After fruit, verify whether the character identification result is effective recognition result, obtains verification result.
In a kind of implementation of the invention, the recognition result obtains module and includes:
Recognition result obtains submodule, carries out word for obtained each monocase region to be input to character recognition model
Symbol identification, obtains the character identification result of each character zone, the first kind recognition result as each character zone, wherein
The character recognition model are as follows: that convolutional neural networks model is trained using first sample character zone in advance,
For the model of character included in detection zone, the first sample character zone are as follows: indicate one in first sample gradient map
The region of a character region, the first sample gradient map are as follows: Morphological Gradient calculating is carried out to first sample image
Obtained image;
Recognition result determines submodule, for determining the character in each monocase region based on the first kind recognition result
Recognition result.
In a kind of implementation of the invention, the recognition result determines that submodule includes:
Candidate region determination unit, for determining each monocase region in the first image region along preset direction
Deviate the corresponding region of preset quantity pixel, the candidate region as each monocase region;
Judging result obtaining unit judges each time for obtained each candidate region to be input to character judgment models
Whether favored area is the region comprising character, obtains the character judging result of each candidate region, wherein the character judges mould
Type are as follows: in advance using the second sample character zone convolutional neural networks model is trained, for judging in region
Whether include character model, the second sample character zone are as follows: in the second sample gradient map indicate a character where
Region where region or non-character, the second sample gradient map are as follows: Morphological Gradient meter is carried out to the second sample image
Obtained image;
Correcting area determination unit determines each for the character judging result based on each candidate region obtained
Correcting area of the highest candidate region of confidence level as each candidate region in candidate region;
Recognition result obtaining unit, for the correcting area in each monocase region to be input to the character recognition model
Character recognition is carried out, the character identification result of the correcting area in each monocase region is obtained, as each monocase region
Second class recognition result;
As a result determination unit, for will be set in the first kind recognition result in each monocase region and the second class recognition result
The highest recognition result of reliability is determined as the character identification result of the character zone.
In a kind of implementation of the invention, the quantity determining module includes:
Testing result obtains submodule, for each pixel column in the first image region to be input to character respectively
The quantity that the affiliated character of pixel in each pixel column is detected in quantity detection model obtains the corresponding detection of each pixel column
As a result, wherein the character quantity detection model are as follows: in advance using each pixel column and each picture in third sample gradient map
In plain row the mark quantity of the affiliated character of pixel preset neural network model is trained, for detection pixel
The neural network model of the quantity of the affiliated character of pixel in row, the third sample gradient map are as follows: to third sample image into
The gradient map that row Morphological Gradient is calculated;
Quantity obtains submodule, for being based on obtained testing result, obtains character in the first image region
Character quantity.
In a kind of implementation of the invention, the organizational systems determining module includes:
Model determines submodule, for determine it is corresponding with character quantity obtained, be used for detection image in character
The organizational systems detection model of organizational systems, wherein the organizational systems detection model are as follows: use the 4th sample gradient map in advance
In each pixel column and each pixel column in the affiliated character of pixel mark organizational systems to preset neural network model
The neural network model of organizational systems being trained, for character described in pixel in detection pixel row, described
Four sample gradient maps are as follows: the gradient map that Morphological Gradient is calculated is carried out to the 4th sample image;
First probability obtains submodule, is input to each pixel column in the first image region for respectively described
The organizational systems that the affiliated character of pixel in each pixel column is detected in organizational systems detection model, obtain in each pixel column
The organizational systems of the affiliated character of pixel are the probability of default organizational systems;
First calculates each picture in the first image region for being directed to each organizational systems with value computational submodule
The organizational systems of the affiliated character of pixel are the probability and value of default organizational systems in plain row;
Organizational systems determine submodule, for the maximum and corresponding organizational systems of value to be determined as the first image region
First organizational systems of interior character.
In a kind of implementation of the invention, the region obtains module and includes:
Quantity statistics submodule, the number of character pixels point in each pixel column for counting the first image region
Amount, wherein the character pixels point are as follows: belong to the pixel of character;
Distribution obtains submodule, for obtaining character in each character arrangements that organizational systems are first organizational systems
First discreet of pixel is distributed, wherein the character width of character is between predetermined width, character group in each character arrangements
Away to preset spacing, character width is different in kinds of characters arrangement and/or character group spacing is different;
Be distributed determine submodule, for determine obtains the first discreet be distributed in first be distributed between diversity factor most
Small the first discreet distribution, wherein first distribution are as follows: counted by the character pixels that the quantity counted determines
The distribution of amount;
Region obtains submodule, for being distributed corresponding character arrangements to described the according to identified first discreet
One image-region carries out Character segmentation, obtains monocase region.
In a kind of implementation of the invention, the area determination module includes:
Second probability obtains submodule, for each pixel column of the first gradient figure to be input to region inspection respectively
It surveys in model, obtains each pixel column corresponding pixel column in the images to be recognized and be located at the image-region comprising character
First probability, wherein the region detection model are as follows: in advance using each pixel column in the 5th sample gradient map to preset
The two Classification Neural models that neural network model is trained, the 5th sample gradient map are as follows: to the 5th sample
Image carries out the gradient map that Morphological Gradient is calculated;
Second and value computational submodule, for calculating each continuous first preset quantity pixel column in the first gradient figure
The first probability and value;
Region determines submodule, corresponding first preset quantity of maximum and value for determining obtained first probability
Pixel column corresponding region in the images to be recognized, as the first image-region.
In a kind of implementation of the invention, the gradient distribution computing module includes:
Image obtains submodule, for obtaining the gray component image and chromatic component image of images to be recognized;
First gradient figure obtains submodule, for carrying out respectively to the gray component image and the chromatic component image
Morphological Gradientization calculates, and obtains gray component gradient map and chromatic component gradient map;
Second gradient map obtains submodule, for carrying out to the gray component gradient map and the chromatic component gradient map
Difference operation obtains first gradient figure.
In a kind of implementation of the invention, second gradient map obtains submodule and includes:
Image acquiring unit obtains chromatic component two-value for carrying out binary conversion treatment to the chromatic component gradient map
Figure;
Gradient map obtaining unit, for determining that the pixel value of the first pixel in the gray component gradient map is first pre-
If pixel value, first gradient figure is obtained, wherein the first presetted pixel value are as follows: represented gradient value is less than preset threshold
Pixel value, first pixel are as follows: with pixel value in the chromatic component binary map be the second presetted pixel value pixel
Pixel in corresponding, the described gray component gradient map of point, the second presetted pixel value are as follows: the chromatic component two-value
The pixel value of background pixel point in figure.
The embodiment of the present invention also provides a kind of electronic equipment, including processor, communication interface, memory and communication bus,
Wherein, processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any of the above-described image-recognizing method
The step of.
At the another aspect that the present invention is implemented, the embodiment of the invention also provides a kind of computer readable storage medium, institutes
It states and is stored with instruction in computer readable storage medium, when run on a computer, so that computer execution is any of the above-described
The step of described image-recognizing method.
At the another aspect that the present invention is implemented, the embodiment of the invention also provides a kind of, and the computer program comprising instruction is produced
Product, when run on a computer, so that computer executes any of the above-described image-recognizing method.
Image-recognizing method and device provided in an embodiment of the present invention can first obtain the gradient map of image, determine image
Region where middle character, then determine the quantity of character and the first organizational systems of character in image-region, then to the region
Character segmentation is carried out, monocase region is obtained, finally character recognition is carried out to each monocase region respectively, obtain the knowledge of image
Other result.In scheme provided in an embodiment of the present invention, the upright projection of binary map is not used to determine card number field, no longer yet
Carry out Character segmentation using the floor projection of binary map, but to the image of Morphological Gradient carry out Text RegionDetection,
Character length detection and the detection of character organizational systems, according to identified character organizational systems separating character, are then known again
Not, in this way can be to avoid because character zone positions, mistake is caused to identify mistake, and character quantity and word has successively been determined
Character segmentation is carried out again after symbol organizational systems, it can also be to avoid Character segmentation mistake, to improve the anti-interference of image recognition
Property and accuracy rate.Certainly, implement any of the products of the present invention or method it is not absolutely required at the same reach all the above
Advantage.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described.
Fig. 1 is a kind of flow diagram of image-recognizing method provided in an embodiment of the present invention;
Fig. 2 is a kind of bank's card graphic provided in an embodiment of the present invention;
Fig. 3 is the schematic diagram in the monocase region in bank's card graphic provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of pattern recognition device provided in an embodiment of the present invention;
Fig. 5 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention is described.
The embodiment of the invention provides a kind of image-recognizing method and devices, below first to involved in the embodiment of the present invention
Concept is illustrated.
Morphological Gradientization calculates: the Morphological scale-space for being expanded and being corroded to image respectively, then with after expansion
Image subtracts the image after corrosion, obtains error image.In the Morphological scale-space for being expanded and being corroded to image, Ke Yixuan
Use 3 × 3 convolution kernel as property detector.
Organizational systems: for multiple characters, the quantity of the character of continuous arrangement together and the character quilt discontinuously arranged
The case where separating.
By taking the card number of bank card as an example, it is assumed that the card number of bank card includes 16 characters, then its organizational systems can be with are as follows:
4-4-4-4, together, continuously arranged character string is separated every 4 character continuous arrangements by the width of 1 character, specific manifestation
Are as follows: 6,200 0,000 0,000 0000;Assuming that the card number of bank card includes 19 characters, then its organizational systems can be with are as follows: 6-13,
Together, continuously arranged character string is separated every 4 character continuous arrangements by the width of 1 character, specific manifestation are as follows: 620000
0000000000000。
The complex network system that neural network model: widely being interconnected by a large amount of, simple processing unit and is formed
System.Wherein, convolutional neural networks model: being a kind of BP network model, can carry out large-scale image procossing.Convolutional Neural
Network model includes convolutional layer and pond layer.Convolutional neural networks model includes one-dimensional convolutional neural networks model, two-dimensional convolution
Neural network model and Three dimensional convolution neural network model.One-dimensional convolutional neural networks model is commonly applied to the data of sequence class
Processing;Two-dimensional convolution neural network model is commonly applied to the identification of image class text;Three dimensional convolution neural network model is mainly answered
It is identified for medical image and video class data.
Monocase region: the region where single character is indicated.When identifying the character in image, generally require to image
In character zone carry out Character segmentation, determine single character region, then again one by one to single character region into
Line character identification.
The distribution of character pixels point quantity: the discrete distribution of the character pixels point quantity of each pixel column in image, it can be with
It is expressed as the form of array, the form of vector can also be expressed as.
Below by specific embodiment, image-recognizing method provided in an embodiment of the present invention is described in detail.
Referring to Fig. 1, Fig. 1 is a kind of flow chart of image-recognizing method provided in an embodiment of the present invention, is included the following steps:
Step S101, Morphological Gradient calculating is carried out to images to be recognized, obtains first gradient figure.
Images to be recognized can be gray level image, or color image.If images to be recognized is gray level image,
Morphological Gradient calculating directly can be carried out to images to be recognized, obtain first gradient figure;If images to be recognized is colour
When image, the grayscale image of images to be recognized can be first obtained, then Morphological Gradient calculating is carried out to the grayscale image, obtain first
Gradient map.
The embodiment of the present invention only by it is above-mentioned obtain first gradient figure in the way of for be illustrated, not to structure of the present invention
At restriction.
Step S102, in first gradient figure, area corresponding with the image-region where character in images to be recognized is determined
Domain, as the first image-region.
It include the part of character portion and the NULI character gone together with character in image-region where character.Determine above-mentioned figure
When as region, the floor projection algorithm based on binaryzation can be used, specific steps may include: to carry out two to first gradient figure
Value processing, obtains black and white bianry image;It is white or black for counting color in each pixel column of above-mentioned bianry image
The pixel of color is distributed;According to statistical result, above-mentioned image-region is determined.
If the image-region where all characters of images to be recognized, entire first gradient figure is the first image
Region.Certainly, the image-region where character is also possible to the partial region in images to be recognized, in this case, above-mentioned
One image-region is the partial region of first gradient figure.
Character can be number, or letter can also be Chinese character, can also be in above-mentioned three both at least
Mixing, the embodiment of the present invention do not limit this.
Above-mentioned images to be recognized can be bank card image, as shown in Fig. 2, the image-region so where character can be
The card number field of bank card in image.
Step S103, the character quantity of character in the first image-region is determined.
When determining the character quantity of character in the first image-region, the floor projection algorithm based on binaryzation can be used,
Specific steps may include: to carry out binary conversion treatment to the first image-region;Count each pixel column of obtained binary map
Middle color is the pixel distribution of white or black;According to statistical result, the character quantity of character in the first image-region is determined.
In first image-region the character quantity of character can also by calculate the first image-region width with it is preset
The quotient of character width determines, can also be by preparatory trained neural network model to the pixel column of first image-region
It is detected to determine.
Step S104, it is based on character quantity, determines the first organizational systems of character in the first image-region.
In application scenes, the organizational systems of character are fixed, therefore for the image of such application scenarios,
After character quantity has been determined, so that it may determine the marshalling side of character in the image according to the setting for the character for including in the image
Formula.
Such as: images to be recognized be China Unionpay's bank card image, and include character image-region be bank card
Card number field.It, can be according to the rule of bank, China Unionpay card number, directly when the digital numerical for determining bank's card number is 16
The organizational systems for connecing determining bank's card number are 4-4-4-4, every 4 digital continuous arrangements together, continuously arranged numeric string quilt
One white space separates.It, can be according to bank, China Unionpay card number when the digital numerical for determining bank's card number is 18
Rule, the organizational systems for directly determining bank's card number are 6-6-6, every 6 digital continuous arrangements together, continuously arranged number
String is separated by a white space.
For the case where there are a variety of organizational systems of identical characters quantity, it is determined that after character quantity, it is also necessary to be based on
The character quantity determines organizational systems, how based on character quantity to determine organizational systems, is described in detail in subsequent embodiment, here temporarily
It does not repeat.
Step S105, the first organizational systems are based on, Character segmentation is carried out to the first image-region, obtains monocase region.
Under some scenes, the width of each character region is often fixed, and the width of each character region
It spends similar, first gradient figure is divided, can be according to preset interval in a kind of implementation of the invention based on this
It is divided.
For example, the width of a character is about 27 pixels, then it can be according to the interval of 27 pixels to the first image
Region carries out Character segmentation, obtains multiple character zones.
Based on above-mentioned example, as shown in figure 3, each white box in Fig. 3 indicates a monocase region.
Step S106, character recognition is carried out to each monocase region, and then obtains the character recognition knot of images to be recognized
Fruit.
The recognition result that identification monocase region obtains is single character.The character identification result of images to be recognized are as follows: know
The character that other images to be recognized obtains.If only one monocase region, the knot which is identified
Fruit is that the character identification result of images to be recognized then can be according to the reading of character if there is multiple each monocase regions
Sequentially, the recognition result in each monocase region is combined, obtains the character identification result of images to be recognized.
In a kind of implementation, each monocase region can be identified by template matching algorithm: first will be each
The size in monocase region is scaled the size of template in character database, is then matched with all templates, choosing
Select best match as a result.In another implementation, each monocase region can be carried out by neural network model
Identification.When being identified using neural network to monocase region, feature extraction first can be carried out to character, then will be obtained
Feature input value neural network model in obtain recognition result, directly image can also be input in neural network model,
Feature extraction and identification are realized by model.
Image-recognizing method provided in an embodiment of the present invention can first obtain the gradient map of image, determine character in image
The region at place, then determine the quantity of character and the first organizational systems of character in image-region, word then is carried out to the region
Symbol segmentation, obtains monocase region, finally carries out character recognition respectively to each monocase region, obtain the identification knot of image
Fruit.In scheme provided in an embodiment of the present invention, the upright projection of binary map is not used to determine card number field, is not used yet
The floor projection of binary map carries out Character segmentation, but to the image of Morphological Gradient carries out Text RegionDetection, character
Length detection and the detection of character organizational systems, according to identified character organizational systems separating character, are then identified again, this
Sample can be to avoid because character zone positions, mistake is caused to identify mistake, and character quantity and character marshalling has successively been determined
Character segmentation is carried out again after mode, it can also be to avoid Character segmentation mistake, to improve the anti-interference and standard of image recognition
True rate.
In a kind of implementation of the invention, after above-mentioned steps S106, whether verifying character identification result is effective
Recognition result obtains verification result.
The identification that each monocase region is carried out in above-mentioned steps S106, the knowledge in available each monocase region
Other confidence level, wherein the recognition confidence is the numerical value from 0 to 1.In this implementation, the knowledge in each monocase region is verified
The summation of other confidence level, if be greater than preset threshold, if it does, then it is determined that recognition result is effective recognition result.Wherein,
The preset threshold can subtract 1 for each monocase region total quantity, or each monocase region total quantity multiplied by 0.9 or
0.8, for example, step S105 obtains 18 monocase regions, then preset threshold can be 17 or 16.2.
In addition, recognition result itself has its preset rule in application scenes, obtain recognition result it
Afterwards, it is detected using the preset rule of recognition result, can detecte out the recognition result for identifying mistake.
For example, when identification target is bank's card number, can will identify obtained number when images to be recognized is bank's card graphic
First 6 of word and 6 BIN (Bank Identification Number, credit card issuer identification code) of bank card are matched, if
First 6 no corresponding BIN for identifying obtained number, then illustrate to identify mistake.For known credit card issuer and bank card types
Bank card, if identify number first 6 it is different from the BIN of the bank card of bank's the type, illustrate to know
Not mistake.
At the same time, when images to be recognized is bank's card graphic, and identification target is bank's card number, identification can be obtained
Number carry out mould 10 verify, bank's card number last be mould 10 verify verifying position, if recognition result can not pass through
Mould 10 verifies, then illustrates to identify mistake.
In this implementation, whether verifying character identification result is effective recognition result.The character in image identified
Preset rule is itself had, can will be determined as effective recognition result by the recognition result of above-mentioned rule verifying, exclude
The recognition result for not meeting above-mentioned rule, can be improved the accuracy of finally obtained recognition result.
In a kind of implementation of the invention, character recognition is carried out to each monocase region in above-mentioned steps S106, into
And when obtaining the character identification result of images to be recognized, obtained each monocase region first can be input to character recognition mould
Type carries out character recognition, obtains the character identification result of each character zone, and the first kind as each character zone identifies knot
Fruit, then determine based on the first kind recognition result character identification result in each monocase region.
Character recognition model are as follows: in advance convolutional neural networks model is trained to obtain using first sample character zone
, model for character included in detection zone.
First sample character zone are as follows: the region of a character region is indicated in first sample gradient map.
First sample gradient map are as follows: the image that Morphological Gradient is calculated is carried out to first sample image.
It may include character present in the obtained each character zone of identification in above-mentioned character identification result, except this it
It outside, can also include: character present in each character zone in above-mentioned character identification result be the obtained character of above-mentioned identification
Confidence level.
Character present in each character zone is the confidence level for the character that identification obtains it is to be understood that character zone is deposited
Character be the probability of character that identification obtains.
First sample image can be gray level image, or color image.
First sample image can be the image comprising multiple characters, be also possible to the image comprising a character.
When first sample image is the image comprising multiple characters, then morphology is first carried out to first sample image first
First sample gradient map is calculated in change, then divides to above-mentioned first sample gradient map, obtains first sample character zone.
When first sample image is the image comprising a character, morphology first can also be carried out to first sample image
First sample gradient map is calculated in gradient distribution, in this case, can be directly by first sample gradient map all as upper
State first sample character zone.In addition, though only including a character in first sample image, but removed in first sample image
It can also include other content outside character, for this purpose, after obtaining first sample gradient map, where can also determining wherein character
Region, the region where character is determined as above-mentioned first sample character zone.
When carrying out character recognition to each character zone, the first kind character identification result of obtained each character zone
In, it can also be able to include the multiple possible characters identified only comprising the character identified.
In the first kind character identification result of each character zone, only comprising identify a character when, can be by
According to sequence of positions of each character zone in images to be recognized, the character for including in above-mentioned images to be recognized is determined.
In the first kind character identification result of each character zone, comprising identify multiple possible characters when, can
With the highest character of confidence level in the first kind character identification result according to each character zone and each character zone to
It identifies the sequence of positions in image, determines the character for including in images to be recognized.It can also be according to each first kind character recognition
As a result each character meets the degree of syntactic structure according to the combination of above-mentioned sequence of positions in, determines in images to be recognized and includes
Character.
As it can be seen that this implementation is determined above-mentioned wait know by the first kind character identification result according to each character zone
The character for including in other image can be quickly obtained the character in identification image included.
The character identification result in each monocase region is determined based on the first kind recognition result.
In a kind of implementation, first kind recognition result can be directly determined as to the character recognition in each monocase region
As a result;In another implementation, first kind recognition result can be made comparisons with other recognition results, choose suitable identification knot
Fruit is determined as the character identification result in each monocase region.
In this implementation, each character zone is input to character recognition model and carries out character recognition, obtains each word
Accord with the character identification result in region.In this implementation, character is identified without using the low mode of this accuracy rate of pattern algorithm, and
It is to be detected using the convolutional neural networks model trained by great amount of samples to monocase region.Use great amount of samples
Convolutional neural networks are trained, convolutional neural networks study can be made to the feature of character under various backgrounds, and due to
Convolutional neural networks are trained using the character zone after progress Morphological Gradient calculating, and Morphological Gradientization calculates
Can protrude the edge in picture material, thus it is above-mentioned it is trained after convolutional neural networks model can efficiently identify image
The character of middle complex background, so as to improve the accuracy of identification character.
In a kind of above-mentioned implementation, the preset interval due to carrying out Character segmentation to the first image-region is only one
A statistical value, and the developed width of each character is not absolutely equal, in addition to this, is influenced by factors such as shooting angle, schemes
As situations such as there is likely to be deformation, rotation, for this purpose, each monocase region that Character segmentation obtains in above-mentioned steps S105
In, some monocase regions may include a complete character just, and some monocase regions may include a character
Part.
In order to solve monocase region that above-mentioned Character segmentation obtains there may be including the part of a character,
Based on above-mentioned implementation, propose in another implementation of the invention, it is above-mentioned to be determined respectively based on first kind recognition result
The character identification result in a monocase region can be realized using following steps A1-A5:
Step A1: determine that each monocase region deviates preset quantity pixel along preset direction in the first image-region
The corresponding region of point, the candidate region as each monocase region.
It is above-mentioned to can also be and be deviated along vertical direction to be deviated along horizontal direction along preset direction offset.
The quantity of the candidate region of above-mentioned each character zone can be one, for example, each character zone it is above-mentioned to
It identifies in image along the corresponding region of some direction offset preset quantity pixel;
The quantity of the candidate region of above-mentioned each character zone be also possible to it is multiple, such as: each character zone is above-mentioned
Along the corresponding region of multiple directions offset preset quantity pixel in images to be recognized.
Above-mentioned preset quantity can be 3 pixels, 4 pixels etc..
Since the candidate region of each character zone is the character zone along preset direction offset preset quantity pixel
It obtains, therefore, the candidate region of each character zone and the character zone are equal in magnitude.
Step A2: obtained each candidate region is input to character judgment models and judges whether each candidate region is packet
Region containing character obtains the character judging result of each candidate region.
Character judgment models are as follows: in advance convolutional neural networks model is trained to obtain using the second sample character zone
, for judge in region whether include character model.
Second sample character zone are as follows: the region or non-character place where a character are indicated in the second sample gradient map
Region.
Second sample gradient map are as follows: the image that Morphological Gradient is calculated is carried out to the second sample image.
Above-mentioned character judging result may include: to judge that candidate region includes character, determine that candidate region does not include character,
Namely non-character region also may include: to judge that candidate region includes character and judges that candidate region includes setting for character
Reliability can also include: to judge candidate region for non-character region and be determined as the confidence level in non-character region.
Second sample image can be gray level image, or color image.
Second sample image can be character sample image and non-character sample image, wherein character sample image can be with
It is the sample image comprising a character, is also possible to the sample image comprising multiple characters.Character sample image and non-character
Sample image can be from an original image, be also possible to from same class original image.
By taking bank card as an example, the character sample image sources in the second sample image are in bank's card graphic, non-character
Sample image can obtain at the preset quantity pixel of offset character sample image in the Zhang Yinhang card graphic.
Step A3: the character judging result based on each candidate region obtained determines confidence in each candidate region
Spend correcting area of the highest candidate region as each candidate region.
It is above-mentioned using the highest candidate region of confidence level in multiple candidate regions as correcting area.
Step A4: the correcting area in each monocase region is input to character recognition model and carries out character recognition, is obtained
The character identification result of the correcting area in each monocase region, the second class recognition result as each monocase region.
Step A5: confidence level in the first kind recognition result in each monocase region and the second class recognition result is highest
Recognition result is determined as the character identification result of the character zone.
In this implementation, by by confidence in the first kind recognition result of each character zone and the second class recognition result
The final recognition result that highest recognition result is determined as the character zone is spent, can be improved the accuracy rate of identification character.And lead to
It crosses and each candidate region is input in character judgment models, export the character judging result of each candidate region, character is sentenced
The highest candidate region of confidence level can be further improved the accuracy rate of identification character as correcting area in disconnected result.In addition,
In this implementation, using the convolutional neural networks model trained by great amount of samples, to the image of Morphological Gradient
It is detected.Use the second sample that the second sample gradient map that Morphological Gradient is calculated is carried out to the second sample image
Character zone is trained neural network as sample, so that the anti-interference of character judgment models is enhanced, so that model
It can determine that complex background whether there is character in image, effectively so as to improve the accuracy of identification character.
In a kind of implementation of the invention, the character quantity of character in the first image-region is determined in above-mentioned steps S103
When, first each pixel column of the first image-region can be input in character quantity detection model respectively and detect each pixel
The quantity of the affiliated character of pixel in row is obtained the corresponding testing result of each pixel column, then is tied based on obtained detection
Fruit obtains the character quantity of character in the first image-region.
Character quantity detection model are as follows: in advance using in each pixel column and each pixel column in third sample gradient map
It is that the mark quantity of the affiliated character of pixel is trained preset neural network model, for picture in detection pixel row
The neural network model of the quantity of the affiliated character of vegetarian refreshments.
Third sample gradient map are as follows: the gradient map that Morphological Gradient is calculated is carried out to third sample image.
First image-region is a part that images to be recognized carries out the first gradient figure that Morphological Gradient is calculated,
So the pixel in pixel and images to be recognized in the first image-region has corresponding relationship, and because the first image-region includes
The character being made of pixel, so character belonging to pixel in pixel column in images to be recognized, is the first image district
Character belonging to pixel in first image-region corresponding to the pixel in pixel column in domain.
The pixel column for being input to character quantity detection model can be made of the first preset quantity pixel, and first is default
Quantity can be 240 or 300 equal numerical value with value.If the pixel column of the first image-region, it is pre- that pixel quantity is greater than first
If quantity, diminution processing can be carried out to the first image-region, so that the width of the first image-region is the first preset quantity
Pixel;If the pixel column of the first image-region, pixel quantity is less than third preset quantity, and pixel can be used will
Pixel column completion, the pixel value of pixel used in completion are as follows: represented gradient value is less than the pixel value of preset threshold.If
In the first image-region, represented gradient value is successively descending from white to black, then in the first image-region
When the pixel quantity of pixel column is less than the first preset quantity, pixel value can be used and be expressed as the pixel of black for the pixel
Row completion pixel point quantity is the pixel column of the first preset quantity.
Above-mentioned testing result can be the specific number of character quantity, such as: " 18 ";Above-mentioned testing result may be
Probability corresponding to the possible specific character quantity of two preset quantities and each character quantity, such as: " 17:0.10,18:
0.70,19:0.20 ", i.e. character quantity may be 17,18 or 19, wherein the probability that character quantity is 17 is 0.10, number of characters
Amount is 0.70 for 18 probability, and the probability that character quantity is 19 is 0.20;Above-mentioned testing result can also be that character quantity is pre-
If one or more character quantities probability, such as: " 0.05,0.00,0.75,0.20 ", for preset four kinds of number of characters
Amount 16,17,18 and 19, the character quantity detected be the probability of the preset characters quantity be respectively 0.05,0.00,0.75,
0.20。
If above-mentioned testing result is the specific number of character quantity, each pixel column pair is directly obtained from testing result
The character quantity of character in the images to be recognized answered, can be using the character quantity in the testing result of most pixel columns as wait know
The character quantity of character in other image, for example, will test the maximum character quantity of frequency of occurrence in result as images to be recognized
The character quantity of middle character.
If testing result is corresponding to the possible specific character quantity of the second preset quantity and each character quantity
Probability, testing result can be counted, for each obtained character quantity, calculate the number of characters in testing result
The probability value of amount and value, using probability value and be worth maximum character quantity as the character quantity of character in images to be recognized.
If testing result is the probability of preset character quantity, can calculate in testing result, corresponding each default
The probability value of character quantity and value, using probability value and be worth maximum character quantity as the number of characters of character in images to be recognized
Amount.
In this implementation, the pixel column of the first image-region is first input to the neural network model that training obtains in advance
In, then the output based on neural network model obtains the character quantity of character in the first image-region.In this implementation, use
The neural network model trained by great amount of samples detects the first image-region.Preset kinds of characters quantity
Distinction is trained neural network as sample, and model is enabled effectively to distinguish character quantity, so as to standard
True obtains character quantity, can promote the accuracy of final recognition result.
In a kind of implementation of the invention, above-mentioned steps S104 is based on character quantity, determines word in the first image-region
First organizational systems of symbol can be realized using following steps B1-B4:
Step B1: volumes corresponding with character quantity obtained, for character organizational systems in detection image are determined
Group mode detection model.
Organizational systems detection model are as follows: in advance using in each pixel column and each pixel column in the 4th sample gradient map
It is that the mark organizational systems of the affiliated character of pixel are trained preset neural network model, be used for detection pixel row
The neural network model of the organizational systems of middle pixel point character.
4th sample gradient map are as follows: the gradient map that Morphological Gradient is calculated is carried out to the 4th sample image.
Different character quantities can correspond to different organizational systems detection models, and organizational systems detection model, which can be, to be made
It is obtained with the sample image training that character quantity wherein included is particular preset character quantity.
Step B2: each pixel column of the first image-region is input in organizational systems detection model detects often respectively
The organizational systems of the affiliated character of pixel in one pixel column, obtain the organizational systems of the affiliated character of pixel in each pixel column
For the probability for presetting organizational systems.
The pixel column for being input to organizational systems detection model can be made of the first preset quantity pixel, and first is default
Quantity can be 240 or 300 equal numerical value with value.If the pixel column of the first image-region, it is pre- that pixel quantity is greater than first
If quantity, diminution processing can be carried out to the first image-region, so that the width of the first image-region is the first preset quantity
Pixel;If the pixel column of the first image-region, pixel quantity is less than third preset quantity, and pixel can be used will
Pixel column completion, the pixel value of pixel used in completion are as follows: represented gradient value is less than the pixel value of preset threshold.If
In the first image-region, represented gradient value is successively descending from white to black, then in the first image-region
When the pixel quantity of pixel column is less than the first preset quantity, pixel value can be used and be expressed as the pixel of black for the pixel
Row completion pixel point quantity is the pixel column of the first preset quantity.
The value of above-mentioned probability can be the numerical value between 0 to 1.
Step B3: being directed to each organizational systems, calculates the affiliated character of pixel in each pixel column of the first image-region
Organizational systems be default organizational systems probability and value.
Step B4: the maximum and corresponding organizational systems of value are determined as to the first marshalling side of character in the first image-region
Formula.
It, can be more above-mentioned if corresponding and value is all there are two maximum and value different organizational systems or two or more
It is two or more difference organizational systems corresponding to carries out read group total probability, will wherein probability numbers it is maximum generally
Organizational systems corresponding to rate are determined as the organizational systems of character in images to be recognized.
In this implementation, corresponding organizational systems detection model is first determined according to character quantity, then by the first image
The pixel column in region is input in the neural network model that training obtains in advance, and obtaining the corresponding organizational systems of each pixel column is
The probability of default organizational systems, then calculates probability and value, and the maximum and corresponding default organizational systems of value are determined as marshalling side
Formula.The first figure in this implementation, using the neural network model trained by great amount of samples, after being determined to character quantity
As region is detected.The distinction of preset difference organizational systems is trained neural network as sample, so that mould
Type can effectively distinguish different organizational systems, and coping with identical characters quantity has the case where different organizational systems, and
It can determine organizational systems, accurately so as to promote the accuracy of final recognition result.
In a kind of implementation of the invention, above-mentioned steps S105 be based on the first organizational systems, to the first image-region into
Line character segmentation, obtains monocase region, can be realized using following steps C1-C4:
Step C1: the quantity of character pixels point in each pixel column of the first image-region of statistics.
Above-mentioned character pixels point are as follows: belong to the pixel of character.Since the first image-region is that images to be recognized passes through shape
What state obtained after calculating, so, above-mentioned pixel character point is the edge pixel point of character.
Step C2: obtain character pixels point in each character arrangements that organizational systems are the first organizational systems first is estimated
Distributed number.
The character width of character is predetermined width in each character arrangements, character group spacing is default spacing, kinds of characters
Character width is different in arrangement and/or character group spacing is different.Character group spacing is adjacent the distance between character group, character
Group spacing can be indicated with the quantity of pixel.Above-mentioned character arrangements directly determine that how to treat segmented image carries out word
Symbol segmentation.
The mode for obtaining above-mentioned character arrangements includes but is not limited to:
(1) pre-set character arrangements are directly acquired;
(2) different sizes is chosen in preset size range, and character arrangements are obtained according to selected size.
The distribution of first discreet are as follows: when estimating character according to the corresponding character arrangements of the first discreet distribution,
The quantity of character pixels point in each pixel unit in the image-region of place.Obtaining the mode that the first discreet is distributed includes
But it is not limited to:
(1) pre-set the first discreet distribution is directly acquired;
(2) the discreet distribution for obtaining pre-set single character, according to corresponding character arrangements and character group
Spacing is combined to obtain the distribution of the first discreet, wherein the discreet of single character, which is distributed, to be indicated, an individual character
The quantity of character pixels point in each pixel unit in the image-region of symbol.
Step C3: determine obtains the first discreet be distributed in first be distributed between diversity factor the smallest first estimate
Distributed number.
First distribution are as follows: by the distribution for the character pixels point quantity that the quantity counted determines.
When calculating diversity factor between the distribution of the first discreet and the first distribution, the distribution of the first discreet can be first calculated
With the difference of corresponding element in the first distribution, then the absolute value of obtained difference summed, as diversity factor;It can also
To calculate the quadratic sum of the distribution of the first discreet with each corresponding element in the first distribution, as diversity factor.
In a kind of implementation, each first discreet distribution and the first distribution are point by normalized
Cloth calculates diversity factor using the distribution Jing Guo normalized, can be to avoid the character picture as caused by picture size difference
The occurrence of vegetarian refreshments quantity is unmatched.Influence of the picture size for character pixels point quantity is eliminated, it can be better
Shape composed by character pixels is embodied by the distribution of character pixels point quantity.
The distribution of first discreet and the first distribution are discrete distribution, because of the element in the distribution of the first discreet
Number is not necessarily equal with the element number in the first distribution, it is possible to first compare the element number in the distribution of the first discreet
With the element number in the first distribution, the distribution that element number is lacked adds to the element with another distribution with default value
Number is equal.Default value can be 0, and for the distribution crossed by normalized, default value may be 0.3 or 0.5.
Step C4: corresponding character arrangements are distributed according to identified first discreet, word is carried out to the first image-region
Symbol segmentation, obtains monocase region.
As shown in figure 3, each white box in Fig. 3 indicates a monocase region.
In this implementation, the quantity of character pixels point in the pixel column of image to be split can be first counted, then is obtained every
The discreet distribution of character pixels point, then determines in discreet distribution and forms with the quantity counted in one character arrangements
The smallest discreet distribution of the diversity factor of distribution, is finally distributed corresponding character arrangements according to the discreet and treats segmentation figure
As carrying out Character segmentation.In this implementation, the feature in image there are character is converted to character pixels point quantity distribution number
According to the character pixels point distributed number being converted to by image to be split estimates number from corresponding to different Character segmentation parameters
Amount distribution is compared, and determines the smallest Character segmentation parameter of difference, and directly carry out Character segmentation according to default partitioning parameters
It compares, improves the accuracy of Character segmentation.
In a kind of implementation of the invention, above-mentioned steps S102 is in first gradient figure, in determining and images to be recognized
The corresponding region of image-region where character can be realized as the first image-region using following steps D1-D3:
Step D1: each pixel column of first gradient figure is input in region detection model respectively, obtains each picture
Plain row corresponding pixel column in images to be recognized is located at the first probability of the image-region comprising character.
Region detection model are as follows: in advance using each pixel column in the 5th sample gradient map to preset neural network mould
The two Classification Neural models that type is trained.
5th sample gradient map are as follows: the gradient map that Morphological Gradient is calculated is carried out to the 5th sample image.
First probability is located at the figure comprising character for the pixel column that is inputted pixel column corresponding in images to be recognized
As the probability in region, numerical value can be between 0 and 1.
The pixel column for being input to region detection model can be made of third preset quantity pixel, and third preset quantity can
It is 240 or 300 equal numerical value with value.If the pixel column of first gradient figure, pixel quantity is greater than third preset quantity, can be with
Diminution processing is carried out to first gradient figure, so that the width of first gradient figure is third preset quantity pixel;If the first ladder
The pixel column of figure is spent, pixel quantity is less than third preset quantity, pixel can be used by pixel column completion, picture used in completion
The pixel value of element are as follows: represented gradient value is less than the pixel value of preset threshold.If in first gradient figure, from white to black
Gradient value represented by color is successively descending, then the pixel quantity in the pixel column of first gradient figure is less than third present count
When amount, pixel value can be used and be expressed as picture of the pixel of black by the pixel column completion pixel quantity for third preset quantity
Plain row.
Step D2: calculate first gradient figure in each continuous first preset quantity pixel column the first probability and be worth.
First preset quantity indicates the high how many a pixels of the identified image-region comprising character, and the first preset quantity can
With value 27 or 30 etc..If continuous first preset quantity pixel column is pre- as one group of pixel column, each continuous first
If quantity pixel column indicates: can repeat to choose the continuous first preset quantity pixel column of the multiple groups of pixel column;Continuous representation:
Each pixel column in one group of pixel column is adjacent two-by-two.
For example, each continuous 27 pixel columns can indicate in first gradient figure when the value of the first preset quantity is 27 are as follows:
1st row is to the 27th row, the 2nd row to the 28th row, the 3rd row to the 29th row ...
Step D3: the maximum and the corresponding first preset quantity pixel column of value for determining obtained first probability are wait know
Corresponding region in other image, as the first image-region.
In this implementation, the pixel column of first gradient figure is first input to two Classification Neurals that training obtains in advance
In model, the pixel column obtained in first gradient figure is located at the probability of the image-region comprising character, then calculates each continuous default
The probability and value of quantity pixel column, then the region by probability and where being worth maximum continuous preset quantity pixel column determines
For the first image-region comprising character.It is right using the neural network model trained by great amount of samples in this implementation
First gradient figure is detected.The distinction of character and background patterns is trained neural network as sample, so that mould
Type can effectively distinguish the character and background patterns for needing to identify, to improve the first figure determined, comprising character
As the accuracy in region.
In a kind of implementation of the invention, in above-mentioned steps S102, Morphological Gradient meter is carried out to images to be recognized
It calculates, when obtaining first gradient figure, can first obtain the gray component image and chromatic component image of images to be recognized;It is right respectively again
Gray component image and chromatic component image carry out Morphological Gradient calculating, obtain gray component gradient map and chromatic component ladder
Degree figure;Then difference operation is carried out to gray component gradient map and chromatic component gradient map, obtains first gradient figure.
As shown in figure 3, Fig. 3 is the first gradient figure of the bank's card graphic obtained using this implementation.
Based on chrominance space used by above-mentioned images to be recognized, an available more than chromatic component image, every
Chromatic component image indicates a kind of component of the above-mentioned images to be recognized in coloration.Morphological Gradient is carried out to images to be recognized
After calculating, multiple chromatic component gradient maps are obtained, it is poor then to carry out to gray component gradient map and multiple chromatic component gradient maps
Operation obtains first gradient figure.How difference operation is carried out to gray component gradient map and multiple chromatic component gradient maps, subsequent
It is described in detail in embodiment, wouldn't repeat here.
When obtaining the gray component image and chromatic component image of images to be recognized, YCbCr color space can be used
Model obtains the Y-component of images to be recognized as gray component image, obtains Cb component and the Cr component conduct of images to be recognized
Two chromatic component images.
In this implementation, images to be recognized is divided into gray component and chromatic component, carries out Morphological Gradient respectively
It calculates, then difference operation is carried out to two kinds of obtained gradient maps.The gradient map that Morphological Gradient obtains has reacted the figure in image
Case edge, it is not abundant enough for wanting the color of content of identification, and the situation that background patterns are rich in color, this implementation can
The interference identified with weakening background patterns for determining the first image-region comprising character, Character segmentation and monocase, is improved
The accuracy of image recognition.
Based on above-mentioned implementation, in another implementation of the invention, to gray component gradient map and chromatic component
Gradient map carries out difference operation, when obtaining first gradient figure, first can carry out binary conversion treatment to chromatic component gradient map, obtain color
Spend component binary map;The pixel value for determining the first pixel in gray component gradient map again is the first presetted pixel value, obtains the
One gradient map.
First presetted pixel value are as follows: represented gradient value is less than the pixel value of preset threshold.
First pixel are as follows: corresponding for the pixel of the second presetted pixel value with pixel value in chromatic component binary map
, pixel in gray component gradient map.
Second presetted pixel value are as follows: the pixel value of background pixel point in chromatic component binary map.
When the pixel value of the first pixel is the first presetted pixel value in determining gray component gradient map, if the first picture
The pixel value of vegetarian refreshments is just originally the first presetted pixel value, then not changing pixel value, if the pixel value of the first pixel is not
For the first presetted pixel value, then the pixel value of the first pixel is changed into the first presetted pixel value.
If indicating ladder using white when gray component gradient map and chromatic component gradient map is calculated in morphology
Angle value is big, indicates that gradient value is small using black, indicates the first default picture between black and white gradient value using grey
Plain value can be so that the pixel value of black is presented in pixel.
The chromatic component binary map obtained by chromatic component gradient map binaryzation, only there are two types of pixels for pixel therein
Value: it is a kind of indicate script chromatic component gradient map in gradient value it is larger, it is a kind of indicate script chromatic component gradient map in
Gradient value it is smaller, indicate that the biggish pixel of gradient value in chromatic component gradient map indicates is identification for convenience and needs
The background patterns to be removed, so, indicate that the biggish pixel value of gradient value in the chromatic component gradient map of script is second pre-
If pixel value.
Chromatic component binary map and gray component gradient map are obtained by images to be recognized by image procossing, if obtained
The image processing process of chromatic component binary map and gray component gradient map, without the size for changing image, then with coloration
Pixel in component binary map is corresponding, the pixel in gray component gradient map, is the identical pixel of pixel coordinate
Point;If obtaining the image processing process of chromatic component binary map and gray component gradient map, figure is changed according to certain rule
The size of picture, then pixel corresponding with the pixel in chromatic component binary map, in gray component gradient map, is picture
Vegetarian refreshments coordinate is according to the corresponding pixel of above-mentioned rule.
If chromatic component image has multiple images, each image corresponds to different chromatic components, then chromatic component is terraced
Degree figure and chromatic component binary map, there is the chromatic component that multiple and each correspondence are different.In this case, the first pixel
Are as follows: it with pixel value in any chromatic component binary map is that the pixel of the second presetted pixel value is corresponding, gray component
Pixel in gradient map.For the pixel in gray component gradient map, multiple chromatic component binary maps corresponding thereto
In middle pixel, as long as soon as the pixel value for having a pixel is the second presetted pixel value, by being somebody's turn to do in gray component gradient map
Pixel is determined as the first presetted pixel value.
Such as: in gray component gradient map, the first presetted pixel value can be 0, represented by color can be black
Color;In Cb component binary map and Cr component binary map, the second presetted pixel value can be 1, represented by color can be
White, wherein Cb component binary map and Cr component binary map are chromatic component binary map, and the size and gray component of figure
Gradient map is identical;So carrying out difference operation in the present embodiment to gray component gradient map and chromatic component gradient map, can wrap
Include following steps:
Step E1: determining the coordinate for the point that pixel value is 1 in Cb component binary map and Cr component binary map respectively, as the
One coordinate and the second coordinate;
Step E2: in gray component gradient map, by the pixel value for the pixel that coordinate is the first coordinate and the second coordinate
It is determined as 0.
In this implementation, by binaryzation choose in chromatic component gradient map indicate background pixel, determine its
The pixel value of corresponding pixel is the pixel value for indicating that gradient is low in gray component gradient map, to complete gray component gradient
Difference operation between figure and chromatic component gradient map.
Based on the same inventive concept, the image-recognizing method provided according to that above embodiment of the present invention, correspondingly, the present invention
Embodiment additionally provides a kind of pattern recognition device, and structural schematic diagram is as shown in figure 4, specifically include:
Gradient distribution computing module 401 obtains first gradient for carrying out Morphological Gradient calculating to images to be recognized
Figure;
Area determination module 402, for the figure in the first gradient figure, in determining and images to be recognized where character
As the corresponding region in region, as the first image-region;
Quantity determining module 403, for determining the character quantity of character in the first image region;
Organizational systems determining module 404 determines character in the first image region for being based on the character quantity
First organizational systems;
Region obtains module 405, for being based on first organizational systems, carries out character point to the first image region
It cuts, obtains monocase region;
Recognition result obtains module 406, for carrying out character recognition to each monocase region, and then obtains described wait know
The character identification result of other image.
Pattern recognition device provided in an embodiment of the present invention can first obtain the gradient map of image, determine character in image
The region at place, then determine the quantity of character and the first organizational systems of character in image-region, word then is carried out to the region
Symbol segmentation, obtains monocase region, finally carries out character recognition respectively to each monocase region, obtain the identification knot of image
Fruit.In scheme provided in an embodiment of the present invention, the upright projection of binary map is not used to determine card number field, is not used yet
The floor projection of binary map carries out Character segmentation, but to the image of Morphological Gradient carries out Text RegionDetection, character
Length detection and the detection of character organizational systems, according to identified character organizational systems separating character, are then identified again, this
Sample can be to avoid because character zone positions, mistake is caused to identify mistake, and character quantity and character marshalling has successively been determined
Character segmentation is carried out again after mode, it can also be to avoid Character segmentation mistake, to improve the anti-interference and standard of image recognition
True rate.
In a kind of implementation of the invention, described device further include:
Result verification module, for obtaining the character recognition knot that module obtains the images to be recognized in the recognition result
After fruit, verify whether the character identification result is effective recognition result, obtains verification result.
In this implementation, whether verifying character identification result is effective recognition result.The character in image identified
Preset rule is itself had, can will be determined as effective recognition result by the recognition result of above-mentioned rule verifying, exclude
The recognition result for not meeting above-mentioned rule, can be improved the accuracy of finally obtained recognition result.
In a kind of implementation of the invention, the recognition result obtains module 406 and includes:
Recognition result obtains submodule, carries out word for obtained each monocase region to be input to character recognition model
Symbol identification, obtains the character identification result of each character zone, the first kind recognition result as each character zone, wherein
The character recognition model are as follows: that convolutional neural networks model is trained using first sample character zone in advance,
For the model of character included in detection zone, the first sample character zone are as follows: indicate one in first sample gradient map
The region of a character region, the first sample gradient map are as follows: Morphological Gradient calculating is carried out to first sample image
Obtained image;
Recognition result determines submodule, for determining the character in each monocase region based on the first kind recognition result
Recognition result.
In this implementation, each character zone is input to character recognition model and carries out character recognition, obtains each word
Accord with the character identification result in region.In this implementation, character is identified without using the low mode of this accuracy rate of pattern algorithm, and
It is to be detected using the convolutional neural networks model trained by great amount of samples to monocase region.Use great amount of samples
Convolutional neural networks are trained, convolutional neural networks study can be made to the feature of character under various backgrounds, and due to
Convolutional neural networks are trained using the character zone after progress Morphological Gradient calculating, and Morphological Gradientization calculates
Can protrude the edge in picture material, thus it is above-mentioned it is trained after convolutional neural networks model can efficiently identify image
The character of middle complex background, so as to improve the accuracy of identification character.
In a kind of implementation of the invention, the recognition result determines that submodule includes:
Candidate region determination unit, for determining each monocase region in the first image region along preset direction
Deviate the corresponding region of preset quantity pixel, the candidate region as each monocase region;
Judging result obtaining unit judges each time for obtained each candidate region to be input to character judgment models
Whether favored area is the region comprising character, obtains the character judging result of each candidate region, wherein the character judges mould
Type are as follows: in advance using the second sample character zone convolutional neural networks model is trained, for judging in region
Whether include character model, the second sample character zone are as follows: in the second sample gradient map indicate a character where
Region where region or non-character, the second sample gradient map are as follows: Morphological Gradient meter is carried out to the second sample image
Obtained image;
Correcting area determination unit determines each for the character judging result based on each candidate region obtained
Correcting area of the highest candidate region of confidence level as each candidate region in candidate region;
Recognition result obtaining unit, for the correcting area in each monocase region to be input to the character recognition model
Character recognition is carried out, the character identification result of the correcting area in each monocase region is obtained, as each monocase region
Second class recognition result;
As a result determination unit, for will be set in the first kind recognition result in each monocase region and the second class recognition result
The highest recognition result of reliability is determined as the character identification result of the character zone.
In this implementation, by by confidence in the first kind recognition result of each character zone and the second class recognition result
The final recognition result that highest recognition result is determined as the character zone is spent, can be improved the accuracy rate of identification character.And lead to
It crosses and each candidate region is input in character judgment models, export the character judging result of each candidate region, character is sentenced
The highest candidate region of confidence level can be further improved the accuracy rate of identification character as correcting area in disconnected result.In addition,
In this implementation, using the convolutional neural networks model trained by great amount of samples, to the image of Morphological Gradient
It is detected.Use the second sample that the second sample gradient map that Morphological Gradient is calculated is carried out to the second sample image
Character zone is trained neural network as sample, so that the anti-interference of character judgment models is enhanced, so that model
It can determine that complex background whether there is character in image, effectively so as to improve the accuracy of identification character.
In a kind of implementation of the invention, the quantity determining module 403 includes:
Testing result obtains submodule, for each pixel column in the first image region to be input to character respectively
The quantity that the affiliated character of pixel in each pixel column is detected in quantity detection model obtains the corresponding detection of each pixel column
As a result, wherein the character quantity detection model are as follows: in advance using each pixel column and each picture in third sample gradient map
In plain row the mark quantity of the affiliated character of pixel preset neural network model is trained, for detection pixel
The neural network model of the quantity of the affiliated character of pixel in row, the third sample gradient map are as follows: to third sample image into
The gradient map that row Morphological Gradient is calculated;
Quantity obtains submodule, for being based on obtained testing result, obtains character in the first image region
Character quantity.
In this implementation, the pixel column of the first image-region is first input to the neural network model that training obtains in advance
In, then the output based on neural network model obtains the character quantity of character in the first image-region.In this implementation, use
The neural network model trained by great amount of samples detects the first image-region.Preset kinds of characters quantity
Distinction is trained neural network as sample, and model is enabled effectively to distinguish character quantity, so as to standard
True obtains character quantity, can promote the accuracy of final recognition result.
In a kind of implementation of the invention, the organizational systems determining module 404 includes:
Model determines submodule, for determine it is corresponding with character quantity obtained, be used for detection image in character
The organizational systems detection model of organizational systems, wherein the organizational systems detection model are as follows: use the 4th sample gradient map in advance
In each pixel column and each pixel column in the affiliated character of pixel mark organizational systems to preset neural network model
The neural network model of organizational systems being trained, for character described in pixel in detection pixel row, described
Four sample gradient maps are as follows: the gradient map that Morphological Gradient is calculated is carried out to the 4th sample image;
First probability obtains submodule, is input to each pixel column in the first image region for respectively described
The organizational systems that the affiliated character of pixel in each pixel column is detected in organizational systems detection model, obtain in each pixel column
The organizational systems of the affiliated character of pixel are the probability of default organizational systems;
First calculates each picture in the first image region for being directed to each organizational systems with value computational submodule
The organizational systems of the affiliated character of pixel are the probability and value of default organizational systems in plain row;
Organizational systems determine submodule, for the maximum and corresponding organizational systems of value to be determined as the first image region
First organizational systems of interior character.
In this implementation, corresponding organizational systems detection model is first determined according to character quantity, then by the first image
The pixel column in region is input in the neural network model that training obtains in advance, and obtaining the corresponding organizational systems of each pixel column is
The probability of default organizational systems, then calculates probability and value, and the maximum and corresponding default organizational systems of value are determined as marshalling side
Formula.The first figure in this implementation, using the neural network model trained by great amount of samples, after being determined to character quantity
As region is detected.The distinction of preset difference organizational systems is trained neural network as sample, so that mould
Type can effectively distinguish different organizational systems, and coping with identical characters quantity has the case where different organizational systems, and
It can determine organizational systems, accurately so as to promote the accuracy of final recognition result.
In a kind of implementation of the invention, the region obtains module 405 and includes:
Quantity statistics submodule, the number of character pixels point in each pixel column for counting the first image region
Amount, wherein the character pixels point are as follows: belong to the pixel of character;
Distribution obtains submodule, for obtaining character in each character arrangements that organizational systems are first organizational systems
First discreet of pixel is distributed, wherein the character width of character is between predetermined width, character group in each character arrangements
Away to preset spacing, character width is different in kinds of characters arrangement and/or character group spacing is different;
Be distributed determine submodule, for determine obtains the first discreet be distributed in first be distributed between diversity factor most
Small the first discreet distribution, wherein first distribution are as follows: counted by the character pixels that the quantity counted determines
The distribution of amount;
Region obtains submodule, for being distributed corresponding character arrangements to described the according to identified first discreet
One image-region carries out Character segmentation, obtains monocase region.
In this implementation, the quantity of character pixels point in the pixel column of image to be split can be first counted, then is obtained every
The discreet distribution of character pixels point, then determines in discreet distribution and forms with the quantity counted in one character arrangements
The smallest discreet distribution of the diversity factor of distribution, is finally distributed corresponding character arrangements according to the discreet and treats segmentation figure
As carrying out Character segmentation.In this implementation, the feature in image there are character is converted to character pixels point quantity distribution number
According to the character pixels point distributed number being converted to by image to be split estimates number from corresponding to different Character segmentation parameters
Amount distribution is compared, and determines the smallest Character segmentation parameter of difference, and directly carry out Character segmentation according to default partitioning parameters
It compares, improves the accuracy of Character segmentation.
In a kind of implementation of the invention, the area determination module 402 includes:
Second probability obtains submodule, for each pixel column of the first gradient figure to be input to region inspection respectively
It surveys in model, obtains each pixel column corresponding pixel column in the images to be recognized and be located at the image-region comprising character
First probability, wherein the region detection model are as follows: in advance using each pixel column in the 5th sample gradient map to preset
The two Classification Neural models that neural network model is trained, the 5th sample gradient map are as follows: to the 5th sample
Image carries out the gradient map that Morphological Gradient is calculated;
Second and value computational submodule, for calculating each continuous first preset quantity pixel column in the first gradient figure
The first probability and value;
Region determines submodule, corresponding first preset quantity of maximum and value for determining obtained first probability
Pixel column corresponding region in the images to be recognized, as the first image-region.
In this implementation, the pixel column of first gradient figure is first input to two Classification Neurals that training obtains in advance
In model, the pixel column obtained in first gradient figure is located at the probability of the image-region comprising character, then calculates each continuous default
The probability and value of quantity pixel column, then the region by probability and where being worth maximum continuous preset quantity pixel column determines
For the first image-region comprising character.It is right using the neural network model trained by great amount of samples in this implementation
First gradient figure is detected.The distinction of character and background patterns is trained neural network as sample, so that mould
Type can effectively distinguish the character and background patterns for needing to identify, to improve the first figure determined, comprising character
As the accuracy in region.
In a kind of implementation of the invention, the gradient distribution computing module 401 includes:
Image obtains submodule, for obtaining the gray component image and chromatic component image of images to be recognized;
First gradient figure obtains submodule, for carrying out respectively to the gray component image and the chromatic component image
Morphological Gradientization calculates, and obtains gray component gradient map and chromatic component gradient map;
Second gradient map obtains submodule, for carrying out to the gray component gradient map and the chromatic component gradient map
Difference operation obtains first gradient figure.
In this implementation, images to be recognized is divided into gray component and chromatic component, carries out Morphological Gradient respectively
It calculates, then difference operation is carried out to two kinds of obtained gradient maps.The gradient map that Morphological Gradient obtains has reacted the figure in image
Case edge, it is not abundant enough for wanting the color of content of identification, and the situation that background patterns are rich in color, this implementation can
The interference identified with weakening background patterns for determining the first image-region comprising character, Character segmentation and monocase, is improved
The accuracy of image recognition.
In a kind of implementation of the invention, second gradient map obtains submodule and includes:
Image acquiring unit obtains chromatic component two-value for carrying out binary conversion treatment to the chromatic component gradient map
Figure;
Gradient map obtaining unit, for determining that the pixel value of the first pixel in the gray component gradient map is first pre-
If pixel value, first gradient figure is obtained, wherein the first presetted pixel value are as follows: represented gradient value is less than preset threshold
Pixel value, first pixel are as follows: with pixel value in the chromatic component binary map be the second presetted pixel value pixel
Pixel in corresponding, the described gray component gradient map of point, the second presetted pixel value are as follows: the chromatic component two-value
The pixel value of background pixel point in figure.
In this implementation, by binaryzation choose in chromatic component gradient map indicate background pixel, determine its
The pixel value of corresponding pixel is the pixel value for indicating that gradient is low in gray component gradient map, to complete gray component gradient
Difference operation between figure and chromatic component gradient map.
Based on the same inventive concept, the image-recognizing method provided according to that above embodiment of the present invention, correspondingly, the present invention
Embodiment additionally provides a kind of electronic equipment, as shown in figure 5, including processor 501, communication interface 502, memory 503 and leading to
Believe bus 504, wherein processor 501, communication interface 502, memory 503 complete mutual lead to by communication bus 504
Letter,
Memory 503, for storing computer program;
Processor 501 when for executing the program stored on memory 503, realizes any image in above-described embodiment
The step of recognition methods.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
Image recognition electronic equipment provided in an embodiment of the present invention can first obtain the gradient map of image, determine in image
Region where character, then determine image-region in the quantity of character and the first organizational systems of character, then to the region into
Line character segmentation, obtains monocase region, finally carries out character recognition respectively to each monocase region, obtain the identification of image
As a result.In scheme provided in an embodiment of the present invention, the upright projection of binary map is not used to determine card number field, is no longer made yet
Character segmentation is carried out with the floor projection of binary map, but Text RegionDetection, word are carried out to the image of Morphological Gradient
Length detection and the detection of character organizational systems are accorded with, according to identified character organizational systems separating character, is then identified again,
In this way can be to avoid because character zone positions, mistake is caused to identify mistake, and successively it has been determined that character quantity and character are compiled
Group mode after carry out Character segmentation again, can also to avoid Character segmentation mistake, thus improve image recognition anti-interference and
Accuracy rate.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with instruction in storage medium, when run on a computer, so that computer executes any figure in above-described embodiment
As the step of recognition methods.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it
When running on computers, so that computer executes any image recognition methods in above-described embodiment.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meter
Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or
Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or
It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with
It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk
SolidState Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device,
For electronic equipment, computer readable storage medium and computer program product embodiments, since it is substantially similar to method reality
Example is applied, so being described relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (21)
1. a kind of image-recognizing method characterized by comprising
Morphological Gradient calculating is carried out to images to be recognized, obtains first gradient figure;
In the first gradient figure, corresponding with the image-region where character in images to be recognized region is determined, as the
One image-region;
Determine the character quantity of character in the first image region;
Based on the character quantity, the first organizational systems of character in the first image region are determined;
Based on first organizational systems, Character segmentation is carried out to the first image region, obtains monocase region;
Character recognition is carried out to each monocase region, and then obtains the character identification result of the images to be recognized.
2. the method according to claim 1, wherein in the character recognition knot for obtaining the images to be recognized
After fruit, the method also includes:
Verify whether the character identification result is effective recognition result, obtains verification result.
3. the method according to claim 1, wherein it is described to each monocase region carry out character recognition, into
And obtain the character identification result of the images to be recognized, comprising:
Obtained each monocase region is input to character recognition model and carries out character recognition, obtains the word of each character zone
Accord with recognition result, the first kind recognition result as each character zone, wherein the character recognition model are as follows: use in advance
Mould that first sample character zone is trained convolutional neural networks model, for character included in detection zone
Type, the first sample character zone are as follows: the region of one character region of expression in first sample gradient map, described first
Sample gradient map are as follows: the image that Morphological Gradient is calculated is carried out to first sample image;
The character identification result in each monocase region is determined based on the first kind recognition result.
4. according to the method described in claim 3, it is characterized in that, described determine each list based on the first kind recognition result
The character identification result of character zone, comprising:
Determine that each monocase region is corresponding along preset direction offset preset quantity pixel in the first image region
Region, the candidate region as each monocase region;
Obtained each candidate region is input to character judgment models and judges whether each candidate region is the area comprising character
Domain obtains the character judging result of each candidate region, wherein the character judgment models are as follows: uses the second sample word in advance
It is that symbol region is trained convolutional neural networks model, for judge in region whether include character model, it is described
Second sample character zone are as follows: the region in the second sample gradient map where one character of expression or the region where non-character,
The second sample gradient map are as follows: the image that Morphological Gradient is calculated is carried out to the second sample image;
Based on the character judging result of each candidate region obtained, the highest candidate of confidence level in each candidate region is determined
Correcting area of the region as each candidate region;
The correcting area in each monocase region is input to the character recognition model and carries out character recognition, obtains each individual character
Accord with the character identification result of the correcting area in region, the second class recognition result as each monocase region;
The highest recognition result of confidence level in the first kind recognition result in each monocase region and the second class recognition result is true
It is set to the character identification result of the character zone.
5. the method according to claim 1, wherein in the determining the first image region character character
Quantity, comprising:
Each pixel column in the first image region is input in character quantity detection model respectively and detects each pixel
The quantity of the affiliated character of pixel in row, obtains the corresponding testing result of each pixel column, wherein the character quantity detection
Model are as follows: in advance using the mark of the affiliated character of pixel in each pixel column and each pixel column in third sample gradient map
It is that quantity is trained preset neural network model, for the quantity of the affiliated character of pixel in detection pixel row
Neural network model, the third sample gradient map are as follows: the ladder that Morphological Gradient is calculated is carried out to third sample image
Degree figure;
Based on obtained testing result, the character quantity of character in the first image region is obtained.
6. determining first figure the method according to claim 1, wherein described be based on the character quantity
As the first organizational systems of character in region, comprising:
Determine organizational systems detection moulds corresponding with character quantity obtained, for character organizational systems in detection image
Type, wherein the organizational systems detection model are as follows: use each pixel column and each pixel in the 4th sample gradient map in advance
In row the mark organizational systems of the affiliated character of pixel preset neural network model is trained, for detecting picture
The neural network model of the organizational systems of character described in pixel in plain row, the 4th sample gradient map are as follows: to the 4th sample
Image carries out the gradient map that Morphological Gradient is calculated;
Each pixel column in the first image region is input in the organizational systems detection model respectively detect it is each
The organizational systems of the affiliated character of pixel in pixel column, the organizational systems for obtaining the affiliated character of pixel in each pixel column are
The probability of default organizational systems;
For each organizational systems, the marshalling side of the affiliated character of pixel in each pixel column in the first image region is calculated
Formula is the probability and value of default organizational systems;
The maximum and corresponding organizational systems of value are determined as to the first organizational systems of character in the first image region.
7. the method according to claim 1, wherein described be based on first organizational systems, to described first
Image-region carries out Character segmentation, obtains monocase region, comprising:
Count the quantity of character pixels point in each pixel column in the first image region, wherein the character pixels point are as follows:
Belong to the pixel of character;
Obtain the first discreet minute of character pixels point in each character arrangements that organizational systems are first organizational systems
Cloth, wherein the character width of character is predetermined width in each character arrangements, character group spacing is default spacing, kinds of characters
Character width is different in arrangement and/or character group spacing is different;
It determines and obtains the smallest first discreet distribution of diversity factor between the first distribution in the distribution of the first discreet,
In, first distribution are as follows: by the distribution for the character pixels point quantity that the quantity counted determines;
Corresponding character arrangements are distributed according to identified first discreet, and Character segmentation is carried out to the first image region,
Obtain monocase region.
8. the method according to claim 1, wherein described in the first gradient figure, it is determining with it is to be identified
The corresponding region of image-region in image where character, as the first image-region, comprising:
Each pixel column of the first gradient figure is input in region detection model respectively, obtains each pixel column in institute
State the first probability that corresponding pixel column in images to be recognized is located at the image-region comprising character, wherein the region detection
Model are as follows: preset neural network model is trained using each pixel column in the 5th sample gradient map in advance
Two Classification Neural models, the 5th sample gradient map are as follows: Morphological Gradient is carried out to the 5th sample image and is calculated
The gradient map arrived;
Calculate the first probability of each continuous first preset quantity pixel column in the first gradient figure and value;
The maximum and the corresponding first preset quantity pixel column of value for determining obtained first probability are in the images to be recognized
In corresponding region, as the first image-region.
9. method according to claim 1 to 8, which is characterized in that described to carry out morphology to images to be recognized
Gradient distribution calculates, and obtains first gradient figure, comprising:
Obtain the gray component image and chromatic component image of images to be recognized;
Morphological Gradient calculating is carried out to the gray component image and the chromatic component image respectively, obtains gray component
Gradient map and chromatic component gradient map;
Difference operation is carried out to the gray component gradient map and the chromatic component gradient map, obtains first gradient figure.
10. according to the method described in claim 9, it is characterized in that, described to the gray component gradient map and the coloration
Component gradient map carries out difference operation, obtains first gradient figure, comprising:
Binary conversion treatment is carried out to the chromatic component gradient map, obtains chromatic component binary map;
The pixel value for determining the first pixel in the gray component gradient map is the first presetted pixel value, obtains first gradient
Figure, wherein the first presetted pixel value are as follows: represented gradient value is less than the pixel value of preset threshold, first pixel
Point are as follows: corresponding, the described gray scale is divided with pixel value in the chromatic component binary map for the pixel of the second presetted pixel value
Measure the pixel in gradient map, the second presetted pixel value are as follows: the pixel of background pixel point in the chromatic component binary map
Value.
11. a kind of pattern recognition device characterized by comprising
Gradient distribution computing module obtains first gradient figure for carrying out Morphological Gradient calculating to images to be recognized;
Area determination module, for the image-region in the first gradient figure, in determining and images to be recognized where character
Corresponding region, as the first image-region;
Quantity determining module, for determining the character quantity of character in the first image region;
Organizational systems determining module determines that first of character in the first image region is compiled for being based on the character quantity
Group mode;
Region obtains module, for being based on first organizational systems, carries out Character segmentation to the first image region, obtains
Monocase region;
Recognition result obtains module, for carrying out character recognition to each monocase region, and then obtains the images to be recognized
Character identification result.
12. device according to claim 11, which is characterized in that described device further include:
Result verification module, for the recognition result obtain module obtain the images to be recognized character identification result it
Afterwards, verify whether the character identification result is effective recognition result, obtain verification result.
13. device according to claim 11, which is characterized in that the recognition result obtains module and includes:
Recognition result obtains submodule, carries out character knowledge for obtained each monocase region to be input to character recognition model
Not, the character identification result for obtaining each character zone, the first kind recognition result as each character zone, wherein described
Character recognition model are as follows: in advance using first sample character zone convolutional neural networks model is trained, be used for
The model of character included in detection zone, the first sample character zone are as follows: a word is indicated in first sample gradient map
Accord with the region of region, the first sample gradient map are as follows: Morphological Gradient is carried out to first sample image and is calculated
Image;
Recognition result determines submodule, for determining the character recognition in each monocase region based on the first kind recognition result
As a result.
14. device according to claim 13, which is characterized in that the recognition result determines that submodule includes:
Candidate region determination unit, for determining that each monocase region deviates in the first image region along preset direction
The corresponding region of preset quantity pixel, the candidate region as each monocase region;
Judging result obtaining unit judges each candidate regions for obtained each candidate region to be input to character judgment models
Whether domain is the region comprising character, obtains the character judging result of each candidate region, wherein the character judgment models
Are as follows: it is that convolutional neural networks model is trained using the second sample character zone in advance, for judging be in region
The no model comprising character, the second sample character zone are as follows: the area where a character is indicated in the second sample gradient map
Region where domain or non-character, the second sample gradient map are as follows: Morphological Gradient calculating is carried out to the second sample image
Obtained image;
Correcting area determination unit determines each candidate for the character judging result based on each candidate region obtained
Correcting area of the highest candidate region of confidence level as each candidate region in region;
Recognition result obtaining unit is carried out for the correcting area in each monocase region to be input to the character recognition model
Character recognition obtains the character identification result of the correcting area in each monocase region, second as each monocase region
Class recognition result;
As a result determination unit, for by confidence level in the first kind recognition result in each monocase region and the second class recognition result
Highest recognition result is determined as the character identification result of the character zone.
15. device according to claim 11, which is characterized in that the quantity determining module includes:
Testing result obtains submodule, for each pixel column in the first image region to be input to character quantity respectively
The quantity that the affiliated character of pixel in each pixel column is detected in detection model obtains the corresponding detection knot of each pixel column
Fruit, wherein the character quantity detection model are as follows: use each pixel column and each pixel in third sample gradient map in advance
In row the mark quantity of the affiliated character of pixel preset neural network model is trained, for detection pixel row
The neural network model of the quantity of the middle affiliated character of pixel, the third sample gradient map are as follows: third sample image is carried out
The gradient map that Morphological Gradient is calculated;
Quantity obtains submodule, for being based on obtained testing result, obtains the character of character in the first image region
Quantity.
16. device according to claim 11, which is characterized in that the organizational systems determining module includes:
Model determines submodule, for determine it is corresponding with character quantity obtained, organized into groups for character in detection image
The organizational systems detection model of mode, wherein the organizational systems detection model are as follows: in advance using in the 4th sample gradient map
The mark organizational systems of the affiliated character of pixel carry out preset neural network model in each pixel column and each pixel column
The neural network model of organizational systems that training obtains, for character described in pixel in detection pixel row, the 4th sample
This gradient map are as follows: the gradient map that Morphological Gradient is calculated is carried out to the 4th sample image;
First probability obtains submodule, for each pixel column in the first image region to be input to the marshalling respectively
The organizational systems that the affiliated character of pixel in each pixel column is detected in mode detection model, obtain pixel in each pixel column
The organizational systems of character belonging to point are the probability of default organizational systems;
First calculates each pixel column in the first image region for being directed to each organizational systems with value computational submodule
The organizational systems of the middle affiliated character of pixel are the probability and value of default organizational systems;
Organizational systems determine submodule, for the maximum and corresponding organizational systems of value to be determined as word in the first image region
First organizational systems of symbol.
17. device according to claim 11, which is characterized in that the region obtains module and includes:
Quantity statistics submodule, the quantity of character pixels point in each pixel column for counting the first image region,
In, the character pixels point are as follows: belong to the pixel of character;
Distribution obtains submodule, for obtaining character pixels in each character arrangements that organizational systems are first organizational systems
The first discreet distribution of point, wherein the character width of character is predetermined width in each character arrangements, character group spacing is
Spacing is preset, character width is different in kinds of characters arrangement and/or character group spacing is different;
Be distributed determine submodule, for determine obtains the first discreet be distributed in first be distributed between diversity factor it is the smallest
First discreet distribution, wherein first distribution are as follows: the character pixels point quantity determined by the quantity counted
Distribution;
Region obtains submodule, for being distributed corresponding character arrangements to first figure according to identified first discreet
As region progress Character segmentation, monocase region is obtained.
18. device according to claim 11, which is characterized in that the area determination module includes:
Second probability obtains submodule, for each pixel column of the first gradient figure to be input to region detection mould respectively
In type, obtains each pixel column corresponding pixel column in the images to be recognized and be located at first of the image-region comprising character
Probability, wherein the region detection model are as follows: in advance using each pixel column in the 5th sample gradient map to preset nerve
The two Classification Neural models that network model is trained, the 5th sample gradient map are as follows: to the 5th sample image
Carry out the gradient map that Morphological Gradient is calculated;
Second and value computational submodule, for calculating the of each continuous first preset quantity pixel column in the first gradient figure
One probability and value;
Region determines submodule, for determining the maximum and the corresponding first preset quantity pixel of value of obtained first probability
Row region corresponding in the images to be recognized, as the first image-region.
19. device described in any one of 1-18 according to claim 1, which is characterized in that the gradient distribution computing module includes:
Image obtains submodule, for obtaining the gray component image and chromatic component image of images to be recognized;
First gradient figure obtains submodule, for carrying out form to the gray component image and the chromatic component image respectively
It learns gradient distribution to calculate, obtains gray component gradient map and chromatic component gradient map;
Second gradient map obtains submodule, for carrying out poor fortune to the gray component gradient map and the chromatic component gradient map
It calculates, obtains first gradient figure.
20. device according to claim 19, which is characterized in that second gradient map obtains submodule and includes:
Image acquiring unit obtains chromatic component binary map for carrying out binary conversion treatment to the chromatic component gradient map;
Gradient map obtaining unit, for determining that the pixel value of the first pixel in the gray component gradient map is the first default picture
Element value, obtains first gradient figure, wherein the first presetted pixel value are as follows: represented gradient value is less than the picture of preset threshold
Element value, first pixel are as follows: be the pixel phase of the second presetted pixel value with pixel value in the chromatic component binary map
Pixel in corresponding, the described gray component gradient map, the second presetted pixel value are as follows: in the chromatic component binary map
The pixel value of background pixel point.
21. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and step of claim 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811563632.3A CN109740606B (en) | 2018-12-20 | 2018-12-20 | Image identification method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811563632.3A CN109740606B (en) | 2018-12-20 | 2018-12-20 | Image identification method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109740606A true CN109740606A (en) | 2019-05-10 |
CN109740606B CN109740606B (en) | 2021-02-05 |
Family
ID=66360716
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811563632.3A Active CN109740606B (en) | 2018-12-20 | 2018-12-20 | Image identification method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109740606B (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110348449A (en) * | 2019-07-10 | 2019-10-18 | 电子科技大学 | A kind of identity card character recognition method neural network based |
CN111291794A (en) * | 2020-01-21 | 2020-06-16 | 上海眼控科技股份有限公司 | Character recognition method, character recognition device, computer equipment and computer-readable storage medium |
CN111340040A (en) * | 2020-02-26 | 2020-06-26 | 五八有限公司 | Paper character recognition method and device, electronic equipment and storage medium |
CN111583159A (en) * | 2020-05-29 | 2020-08-25 | 北京金山云网络技术有限公司 | Image completion method and device and electronic equipment |
CN111582259A (en) * | 2020-04-10 | 2020-08-25 | 支付宝实验室(新加坡)有限公司 | Machine-readable code identification method and device, electronic equipment and storage medium |
CN112215236A (en) * | 2020-10-21 | 2021-01-12 | 科大讯飞股份有限公司 | Text recognition method and device, electronic equipment and storage medium |
CN112381057A (en) * | 2020-12-03 | 2021-02-19 | 上海芯翌智能科技有限公司 | Handwritten character recognition method and device, storage medium and terminal |
WO2024027854A1 (en) * | 2022-08-05 | 2024-02-08 | 顺丰科技有限公司 | Method and apparatus for determining number of express items, and electronic device and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5787194A (en) * | 1994-11-08 | 1998-07-28 | International Business Machines Corporation | System and method for image processing using segmentation of images and classification and merging of image segments using a cost function |
WO2009040922A1 (en) * | 2007-09-27 | 2009-04-02 | Glory Ltd. | Paper sheet processor |
CN101408941A (en) * | 2008-10-20 | 2009-04-15 | 中国科学院遥感应用研究所 | Method for multi-dimension segmentation of remote sensing image and representation of segmentation result hierarchical structure |
CN104616009A (en) * | 2015-02-13 | 2015-05-13 | 广州广电运通金融电子股份有限公司 | Character cutting and recognizing method |
CN105354574A (en) * | 2015-12-04 | 2016-02-24 | 山东博昂信息科技有限公司 | Vehicle number recognition method and device |
CN105426891A (en) * | 2015-12-14 | 2016-03-23 | 广东安居宝数码科技股份有限公司 | Image-based vehicle license plate character segmentation method and system |
CN107305630A (en) * | 2016-04-25 | 2017-10-31 | 腾讯科技(深圳)有限公司 | Text sequence recognition methods and device |
CN107832756A (en) * | 2017-10-24 | 2018-03-23 | 讯飞智元信息科技有限公司 | Express delivery list information extracting method and device, storage medium, electronic equipment |
-
2018
- 2018-12-20 CN CN201811563632.3A patent/CN109740606B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5787194A (en) * | 1994-11-08 | 1998-07-28 | International Business Machines Corporation | System and method for image processing using segmentation of images and classification and merging of image segments using a cost function |
WO2009040922A1 (en) * | 2007-09-27 | 2009-04-02 | Glory Ltd. | Paper sheet processor |
CN101408941A (en) * | 2008-10-20 | 2009-04-15 | 中国科学院遥感应用研究所 | Method for multi-dimension segmentation of remote sensing image and representation of segmentation result hierarchical structure |
CN104616009A (en) * | 2015-02-13 | 2015-05-13 | 广州广电运通金融电子股份有限公司 | Character cutting and recognizing method |
CN105354574A (en) * | 2015-12-04 | 2016-02-24 | 山东博昂信息科技有限公司 | Vehicle number recognition method and device |
CN105426891A (en) * | 2015-12-14 | 2016-03-23 | 广东安居宝数码科技股份有限公司 | Image-based vehicle license plate character segmentation method and system |
CN107305630A (en) * | 2016-04-25 | 2017-10-31 | 腾讯科技(深圳)有限公司 | Text sequence recognition methods and device |
CN107832756A (en) * | 2017-10-24 | 2018-03-23 | 讯飞智元信息科技有限公司 | Express delivery list information extracting method and device, storage medium, electronic equipment |
Non-Patent Citations (1)
Title |
---|
章卫祥 等: "一种基于梯度域的彩色图像转灰度图像的方法", 《影像技术》 * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110348449B (en) * | 2019-07-10 | 2023-04-18 | 电子科技大学 | Neural network-based identification card character recognition method |
CN110348449A (en) * | 2019-07-10 | 2019-10-18 | 电子科技大学 | A kind of identity card character recognition method neural network based |
CN111291794A (en) * | 2020-01-21 | 2020-06-16 | 上海眼控科技股份有限公司 | Character recognition method, character recognition device, computer equipment and computer-readable storage medium |
CN111340040A (en) * | 2020-02-26 | 2020-06-26 | 五八有限公司 | Paper character recognition method and device, electronic equipment and storage medium |
CN111340040B (en) * | 2020-02-26 | 2023-09-12 | 五八有限公司 | Paper character recognition method and device, electronic equipment and storage medium |
CN111582259B (en) * | 2020-04-10 | 2024-04-16 | 支付宝实验室(新加坡)有限公司 | Machine-readable code identification method, device, electronic equipment and storage medium |
CN111582259A (en) * | 2020-04-10 | 2020-08-25 | 支付宝实验室(新加坡)有限公司 | Machine-readable code identification method and device, electronic equipment and storage medium |
CN111583159B (en) * | 2020-05-29 | 2024-01-05 | 北京金山云网络技术有限公司 | Image complement method and device and electronic equipment |
CN111583159A (en) * | 2020-05-29 | 2020-08-25 | 北京金山云网络技术有限公司 | Image completion method and device and electronic equipment |
CN112215236A (en) * | 2020-10-21 | 2021-01-12 | 科大讯飞股份有限公司 | Text recognition method and device, electronic equipment and storage medium |
CN112215236B (en) * | 2020-10-21 | 2024-04-16 | 科大讯飞股份有限公司 | Text recognition method, device, electronic equipment and storage medium |
CN112381057A (en) * | 2020-12-03 | 2021-02-19 | 上海芯翌智能科技有限公司 | Handwritten character recognition method and device, storage medium and terminal |
WO2024027854A1 (en) * | 2022-08-05 | 2024-02-08 | 顺丰科技有限公司 | Method and apparatus for determining number of express items, and electronic device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109740606B (en) | 2021-02-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109740606A (en) | A kind of image-recognizing method and device | |
CN109658584B (en) | Bill information identification method and device | |
CN108549870A (en) | A kind of method and device that article display is differentiated | |
CN109343920B (en) | Image processing method and device, equipment and storage medium thereof | |
CN107622489A (en) | A kind of distorted image detection method and device | |
CN105069811A (en) | Multi-temporal remote sensing image change detection method | |
CN108197644A (en) | A kind of image-recognizing method and device | |
CN110738216A (en) | Medicine identification method based on improved SURF algorithm | |
Hou et al. | Detection of hue modification using photo response nonuniformity | |
CN109389110B (en) | Region determination method and device | |
US20200005078A1 (en) | Content aware forensic detection of image manipulations | |
CN110942473A (en) | Moving target tracking detection method based on characteristic point gridding matching | |
CN107403179A (en) | A kind of register method and device of article packaged information | |
CN113158895A (en) | Bill identification method and device, electronic equipment and storage medium | |
CN110738204B (en) | Certificate area positioning method and device | |
CN105190689A (en) | Image processing including adjoin feature based object detection, and/or bilateral symmetric object segmentation | |
CN109726722B (en) | Character segmentation method and device | |
CN107533748A (en) | Component kind automatic distinguishing method, component kind automatic discrimination system, image procossing generate system with component data generation method and image procossing component data | |
CN109583492A (en) | A kind of method and terminal identifying antagonism image | |
CN109636838A (en) | A kind of combustion gas Analysis of Potential method and device based on remote sensing image variation detection | |
CN115082713A (en) | Method, system and equipment for extracting target detection frame by introducing space contrast information | |
Arias et al. | Efficient extraction of primitives from line drawings composed of horizontal and vertical lines | |
CN115374517A (en) | Testing method and device for wiring software, electronic equipment and storage medium | |
CN114495135A (en) | Bill identification method and device | |
CN114743048A (en) | Method and device for detecting abnormal straw picture |
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 |