CN105117680B - A kind of method and apparatus of the information of ID card - Google Patents

A kind of method and apparatus of the information of ID card Download PDF

Info

Publication number
CN105117680B
CN105117680B CN201510221862.1A CN201510221862A CN105117680B CN 105117680 B CN105117680 B CN 105117680B CN 201510221862 A CN201510221862 A CN 201510221862A CN 105117680 B CN105117680 B CN 105117680B
Authority
CN
China
Prior art keywords
gradient
pixel point
line segment
image
preset
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.)
Active
Application number
CN201510221862.1A
Other languages
Chinese (zh)
Other versions
CN105117680A (en
Inventor
龙飞
张涛
陈志军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiaomi Inc
Original Assignee
Xiaomi Inc
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201510221862.1A priority Critical patent/CN105117680B/en
Publication of CN105117680A publication Critical patent/CN105117680A/en
Application granted granted Critical
Publication of CN105117680B publication Critical patent/CN105117680B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The disclosure is directed to a kind of method and apparatus of the information of ID card, belong to field of computer technology.The described method includes: obtaining the corresponding gradient bianry image of detection image of release, the two values of the gradient bianry image respectively correspond high gradient and low gradient;In each line segment connected into the gradient bianry image by the pixel of two high gradients, the number for choosing the pixel comprising high gradient meets the line segment of preset number condition;According to the line segment of selection, in the detection image, the boundary of the release is determined;According to the boundary of the release, in the detection image, the information in the clamp of the release is identified.Using the disclosure, the efficiency of the information of ID card can be improved.

Description

Method and device for identifying information of information card
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for identifying information of an information card.
Background
With the development of mobile terminal technology, the application of the mobile terminal is more and more extensive, and the functions are more and more powerful, and the mobile terminal can identify information on an information card besides mobile communication. The information card is a card with information such as numbers and images printed on the card body, such as a bank card and an identity card. Taking the information card as a bank card as an example, when a user pays, the mobile terminal can identify the bank card number printed on the bank card, so that the user can pay by using an account corresponding to the bank card number without inputting the bank card number.
When the mobile terminal identifies the information on the information card, the mobile terminal firstly acquires a detection image containing the information card, then analyzes the detection image, extracts information related to the content printed on the card body from the detection image, and further identifies the information of the information card.
In carrying out the present disclosure, the inventors found that at least the following problems exist:
when the mobile terminal identifies the information of the information card, it needs to analyze the entire detection image including the information card and then identify the information of the information card, which may result in low efficiency of identifying the information of the information card.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides a method and apparatus for identifying information of an information card. The technical scheme is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a method of identifying information of an information card, the method including:
acquiring a gradient binary image corresponding to a detection image of an information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in the gradient binary image;
determining the boundary of the information card in the detection image according to the selected line segment;
and identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
Optionally, in each line segment formed by connecting two high-gradient pixel points in the binary image, selecting a line segment in which the number of the high-gradient pixel points meets a preset number condition, where the selecting includes:
regarding the boundary of any direction of the information card, taking the any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image;
if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment, the number of which meets the preset number condition, from all line segments formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area.
Optionally, if the first direction is up or down, selecting a first type of pixel point of which a left-side adjacent pixel point is a low-gradient pixel point from high-gradient pixel points of the left half portion of the image in the first preset detection area, selecting a second type of pixel point of which a right-side adjacent pixel point is a low-gradient pixel point from high-gradient pixel points of the right half portion of the image in the first preset detection area, and selecting a line segment, of which the number of the high-gradient pixel points meets a preset number condition, from each line segment formed by connecting one pixel point of the first type of pixel point and one pixel point of the second type of pixel point;
if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
Optionally, if the first direction is up or down, selecting a line segment, in each line segment formed by connecting a high-gradient pixel point in the left half portion and a high-gradient pixel point in the right half portion in the image in the first preset detection area, where the number of the high-gradient pixel points meets a preset number condition and an included angle with the horizontal direction is smaller than a preset angle threshold;
and if the first direction is left or right, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the vertical direction smaller than the preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part in the image in the first preset detection area.
Optionally, if the first direction is up or down, in each pixel row of the image in the first preset detection area, high-gradient pixel points whose number is greater than a second preset number threshold are reserved in a horizontal continuous manner, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half portion and one high-gradient pixel point in the right half portion of the image in the first preset detection area after removal processing, a line segment including the number of the high-gradient pixel points meeting a preset number condition is selected;
if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing the high gradients meets the preset number condition.
Optionally, the selecting a line segment in which the number of pixel points with high gradient meets a preset number condition includes:
selecting a line segment with the largest number of pixel points with high gradient; or,
and selecting the line segment with the number of the pixel points with high gradient larger than a first preset number threshold value.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for identifying information of an information card, the apparatus including:
the acquisition module is used for acquiring a gradient binary image corresponding to a detection image of the information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
the selecting module is used for selecting line segments with the number of the high-gradient pixel points meeting a preset number condition from all line segments formed by connecting two high-gradient pixel points in the gradient binary image;
the determining module is used for determining the boundary of the information card in the detection image according to the selected line segment;
and the identification module is used for identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
Optionally, the selecting module is configured to:
regarding the boundary of any direction of the information card, taking the any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image;
if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment, the number of which meets the preset number condition, from all line segments formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area.
Optionally, the selecting module is configured to: if the first direction is up or down, selecting a first type of pixel point of which the left adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the left half part of the image in the first preset detection area, selecting a second type of pixel point of which the right adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the right half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the first type of pixel point and one pixel point of the second type of pixel point;
if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
Optionally, the selecting module is configured to: if the first direction is up or down, selecting a line segment which contains the number of high-gradient pixel points, meets a preset number condition and has an included angle with the horizontal direction smaller than a preset angle threshold value, from each line segment formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part in the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the vertical direction smaller than the preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part in the image in the first preset detection area.
Optionally, the selecting module is configured to: if the first direction is up or down, in each pixel row of the image in the first preset detection area, transversely continuous high-gradient pixel points of which the number is larger than a second preset number threshold value are reserved, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half part and one high-gradient pixel point in the right half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the high-gradient pixel points meets a preset number condition;
if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing the high gradients meets the preset number condition.
Optionally, the selecting module is configured to:
selecting a line segment with the largest number of pixel points with high gradient; or,
and selecting the line segment with the number of the pixel points with high gradient larger than a first preset number threshold value.
According to a third aspect of the embodiments of the present disclosure, there is provided an apparatus for identifying information of an information card, the apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring a gradient binary image corresponding to a detection image of an information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in the gradient binary image;
determining the boundary of the information card in the detection image according to the selected line segment;
and identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the embodiment of the disclosure, a gradient binary image corresponding to a detection image of an information card is obtained, and two values of the gradient binary image respectively correspond to a high gradient and a low gradient; selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in a gradient binary image; determining the boundary of the information card in the detection image according to the selected line segment; the information on the card body of the information card is identified in the detection image according to the boundary of the information card, so that after the boundary of the information card is determined, the information on the card body of the information card can be identified according to the boundary of the information card, the whole detection image containing the information card does not need to be analyzed, and the information identification efficiency of the information card can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. In the drawings:
FIG. 1 is a flow diagram illustrating a method of identifying information of an information card in accordance with one illustrative embodiment;
FIG. 2 is a schematic diagram of a gradient binary image shown in accordance with an exemplary embodiment;
FIG. 3 is a schematic diagram of a gradient binary image shown in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating boundary detection in accordance with an exemplary embodiment;
FIG. 5 is a schematic diagram of an apparatus for identifying information on an information card, according to an exemplary embodiment;
fig. 6 is a schematic diagram illustrating a structure of a terminal according to an exemplary embodiment.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
An exemplary embodiment of the present disclosure provides a method for identifying information of an information card, as shown in fig. 1, a processing flow of the method may include the following steps:
in step 101, a gradient binary image corresponding to a detected image of the information card is obtained, and two values of the gradient binary image correspond to a high gradient and a low gradient, respectively.
In step 102, in each line segment formed by connecting two high-gradient pixel points in the gradient binary image, a line segment is selected, wherein the number of the high-gradient pixel points meets a preset number condition.
In step 103, the boundary of the information card is determined in the detection image according to the selected line segment.
In step 104, information on the card body of the information card is identified in the detection image based on the boundary of the information card.
In the embodiment of the disclosure, a gradient binary image corresponding to a detection image of an information card is obtained, and two values of the gradient binary image respectively correspond to a high gradient and a low gradient; selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in a gradient binary image; determining the boundary of the information card in the detection image according to the selected line segment; the information on the card body of the information card is identified in the detection image according to the boundary of the information card, so that after the boundary of the information card is determined, the information on the card body of the information card can be identified according to the boundary of the information card, the whole detection image containing the information card does not need to be analyzed, and the information identification efficiency of the information card can be improved.
Another exemplary embodiment of the present disclosure provides a method for identifying information of an information card, which may be used in a terminal, wherein the terminal may be a terminal having a function of identifying information on the information card, such as a mobile terminal like a mobile phone or a tablet computer. The terminal can be provided with an application program with a function of identifying information on the information card, the terminal can comprise an input unit, the input unit can be a camera or a scanner, and the terminal can acquire a detection image of the information card through the input unit; the terminal can comprise a processor, and the processor can identify information on the card body of the information card according to the acquired detection image of the information card; the terminal may further include a display unit, which may be a liquid crystal display, and may display information obtained by the recognition processing by the processor. In addition, the terminal may also include components such as memory, sensors, audio circuitry, and a power supply.
The process flow shown in fig. 1 will be described in detail below with reference to the embodiments, and the contents may be as follows:
in step 101, a gradient binary image corresponding to a detected image of the information card is obtained, and two values of the gradient binary image correspond to a high gradient and a low gradient, respectively.
In implementation, a user may install an application program on the terminal, where the application program has a function of identifying information on an information card, and the information card may be a card with information such as numbers and images printed on the card, such as a bank card and an identity card. When a user wants to identify information on an information card, the user can start the application program at the terminal, click the corresponding option of the information card identification, the terminal can receive a click instruction corresponding to the option, then can start an input device (such as a camera), display a detection area in a screen, and move the position of the terminal so that images of the information card are all located in the displayed detection area, the terminal can acquire a detection image of the information card, then can perform gradient detection processing on the detection image through a sobel boundary detection algorithm to obtain a gradient value corresponding to each pixel point, and further can acquire a gradient image corresponding to the detection image. The terminal may store a gradient threshold in advance, and then, of the gradient values corresponding to each pixel point, a gradient value larger than the gradient threshold may be used as a high gradient, and a gradient value smaller than the gradient threshold may be used as a low gradient. The terminal may use two values to respectively correspond to the high gradient and the low gradient, and the two values correspond to different colors in the gradient image, so that the terminal may obtain a gradient binary image corresponding to the detected image according to the gradient value of each pixel point, as shown in fig. 2. In this embodiment, the numerical value corresponding to the high gradient is 1, and the numerical value corresponding to the low gradient is 0, which are similar to each other, where 1 may correspond to white in the gradient image, and 0 may correspond to black in the gradient image.
In step 102, in each line segment formed by connecting two high-gradient pixel points in the gradient binary image, a line segment is selected, wherein the number of the high-gradient pixel points meets a preset number condition.
In implementation, after the terminal obtains the gradient binary image corresponding to the detection image of the information card, two pixel points can be arbitrarily selected from the pixel points with the value of 1 of the gradient binary image to be connected to obtain a plurality of line segments, then the number of the pixel points with the value of 1 in the line segments can be determined, and then the line segments with the number of the pixel points with high gradient meeting the preset number condition can be selected.
Optionally, the preset number condition may be various, and the corresponding processing procedure may be as follows: selecting a line segment with the largest number of pixel points with high gradient; or, selecting a line segment with the number of pixel points with high gradient larger than a first preset number threshold.
In implementation, for each connected line segment, the terminal may determine the number of pixel points with a value of 1 included in each line segment, and then may select the line segment with the largest number of pixel points with a value of 1; or, the terminal may select a line segment, in which the number of the pixel points with the value of 1 is greater than the first preset number threshold, after determining the number of the pixel points with the value of 1 included in each line segment.
Optionally, high-gradient pixel points may be selected from the regions in different directions of the image, and a line segment meeting the preset number condition is selected from the line segments formed by connecting the selected pixel points, and accordingly, the processing procedure in step 102 may be as follows: regarding the boundary of any direction of the information card, taking any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image; if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area; if the first direction is left or right, selecting a line segment, in each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area, wherein the number of the high-gradient pixel points meets the preset number condition.
In implementation, as for the boundary in any direction of the information card, any direction may be used as the first direction, a detection region (i.e., a first preset detection region) corresponding to the boundary in the first direction may be preset in the terminal, and the terminal may also preset a percentage of an area of the first preset detection region in the entire detection region of the terminal, for example, if the first direction is up, the first preset detection region may be an upper third region of the entire detection region of the terminal. The terminal can acquire an image in a first preset detection area corresponding to the boundary in the first direction in the gradient binary image.
If the first direction is up or down, the terminal can randomly select a pixel point with the numerical value of 1 in the left half part of the image in the first preset detection area, randomly select a pixel point with the numerical value of 1 in the right half part, and then connect into a line segment, the terminal can connect into a plurality of line segments according to all the pixel points with the numerical value of 1 in the left half part and all the pixel points with the numerical value of 1 in the right half part, and then can select the line segment with the number of the pixel points with high gradient meeting the preset number condition in all the connected line segments.
If the first direction is left or right, the terminal can randomly select a pixel point with the numerical value of 1 in the upper half part of the image in the first preset detection area, randomly select a pixel point with the numerical value of 1 in the lower half part, and then connect into a line segment, the terminal can connect into a plurality of line segments according to all the pixel points with the numerical value of 1 in the upper half part and all the pixel points with the numerical value of 1 in the lower half part, and then can select the line segment with the number of the pixel points with the numerical value of 1 meeting the preset number condition in all the connected line segments.
Optionally, high-gradient pixel points meeting preset conditions can be selected from preset detection areas in different directions of the image, line segments meeting preset number conditions are selected from line segments formed by connecting the selected pixel points, and accordingly, the processing process can be as follows: if the first direction is up or down, selecting a first type of pixel point of which the left adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the left half part of the image in the first preset detection area, selecting a second type of pixel point of which the right adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the right half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point in the first type of pixel point and one pixel point in the second type of pixel point; if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets the preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
In implementation, if the first direction is up or down, the terminal may select, as the first-class pixels, all pixels whose values are 0 and whose left-side adjacent pixels are left-side adjacent pixels among the pixels whose values are 1 and whose values are left half of the image in the first preset detection area, select, as the second-class pixels, all pixels whose values are 0 and whose right-side adjacent pixels are right-side adjacent pixels among the pixels whose values are right half of the image in the first preset detection area and whose values are 1, and then select, as the second-class pixels, a segment whose number of pixels including the value of 1 satisfies the preset number condition from among segments in which one of the first-class pixels and one of the second-class pixels are connected.
If the first direction is left or right, the terminal can select all the pixels with the numerical value of 0 as the first-class pixels from the pixels with the numerical value of 1 in the upper half part of the image in the first preset detection area, select all the pixels with the numerical value of 0 as the lower-side adjacent pixels from the pixels with the numerical value of 1 in the lower half part of the image in the first preset detection area, select all the pixels with the numerical value of 0 as the second-class pixels, and select the line segment with the number of the pixels with the numerical value of 1 meeting the preset number condition from the line segments formed by connecting one pixel in the first-class pixels and one pixel in the second-class pixels.
Optionally, the line segment may be selected according to a preset angle threshold, and correspondingly, the processing procedure may be as follows: if the first direction is up or down, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the horizontal direction smaller than a preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part in the image in the first preset detection area; if the first direction is left or right, selecting a line segment, in each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area, wherein the number of the high-gradient pixel points meets a preset number condition, and an included angle between the high-gradient pixel points and the vertical direction is smaller than a preset angle threshold value.
In implementation, if the first direction is up or down, the terminal may randomly select one pixel point with a value of 1 in the left half of the image in the first preset detection area, randomly select one pixel point with a value of 1 in the right half, and then connect the pixel points into one line segment, the terminal may connect the pixel points with the value of 1 in the left half and the pixel points with the value of 1 in the right half into a plurality of line segments, then may determine the number of pixel points with high gradients in the line segments, may determine an included angle between the line segments and the horizontal direction, and select a line segment where the number of pixel points with high gradients meets a preset number condition and the included angle between the line segment and the horizontal direction is smaller than a preset angle threshold. For example, the preset number condition is that the number of the pixel points with high gradient is greater than 20, the preset angle threshold is 15 degrees, for a line segment formed by connecting the high pixel points (5,5) and the high pixel points (55,2), the terminal determines that the number of the pixel points with high gradient of the line segment is 30, and the included angle between the line segment and the horizontal direction is 8.5 degrees, then the terminal can select the line segment.
If the first direction is left or right, the terminal can randomly select a pixel point with the numerical value of 1 in the upper half part of the image in the first preset detection area, randomly select a pixel point with the numerical value of 1 in the lower half part, and then connect into a line segment, the terminal can connect into a plurality of line segments according to all the pixel points with the numerical value of 1 in the upper half part and all the pixel points with the numerical value of 1 in the lower half part, then can determine the number of pixel points containing high gradient in the line segments, and can determine the included angles between the line segments and the vertical direction, and select the line segment of which the number of the pixel points containing high gradient meets the preset number condition and the included angle between the line segments and the vertical direction is smaller than the preset angle threshold. For example, the preset number condition is that the number of the pixel points with high gradient is greater than 20, the preset angle threshold is 15 degrees, for a line segment formed by connecting the high pixel points (5,5) and the high pixel points (2,55), the terminal determines that the number of the pixel points with high gradient of the line segment is 35, and the included angle between the line segment and the vertical direction is 8.5 °, the terminal can select the line segment.
Optionally, a part of pixel points may be excluded from the gradient binary image, and then line segments are selected, and accordingly, the processing procedure in the above steps may be as follows: if the first direction is up or down, high-gradient pixel points with the number larger than a second preset number threshold value are reserved in each pixel row of the image in the first preset detection area in a transverse continuous mode, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half part and one high-gradient pixel point in the right half part of the image in the first preset detection area after removal processing, line segments with the number of the high-gradient pixel points meeting a preset number condition are selected; if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing high gradients meets a preset number condition.
In implementation, if the first direction is up or down, the terminal may determine the number of pixel points with a horizontal continuous numerical value of 1 in each pixel row of the image in the first preset detection area, and the terminal may retain the pixel points with a horizontal continuous numerical value of 1 that is greater than the second preset number threshold, and remove other pixel points with a numerical value of 1. The terminal can randomly select a pixel point with the value of 1 in the left half part of the image in the first preset detection area after removal processing, randomly select a pixel point with the value of 1 in the right half part, and then connect the pixel points into a line segment, and the terminal can select a line segment, in each connected line segment, of which the number of the pixel points with the value of 1 meets the preset number condition. The technical staff can preset a second preset number threshold in the application program so that the terminal can keep or remove the pixel points according to the second preset number threshold, and the technical staff can also preset the proportion of the number of the pixel points with the transverse continuous numerical value of 1 in the total number of the transverse pixel points in the gradient binary image in the application program, so that the terminal can determine the number threshold of the pixel points with the transverse continuous numerical value of 1 according to the proportion so as to keep or remove the pixel points. For example, the ratio is set to 1/10, and the total number of horizontal pixels is 1000, then the terminal may retain horizontally consecutive pixels whose number is greater than 100 and whose value is 1, and remove other pixels whose value is 1.
If the first direction is left or right, the terminal may determine the number of pixel points with a longitudinally continuous numerical value of 1 in each pixel row of the image in the first preset detection area, and the terminal may reserve pixel points with a longitudinally continuous numerical value of 1 greater than the second preset number threshold, and remove other pixel points with a numerical value of 1. The terminal can randomly select a pixel point with the value of 1 in the upper half part of the image in the first preset detection area after removal processing, randomly select a pixel point with the value of 1 in the lower half part, and then connect the pixel points into a line segment, and the terminal can select the line segment containing the number of the pixel points with the value of 1 and meeting the preset number condition in each line segment connected. The technician can preset a second preset number threshold in the application program, so that the terminal reserves or removes the pixel points according to the second preset number threshold, and the technician can also preset the proportion of the number of the pixel points with the longitudinal continuous numerical value of 1 in the total number of the longitudinal pixel points in the gradient binary image in the application program, so as to reserve or remove the pixel points, as shown in fig. 3.
In step 103, the boundary of the information card is determined in the detection image according to the selected line segment.
In implementation, after the terminal selects the line segment, the boundary of the information card can be determined in the detection image according to the selected line segment. For the case that the terminal selects the line segment with the largest number of pixel points with high gradient, the terminal may determine one line segment in the preset detection areas corresponding to the upper, lower, left and right directions to obtain four line segments, and then determine the straight lines where the four line segments are located, and then obtain four vertexes where the four straight lines intersect, so as to connect the four vertexes to obtain the boundary of the information card, as shown in fig. 4.
For the condition that the terminal selects the line segment with the number of the pixel points with high gradient being greater than the first preset number threshold, if the first direction is up or down, the terminal can determine the average value of the coordinates of the left end point of each selected line segment to obtain the pixel point (which can be called as a first pixel point) corresponding to the average value of the coordinates, and can also determine the average value of the coordinates of the right end point of each selected line segment to obtain the pixel point (which can be called as a second pixel point) corresponding to the average value of the coordinates, and then can connect the first pixel point and the second pixel point to obtain the upper boundary or the lower boundary of the information card, if the first direction is left or right, the terminal can determine the average value of the coordinates of the upper end point of each selected line segment to obtain the pixel point (which can be called as a third pixel point) corresponding to the average value of the coordinates, and can also determine, and obtaining a pixel point (which can be called as a fourth pixel point) corresponding to the average value of the coordinates, and then connecting the third pixel point and the fourth pixel point to obtain the left boundary or the right boundary of the information card.
In step 104, information on the card body of the information card is identified in the detection image based on the boundary of the information card.
In implementation, after the terminal determines the boundary of the information card, an image within the boundary of the information card may be determined in the detection image, information extraction may be performed in the image, and the extracted information may be analyzed to identify information on the card body of the information card.
In the embodiment of the disclosure, a gradient binary image corresponding to a detection image of an information card is obtained, and two values of the gradient binary image respectively correspond to a high gradient and a low gradient; selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in a gradient binary image; determining the boundary of the information card in the detection image according to the selected line segment; the information on the card body of the information card is identified in the detection image according to the boundary of the information card, so that after the boundary of the information card is determined, the information on the card body of the information card can be identified according to the boundary of the information card, the whole detection image containing the information card does not need to be analyzed, and the information identification efficiency of the information card can be improved.
Still another exemplary embodiment of the present disclosure provides an apparatus for identifying information of an information card, as shown in fig. 5, the apparatus including: an acquisition module 510, a selection module 520, a determination module 530, and an identification module 540.
An obtaining module 510, configured to obtain a gradient binary image corresponding to a detection image of an information card, where two values of the gradient binary image correspond to a high gradient and a low gradient, respectively;
a selecting module 520, configured to select, from each line segment in the gradient binary image, where two high-gradient pixel points are connected to form the line segment, a line segment in which the number of high-gradient pixel points meets a preset number condition;
a determining module 530, configured to determine, according to the selected line segment, a boundary of the information card in the detection image;
and the identifying module 540 is configured to identify information on the card body of the information card in the detection image according to the boundary of the information card.
Optionally, the selecting module 520 is configured to:
regarding the boundary of any direction of the information card, taking the any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image;
if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment, the number of which meets the preset number condition, from all line segments formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area.
Optionally, the selecting module 520 is configured to: if the first direction is up or down, selecting a first type of pixel point of which the left adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the left half part of the image in the first preset detection area, selecting a second type of pixel point of which the right adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the right half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the first type of pixel point and one pixel point of the second type of pixel point;
if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
Optionally, the selecting module 520 is configured to: if the first direction is up or down, selecting a line segment which contains the number of high-gradient pixel points, meets a preset number condition and has an included angle with the horizontal direction smaller than a preset angle threshold value, from each line segment formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part in the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the vertical direction smaller than the preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part in the image in the first preset detection area.
Optionally, the selecting module 520 is configured to: if the first direction is up or down, in each pixel row of the image in the first preset detection area, transversely continuous high-gradient pixel points of which the number is larger than a second preset number threshold value are reserved, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half part and one high-gradient pixel point in the right half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the high-gradient pixel points meets a preset number condition;
if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing the high gradients meets the preset number condition.
Optionally, the selecting module 520 is configured to:
selecting a line segment with the largest number of pixel points with high gradient; or,
and selecting the line segment with the number of the pixel points with high gradient larger than a first preset number threshold value.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In the embodiment of the disclosure, a gradient binary image corresponding to a detection image of an information card is obtained, and two values of the gradient binary image respectively correspond to a high gradient and a low gradient; selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in a gradient binary image; determining the boundary of the information card in the detection image according to the selected line segment; the information on the card body of the information card is identified in the detection image according to the boundary of the information card, so that after the boundary of the information card is determined, the information on the card body of the information card can be identified according to the boundary of the information card, the whole detection image containing the information card does not need to be analyzed, and the information identification efficiency of the information card can be improved.
It should be noted that: the apparatus for identifying information of an information card provided in the above embodiment is only illustrated by the above division of each functional module when identifying information of an information card, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the apparatus for identifying information of an information card and the method embodiment for identifying information of an information card provided in the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
Yet another exemplary embodiment of the present disclosure provides a structural diagram of a terminal. The terminal may be a mobile phone or the like.
Referring to fig. 6, terminal 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the terminal 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operation at the terminal 800. Examples of such data include instructions for any application or method operating on terminal 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power components 806 provide power to the various components of terminal 800. Power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for audio output device 800.
The multimedia component 808 includes a screen providing an output interface between the terminal 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the terminal 800 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the audio output device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for terminal 800. For example, sensor assembly 814 can detect an open/closed state of terminal 800, the relative positioning of components, such as a display and keypad of terminal 800, sensor assembly 814 can also detect a change in position of terminal 800 or a component of terminal 800, the presence or absence of user contact with terminal 800, orientation or acceleration/deceleration of terminal 800, and a change in temperature of terminal 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communication component 816 is configured to facilitate communications between terminal 800 and other devices in a wired or wireless manner. The terminal 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the terminal 800 may be implemented by 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 an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the terminal 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium, instructions in which, when executed by a processor of a terminal, enable the terminal to perform a method of identifying information of an information card, the method comprising:
acquiring a gradient binary image corresponding to a detection image of an information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in the gradient binary image;
determining the boundary of the information card in the detection image according to the selected line segment;
and identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
Optionally, in each line segment formed by connecting two high-gradient pixel points in the binary image, selecting a line segment in which the number of the high-gradient pixel points meets a preset number condition, where the selecting includes:
regarding the boundary of any direction of the information card, taking the any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image;
if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment, the number of which meets the preset number condition, from all line segments formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area.
Optionally, if the first direction is up or down, selecting a first type of pixel point of which a left-side adjacent pixel point is a low-gradient pixel point from high-gradient pixel points of the left half portion of the image in the first preset detection area, selecting a second type of pixel point of which a right-side adjacent pixel point is a low-gradient pixel point from high-gradient pixel points of the right half portion of the image in the first preset detection area, and selecting a line segment, of which the number of the high-gradient pixel points meets a preset number condition, from each line segment formed by connecting one pixel point of the first type of pixel point and one pixel point of the second type of pixel point;
if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
Optionally, if the first direction is up or down, selecting a line segment, in each line segment formed by connecting a high-gradient pixel point in the left half portion and a high-gradient pixel point in the right half portion in the image in the first preset detection area, where the number of the high-gradient pixel points meets a preset number condition and an included angle with the horizontal direction is smaller than a preset angle threshold;
and if the first direction is left or right, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the vertical direction smaller than the preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part in the image in the first preset detection area.
Optionally, if the first direction is up or down, in each pixel row of the image in the first preset detection area, high-gradient pixel points whose number is greater than a second preset number threshold are reserved in a horizontal continuous manner, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half portion and one high-gradient pixel point in the right half portion of the image in the first preset detection area after removal processing, a line segment including the number of the high-gradient pixel points meeting a preset number condition is selected;
if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing the high gradients meets the preset number condition.
Optionally, the selecting a line segment in which the number of pixel points with high gradient meets a preset number condition includes:
selecting a line segment with the largest number of pixel points with high gradient; or,
and selecting the line segment with the number of the pixel points with high gradient larger than a first preset number threshold value.
In the embodiment of the disclosure, a gradient binary image corresponding to a detection image of an information card is obtained, and two values of the gradient binary image respectively correspond to a high gradient and a low gradient; selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in a gradient binary image; determining the boundary of the information card in the detection image according to the selected line segment; the information on the card body of the information card is identified in the detection image according to the boundary of the information card, so that after the boundary of the information card is determined, the information on the card body of the information card can be identified according to the boundary of the information card, the whole detection image containing the information card does not need to be analyzed, and the information identification efficiency of the information card can be improved.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (13)

1. A method of identifying information of an information card, the method comprising:
acquiring a gradient binary image corresponding to a detection image of an information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in the gradient binary image;
determining the boundary of the information card in the detection image according to the selected line segment;
and identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
2. The method according to claim 1, wherein selecting, from the line segments formed by connecting two high-gradient pixel points in the gradient binary image, a line segment having a number of high-gradient pixel points satisfying a preset number condition includes:
regarding the boundary of any direction of the information card, taking the any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image;
if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment, the number of which meets the preset number condition, from all line segments formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area.
3. The method according to claim 2, wherein if the first direction is up or down, then selecting a first type of pixel whose left-side adjacent pixel is a low-gradient pixel from high-gradient pixels in the left half of the image in the first preset detection region, selecting a second type of pixel whose right-side adjacent pixel is a low-gradient pixel from high-gradient pixels in the right half of the image in the first preset detection region, and selecting a segment whose number of pixels including high gradient satisfies a preset number condition from segments in which one of the first type of pixels and one of the second type of pixels are connected;
if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
4. The method according to claim 2, wherein if the first direction is up or down, in each line segment formed by connecting a high-gradient pixel point in the left half and a high-gradient pixel point in the right half of the image in the first preset detection area, a line segment is selected, wherein the number of the high-gradient pixel points meets a preset number condition, and an included angle between the line segment and the horizontal direction is smaller than a preset angle threshold;
and if the first direction is left or right, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the vertical direction smaller than the preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part in the image in the first preset detection area.
5. The method according to claim 2, wherein if the first direction is up or down, in each pixel row of the image in the first preset detection area, high-gradient pixel points whose number is greater than a second preset number threshold are retained in a horizontal sequence, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half portion and one high-gradient pixel point in the right half portion of the image in the first preset detection area after removal processing, a line segment in which the number of the high-gradient pixel points meets a preset number condition is selected;
if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing the high gradients meets the preset number condition.
6. The method according to claim 2, wherein the selecting the line segment having the number of the pixel points with high gradient satisfying a predetermined number condition comprises:
selecting a line segment with the largest number of pixel points with high gradient; or,
and selecting the line segment with the number of the pixel points with high gradient larger than a first preset number threshold value.
7. An apparatus for identifying information of an information card, the apparatus comprising:
the acquisition module is used for acquiring a gradient binary image corresponding to a detection image of the information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
the selecting module is used for selecting line segments with the number of the high-gradient pixel points meeting a preset number condition from all line segments formed by connecting two high-gradient pixel points in the gradient binary image;
the determining module is used for determining the boundary of the information card in the detection image according to the selected line segment;
and the identification module is used for identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
8. The apparatus of claim 7, wherein the selecting module is configured to:
regarding the boundary of any direction of the information card, taking the any direction as a first direction, and acquiring an image in a first preset detection area corresponding to the boundary of the first direction in the gradient binary image;
if the first direction is up or down, selecting a line segment, the number of which meets a preset number condition, from all line segments formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part of the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment, the number of which meets the preset number condition, from all line segments formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part of the image in the first preset detection area.
9. The apparatus of claim 8, wherein the selecting module is configured to: if the first direction is up or down, selecting a first type of pixel point of which the left adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the left half part of the image in the first preset detection area, selecting a second type of pixel point of which the right adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the right half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the first type of pixel point and one pixel point of the second type of pixel point;
if the first direction is left or right, selecting a third type of pixel point of which the upper side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the upper half part of the image in the first preset detection area, selecting a fourth type of pixel point of which the lower side adjacent pixel point is a low-gradient pixel point from the high-gradient pixel points of the lower half part of the image in the first preset detection area, and selecting a line segment of which the number of the high-gradient pixel points meets a preset number condition from each line segment formed by connecting one pixel point of the third type of pixel point and one pixel point of the fourth type of pixel point.
10. The apparatus of claim 8, wherein the selecting module is configured to: if the first direction is up or down, selecting a line segment which contains the number of high-gradient pixel points, meets a preset number condition and has an included angle with the horizontal direction smaller than a preset angle threshold value, from each line segment formed by connecting a high-gradient pixel point in the left half part and a high-gradient pixel point in the right half part in the image in the first preset detection area;
and if the first direction is left or right, selecting a line segment which contains the number of high-gradient pixel points meeting a preset number condition and has an included angle with the vertical direction smaller than the preset angle threshold value from each line segment formed by connecting a high-gradient pixel point in the upper half part and a high-gradient pixel point in the lower half part in the image in the first preset detection area.
11. The apparatus of claim 8, wherein the selecting module is configured to: if the first direction is up or down, in each pixel row of the image in the first preset detection area, transversely continuous high-gradient pixel points of which the number is larger than a second preset number threshold value are reserved, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the left half part and one high-gradient pixel point in the right half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the high-gradient pixel points meets a preset number condition;
if the first direction is left or right, high-gradient pixel points with the number larger than a second preset number threshold value in longitudinal continuity are reserved in each pixel row of the image in the first preset detection area, other high-gradient pixel points are removed, and in each line segment formed by connecting one high-gradient pixel point in the upper half part and one high-gradient pixel point in the lower half part of the image in the first preset detection area after removal processing, a line segment is selected, wherein the number of the pixel points containing the high gradients meets the preset number condition.
12. The apparatus of claim 8, wherein the selecting module is configured to:
selecting a line segment with the largest number of pixel points with high gradient; or,
and selecting the line segment with the number of the pixel points with high gradient larger than a first preset number threshold value.
13. An apparatus for identifying information of an information card, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring a gradient binary image corresponding to a detection image of an information card, wherein two numerical values of the gradient binary image respectively correspond to a high gradient and a low gradient;
selecting a line segment, the number of which meets a preset number condition, from each line segment formed by connecting two high-gradient pixel points in the gradient binary image;
determining the boundary of the information card in the detection image according to the selected line segment;
and identifying the information on the card body of the information card in the detection image according to the boundary of the information card.
CN201510221862.1A 2015-05-04 2015-05-04 A kind of method and apparatus of the information of ID card Active CN105117680B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510221862.1A CN105117680B (en) 2015-05-04 2015-05-04 A kind of method and apparatus of the information of ID card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510221862.1A CN105117680B (en) 2015-05-04 2015-05-04 A kind of method and apparatus of the information of ID card

Publications (2)

Publication Number Publication Date
CN105117680A CN105117680A (en) 2015-12-02
CN105117680B true CN105117680B (en) 2019-06-14

Family

ID=54665664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510221862.1A Active CN105117680B (en) 2015-05-04 2015-05-04 A kind of method and apparatus of the information of ID card

Country Status (1)

Country Link
CN (1) CN105117680B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106845508B (en) 2015-12-07 2019-05-17 腾讯科技(深圳)有限公司 The methods, devices and systems of release in a kind of detection image
CN106127211A (en) * 2016-06-22 2016-11-16 北京小米移动软件有限公司 Blank detection method and device
CN109389644B (en) * 2017-08-10 2024-02-13 纵目科技(上海)股份有限公司 Direction gradient enhancement-based parking space line detection method
CN108345893B (en) * 2018-03-15 2021-01-26 京东方科技集团股份有限公司 Straight line detection method and device, computer storage medium and terminal
US10331966B1 (en) * 2018-10-19 2019-06-25 Capital One Services, Llc Image processing to detect a rectangular object
CN111160209B (en) * 2019-12-24 2023-07-25 北京爱医生智慧医疗科技有限公司 Method and device for eliminating noise line segments in text image

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6021256A (en) * 1996-09-03 2000-02-01 Eastman Kodak Company Resolution enhancement system for digital images
CN103473541A (en) * 2013-08-21 2013-12-25 方正国际软件有限公司 Certificate perspective correction method and system
CN104112139A (en) * 2014-06-30 2014-10-22 南京富士通南大软件技术有限公司 Method and system for accurate positioning of LPR license plate
CN104156704A (en) * 2014-08-04 2014-11-19 胡艳艳 Novel license plate identification method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6021256A (en) * 1996-09-03 2000-02-01 Eastman Kodak Company Resolution enhancement system for digital images
CN103473541A (en) * 2013-08-21 2013-12-25 方正国际软件有限公司 Certificate perspective correction method and system
CN104112139A (en) * 2014-06-30 2014-10-22 南京富士通南大软件技术有限公司 Method and system for accurate positioning of LPR license plate
CN104156704A (en) * 2014-08-04 2014-11-19 胡艳艳 Novel license plate identification method and system

Also Published As

Publication number Publication date
CN105117680A (en) 2015-12-02

Similar Documents

Publication Publication Date Title
CN105117680B (en) A kind of method and apparatus of the information of ID card
US10452890B2 (en) Fingerprint template input method, device and medium
US9674395B2 (en) Methods and apparatuses for generating photograph
JP6392468B2 (en) Region recognition method and apparatus
CN105095881B (en) Face recognition method, face recognition device and terminal
EP3125135A1 (en) Picture processing method and device
KR101782633B1 (en) Method and apparatus for area identification
US10095949B2 (en) Method, apparatus, and computer-readable storage medium for area identification
US10095377B2 (en) Method and device for displaying icon badge
CN105245775B (en) camera imaging method, mobile terminal and device
CN104918107B (en) The identification processing method and device of video file
US10216976B2 (en) Method, device and medium for fingerprint identification
CN104504684B (en) Edge extraction method and device
CN106127751B (en) Image detection method, device and system
CN105894042B (en) The method and apparatus that detection certificate image blocks
CN105631803B (en) The method and apparatus of filter processing
CN105404438B (en) Blurred background method, apparatus and terminal device
CN112927122A (en) Watermark removing method, device and storage medium
CN110286813B (en) Icon position determining method and device
CN106469446B (en) Depth image segmentation method and segmentation device
CN105677352B (en) Method and device for setting application icon color
CN104902318B (en) Control method for playing back and terminal device
CN108010009B (en) Method and device for removing interference image
CN107301404B (en) Fingerprint input method and device
CN106227505A (en) Image detecting method, device and the device for image detection

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant