EP3163502A1 - Method and device for region identification - Google Patents
Method and device for region identification Download PDFInfo
- Publication number
- EP3163502A1 EP3163502A1 EP16195027.4A EP16195027A EP3163502A1 EP 3163502 A1 EP3163502 A1 EP 3163502A1 EP 16195027 A EP16195027 A EP 16195027A EP 3163502 A1 EP3163502 A1 EP 3163502A1
- Authority
- EP
- European Patent Office
- Prior art keywords
- abscissa
- histogram
- threshold
- words
- abscissas
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
- G06V10/267—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/148—Segmentation of character regions
- G06V30/153—Segmentation of character regions using recognition of characters or words
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/41—Analysis of document content
- G06V30/414—Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/50—Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
- G06V10/507—Summing image-intensity values; Histogram projection analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/758—Involving statistics of pixels or of feature values, e.g. histogram matching
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/146—Aligning or centring of the image pick-up or image-field
- G06V30/1475—Inclination or skew detection or correction of characters or of image to be recognised
- G06V30/1478—Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/28—Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet
- G06V30/287—Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet of Kanji, Hiragana or Katakana characters
Definitions
- the present disclosure generally relates to image processing, and more particularly to a method and device for region identification.
- a terminal may have to identify a character region of each word firstly.
- a method for region identification including: removing, by a terminal, a background in an image, to extract a foreground image; identifying, with an edge enhancement technology, an edge of each word in the extracted foreground image; and determining a character region of each word according to the identified edge of each word.
- accuracy of the determined character region may be relatively low, since the edge enhancement technology may only provide a rough location.
- a method for region identification including: binarizing a word region, to obtain a binarized word region, wherein the word region includes several words belonging to a same row; calculating a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identifying a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- the above identifying step may include: determining several sets of abscissas according to the distribution information of accumulated values in the histogram, wherein each of the several sets of abscissas includes a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to the first abscissa are larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa is smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the second abscissa is smaller
- the step of determining several sets of abscissas according to the distribution information of accumulated values in the histogram may include: identifying a third abscissa in the histogram according to the distribution information of accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words; and searching, starting with the third abscissa in a predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas.
- the step of searching, starting with the third abscissa in the predetermined direction and based on the distribution information of the accumulated values, the several sets of abscissas includes: for an i th set of abscissas, searching, starting with the first abscissa within the i th set of abscissas in the histogram and in a direction towards right, a fourth abscissa, wherein accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the fourth abscissa is smaller than the second threshold; wherein 1 ⁇ i ⁇ n
- the step of searching, starting with the third abscissa in the predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas includes: for a j th set of abscissas, searching, starting with the second abscissa within the j th set of abscissas in the histogram and in a direction towards left, a sixth abscissa, wherein accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to the sixth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa is smaller than the second threshold; 1 ⁇ j ⁇ n
- the step of identifying the third abscissa in the histogram according to the distribution information of accumulated values may include: in case that the several words comprise both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, looking up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determining, an abscissa located on the right side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is
- the step of identifying the third abscissa in the histogram according to the distribution information of accumulated values may include: in case that the several words includes both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, looking up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determining, an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second
- the method may further include: binarizing a targeted image region, to obtain a binarized targeted image region; calculating, in a horizontal direction, a horizontal histogram for a binarized targeted image region, wherein the horizontal histogram includes: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row; determining, according to distribution information of the accumulated values in the horizontal histogram, several sets of ordinates, wherein each of the several sets of ordinates includes a first ordinate and a second ordinate located below the first ordinate; and for each of the several sets of ordinates, identifying a pixel row where the first ordinate is located as an upper edge of a row of words, and identifying a pixel row where the second ordinate is located as a lower edge of the row of words; accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa are larger than the first threshold, and an accumulated value corresponding to an an
- the steps of the method for region identification are determined by computer program instructions.
- the invention is also directed to a computer program for executing the steps of a method for region identification as defined above when this program is executed by a computer.
- This program can use any programming language and take the form of source code, object code or a code intermediate between source code and object code, such as a partially compiled form, or any other desirable form.
- the invention is also directed to a computer-readable information medium containing instructions of a computer program as described above.
- the information medium can be any entity or device capable of storing the program.
- the support can include storage means such as a ROM, for example a CD ROM or a microelectronic circuit ROM, or magnetic storage means, for example a diskette (floppy disk) or a hard disk.
- the information medium can be an integrated circuit in which the program is incorporated, the circuit being adapted to execute the method in question or to be used in its execution.
- a device for region identification including: a first binarization module, configured to binarize a word region to obtain a binarized word region, wherein the word region comprises several words belonging to a same row; a first calculation module, configured to calculate, in a vertical direction, a histogram for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and a region identification module, configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- the region identification module may include: a coordinate determination sub-module, configured to determine several sets of abscissas according to the distribution information of accumulated values in the histogram, wherein each of the several sets of abscissas includes a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to the first abscissa are larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa is smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the
- the coordinate determination sub-module may include: a coordinate identification sub-module, configured to identify a third abscissa in the histogram according to the distribution information of accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words; and a coordinate search sub-module, configured to search, starting with the third abscissa, in a predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas.
- a coordinate identification sub-module configured to identify a third abscissa in the histogram according to the distribution information of accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of
- the coordinate search sub-module is further configured to: for an i th set of abscissas, search, starting with the first abscissa within the i th set of abscissas in the histogram, and in a direction towards right, a fourth abscissa, wherein accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to fourth abscissa is smaller than the second threshold; wherein 1 ⁇ i ⁇ n, i is a positive integer of which an initial value is 1, and n is a number of valid words in the several words; and the first
- the coordinate search sub-module is further configured to: for a j th set of abscissas, search starting with the second abscissa within the j th set of abscissas in the histogram, and in a direction towards left, a sixth abscissa, wherein accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to sixth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa is smaller than the second threshold; 1 ⁇ j ⁇ n, j is a positive integer of which an initial value is n, and n is a number of valid words in the several words; and the
- the coordinate identification sub-module is further configured to: in case that the several words include both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine, an abscissa located on the right side of the interval and of which an accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; or in case that the several words are all valid words, determine
- the coordinate identification sub-module is further configured to: in case that the several words include both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, look up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determine, an abscissa located on the left side of the interval and of which an accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; or in case that the several words are all valid words, determine a first one
- the device may further include: a second binarization module, configured to binarize a targeted image region, to obtain a binarized targeted image region; a second calculation module, configured to calculate, in a horizontal direction, a horizontal histogram for a binarized targeted image region, wherein the horizontal histogram includes: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row; and an edge determination module, configured to determine, according to distribution information of accumulated values in the horizontal histogram, several sets of ordinates, wherein each of the several sets of ordinates includes a first ordinate and a second ordinate located below the first ordinate; and for each of the several sets of ordinates, identify a pixel row where the first ordinate is located as an upper edge of a row of words, and identify a pixel row where the second ordinate is located as a lower edge of the row of words; accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abs
- a device for region identification including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to: binarize a word region, to obtain a binarized word region, wherein the word region includes several words belonging to a same row; calculate a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- Embodiments of the disclosure may solve the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- a word region may include several words belonging to a same row.
- the word region may be a region in a credential image, or a region in a scanned image of article, or a region in an electronic document; and the embodiment is not limited thereto. Additionally, in the embodiment, a top edge of the word region is between a top edge of words in the same row and a bottom edge of words in a previous row; and a bottom edge of the word region is between a bottom edge of words in the same row and a top edge of words in a next row.
- the word region is a region containing a citizen identity card number included in a same row on a second-generation identity card as an example, referring to Fig. 1 , the top edge of the word region is between / 1 and / 2 ; and the bottom edge of the word region is between / 3 and / 4 .
- the word region is region 11 as shown in Fig.1 .
- Words in the word region may be all valid words, or may be a combination of valid words and invalid words.
- a character region for each of the valid words needs to be identified; however a character region for each of the invalid words needs not to be identified.
- words in the word region may only include numerals included therein, i.e., "3 3 0 4 2 1 1 9 9 0 1 2 1 6 2 8 3 4", or may include at least one character located on the left of the numerals, in addition to the numerals ("3 3 0 4 2 1 1 9 9 0 1 2 1 6 2 8 3 4"), for example words in the word region are "number 3 3 0 4 2 1 1 9 9 0 1 2 1 6 2 8 3 4".
- the character region refers to a region corresponding to a single word.
- words referred to in various embodiments of the disclosure may be numerals, letters, characters, pictures, or other contents for which a number of foreground color pixels is larger than a threshold in a calculated histogram.
- Fig. 2 is a flow chart illustrating a method for region identification, implemented by a terminal (or device), according to an exemplary embodiment. As shown in Fig. 2 , the method for region identification may include following steps.
- a word region may be binarized, to obtain a binarized word region.
- the word region may include several words belonging to a same row.
- a histogram may be calculated in a vertical direction for the binarized word region.
- the histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column.
- a character region of each of the words in the word region may be identified, according to distribution information of accumulated values in the histogram.
- the method for region identification solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- Fig. 3A is a flow chart illustrating a method for region identification, implemented by a device, according to another exemplary embodiment. As shown in Fig. 3 , the method for region identification may include following steps.
- a word region may be binarized, to obtain a binarized word region.
- the word region may include several words belonging to a same row.
- a terminal may preprocess the word region, in which preprocesses may include: operations such as denoising, filtering, abstraction a edge and the like; the preprocessed word region may be binarized.
- Binarization means to compare grey level values of pixels in the word region with a predetermined grey level value; divide the pixels in the word region into two portions: a group of pixels for each of which the grey level value is larger than the predetermined grey level value and a group of pixels for each of which the grey level value is smaller than the predetermined grey level value; and rending the two groups of pixels in the word region with two different colors, such as black and white, to obtain the binarized word region, as shown in Fig. 3B .
- pixels located in a foreground color may be called foreground color pixels, i.e., white pixels in Fig. 3B
- pixels located in a background color may be called background color pixels, i.e., black pixels in Fig. 3B .
- a histogram may be calculated in a vertical direction for the binarized word region.
- the histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column.
- the histogram may be calculated in the vertical direction after the binarization of the word region.
- the horizontal direction of the histogram may represent the abscissas of pixels in each column, and the vertical direction of the histogram may represent an accumulated value of a number of the foreground color pixels of the pixels in each column; wherein the foreground color pixels refer to pixels in a white region of the binarized word region, with respect to background color pixels.
- the terminal may calculate the histogram.
- step 303 several sets of abscissas may be determined according to the distribution information of accumulated values in the histogram.
- step 303 may include following steps.
- a third abscissa may be identified in the histogram according to the distribution information of accumulated values.
- the third abscissa may be an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words.
- the valid words in the word region may be the citizen identity card number in Fig. 1 for an example, referring to Fig. 3E , the third abscissa may be the abscissa X 1 in the histogram corresponding to a left edge of the first valid word "3", or the abscissa X 2 corresponding to a right edge of the last valid word "4".
- step 303b started with the third abscissa, the several sets of abscissas are searched in a predetermined direction and based on the distribution information of accumulated values.
- the terminal may search, starting with the third abscissa, the several sets of abscissas in the predetermined direction and based on the distribution information of accumulated values.
- the predetermined direction is a direction towards right; and in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word, the predetermined direction is a direction towards left.
- a number of sets of the abscissas may correspond to the number of valid words in the word region, i.e., each set of abscissas may include a first abscissa in the histogram corresponding to a left edge of a character region of one valid word and a second abscissa in the histogram corresponding to the left edge of the character region of the valid word. That is to say, each set of abscissas may include the first abscissa and a second abscissa located on the right side of the first abscissa.
- Accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to first abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa may be smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to second abscissa may be smaller than the second threshold.
- the terminal may identify each of the sets of abscissas as shown in Fig. 3F .
- Fig. 3F is only an exemplary illustration showing several of the identified sets of abscissas, and in practice more sets of abscissas may be included; and the embodiment is not limited thereto.
- first threshold and second threshold may have relatively small numerical values.
- the first threshold and second threshold may have numerical values slightly more than 0.
- the first threshold may be 0 and the second threshold may have a numerical value approximate to 0.
- the accumulated values respectively corresponding to the first abscissa and the abscissa on the right side of and adjacent to first abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the left side of and adjacent to the first abscissa may equal to 0; and the accumulated values respectively corresponding to the second abscissa and the abscissa on the left side of and adjacent to the second abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the right side of and adjacent to second abscissa may equal to 0.
- a pixel column where the first abscissa is located may be identified as a left edge of a character region, and a pixel column where the second abscissa is located may be identified as a right edge of the character region.
- the method for region identification solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- step 303a may include following steps.
- the terminal may look up, in a direction towards left, an interval which is the first interval of which a width is larger than the second distance; and the terminal may determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa.
- the predetermined abscissa may be an abscissa among a predetermined range, which is a mapping range in the histogram corresponding to the valid words in the word region. For example, taking that the valid words are the citizen identity card number, in connection with Fig. 3E , the predetermined range is the range [ X 1 , X 2 ] in Fig. 3E . Generally, the predetermined range may be set according to an empirical value. Further, an accumulated value of foreground color pixels in the interval may be smaller than a second threshold.
- the predetermined abscissa may be an abscissa in the histogram corresponding to a middle location in a horizontal direction of the second-generation identity card, since the middle location in a horizontal direction of the second-generation identity card may certainly be among the citizen identity card number.
- the predetermined abscissa may be X 0 as shown in Fig. 3G .
- the terminal may look up, starting with X 0 and in the direction towards left.
- the terminal may determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa, i.e., the third abscissa X 1 is determined.
- the terminal may look up, starting with the predetermined abscissa and in the direction towards left as an example. Similarly, the terminal may look up, starting with the predetermined abscissa and in the direction towards right, and after looking up an interval larger than the second distance, determine an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa. This case would not be detailed in the embodiment.
- step 303a may include following steps.
- the terminal after calculating the histogram for the binarized word region, wherein a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, may be determined as an abscissas in the histogram corresponding to the first valid word, the terminal then may determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa.
- the terminal may determine X 1 as the third abscissa.
- a first one of abscissas on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold may be determined as an abscissas in the histogram corresponding to the last valid word. Therefore, the terminal then may determine the first one of the abscissas on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa. Still referring to Fig. 3H , the terminal may determine X 2 as the third abscissa.
- step 303b may be replaced with steps 401-404.
- a fourth abscissa may be searched in a direction towards right.
- n is a number of valid words in several words.
- the valid words may be a citizen identity card number in a second-generation identity card as an example, the number of valid words is 18.
- the first abscissa in the first set of abscissas may be the third abscissa.
- accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to fourth abscissa may be smaller than a second threshold.
- the first abscissa x 1 in the first set of abscissas may be the third abscissa X 1 the terminal mat search, starting with X 1 in the histogram and in a direction towards left, to determine a first fourth abscissa.
- the fourth abscissa may be determined as the second abscissa within the i th set of abscissas.
- step 403 if i ⁇ n, started with the fourth abscissa in the histogram, a fifth abscissa may be searched in the direction towards right.
- the terminal may determine that there may be at least one valid word in the right side for which a character region has not been identified.
- the terminal may search, starting with an abscissa in the histogram corresponding to the right edge of the currently determined character region of a valid word and in the direction towards right, an abscissa in the histogram corresponding to a left edge of a character region of a next valid word.
- the terminal may search, start with the fourth abscissa in the histogram and in the direction towards right, a first fifth abscissa.
- Accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to fifth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa may be smaller than a second threshold.
- the terminal may continue to search in the direction towards right, to determine a set of abscissas corresponding to the character region of each of the valid words according to the above method.
- step 303b may be replaced with steps 501-504.
- a sixth abscissa may be searched in a direction towards left.
- Accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to sixth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa may be smaller than a second threshold; wherein 1 ⁇ j ⁇ n, j is a positive integer whose initial value is n, and n is a number of valid words in several words; and the second abscissa within the n th set of abscissas may be the third abscissa.
- the sixth abscissa may be determined as the first abscissa within the j th set of abscissas.
- a seventh abscissa may be searched in the direction towards left. Accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the seventh abscissa may be smaller than a second threshold; wherein 1 ⁇ j ⁇ n, j is a positive integer whose initial value is n.
- the seventh abscissa may be determined as the second abscissa within the j th set of abscissas.
- steps 501-504 may be similar to steps 401-404; a different between them may be that the method provided in steps 401-404 includes a search starting at the left side and going towards right, while the method provided in steps 501-504 includes a search starting at the right side and going towards left.
- the embodiment would not be detailed herein.
- the terminal may further perform following steps.
- a targeted image region may be binarized, such that a binarized targeted image region may be obtained.
- the targeted image region may be a region including several rows of words.
- Step 601 may be similar to step 301 in the above embodiment, and thus detailed technical specification may refer to the above embodiment, which would not be limited in the present embodiment.
- a horizontal histogram may be calculated in a horizontal direction for a binarized targeted image region.
- the horizontal histogram may include: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row.
- Step 602 may be similar to step 302 in the above embodiment; a difference between them may be that in step 302 the histogram may be calculated in the vertical direction for the binarized word region, while in step 602 the histogram may be calculated in the horizontal direction for a binarized targeted image region.
- each set of ordinates may include a first ordinate and a second ordinate located below the first ordinate.
- a pixel row where the first ordinate may be located may be determined as the upper edge of a row of words
- a pixel row where the second ordinate may be located may be determined as the lower edge of the row of words.
- the terminal may determine the several sets of ordinates according to the distribution information of accumulated values in the histogram; and then determine a region for each row according to each of the several sets of ordinates.
- the step may be similar to the step of determining several sets of abscissas according to the distribution information of accumulated values in the vertical histogram, and then determining the left edge and the right edge of each word according to each of the several sets of abscissas.
- Detailed technical specification may refer to the above embodiment.
- Accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa may be larger than a first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate may be smaller than a second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa may be smaller than the second threshold.
- step 604 the step of binarizing the word region to obtain the binarized word region may be performed for the k th row in the word region, wherein m ⁇ k ⁇ 1, k is a positive integer, and m is a total number of the identified rows.
- the terminal may perform the step of binarizing the word region to obtain the binarized word region for each of the rows of words.
- the terminal may identify the character region of each valid word in each row in the targeted image region.
- the terminal may determine the word region according to the horizontal histogram as an example.
- the terminal may determine the word region by other ways for determination.
- the terminal may obtain the word region by an image positioning technology. Taking that the word region may be a citizen identity card number in a second-generation identity card as an example, since the citizen identity card number may be located at a relatively fixed position and relatively far from an address and head portrait above the citizen identity card number, the terminal may directly locate at the bottom 1/5 region of the credential image and determine the located image region as the word region.
- the embodiment would not be limited thereto.
- Device embodiments are shown below, which may be configured to perform method embodiments of the disclosure. Details which are not disclosed in the device embodiments may refer to the method embodiments of the disclosure.
- Fig. 7 is a block diagram illustrating a device for region identification according to an exemplary embodiment.
- the device for region identification may include but not limited to: a first binarization module 710, a first calculation module 720 and a region identification module 730.
- the first binarization module 710 may be configured to binarize a word region, to obtain a binarized word region.
- the word region may include several words belonging to a same row.
- the first calculation module 720 may be configured to calculate a histogram in a vertical direction for the binarized word region.
- the histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column.
- the region identification module 730 may be configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- the device for region identification provided in embodiments of the disclosure solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- Fig. 8 is a block diagram illustrating a device (or terminal) for region identification according to another exemplary embodiment.
- the device for region identification may include but not limited to: a first binarization module 810, a first calculation module 820 and a region identification module 830.
- the first binarization module 810 may be configured to binarize a word region, to obtain a binarized word region.
- the word region may include several words belonging to a same row.
- the first binarization module 810 may preprocess the word region, in which preprocesses may include: operations such as denoising, filtering, abstraction a edge and the like; and binarize the preprocessed word region.
- Binarization means to compare grey level values of pixels in the word region with a predetermined grey level value; divide the pixels in the word region into two portions: a group of pixels for each of which the grey level value is larger than the predetermined grey level value and a group of pixels for each of which the grey level value is smaller than the predetermined grey level value; and rending the two groups of pixels in the word region with two different colors, such as black and white, to obtain the binarized word region.
- the first calculation module 820 may be configured to calculate a histogram in a vertical direction for the binarized word region.
- the histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column.
- the first calculation module 820 may calculate the histogram in the vertical direction.
- the horizontal direction of the histogram may represent the abscissas of pixels in each column, and the vertical direction of the histogram may represent an accumulated value of a number of the foreground color pixels of the pixels in each column; wherein the foreground color pixels refer to pixels in a white region of the binarized word region, with respect to background color pixels.
- the region identification module 830 may be configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- the region identification module 830 may include a coordinate determination sub-module 831 and a region identification sub-module 832.
- the coordinate determination sub-module 831 may be configured to determine several sets of abscissas, according to the distribution information of accumulated values in the histogram.
- Each set of abscissas may include a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to first abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa may be smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to second absciss
- the region identification sub-module 832 may be configured to, for each set of abscissas, determine a pixel column where the first abscissa is located as a left edge of a character region and a pixel column where the second abscissa is located may be identified as a right edge of the character region.
- the coordinate determination sub-module 831 may include a coordinate identification sub-module 831a and a coordinate search sub-module 831b.
- the coordinate identification sub-module 831a may be configured to identify a third abscissa in the histogram according to the distribution information of accumulated values.
- the third abscissa may be an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words.
- the coordinate search sub-module 831b may be configured to search, starting with the third abscissa, in a predetermined direction and based on the distribution information of accumulated values, several sets of abscissas.
- the coordinate search sub-module 831b may search, starting with the third abscissa, in the predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas.
- the predetermined direction is a direction towards right; and in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word, the predetermined direction is a direction towards left.
- a number of sets of the abscissas may correspond to the number of valid words in the word region, i.e., each set of abscissas may include a first abscissa in the histogram corresponding to a left edge of a character region of one valid word and a second abscissa in the histogram corresponding to the left edge of the character region of the valid word. That is to say, each set of abscissas may include the first abscissa and a second abscissa located on the right side of the first abscissa.
- Accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to first abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa may be smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to second abscissa may be smaller than the second threshold.
- first threshold and second threshold may have relatively small numerical values.
- the first threshold and second threshold may have numerical values slightly more than 0.
- the first threshold may be 0 and the second threshold may have a numerical value approximate to 0.
- the accumulated values respectively corresponding to the first abscissa and the abscissa on the right side of and adjacent to first abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the left side of and adjacent to the first abscissa may equal to 0; and the accumulated values respectively corresponding to the second abscissa and the abscissa on the left side of and adjacent to the second abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the right side of and adjacent to second abscissa may equal to 0.
- the third abscissa may be an abscissa in the histogram corresponding to the left edge of the character region of the first word of several words.
- the coordinate search sub-module 831b may be further configured to, for an i th set of abscissas, search, starting with the first abscissa within the i th set of abscissas in the histogram and in the direction towards right, a fourth abscissa.
- Accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to fourth abscissa may be smaller than a second threshold.
- i is a positive integer whose initial value is 1, and n is a number of valid words in several words; and the first abscissa within the first set of abscissas may be the third abscissa.
- the coordinate search sub-module 831b may be further configured to determine the fourth abscissa as the second abscissa within the i th set of abscissas.
- the coordinate search sub-module 831b may be further configured to search, start with the fourth abscissa in the histogram and in the direction towards right, a fifth abscissa, if i ⁇ n. Accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to fifth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa may be smaller than a second threshold.
- the coordinate search sub-module 831b may continue to search in the direction towards right, to determine a set of abscissas corresponding to the character region of each of the valid words according to the above method.
- the third abscissa may be an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words.
- the coordinate search sub-module 831b may be further configured to perform following operations: for a j th set of abscissas, searching, starting with the second abscissa within the j th set of abscissas in the histogram and in the direction towards left, a sixth abscissa; accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to sixth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa may be smaller than a second threshold; wherein 1 ⁇ j ⁇ n , j is a positive integer whose initial value is n, and n is a number of valid words in several words; and the second abscissa within the n th set of abscissas may be the third abscissa; determining the sixth ab
- the coordinate search sub-module 831b may be further configured to search, starting with the sixth abscissa in the histogram and in the direction towards left, a seventh abscissa, if j>0.
- Accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the seventh abscissa may be smaller than a second threshold; wherein 1 ⁇ j ⁇ n, j is a positive integer whose initial value is n.
- the coordinate search sub-module 831b may be further configured to set j to j-1 and determine the seventh abscissa as the second abscissa within the j th set of abscissas.
- the third abscissa may be an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among several words.
- the coordinate search sub-module 831b may perform similar steps as those performed in case that the third abscissa is an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among the several words, which are omitted herein.
- the coordinate identification sub-module 831a may be configured to look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa; wherein the predetermined abscissa may belong to a predetermined range, which is a range set according to an empirical value; and an accumulated value of foreground color pixels in the interval may be smaller than a second threshold.
- the coordinate identification sub-module 831a may be configured to determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- the coordinate identification sub-module 831a may be configured to look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa.
- the predetermined abscissa may be an abscissa belonging to predetermined range, which is a mapping range in the histogram corresponding to the valid words in the word region.
- the coordinate identification sub-module 831a may look up, starting with the predetermined abscissa and in the direction towards left as an example. Similarly, the coordinate identification sub-module 831a may look up, starting with the predetermined abscissa and in the direction towards right, and after looking up an interval larger than the second distance, determine an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa. This case would not be illustrated in the embodiment.
- the coordinate identification sub-module 831a may determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa.
- the third abscissa may be an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words.
- the coordinate identification sub-module 831a may be configured to look up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determine an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa; wherein the predetermined abscissa may belong to a predetermined range, which is a range set according to an empirical value; and an accumulated value of foreground color pixels in the interval may be smaller than a second threshold.
- the coordinate identification sub-module 831a may be configured to determine a first one of abscissas on the right side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- the coordinate identification sub-module 831a may perform similar steps as those performed in case that the third abscissa is an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among the several words, which are omitted herein.
- the device may further include: a second binarization module 840, a second calculation module 850 and an edge determination module 860.
- the second binarization module 840 may be configured to binarize a targeted image region, to obtain a binarized targeted image region.
- the targeted image region may be a region including several rows of words.
- the second binarization module 840 may be similar to the first binarization module 810, and thus detailed technical specification may refer to the first binarization module 810, which would not be limited in the present embodiment.
- the second calculation module 850 may be configured to calculate a horizontal histogram in a horizontal direction for a binarized targeted image region.
- the horizontal histogram may include: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row.
- the second calculation module 850 may be similar to the first calculation module 820; a difference between them may be that the first calculation module 820 may calculate the histogram in the vertical direction for the binarized word region, while the second calculation module 850 may calculate the histogram in the horizontal direction for a binarized targeted image region.
- the edge determination module 860 may be configured to determine several sets of ordinates, according to distribution information of accumulated values in the histogram; wherein each set of ordinates may include a first ordinate and a second ordinate located below the first ordinate. For each set of ordinates, the row of pixels where the first ordinate may be located may be determined as an upper edge of a row of words, and the row of pixels where the second ordinate may be located may be determined as a lower edge of a row of words.
- Accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa may be larger than a first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate may be smaller than a second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa may be smaller than the second threshold.
- the edge determination module 860 may determine the several sets of ordinates according to the distribution information of accumulated values in the histogram; and then determine a region for each row according to each of the several sets of ordinates.
- the first binarization module 810 may be further configured to binarize, for the k th row in the word region, the word region, to obtain the binarized word region, wherein m ⁇ k ⁇ 1, k is a positive integer, and m is a total number of the identified rows.
- the device for region identification may identify the character region of each valid word in each row in the targeted image region.
- the device for region identification provided in embodiments of the disclosure solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- a device for region identification may be provided in an exemplary embodiment of the disclosure.
- the device for region identification may implement the method for region identification provided in the disclosure.
- the device for region identification may include a processor and a memory for storing processor-executable instructions.
- the processor may be configured to binarize a word region, wherein the word region includes several words belonging to a same row; calculate a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- Fig. 9 is a block diagram illustrating a device for region identification according to an exemplary embodiment.
- the device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a gaming console, a tablet, a medical device, exercise equipment, a personal digital assistant, and the like.
- the device 900 may include one or more of the following components: a processing component 902, a memory 904, a power component 906, a multimedia component 908, an audio component 910, an input/output (I/O) interface 912, a sensor component 914, and a communication component 916.
- the processing component 902 may typically control overall operations of the device 900, such as the operations associated with display, telephone calls, data communications, camera operations, and recording operations.
- the processing component 902 may include one or more processors 918 to execute instructions to perform all or part of the steps in the above described methods.
- the processing component 902 may include one or more modules which facilitate the interaction between the processing component 902 and other components.
- the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.
- the memory 904 may be configured to store various types of data to support the operation of the device 900. Examples of such data include instructions for any applications or methods operated on the device 900, contact data, phonebook data, messages, pictures, video, etc.
- the memory 904 may be implemented using any type of volatile or non-volatile memory devices, or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic or optical disk.
- SRAM static random access memory
- EEPROM electrically erasable programmable read-only memory
- EPROM erasable programmable read-only memory
- PROM programmable read-only memory
- ROM read-only memory
- magnetic memory a magnetic memory
- flash memory a flash memory
- magnetic or optical disk a
- the power component 906 provides power to various components of the device 900.
- the power component 906 may include a power management system, one or more power sources, and any other components associated with the generation, management, and distribution of power for the device 900.
- the multimedia component 908 may include a screen providing an output interface between the device 900 and the user.
- the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
- the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may not only sense a boundary of a touch or swipe action, but also sense a period of time and a pressure associated with the touch or swipe action.
- the multimedia component 908 includes a front camera and/or a rear camera.
- the front camera and the rear camera may receive an external multimedia datum while the device 900 is in an operation mode, such as a photographing mode or a video mode.
- an operation mode such as a photographing mode or a video mode.
- Each of the front camera and the rear camera may be a fixed optical lens system or have optical focusing and zooming capability.
- the audio component 910 may be configured to output and/or input audio signals.
- the audio component 910 includes a microphone ("MIC") configured to receive an external audio signal when the device 900 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode.
- the received audio signal may be further stored in the memory 904 or transmitted via the communication component 916.
- the audio component 910 further includes a speaker to output audio signals.
- the I/O interface 912 provides an interface between the processing component 902 and peripheral interface modules, the peripheral interface modules being, for example, a keyboard, a click wheel, buttons, and the like.
- the buttons may include, but are not limited to, a home button, a volume button, a starting button, and a locking button.
- the sensor component 914 includes one or more sensors to provide status assessments of various aspects of the device 900. For instance, the sensor component 914 may detect an open/closed status of the device 900, relative positioning of components (e.g., the display and the keypad, of the device 900), a change in position of the device 900 or a component of the device 900, a presence or absence of user contact with the device 900, an orientation or an acceleration/deceleration of the device 900, and a change in temperature of the device 900.
- the sensor component 914 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact.
- the sensor component 914 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
- the sensor component 914 may also include an accelerometer sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
- the communication component 916 may be configured to facilitate communication, wired or wirelessly, between the device 900 and other devices.
- the device 900 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof.
- the communication component 916 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel.
- the communication component 916 further includes a near field communication (NFC) module to facilitate short-range communications.
- the NFC module may be implemented based on a radio frequency identification (RFID) technology, an infrared data association (IrDA) technology, an ultra-wideband (UWB) technology, a Bluetooth (BT) technology, and other technologies.
- RFID radio frequency identification
- IrDA infrared data association
- UWB ultra-wideband
- BT Bluetooth
- the device 900 may be implemented with one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components, for performing the above described methods.
- ASICs application specific integrated circuits
- DSPs digital signal processors
- DSPDs digital signal processing devices
- PLDs programmable logic devices
- FPGAs field programmable gate arrays
- controllers micro-controllers, microprocessors, or other electronic components, for performing the above described methods.
- non-transitory computer-readable storage medium including instructions, such as included in the memory 904, executable by the processor 918 in the device 900, for performing the above-described methods.
- the non-transitory computer-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disc, an optical data storage device, and the like.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Artificial Intelligence (AREA)
- Geometry (AREA)
- Computer Graphics (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Character Input (AREA)
- Image Analysis (AREA)
Abstract
A method and device for region identification are provided in the disclosure. The method includes: binarizing (201) a word region, to obtain the binarized word region, wherein the word region includes several words belonging to a same row; calculating (202) a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identifying (203) a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram. The disclosure may solve the fact that, in related arts, the accuracy of character region location is relatively low and may obtains an effect that the character region of each word may be accurately located according to the distribution information of accumulated values of foreground color pixels in the histogram.
Description
- The present disclosure generally relates to image processing, and more particularly to a method and device for region identification.
- In the field of image processing, before identifying words in an image, a terminal may have to identify a character region of each word firstly.
- In related arts, a method for region identification has been provided, including: removing, by a terminal, a background in an image, to extract a foreground image; identifying, with an edge enhancement technology, an edge of each word in the extracted foreground image; and determining a character region of each word according to the identified edge of each word.
- In the above solution, accuracy of the determined character region may be relatively low, since the edge enhancement technology may only provide a rough location.
- In view of the fact that, in related arts, the accuracy of character region location is relatively low, a method and device for region identification are provided in the disclosure.
- According to a first aspect of embodiments of the present disclosure, a method for region identification is provided, including: binarizing a word region, to obtain a binarized word region, wherein the word region includes several words belonging to a same row; calculating a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identifying a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- Additionally, the above identifying step may include: determining several sets of abscissas according to the distribution information of accumulated values in the histogram, wherein each of the several sets of abscissas includes a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to the first abscissa are larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa is smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the second abscissa is smaller than the second threshold; and for each of the several sets of abscissas, identifying a pixel column where the first abscissa is located as a left edge of a character region, and identifying a pixel column where the second abscissa is located as a right edge of the character region.
- Additionally, the step of determining several sets of abscissas according to the distribution information of accumulated values in the histogram may include: identifying a third abscissa in the histogram according to the distribution information of accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words; and searching, starting with the third abscissa in a predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas.
- Additionally, in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the step of searching, starting with the third abscissa in the predetermined direction and based on the distribution information of the accumulated values, the several sets of abscissas includes: for an ith set of abscissas, searching, starting with the first abscissa within the ith set of abscissas in the histogram and in a direction towards right, a fourth abscissa, wherein accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the fourth abscissa is smaller than the second threshold; wherein 1 ≤ i ≤ n, i is a positive integer of which an initial value is 1, and n is a number of valid words in the several words; and the first abscissa in the first set of abscissas is the third abscissa; determining the fourth abscissa as the second abscissa within the ith set of abscissas; searching, starting with the fourth abscissa in the histogram and in the direction towards right, a fifth abscissa, if i<n, wherein accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to the fifth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa is smaller than the second threshold; and setting i to i+1, and determining the fifth abscissa as the first abscissa within the ith set of abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the step of searching, starting with the third abscissa in the predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas includes: for a jth set of abscissas, searching, starting with the second abscissa within the jth set of abscissas in the histogram and in a direction towards left, a sixth abscissa, wherein accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to the sixth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa is smaller than the second threshold; 1 ≤ j ≤ n , j is a positive integer of which an initial value is n, and n is a number of valid words in the several words; and the second abscissa within the nth set of abscissas is the third abscissa; determining the sixth abscissa as the first abscissa within the jth set of abscissas; searching, starting with the sixth abscissa in the histogram and in the direction towards left, a seventh abscissa, if j>0, wherein accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the seventh abscissa is smaller than the second threshold; and setting j to j-1, and determining the seventh abscissa as the second abscissa within the jth set of abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the step of identifying the third abscissa in the histogram according to the distribution information of accumulated values may include: in case that the several words comprise both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, looking up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determining, an abscissa located on the right side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; or in case that the several words are all valid words, determining, a first one of abscissas located on the left side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the step of identifying the third abscissa in the histogram according to the distribution information of accumulated values may include: in case that the several words includes both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, looking up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determining, an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; or in case that the several words are all valid words, determining, a first one of abscissas located on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- Additionally, the method may further include: binarizing a targeted image region, to obtain a binarized targeted image region; calculating, in a horizontal direction, a horizontal histogram for a binarized targeted image region, wherein the horizontal histogram includes: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row; determining, according to distribution information of the accumulated values in the horizontal histogram, several sets of ordinates, wherein each of the several sets of ordinates includes a first ordinate and a second ordinate located below the first ordinate; and for each of the several sets of ordinates, identifying a pixel row where the first ordinate is located as an upper edge of a row of words, and identifying a pixel row where the second ordinate is located as a lower edge of the row of words; accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate is smaller than the second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa is smaller than the second threshold; and for a kth row in the word region, performing the step of binarizing the word region, wherein m ≥ k ≥ 1, k is a positive integer, and m is a total number of the identified rows.
- In one particular embodiment, the steps of the method for region identification are determined by computer program instructions.
- Consequently, according to a particular aspect, the invention is also directed to a computer program for executing the steps of a method for region identification as defined above when this program is executed by a computer.
- This program can use any programming language and take the form of source code, object code or a code intermediate between source code and object code, such as a partially compiled form, or any other desirable form.
- The invention is also directed to a computer-readable information medium containing instructions of a computer program as described above.
- The information medium can be any entity or device capable of storing the program. For example, the support can include storage means such as a ROM, for example a CD ROM or a microelectronic circuit ROM, or magnetic storage means, for example a diskette (floppy disk) or a hard disk.
- Alternatively, the information medium can be an integrated circuit in which the program is incorporated, the circuit being adapted to execute the method in question or to be used in its execution.
- According to a second aspect of embodiments of the present disclosure, a device for region identification is provided, including: a first binarization module, configured to binarize a word region to obtain a binarized word region, wherein the word region comprises several words belonging to a same row; a first calculation module, configured to calculate, in a vertical direction, a histogram for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and a region identification module, configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- Additionally, the region identification module may include: a coordinate determination sub-module, configured to determine several sets of abscissas according to the distribution information of accumulated values in the histogram, wherein each of the several sets of abscissas includes a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to the first abscissa are larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa is smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the second abscissa is smaller than the second threshold; and a region identification sub-module, configured to, for each of the several sets of abscissas, identify a pixel column where the first abscissa is located as a left edge of a character region, and identify a pixel column where the second abscissa is located as a right edge of the character region.
- Additionally, the coordinate determination sub-module may include: a coordinate identification sub-module, configured to identify a third abscissa in the histogram according to the distribution information of accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words; and a coordinate search sub-module, configured to search, starting with the third abscissa, in a predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the coordinate search sub-module is further configured to: for an ith set of abscissas, search, starting with the first abscissa within the ith set of abscissas in the histogram, and in a direction towards right, a fourth abscissa, wherein accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to fourth abscissa is smaller than the second threshold; wherein 1 ≤ i ≤ n, i is a positive integer of which an initial value is 1, and n is a number of valid words in the several words; and the first abscissa in the first set of abscissas is the third abscissa; determine the fourth abscissa as the second abscissa within the ith set of abscissas; search, starting with the fourth abscissa in the histogram, and in the direction towards right, a fifth abscissa, if i<n, wherein accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to fifth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa is smaller than the second threshold; and set i to i+1, and determine the fifth abscissa as the first abscissa within the ith set of abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the coordinate search sub-module is further configured to: for a jth set of abscissas, search starting with the second abscissa within the jth set of abscissas in the histogram, and in a direction towards left, a sixth abscissa, wherein accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to sixth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa is smaller than the second threshold; 1 ≤ j ≤ n, j is a positive integer of which an initial value is n, and n is a number of valid words in the several words; and the second abscissa within the nth set of abscissas is the third abscissa; determine the sixth abscissa as the first abscissa within the jth set of abscissas; search, starting with the sixth abscissa in the histogram, and in the direction towards left, a seventh abscissa, if j>0, wherein accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to seventh abscissa is smaller than the second threshold; and set j to j-1, and determine the seventh abscissa as the second abscissa within the jth set of abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the coordinate identification sub-module is further configured to: in case that the several words include both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine, an abscissa located on the right side of the interval and of which an accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; or in case that the several words are all valid words, determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- Alternatively, in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the coordinate identification sub-module is further configured to: in case that the several words include both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, look up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determine, an abscissa located on the left side of the interval and of which an accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; or in case that the several words are all valid words, determine a first one of abscissas located on the right side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- Additionally, the device may further include: a second binarization module, configured to binarize a targeted image region, to obtain a binarized targeted image region; a second calculation module, configured to calculate, in a horizontal direction, a horizontal histogram for a binarized targeted image region, wherein the horizontal histogram includes: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row; and an edge determination module, configured to determine, according to distribution information of accumulated values in the horizontal histogram, several sets of ordinates, wherein each of the several sets of ordinates includes a first ordinate and a second ordinate located below the first ordinate; and for each of the several sets of ordinates, identify a pixel row where the first ordinate is located as an upper edge of a row of words, and identify a pixel row where the second ordinate is located as a lower edge of the row of words; accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate is smaller than a second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa is smaller than the second threshold; and the first binarization module is further configured to, for a kth row in the word region, perform the step of binarizing the word region, wherein m ≥ k ≥ 1, k is a positive integer, and m is a total number of the identified rows.
- According to a third aspect of embodiments of the present disclosure, a device for region identification is provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to: binarize a word region, to obtain a binarized word region, wherein the word region includes several words belonging to a same row; calculate a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- Technical solutions of embodiments of the disclosure may provide at least some of the following beneficial effects.
- Embodiments of the disclosure may solve the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- It is to be understood that both the forgoing general description and the following detailed description are exemplary only, and are not restrictive of the present disclosure.
- The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
-
Fig. 1 is a schematic diagram illustrating a word region according to some exemplary embodiments; -
Fig. 2 is a flow chart illustrating a method for region identification according to an exemplary embodiment; -
Fig. 3A is a flow chart illustrating a method for region identification according to another exemplary embodiment; -
Fig. 3B is a schematic diagram illustrating a binarized word region according to another exemplary embodiment; -
Fig. 3C is a schematic diagram illustrating a histogram calculated in a vertical direction according to another exemplary embodiment; -
Fig. 3D is a flow chart illustrating a determining method for a terminal to determine several sets of abscissas according to another exemplary embodiment; -
Fig. 3E is a schematic diagram illustrating a third abscissa identified by a terminal in the histogram according to another exemplary embodiment; -
Fig. 3F is a schematic diagram illustrating each set of abscissas determined based on the histogram according to another exemplary embodiment; -
Fig. 3G is a schematic diagram illustrating predetermined abscissas in the histogram according to another exemplary embodiment; -
Fig. 3H is a schematic diagram illustrating a third abscissa determined based on the histogram according to another exemplary embodiment; -
Fig. 4 is a flow chart illustrating an identifying method for identifying each set of abscissas based on distribution information about an accumulated value and the third abscissa according to another exemplary embodiment; -
Fig. 5 is a flow chart illustrating another identifying method for identifying each set of abscissas based on the distribution information about the accumulated value and the third abscissa according to another exemplary embodiment; -
Fig. 6 is a flow chart illustrating an identifying method for a terminal to identify a word region according to an exemplary embodiment; -
Fig. 7 is a block diagram illustrating a device for region identification according to an exemplary embodiment; -
Fig. 8 is a block diagram illustrating a device for region identification according to another exemplary embodiment; and -
Fig. 9 is a block diagram illustrating a device for region identification according to an exemplary embodiment. - Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which same numbers in different drawings represent same or similar elements unless otherwise described. The implementations set forth in the following description of exemplary embodiments do not represent all implementations consistent with the invention. Instead, they are merely examples of devices and methods consistent with aspects related to the invention as recited in the appended claims.
- In order to facilitate understanding, a brief introduction to terms related in each exemplary embodiment of the disclosure would be made firstly.
- A word region may include several words belonging to a same row. The word region may be a region in a credential image, or a region in a scanned image of article, or a region in an electronic document; and the embodiment is not limited thereto. Additionally, in the embodiment, a top edge of the word region is between a top edge of words in the same row and a bottom edge of words in a previous row; and a bottom edge of the word region is between a bottom edge of words in the same row and a top edge of words in a next row.
- For example, taking that the word region is a region containing a citizen identity card number included in a same row on a second-generation identity card as an example, referring to
Fig. 1 , the top edge of the word region is between /1 and /2; and the bottom edge of the word region is between /3 and /4. For example, the word region isregion 11 as shown inFig.1 . - Words in the word region may be all valid words, or may be a combination of valid words and invalid words. A character region for each of the valid words needs to be identified; however a character region for each of the invalid words needs not to be identified. For example, taking that a region for each numeral in the citizen identity card number needs to be identified (i.e., all numerals in the citizen identity card number are valid words) for an example, words in the word region may only include numerals included therein, i.e., "3 3 0 4 2 1 1 9 9 0 1 2 1 6 2 8 3 4", or may include at least one character located on the left of the numerals, in addition to the numerals ("3 3 0 4 2 1 1 9 9 0 1 2 1 6 2 8 3 4"), for example words in the word region are "
number 3 3 0 4 2 1 1 9 9 0 1 2 1 6 2 8 3 4". The character region refers to a region corresponding to a single word. - Further, words referred to in various embodiments of the disclosure may be numerals, letters, characters, pictures, or other contents for which a number of foreground color pixels is larger than a threshold in a calculated histogram.
-
Fig. 2 is a flow chart illustrating a method for region identification, implemented by a terminal (or device), according to an exemplary embodiment. As shown inFig. 2 , the method for region identification may include following steps. - In
step 201, a word region may be binarized, to obtain a binarized word region. The word region may include several words belonging to a same row. - In
step 202, a histogram may be calculated in a vertical direction for the binarized word region. The histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column. - In
step 203, a character region of each of the words in the word region may be identified, according to distribution information of accumulated values in the histogram. - As can be seen, the method for region identification provided in embodiments of the disclosure solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
-
Fig. 3A is a flow chart illustrating a method for region identification, implemented by a device, according to another exemplary embodiment. As shown inFig. 3 , the method for region identification may include following steps. - In
step 301, a word region may be binarized, to obtain a binarized word region. The word region may include several words belonging to a same row. - Alternatively, a terminal may preprocess the word region, in which preprocesses may include: operations such as denoising, filtering, abstraction a edge and the like; the preprocessed word region may be binarized.
- Binarization means to compare grey level values of pixels in the word region with a predetermined grey level value; divide the pixels in the word region into two portions: a group of pixels for each of which the grey level value is larger than the predetermined grey level value and a group of pixels for each of which the grey level value is smaller than the predetermined grey level value; and rending the two groups of pixels in the word region with two different colors, such as black and white, to obtain the binarized word region, as shown in
Fig. 3B . InFig. 3B , pixels located in a foreground color may be called foreground color pixels, i.e., white pixels inFig. 3B ; and pixels located in a background color may be called background color pixels, i.e., black pixels inFig. 3B . - In
step 302, a histogram may be calculated in a vertical direction for the binarized word region. The histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column. - The histogram may be calculated in the vertical direction after the binarization of the word region. The horizontal direction of the histogram may represent the abscissas of pixels in each column, and the vertical direction of the histogram may represent an accumulated value of a number of the foreground color pixels of the pixels in each column; wherein the foreground color pixels refer to pixels in a white region of the binarized word region, with respect to background color pixels. For example, the terminal may calculate the histogram.
- In
step 303, several sets of abscissas may be determined according to the distribution information of accumulated values in the histogram. - Alternatively, referring to
Fig. 3D ,step 303 may include following steps. - In
step 303a, a third abscissa may be identified in the histogram according to the distribution information of accumulated values. - The third abscissa may be an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words.
- For example, taking that the valid words in the word region may be the citizen identity card number in
Fig. 1 for an example, referring toFig. 3E , the third abscissa may be the abscissa X 1 in the histogram corresponding to a left edge of the first valid word "3", or the abscissa X 2 corresponding to a right edge of the last valid word "4". - In
step 303b, started with the third abscissa, the several sets of abscissas are searched in a predetermined direction and based on the distribution information of accumulated values. - After identifying the third abscissa, the terminal may search, starting with the third abscissa, the several sets of abscissas in the predetermined direction and based on the distribution information of accumulated values. In case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word, the predetermined direction is a direction towards right; and in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word, the predetermined direction is a direction towards left.
- A number of sets of the abscissas may correspond to the number of valid words in the word region, i.e., each set of abscissas may include a first abscissa in the histogram corresponding to a left edge of a character region of one valid word and a second abscissa in the histogram corresponding to the left edge of the character region of the valid word. That is to say, each set of abscissas may include the first abscissa and a second abscissa located on the right side of the first abscissa. Accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to first abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa may be smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to second abscissa may be smaller than the second threshold.
- For example, taking that the first abscissa is x 1 and the second abscissa is x 2 as an example, the terminal may identify each of the sets of abscissas as shown in
Fig. 3F . It should be noted thatFig. 3F is only an exemplary illustration showing several of the identified sets of abscissas, and in practice more sets of abscissas may be included; and the embodiment is not limited thereto. - The above first threshold and second threshold may have relatively small numerical values. For example, the first threshold and second threshold may have numerical values slightly more than 0. Alternatively, the first threshold may be 0 and the second threshold may have a numerical value approximate to 0. Further, in practice, the accumulated values respectively corresponding to the first abscissa and the abscissa on the right side of and adjacent to first abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the left side of and adjacent to the first abscissa may equal to 0; and the accumulated values respectively corresponding to the second abscissa and the abscissa on the left side of and adjacent to the second abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the right side of and adjacent to second abscissa may equal to 0.
- In
step 304, for each set of abscissas, a pixel column where the first abscissa is located may be identified as a left edge of a character region, and a pixel column where the second abscissa is located may be identified as a right edge of the character region. - As can be seen, the method for region identification provided in embodiments of the disclosure solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- In the embodiment shown in
Fig. 3A , in case that the words within the word region includes both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words,step 303a may include following steps. - Starting with a predetermined abscissa in the histogram, the terminal may look up, in a direction towards left, an interval which is the first interval of which a width is larger than the second distance; and the terminal may determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa.
- The predetermined abscissa may be an abscissa among a predetermined range, which is a mapping range in the histogram corresponding to the valid words in the word region. For example, taking that the valid words are the citizen identity card number, in connection with
Fig. 3E , the predetermined range is the range [X 1 , X 2] inFig. 3E . Generally, the predetermined range may be set according to an empirical value. Further, an accumulated value of foreground color pixels in the interval may be smaller than a second threshold. - Taking that the valid words are the citizen identity card number in
Fig. 1 as an example, the predetermined abscissa may be an abscissa in the histogram corresponding to a middle location in a horizontal direction of the second-generation identity card, since the middle location in a horizontal direction of the second-generation identity card may certainly be among the citizen identity card number. For example, taking that a width of the word region is an overall width of the second-generation identity card as an example, referring toFig. 3G , the predetermined abscissa may be X 0 as shown inFig. 3G . The terminal may look up, starting with X 0 and in the direction towards left. Since the first distance between two adjacent numerals is much smaller than the second distance between the Chinese character " " and the first numeral in the citizen identity card number, after looking up an interval larger than the second distance (i.e., interval d as shown inFig. 3G ), the terminal may determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa, i.e., the third abscissa X 1 is determined. - The above has taken that the terminal may look up, starting with the predetermined abscissa and in the direction towards left as an example. Similarly, the terminal may look up, starting with the predetermined abscissa and in the direction towards right, and after looking up an interval larger than the second distance, determine an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa. This case would not be detailed in the embodiment.
- In an alternative embodiment as shown in
Fig. 3A , in case that all words in the word region are valid words,step 303a may include following steps. - In case that all words in the word region are valid words, after calculating the histogram for the binarized word region, wherein a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, may be determined as an abscissas in the histogram corresponding to the first valid word, the terminal then may determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa.
- For example, referring to
Fig. 3H , the terminal may determine X 1 as the third abscissa. - Similarly, a first one of abscissas on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold may be determined as an abscissas in the histogram corresponding to the last valid word. Therefore, the terminal then may determine the first one of the abscissas on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa. Still referring to
Fig. 3H , the terminal may determine X 2 as the third abscissa. - In the embodiment shown in
Fig. 3A , after the terminal calculated the third abscissa by the above calculation mode, in case that the calculated third abscissa is an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among several words, a reference may be made toFig. 4 . InFig. 4 ,step 303b may be replaced with steps 401-404. - In
step 401, for an ith set of abscissas, started with the first abscissa within the ith set of abscissas in the histogram, a fourth abscissa may be searched in a direction towards right. - 1 ≤ i ≤ n, i is a positive integer whose initial value is 1, and n is a number of valid words in several words. For example, taking that the valid words may be a citizen identity card number in a second-generation identity card as an example, the number of valid words is 18.
- Additionally, the first abscissa in the first set of abscissas may be the third abscissa. And accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to fourth abscissa may be smaller than a second threshold.
- Taking that i=1 as an example, since the first abscissa x 1 in the first set of abscissas may be the third abscissa X 1 the terminal mat search, starting with X 1 in the histogram and in a direction towards left, to determine a first fourth abscissa.
- In
step 402, the fourth abscissa may be determined as the second abscissa within the ith set of abscissas. - In
step 403, if i<n, started with the fourth abscissa in the histogram, a fifth abscissa may be searched in the direction towards right. - If i<n, the terminal may determine that there may be at least one valid word in the right side for which a character region has not been identified. At the point, the terminal may search, starting with an abscissa in the histogram corresponding to the right edge of the currently determined character region of a valid word and in the direction towards right, an abscissa in the histogram corresponding to a left edge of a character region of a next valid word.
- Alternatively, the terminal may search, start with the fourth abscissa in the histogram and in the direction towards right, a first fifth abscissa. Accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to fifth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa may be smaller than a second threshold.
- In
step 404, set i=i+1, the fifth abscissa may be determined as the first abscissa within the ith set of abscissas. - The terminal may determine the searched abscissa as the abscissa in the histogram corresponding to the left edge of the character region of the next valid word. Alternatively, the terminal may set i=i+1, and determine the fifth abscissa as the first abscissa within the ith set of abscissas.
- From hereafter, the terminal may continue to search in the direction towards right, to determine a set of abscissas corresponding to the character region of each of the valid words according to the above method.
- In the embodiment shown in
Fig. 3A , after the terminal calculated the third abscissa by the above calculation mode, in case that the calculated third abscissa is an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words, a reference may be made toFig. 5 . InFig. 5 ,step 303b may be replaced with steps 501-504. - In
step 501, for a jth set of abscissas, started with the second abscissa within the jth set of abscissas in the histogram, a sixth abscissa may be searched in a direction towards left. - Accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to sixth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa may be smaller than a second threshold; wherein 1 ≤ j ≤ n, j is a positive integer whose initial value is n, and n is a number of valid words in several words; and the second abscissa within the nth set of abscissas may be the third abscissa.
- In
step 502, the sixth abscissa may be determined as the first abscissa within the jth set of abscissas. - In
step 503, if j>0, started with the sixth abscissa in the histogram, a seventh abscissa may be searched in the direction towards left. Accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the seventh abscissa may be smaller than a second threshold; wherein 1 ≤ j ≤ n, j is a positive integer whose initial value is n. - In
step 504, set j to j-1, the seventh abscissa may be determined as the second abscissa within the jth set of abscissas. - It should be further explained that steps 501-504 may be similar to steps 401-404; a different between them may be that the method provided in steps 401-404 includes a search starting at the left side and going towards right, while the method provided in steps 501-504 includes a search starting at the right side and going towards left. The embodiment would not be detailed herein.
- Based on the above-provided embodiment, referring to
Fig. 6 , before binarizing the word region to obtain the binarized word region, the terminal may further perform following steps. - In
step 601, a targeted image region may be binarized, such that a binarized targeted image region may be obtained. - The targeted image region may be a region including several rows of words.
- Step 601 may be similar to step 301 in the above embodiment, and thus detailed technical specification may refer to the above embodiment, which would not be limited in the present embodiment.
- In
step 602, a horizontal histogram may be calculated in a horizontal direction for a binarized targeted image region. The horizontal histogram may include: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row. - Step 602 may be similar to step 302 in the above embodiment; a difference between them may be that in
step 302 the histogram may be calculated in the vertical direction for the binarized word region, while instep 602 the histogram may be calculated in the horizontal direction for a binarized targeted image region. - In
step 603, several sets of ordinates may be determined according to distribution information of accumulated values in the horizontal histogram; wherein each set of ordinates may include a first ordinate and a second ordinate located below the first ordinate. For each set of ordinates, a pixel row where the first ordinate may be located may be determined as the upper edge of a row of words, and a pixel row where the second ordinate may be located may be determined as the lower edge of the row of words. - After calculating the horizontal histogram, the terminal may determine the several sets of ordinates according to the distribution information of accumulated values in the histogram; and then determine a region for each row according to each of the several sets of ordinates.
- The step may be similar to the step of determining several sets of abscissas according to the distribution information of accumulated values in the vertical histogram, and then determining the left edge and the right edge of each word according to each of the several sets of abscissas. Detailed technical specification may refer to the above embodiment.
- Accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa may be larger than a first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate may be smaller than a second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa may be smaller than the second threshold.
- In
step 604, the step of binarizing the word region to obtain the binarized word region may be performed for the kth row in the word region, wherein m ≥ k ≥ 1, k is a positive integer, and m is a total number of the identified rows. - After identified all rows of words in
step 603, the terminal may perform the step of binarizing the word region to obtain the binarized word region for each of the rows of words. - As such, the terminal may identify the character region of each valid word in each row in the targeted image region.
- The above embodiment has taken that the terminal may determine the word region according to the horizontal histogram as an example. Alternatively, the terminal may determine the word region by other ways for determination. For example, the terminal may obtain the word region by an image positioning technology. Taking that the word region may be a citizen identity card number in a second-generation identity card as an example, since the citizen identity card number may be located at a relatively fixed position and relatively far from an address and head portrait above the citizen identity card number, the terminal may directly locate at the bottom 1/5 region of the credential image and determine the located image region as the word region. The embodiment would not be limited thereto.
- Device embodiments are shown below, which may be configured to perform method embodiments of the disclosure. Details which are not disclosed in the device embodiments may refer to the method embodiments of the disclosure.
-
Fig. 7 is a block diagram illustrating a device for region identification according to an exemplary embodiment. As shown inFig. 7 , the device for region identification may include but not limited to: afirst binarization module 710, afirst calculation module 720 and aregion identification module 730. - The
first binarization module 710 may be configured to binarize a word region, to obtain a binarized word region. The word region may include several words belonging to a same row. - The
first calculation module 720 may be configured to calculate a histogram in a vertical direction for the binarized word region. The histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column. - The
region identification module 730 may be configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram. - As can be seen, the device for region identification provided in embodiments of the disclosure solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
-
Fig. 8 is a block diagram illustrating a device (or terminal) for region identification according to another exemplary embodiment. As shown inFig. 8 , the device for region identification may include but not limited to: afirst binarization module 810, afirst calculation module 820 and aregion identification module 830. - The
first binarization module 810 may be configured to binarize a word region, to obtain a binarized word region. The word region may include several words belonging to a same row. - Alternatively, the
first binarization module 810 may preprocess the word region, in which preprocesses may include: operations such as denoising, filtering, abstraction a edge and the like; and binarize the preprocessed word region. - Binarization means to compare grey level values of pixels in the word region with a predetermined grey level value; divide the pixels in the word region into two portions: a group of pixels for each of which the grey level value is larger than the predetermined grey level value and a group of pixels for each of which the grey level value is smaller than the predetermined grey level value; and rending the two groups of pixels in the word region with two different colors, such as black and white, to obtain the binarized word region.
- The
first calculation module 820 may be configured to calculate a histogram in a vertical direction for the binarized word region. The histogram may include: abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column. - After the
first binarization module 810 binarized the word region, thefirst calculation module 820 may calculate the histogram in the vertical direction. The horizontal direction of the histogram may represent the abscissas of pixels in each column, and the vertical direction of the histogram may represent an accumulated value of a number of the foreground color pixels of the pixels in each column; wherein the foreground color pixels refer to pixels in a white region of the binarized word region, with respect to background color pixels. - The
region identification module 830 may be configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram. - In a potential implement, the
region identification module 830 may include a coordinatedetermination sub-module 831 and aregion identification sub-module 832. - The coordinate determination sub-module 831 may be configured to determine several sets of abscissas, according to the distribution information of accumulated values in the histogram. Each set of abscissas may include a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to first abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa may be smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to second abscissa may be smaller than the second threshold.
- The region identification sub-module 832 may be configured to, for each set of abscissas, determine a pixel column where the first abscissa is located as a left edge of a character region and a pixel column where the second abscissa is located may be identified as a right edge of the character region.
- Additionally, the coordinate determination sub-module 831 may include a coordinate identification sub-module 831a and a coordinate search sub-module 831b.
- The coordinate identification sub-module 831a may be configured to identify a third abscissa in the histogram according to the distribution information of accumulated values. The third abscissa may be an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words.
- The coordinate search sub-module 831b may be configured to search, starting with the third abscissa, in a predetermined direction and based on the distribution information of accumulated values, several sets of abscissas.
- After the coordinate identification sub-module 831a identified the third abscissa, the coordinate search sub-module 831b may search, starting with the third abscissa, in the predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas. In case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word, the predetermined direction is a direction towards right; and in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word, the predetermined direction is a direction towards left.
- A number of sets of the abscissas may correspond to the number of valid words in the word region, i.e., each set of abscissas may include a first abscissa in the histogram corresponding to a left edge of a character region of one valid word and a second abscissa in the histogram corresponding to the left edge of the character region of the valid word. That is to say, each set of abscissas may include the first abscissa and a second abscissa located on the right side of the first abscissa. Accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to first abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa may be smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to second abscissa may be smaller than the second threshold.
- The above first threshold and second threshold may have relatively small numerical values. For example, the first threshold and second threshold may have numerical values slightly more than 0. Alternatively, the first threshold may be 0 and the second threshold may have a numerical value approximate to 0. Further, in practice, the accumulated values respectively corresponding to the first abscissa and the abscissa on the right side of and adjacent to first abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the left side of and adjacent to the first abscissa may equal to 0; and the accumulated values respectively corresponding to the second abscissa and the abscissa on the left side of and adjacent to the second abscissa may not equal to 0, and the accumulated value corresponding to the abscissa on the right side of and adjacent to second abscissa may equal to 0.
- Alternatively, the third abscissa may be an abscissa in the histogram corresponding to the left edge of the character region of the first word of several words.
- The coordinate search sub-module 831b may be further configured to, for an ith set of abscissas, search, starting with the first abscissa within the ith set of abscissas in the histogram and in the direction towards right, a fourth abscissa. Accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to fourth abscissa may be smaller than a second threshold. 1 ≤ i ≤ n, i is a positive integer whose initial value is 1, and n is a number of valid words in several words; and the first abscissa within the first set of abscissas may be the third abscissa.
- The coordinate search sub-module 831b may be further configured to determine the fourth abscissa as the second abscissa within the ith set of abscissas.
- The coordinate search sub-module 831b may be further configured to search, start with the fourth abscissa in the histogram and in the direction towards right, a fifth abscissa, if i<n. Accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to fifth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa may be smaller than a second threshold.
- The coordinate search sub-module 831b may be further configured to set i=i+1 and determine the fifth abscissa as the first abscissa within the ith set of abscissas.
- The coordinate search sub-module 831b may determine the searched abscissa as the abscissa in the histogram corresponding to the left edge of the character region of the next valid word. Alternatively, the coordinate search sub-module 831b may set i=i+1, and determine the fifth abscissa as the first abscissa within the ith set of abscissas.
- From hereafter, the coordinate search sub-module 831b may continue to search in the direction towards right, to determine a set of abscissas corresponding to the character region of each of the valid words according to the above method.
- Alternatively, the third abscissa may be an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words.
- The coordinate search sub-module 831b may be further configured to perform following operations: for a jth set of abscissas, searching, starting with the second abscissa within the jth set of abscissas in the histogram and in the direction towards left, a sixth abscissa; accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to sixth abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa may be smaller than a second threshold; wherein 1 ≤ j ≤ n , j is a positive integer whose initial value is n, and n is a number of valid words in several words; and the second abscissa within the nth set of abscissas may be the third abscissa; determining the sixth abscissa as the first abscissa within the jth set of abscissas.
- The coordinate search sub-module 831b may be further configured to search, starting with the sixth abscissa in the histogram and in the direction towards left, a seventh abscissa, if j>0. Accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa may be larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the seventh abscissa may be smaller than a second threshold; wherein 1 ≤ j ≤ n, j is a positive integer whose initial value is n.
- The coordinate search sub-module 831b may be further configured to set j to j-1 and determine the seventh abscissa as the second abscissa within the jth set of abscissas.
- Alternatively, the third abscissa may be an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among several words.
- It should be further explained that in case that the third abscissa is an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words, the coordinate search sub-module 831b may perform similar steps as those performed in case that the third abscissa is an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among the several words, which are omitted herein.
- In case that the several words include both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, the coordinate identification sub-module 831a may be configured to look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa; wherein the predetermined abscissa may belong to a predetermined range, which is a range set according to an empirical value; and an accumulated value of foreground color pixels in the interval may be smaller than a second threshold.
- Alternatively, in case that all words in the word region are valid words, the coordinate identification sub-module 831a may be configured to determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- Alternatively, in case that the several words include both valid words and invalid words and the first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, the coordinate identification sub-module 831a may be configured to look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine an abscissa located on the right of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa.
- The predetermined abscissa may be an abscissa belonging to predetermined range, which is a mapping range in the histogram corresponding to the valid words in the word region.
- The above has taken that the coordinate identification sub-module 831a may look up, starting with the predetermined abscissa and in the direction towards left as an example. Similarly, the coordinate identification sub-module 831a may look up, starting with the predetermined abscissa and in the direction towards right, and after looking up an interval larger than the second distance, determine an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa. This case would not be illustrated in the embodiment.
- Alternatively, in case that several words are all valid words, after calculating the histogram for the binarized word region, wherein a first one of abscissas on the left side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold may be determined as an abscissas in the histogram corresponding to the first valid word, the coordinate identification sub-module 831a then may determine a first one of abscissas on the left side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa.
- Alternatively, the third abscissa may be an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words.
- In case that the several words include both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, the coordinate identification sub-module 831a may be configured to look up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determine an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold as the third abscissa; wherein the predetermined abscissa may belong to a predetermined range, which is a range set according to an empirical value; and an accumulated value of foreground color pixels in the interval may be smaller than a second threshold.
- Alternatively, in case that the several words are all valid words, the coordinate identification sub-module 831a may be configured to determine a first one of abscissas on the right side of the histogram, of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- It should be further explained that in case that the third abscissa is an abscissa in the histogram corresponding to a right edge of the character region of the last valid words among several words, the coordinate identification sub-module 831a may perform similar steps as those performed in case that the third abscissa is an abscissa in the histogram corresponding to the left edge of the character region of the first valid words among the several words, which are omitted herein.
- Alternatively, the device may further include: a
second binarization module 840, asecond calculation module 850 and anedge determination module 860. - The
second binarization module 840 may be configured to binarize a targeted image region, to obtain a binarized targeted image region. - The targeted image region may be a region including several rows of words.
- The
second binarization module 840 may be similar to thefirst binarization module 810, and thus detailed technical specification may refer to thefirst binarization module 810, which would not be limited in the present embodiment. - The
second calculation module 850 may be configured to calculate a horizontal histogram in a horizontal direction for a binarized targeted image region. The horizontal histogram may include: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row. - The
second calculation module 850 may be similar to thefirst calculation module 820; a difference between them may be that thefirst calculation module 820 may calculate the histogram in the vertical direction for the binarized word region, while thesecond calculation module 850 may calculate the histogram in the horizontal direction for a binarized targeted image region. - The
edge determination module 860 may be configured to determine several sets of ordinates, according to distribution information of accumulated values in the histogram; wherein each set of ordinates may include a first ordinate and a second ordinate located below the first ordinate. For each set of ordinates, the row of pixels where the first ordinate may be located may be determined as an upper edge of a row of words, and the row of pixels where the second ordinate may be located may be determined as a lower edge of a row of words. Accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa may be larger than a first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate may be smaller than a second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa may be larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa may be smaller than the second threshold. - After calculating the horizontal histogram in the horizontal direction, the
edge determination module 860 may determine the several sets of ordinates according to the distribution information of accumulated values in the histogram; and then determine a region for each row according to each of the several sets of ordinates. - The
first binarization module 810 may be further configured to binarize, for the kth row in the word region, the word region, to obtain the binarized word region, wherein m ≥ k ≥ 1, k is a positive integer, and m is a total number of the identified rows. - As such, the device for region identification may identify the character region of each valid word in each row in the targeted image region.
- As can be seen, the device for region identification provided in embodiments of the disclosure solves the fact that, in related arts, the accuracy of character region location is relatively low, by calculating the histogram in the vertical direction for the binarized word region and identifying the character region of each of the words in the word region according to the distribution information in the histogram; as a result, an effect that the character region of each of the words may be accurately located according to the distribution information of accumulated values of the foreground color pixels in the histogram may be obtained.
- Regarding the device in the above embodiments, specific fashions in which various modules perform corresponding operations have been detailed in related method embodiments, which would not be further explained herein.
- A device for region identification may be provided in an exemplary embodiment of the disclosure. The device for region identification may implement the method for region identification provided in the disclosure. The device for region identification may include a processor and a memory for storing processor-executable instructions.
- The processor may be configured to binarize a word region, wherein the word region includes several words belonging to a same row; calculate a histogram in a vertical direction for the binarized word region, wherein the histogram includes abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; and identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
-
Fig. 9 is a block diagram illustrating a device for region identification according to an exemplary embodiment. For example, thedevice 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a gaming console, a tablet, a medical device, exercise equipment, a personal digital assistant, and the like. - Referring to
Fig. 9 , thedevice 900 may include one or more of the following components: aprocessing component 902, amemory 904, apower component 906, amultimedia component 908, anaudio component 910, an input/output (I/O)interface 912, asensor component 914, and acommunication component 916. - The
processing component 902 may typically control overall operations of thedevice 900, such as the operations associated with display, telephone calls, data communications, camera operations, and recording operations. Theprocessing component 902 may include one ormore processors 918 to execute instructions to perform all or part of the steps in the above described methods. Moreover, theprocessing component 902 may include one or more modules which facilitate the interaction between theprocessing component 902 and other components. For instance, theprocessing component 902 may include a multimedia module to facilitate the interaction between themultimedia component 908 and theprocessing component 902. - The
memory 904 may be configured to store various types of data to support the operation of thedevice 900. Examples of such data include instructions for any applications or methods operated on thedevice 900, contact data, phonebook data, messages, pictures, video, etc. Thememory 904 may be implemented using any type of volatile or non-volatile memory devices, or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic or optical disk. - The
power component 906 provides power to various components of thedevice 900. Thepower component 906 may include a power management system, one or more power sources, and any other components associated with the generation, management, and distribution of power for thedevice 900. - The
multimedia component 908 may include a screen providing an output interface between thedevice 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may not only sense a boundary of a touch or swipe action, but also sense a period of time and a pressure associated with the touch or swipe action. In some embodiments, themultimedia component 908 includes a front camera and/or a rear camera. The front camera and the rear camera may receive an external multimedia datum while thedevice 900 is in an operation mode, such as a photographing mode or a video mode. Each of the front camera and the rear camera may be a fixed optical lens system or have optical focusing and zooming capability. - The
audio component 910 may be configured to output and/or input audio signals. For example, theaudio component 910 includes a microphone ("MIC") configured to receive an external audio signal when thedevice 900 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may be further stored in thememory 904 or transmitted via thecommunication component 916. In some embodiments, theaudio component 910 further includes a speaker to output audio signals. - The I/
O interface 912 provides an interface between theprocessing component 902 and peripheral interface modules, the peripheral interface modules being, for example, a keyboard, a click wheel, buttons, and the like. The buttons may include, but are not limited to, a home button, a volume button, a starting button, and a locking button. - The
sensor component 914 includes one or more sensors to provide status assessments of various aspects of thedevice 900. For instance, thesensor component 914 may detect an open/closed status of thedevice 900, relative positioning of components (e.g., the display and the keypad, of the device 900), a change in position of thedevice 900 or a component of thedevice 900, a presence or absence of user contact with thedevice 900, an orientation or an acceleration/deceleration of thedevice 900, and a change in temperature of thedevice 900. Thesensor component 914 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. Thesensor component 914 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, thesensor component 914 may also include an accelerometer sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor. - The
communication component 916 may be configured to facilitate communication, wired or wirelessly, between thedevice 900 and other devices. Thedevice 900 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, thecommunication component 916 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, thecommunication component 916 further includes a near field communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on a radio frequency identification (RFID) technology, an infrared data association (IrDA) technology, an ultra-wideband (UWB) technology, a Bluetooth (BT) technology, and other technologies. - In exemplary embodiments, the
device 900 may be implemented with one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components, for performing the above described methods. - In exemplary embodiments, there is also provided a non-transitory computer-readable storage medium including instructions, such as included in the
memory 904, executable by theprocessor 918 in thedevice 900, for performing the above-described methods. For example, the non-transitory computer-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disc, an optical data storage device, and the like. - Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed here. This application is intended to cover any variations, uses, or adaptations of the invention following the general principles thereof and including such departures from the present disclosure as come within known or customary practice in the art. The specification and embodiments are merely considered to be exemplary and the substantive scope of the disclosure is limited only by the appended claims.
- It should be understood that the disclosure is not limited to the precise structure as described above and shown in the figures, but can have various modification and alternations without departing from the scope of the disclosure. The scope of the disclosure is limited only by the appended claims.
Claims (14)
- A method for region identification, characterized in that said method comprises:binarizing (201, 301) a word region, to obtain a binarized word region, wherein the word region comprises several words belonging to a same row;calculating (202, 302) a histogram in a vertical direction for the binarized word region, wherein the histogram comprises abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; andidentifying (203) a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- The method of claim 1, wherein the identifying (203) comprises:determining (303) several sets of abscissas according to the distribution information of the accumulated values in the histogram, wherein each of the several sets of abscissas comprises a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to the first abscissa are larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa is smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the second abscissa is smaller than the second threshold; andfor each of the several sets of abscissas, identifying (304) a pixel column where the first abscissa is located as a left edge of a character region, and identifying a pixel column where the second abscissa is located as a right edge of the character region.
- The method of claim 2, wherein the determining (303) several sets of abscissas according to the distribution information of the accumulated values in the histogram comprises:identifying (303a) a third abscissa in the histogram according to the distribution information of the accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words; andsearching (303b), starting with the third abscissa in a predetermined direction and based on the distribution information of the accumulated values, the several sets of abscissas.
- The method of claim 3, wherein in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the searching (303b), starting with the third abscissa in the predetermined direction and based on the distribution information of the accumulated values, the several sets of abscissas comprises:for an ith set of abscissas, searching (401), starting with the first abscissa within the ith set of abscissas in the histogram and in a direction towards right, a fourth abscissa, wherein accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the fourth abscissa is smaller than the second threshold; wherein 1 ≤ i ≤ n, i is a positive integer of which an initial value is 1, and n is a number of valid words in the several words; and the first abscissa in the first set of abscissas is the third abscissa;determining (402) the fourth abscissa as the second abscissa within the ith set of abscissas;searching (403), starting with the fourth abscissa in the histogram and in the direction towards right, a fifth abscissa, if i<n, wherein accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to the fifth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa is smaller than the second threshold; andsetting (404) i to i+1, and determining (404) the fifth abscissa as the first abscissa within the ith set of abscissas.
- The method of claim 3, wherein in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the searching (303b), starting with the third abscissa in the predetermined direction and based on the distribution information of accumulated values, the several sets of abscissas comprises:for a jth set of abscissas, searching (501), starting with the second abscissa within the jth set of abscissas in the histogram and in a direction towards left, a sixth abscissa, wherein accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to the sixth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa is smaller than the second threshold; 1 ≤ j ≤ n , j is a positive integer of which an initial value is n, and n is a number of valid words in the several words; and the second abscissa within the nth set of abscissas is the third abscissa;determining (502) the sixth abscissa as the first abscissa within the jth set of abscissas;searching (503), starting with the sixth abscissa in the histogram and in the direction towards left, a seventh abscissa, if j>0, wherein accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the seventh abscissa is smaller than the second threshold; andsetting (504) j to j-1, and determining (504) the seventh abscissa as the second abscissa within the jth set of abscissas.
- The method of claim 3, wherein in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the identifying (304) the third abscissa in the histogram according to the distribution information of the accumulated values comprises:in case that the several words comprise both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, looking up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determining, an abscissa located on the right side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; orin case that the several words are all valid words, determining, a first one of abscissas located on the left side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- The method of claim 3, in case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the identifying (304) the third abscissa in the histogram according to the distribution information of the accumulated values comprises:in case that the several words comprise both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, looking up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determining, an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; orin case that the several words are all valid words, determining, a first one of abscissas located on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- The method of any one of claims 1 to 7, further comprising:binarizing (601) a targeted image region, to obtain a binarized targeted image region;calculating (602), in a horizontal direction, a horizontal histogram for a binarized targeted image region, wherein the horizontal histogram comprises: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row;determining (603), according to distribution information of the accumulated values in the horizontal histogram, several sets of ordinates, wherein each of the several sets of ordinates comprises a first ordinate and a second ordinate located below the first ordinate; and for each of the several sets of ordinates, identifying a pixel row where the first ordinate is located as an upper edge of a row of words, and identifying a pixel row where the second ordinate is located as a lower edge of the row of words; accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate is smaller than the second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa is smaller than the second threshold; andfor a kth row in the word region, performing (604) the binarizing the word region, wherein m ≥ k ≥ 1, k is a positive integer, and m is a total number of the identified rows.
- A device for region identification, characterized in that said device comprises:a first binarization module (710, 810), configured to binarize a word region to obtain a binarized word region, wherein the word region comprises several words belonging to a same row;a first calculation module (720, 820), configured to calculate, in a vertical direction, a histogram for the binarized word region, wherein the histogram comprises abscissas of pixels in each column and an accumulated value of foreground color pixels of the pixels in each column; anda region identification module (730, 830), configured to identify a character region of each of the words in the word region, according to distribution information of accumulated values in the histogram.
- The device of claim 9, wherein the region identification module (730, 830) comprises:a coordinate determination sub-module (831), configured to determine several sets of abscissas according to the distribution information of the accumulated values in the histogram, wherein each of the several sets of abscissas comprises a first abscissa and a second abscissa located on the right side of the first abscissa; wherein accumulated values respectively corresponding to the first abscissa and an abscissa on the right side of and adjacent to the first abscissa are larger than a first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the first abscissa is smaller than a second threshold; and accumulated values respectively corresponding to the second abscissa and an abscissa on the left side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the second abscissa is smaller than the second threshold; anda region identification sub-module (832), configured to, for each of the several sets of abscissas, identify a pixel column where the first abscissa is located as a left edge of a character region, and identify a pixel column where the second abscissa is located as a right edge of the character region.
- The device of claim 10, wherein the coordinate determination sub-module (831) comprises:a coordinate identification sub-module (831a), configured to identify a third abscissa in the histogram according to the distribution information of the accumulated values, wherein the third abscissa is an abscissa in the histogram corresponding to a left edge of a character region of the first valid word among the several words, or an abscissa in the histogram corresponding to a right edge of a character region of the last valid word among the several words; anda coordinate search sub-module (831b), configured to search, starting with the third abscissa in a predetermined direction and based on the distribution information of the accumulated values, the several sets of abscissas.
- The device of claim 11, wherein in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the coordinate search sub-module (831b) is further configured to:for an ith set of abscissas, search, starting with the first abscissa within the ith set of abscissas in the histogram and in a direction towards right, a fourth abscissa, wherein accumulated values respectively corresponding to the fourth abscissa and an abscissa on the left side of and adjacent to the fourth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the fourth abscissa is smaller than the second threshold; wherein 1 ≤ i ≤ n, i is a positive integer of which an initial value is 1, and n is a number of valid words in the several words; and the first abscissa in the first set of abscissas is the third abscissa;determine the fourth abscissa as the second abscissa within the ith set of abscissas;search, starting with the fourth abscissa in the histogram and in the direction towards right, a fifth abscissa, if i<n, wherein accumulated values respectively corresponding to the fifth abscissa and an abscissa on the right side of and adjacent to the fifth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the fifth abscissa is smaller than the second threshold; andset i to i+1, and determine the fifth abscissa as the first abscissa within the ith set of abscissas; orin case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the coordinate search sub-module (831b) is further configured to:for a jth set of abscissas, search, starting with the second abscissa within the jth set of abscissas in the histogram and in a direction towards left, a sixth abscissa, wherein accumulated values respectively corresponding to the sixth abscissa and an abscissa on the right side of and adjacent to the sixth abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the left side of and adjacent to the sixth abscissa is smaller than the second threshold; 1 ≤ j ≤ n, j is a positive integer of which an initial value is n, and n is a number of valid words in the several words; and the second abscissa within the nth set of abscissas is the third abscissa;determine the sixth abscissa as the first abscissa within the jth set of abscissas;search, starting with the sixth abscissa in the histogram and in the direction towards left, a seventh abscissa, if j>0, wherein accumulated values respectively corresponding to the seventh abscissa and an abscissa on the left side of and adjacent to the seventh abscissa are larger than the first threshold, and an accumulated value corresponding to an abscissa on the right side of and adjacent to the seventh abscissa is smaller than the second threshold; andset j to j-1, and determine the seventh abscissa as the second abscissa within the jth set of abscissas.
- The device of claim 11, wherein in case that the third abscissa is the abscissa in the histogram corresponding to the left edge of the character region of the first valid word among the several words, the coordinate identification sub-module (831a) is further configured to:in case that the several words comprise both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, look up, starting with a predetermined abscissa in the histogram and in the direction towards left, an interval which is the first interval of which a width is larger than the second distance; and determine, an abscissa located on the right side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; orin case that the several words are all valid words, determine, a first one of abscissas located on the left side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas; orin case that the third abscissa is the abscissa in the histogram corresponding to a right edge of the character region of the last valid word among the several words, the coordinate identification sub-module (831a) is further configured to:in case that the several words comprise both valid words and invalid words and a first distance between a valid word and an invalid word is larger than a second distance between two adjacent valid words, look up, starting with a predetermined abscissa in the histogram and in the direction towards right, an interval of which a width is larger than the second distance; and determine, an abscissa located on the left side of the interval and of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissa; wherein the predetermined abscissa belongs to a predetermined range, which is set according to an empirical value; and the accumulated value of foreground color pixels in the interval is smaller than the second threshold; orin case that the several words are all valid words, determine, a first one of abscissas located on the right side of the histogram of which the accumulated value of foreground color pixels is larger than the first threshold, as the third abscissas.
- The device of any one of claims 9 to 13, further comprising:a second binarization module (840), configured to binarize a targeted image region, to obtain a binarized targeted image region;a second calculation module (850), configured to calculate, in a horizontal direction, a horizontal histogram for a binarized targeted image region, wherein the horizontal histogram comprises: ordinates of pixels in each row and an accumulated value of foreground color pixels of the pixels in each row;an edge determination module (860), configured to determine, according to distribution information of the accumulated values in the horizontal histogram, several sets of ordinates, wherein each of the several sets of ordinates comprises a first ordinate and a second ordinate located below the first ordinate; and for each of the several sets of ordinates, identify a pixel row where the first ordinate is located as an upper edge of a row of words, and identify a pixel row where the second ordinate is located as a lower edge of the row of words; accumulated values respectively corresponding to the first ordinate and an ordinate on the lower side of and adjacent to the first abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the upper side of and adjacent to the first ordinate is smaller than the second threshold; and accumulated values respectively corresponding to the second ordinate and an ordinate on the upper side of and adjacent to the second abscissa are larger than the first threshold, and an accumulated value corresponding to an ordinate on the lower side of and adjacent to the second abscissa is smaller than the second threshold; andthe first binarization module is further configured to, for a kth row in the word region, perform the binarizing the word region, wherein m ≥ k ≥ 1, k is a positive integer, and m is a total number of the identified rows.
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510726153.9A CN105528606B (en) | 2015-10-30 | 2015-10-30 | Area recognizing method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| EP3163502A1 true EP3163502A1 (en) | 2017-05-03 |
Family
ID=55770820
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| EP16195027.4A Ceased EP3163502A1 (en) | 2015-10-30 | 2016-10-21 | Method and device for region identification |
Country Status (8)
| Country | Link |
|---|---|
| US (1) | US10157326B2 (en) |
| EP (1) | EP3163502A1 (en) |
| JP (1) | JP6392468B2 (en) |
| KR (1) | KR101805090B1 (en) |
| CN (1) | CN105528606B (en) |
| MX (1) | MX378914B (en) |
| RU (1) | RU2639668C2 (en) |
| WO (1) | WO2017071063A1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109145891A (en) * | 2018-06-27 | 2019-01-04 | 上海携程商务有限公司 | Client and its system for identifying the method for identity card, identifying identity card |
| CN111291750A (en) * | 2020-01-21 | 2020-06-16 | 河南大学 | Oracle automatic labeling method based on spatial neighbor relation |
Families Citing this family (28)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7873200B1 (en) | 2006-10-31 | 2011-01-18 | United Services Automobile Association (Usaa) | Systems and methods for remote deposit of checks |
| US8708227B1 (en) | 2006-10-31 | 2014-04-29 | United Services Automobile Association (Usaa) | Systems and methods for remote deposit of checks |
| US9058512B1 (en) | 2007-09-28 | 2015-06-16 | United Services Automobile Association (Usaa) | Systems and methods for digital signature detection |
| US9159101B1 (en) | 2007-10-23 | 2015-10-13 | United Services Automobile Association (Usaa) | Image processing |
| US10380562B1 (en) | 2008-02-07 | 2019-08-13 | United Services Automobile Association (Usaa) | Systems and methods for mobile deposit of negotiable instruments |
| US10504185B1 (en) | 2008-09-08 | 2019-12-10 | United Services Automobile Association (Usaa) | Systems and methods for live video financial deposit |
| US8452689B1 (en) | 2009-02-18 | 2013-05-28 | United Services Automobile Association (Usaa) | Systems and methods of check detection |
| US10956728B1 (en) | 2009-03-04 | 2021-03-23 | United Services Automobile Association (Usaa) | Systems and methods of check processing with background removal |
| US9779392B1 (en) | 2009-08-19 | 2017-10-03 | United Services Automobile Association (Usaa) | Apparatuses, methods and systems for a publishing and subscribing platform of depositing negotiable instruments |
| US8977571B1 (en) | 2009-08-21 | 2015-03-10 | United Services Automobile Association (Usaa) | Systems and methods for image monitoring of check during mobile deposit |
| US8699779B1 (en) | 2009-08-28 | 2014-04-15 | United Services Automobile Association (Usaa) | Systems and methods for alignment of check during mobile deposit |
| US9129340B1 (en) | 2010-06-08 | 2015-09-08 | United Services Automobile Association (Usaa) | Apparatuses, methods and systems for remote deposit capture with enhanced image detection |
| US10380565B1 (en) | 2012-01-05 | 2019-08-13 | United Services Automobile Association (Usaa) | System and method for storefront bank deposits |
| US9286514B1 (en) * | 2013-10-17 | 2016-03-15 | United Services Automobile Association (Usaa) | Character count determination for a digital image |
| US10402790B1 (en) | 2015-05-28 | 2019-09-03 | United Services Automobile Association (Usaa) | Composing a focused document image from multiple image captures or portions of multiple image captures |
| US10506281B1 (en) | 2015-12-22 | 2019-12-10 | United Services Automobile Association (Usaa) | System and method for capturing audio or video data |
| US11030752B1 (en) | 2018-04-27 | 2021-06-08 | United Services Automobile Association (Usaa) | System, computing device, and method for document detection |
| CN109635807A (en) * | 2018-10-16 | 2019-04-16 | 深圳壹账通智能科技有限公司 | Information input method, device, equipment and computer readable storage medium |
| CN111104940A (en) * | 2018-10-26 | 2020-05-05 | 深圳怡化电脑股份有限公司 | Image rotation correction method and device, electronic equipment and storage medium |
| CN111223104B (en) * | 2018-11-23 | 2023-10-10 | 杭州海康威视数字技术股份有限公司 | Package extraction and tracking method, device and electronic equipment |
| CN110533030B (en) * | 2019-08-19 | 2023-07-14 | 三峡大学 | Time stamp information extraction method of solar film image based on deep learning |
| CN111898602B (en) * | 2020-08-10 | 2024-04-16 | 赞同科技股份有限公司 | Method, device and equipment for identifying voucher number area in image |
| US11900755B1 (en) | 2020-11-30 | 2024-02-13 | United Services Automobile Association (Usaa) | System, computing device, and method for document detection and deposit processing |
| CN113723301B (en) * | 2021-08-31 | 2024-08-30 | 广州新丝路信息科技有限公司 | OCR recognition and branch processing method and device for import goods customs declaration |
| CN117351438B (en) * | 2023-10-24 | 2024-06-04 | 武汉无线飞翔科技有限公司 | A vehicle real-time position tracking method and system based on image recognition |
| CN117274267B (en) * | 2023-11-22 | 2024-04-05 | 合肥晶合集成电路股份有限公司 | Automatic detection method and device for mask layout, processor and electronic equipment |
| CN117727059B (en) * | 2024-02-18 | 2024-05-03 | 蓝色火焰科技成都有限公司 | Method and device for checking automobile financial invoice information, electronic equipment and storage medium |
| US12211095B1 (en) | 2024-03-01 | 2025-01-28 | United Services Automobile Association (Usaa) | System and method for mobile check deposit enabling auto-capture functionality via video frame processing |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104156704A (en) * | 2014-08-04 | 2014-11-19 | 胡艳艳 | Novel license plate identification method and system |
| US20150077817A1 (en) * | 2013-09-19 | 2015-03-19 | Pfu Limited | Image processing apparatus, image processing method, and computer-readable, non-transitory medium |
Family Cites Families (14)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR0186172B1 (en) | 1995-12-06 | 1999-05-15 | 구자홍 | Character recognition apparatus |
| JP3452774B2 (en) * | 1997-10-16 | 2003-09-29 | 富士通株式会社 | Character recognition method |
| AU2002351310A1 (en) * | 2001-12-06 | 2003-06-23 | The Trustees Of Columbia University In The City Of New York | System and method for extracting text captions from video and generating video summaries |
| RU2234126C2 (en) * | 2002-09-09 | 2004-08-10 | Аби Софтвер Лтд. | Method for recognition of text with use of adjustable classifier |
| US7302098B2 (en) * | 2004-12-03 | 2007-11-27 | Motorola, Inc. | Character segmentation method and apparatus |
| JP2007206985A (en) * | 2006-02-01 | 2007-08-16 | Sharp Corp | Character string extraction apparatus, character string extraction method, program thereof, and recording medium |
| JP4991411B2 (en) * | 2006-07-28 | 2012-08-01 | キヤノン株式会社 | Image processing method |
| CN101408933A (en) * | 2008-05-21 | 2009-04-15 | 浙江师范大学 | Method for recognizing license plate character based on wide gridding characteristic extraction and BP neural network |
| JP5334042B2 (en) * | 2008-11-23 | 2013-11-06 | 日本電産サンキョー株式会社 | Character string recognition method and character string recognition apparatus |
| KR20110087620A (en) | 2010-01-26 | 2011-08-03 | 광주과학기술원 | Layout-based print media page recognition method |
| JP5591578B2 (en) | 2010-04-19 | 2014-09-17 | 日本電産サンキョー株式会社 | Character string recognition apparatus and character string recognition method |
| CN102184399A (en) * | 2011-03-31 | 2011-09-14 | 上海名图信息技术有限公司 | Character segmenting method based on horizontal projection and connected domain analysis |
| CN103310435B (en) * | 2012-03-21 | 2016-04-06 | 华中科技大学 | Combine vertical projection and optimal path the method split characters on license plate |
| JP6080259B2 (en) * | 2013-02-06 | 2017-02-15 | 日本電産サンキョー株式会社 | Character cutting device and character cutting method |
-
2015
- 2015-10-30 CN CN201510726153.9A patent/CN105528606B/en active Active
- 2015-12-29 WO PCT/CN2015/099299 patent/WO2017071063A1/en not_active Ceased
- 2015-12-29 MX MX2016003679A patent/MX378914B/en unknown
- 2015-12-29 JP JP2017547046A patent/JP6392468B2/en active Active
- 2015-12-29 RU RU2016110434A patent/RU2639668C2/en active
- 2015-12-29 KR KR1020167005567A patent/KR101805090B1/en active Active
-
2016
- 2016-10-20 US US15/298,270 patent/US10157326B2/en active Active
- 2016-10-21 EP EP16195027.4A patent/EP3163502A1/en not_active Ceased
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150077817A1 (en) * | 2013-09-19 | 2015-03-19 | Pfu Limited | Image processing apparatus, image processing method, and computer-readable, non-transitory medium |
| CN104156704A (en) * | 2014-08-04 | 2014-11-19 | 胡艳艳 | Novel license plate identification method and system |
Non-Patent Citations (2)
| Title |
|---|
| "Handbook of character recognition and document image analysis, Ch16", 1 January 1997, article BUNKE ET AL: "Handbook of character recognition and document image analysis, Ch16", pages: 422 - 424, XP055558736 * |
| BUNKE H ET AL: "Image Processing Methods for Document Image Analysis", 1 January 1997, HANDBOOK OF CHARACTER RECOGNITION AND DOCUMENT IMAGE ANALYSIS, WORLD SCIENTIFIC, SINGAPORE [U.A.], PAGE(S) 35 - 38, ISBN: 978-981-02-2270-3, XP002665435 * |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109145891A (en) * | 2018-06-27 | 2019-01-04 | 上海携程商务有限公司 | Client and its system for identifying the method for identity card, identifying identity card |
| CN111291750A (en) * | 2020-01-21 | 2020-06-16 | 河南大学 | Oracle automatic labeling method based on spatial neighbor relation |
| CN111291750B (en) * | 2020-01-21 | 2023-03-24 | 河南大学 | Oracle automatic labeling method based on spatial neighbor relation |
Also Published As
| Publication number | Publication date |
|---|---|
| KR101805090B1 (en) | 2017-12-05 |
| US20170124414A1 (en) | 2017-05-04 |
| US10157326B2 (en) | 2018-12-18 |
| KR20170061631A (en) | 2017-06-05 |
| CN105528606A (en) | 2016-04-27 |
| MX378914B (en) | 2025-03-10 |
| MX2016003679A (en) | 2018-06-22 |
| JP2018500705A (en) | 2018-01-11 |
| RU2639668C2 (en) | 2017-12-21 |
| CN105528606B (en) | 2019-08-06 |
| JP6392468B2 (en) | 2018-09-19 |
| RU2016110434A (en) | 2017-09-26 |
| WO2017071063A1 (en) | 2017-05-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3163502A1 (en) | Method and device for region identification | |
| US10127471B2 (en) | Method, device, and computer-readable storage medium for area extraction | |
| US10095949B2 (en) | Method, apparatus, and computer-readable storage medium for area identification | |
| US20170124386A1 (en) | Method, device and computer-readable medium for region recognition | |
| US20170124412A1 (en) | Method, apparatus, and computer-readable medium for area recognition | |
| US20150332439A1 (en) | Methods and devices for hiding privacy information | |
| CN107977659B (en) | Character recognition method and device and electronic equipment | |
| CN105095881B (en) | Face recognition method, face recognition device and terminal | |
| EP3163509A1 (en) | Method for region extraction, method for model training, and devices thereof | |
| US10216976B2 (en) | Method, device and medium for fingerprint identification | |
| EP3333844B1 (en) | Display operation method and apparatus, computer program and recording medium | |
| CN105631803B (en) | The method and apparatus of filter processing | |
| US10438377B2 (en) | Method and device for processing a page | |
| CN106227505A (en) | Image detecting method, device and the device for image detection |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PUAI | Public reference made under article 153(3) epc to a published international application that has entered the european phase |
Free format text: ORIGINAL CODE: 0009012 |
|
| 17P | Request for examination filed |
Effective date: 20161021 |
|
| AK | Designated contracting states |
Kind code of ref document: A1 Designated state(s): AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR |
|
| AX | Request for extension of the european patent |
Extension state: BA ME |
|
| 17Q | First examination report despatched |
Effective date: 20171114 |
|
| STAA | Information on the status of an ep patent application or granted ep patent |
Free format text: STATUS: THE APPLICATION HAS BEEN REFUSED |
|
| 18R | Application refused |
Effective date: 20190305 |