1. Field of the Invention
The present invention relates to a correction method of distortion on an input image.
2. Description of the Related Art
Lately, the improvement of a slip recognition technology using an overhead reader (OHR) has been a major problem in financial optical character reader (OCR) business.
An overhead reader is a stand type image input device using a line or area CCD as a camera element as shown in
However, compared with an image obtained by a scanner (hereinafter called a “scanner image”), a slip image obtained by an OHR (hereinafter called an “OHR image”) has degradation in image quality, such as uneven gradation, shadow, image distortion, etc. The main distortion of an OHR image is three-dimension distortion.
A plurality of pieces of three-dimension distortion of an OHR image are classified into the following three categories.
In order to use an OHR in financial OCR business, a correction method for overcoming three-dimension distortion in these images must be developed, which is a major problem.
Japanese Patent Laid-open No. 10-150532 discloses a distortion correction method for an OHR image with three-dimension distortion in order to implement high-definition document recognition. This correction method targets one-point stapled distortion caused on a document obtained by stapling several pieces of paper at one point. A plurality of pieces of images photographed from a plurality of top and side viewpoints in order to calculate a three-dimension shape are used to measure three-dimension distortion.
However, since the conventional method for correcting three-dimension distortion uses a plurality of cameras, implementation cost becomes high and wide installation space is required.
It is an object of the present invention to reduce both implementation cost and installation space by using only one piece of image photographed from the top.
In the present invention, a three-dimension curved-surface model is estimated by using two-dimension outlines obtained from a piece of image photographed from the top as a clue and further using a restriction that a piece of paper is rectangular, and three-dimension distortion in the image is corrected using the calculated three-dimension curved-surface model.
According to the present invention, an outline extraction device comprises a curved-surface estimation device and a distortion correction device. An image obtained by photographing a piece of rectangular paper is used an input image. The outline extraction device extracts the outline of the paper from the input image, and the curved-surface estimation device estimates the three-dimension curved-surface model of the paper using the two-dimension outline as a clue. Then, the distortion correction device corrects the distortion based on the estimated three-dimension curved-surface model and outputs the distortion-corrected image.
Since by adopting such a configuration, an input image is corrected using two-dimension outline distortion obtained from a piece of image as a clue, compared with the conventional technology, one camera is sufficient and as a result, both implement cost and installation space can be reduced.
The preferred embodiments of the present invention are described with reference to the drawings.
Although a shadow is caused due to a fold, etc., on the OHR image of a slip, the acquisition of stable information about the shadow cannot be expected due to the dynamic shadow and uneven gradation of the shadow. Therefore, it is not recommended to use the fluctuation of a shadow as a clue to distortion correction. Therefore, in the present invention shown in
In
The outline extraction device 201 first designates outlines obtained by edge extraction, such as Sobel's edge extraction, etc., as outline pixel candidates and judges whether each outline pixel candidate constitutes the outline. The outline extraction device 201 can also be designed to extract and to use not only a paper outline obtained by edge extraction, but also a straight line (horizontal/vertical), a character string that are provided in a piece of paper.
A case where it is judged whether a target pixel in an aggregate of extracted outline pixel candidates constitutes, for example, the left outline (see
Similarly, in the case of the right outline, it is all right if a linear filter (1, 1, 1, 0, −1, −1, −1) with a configuration the reversal of the left outline is used. The top/bottom outline can also be determined in the same way.
A linear filter can have arbitrary peculiar vector that is horizontally/vertically symmetric with 0 at the center. Specifically, the filter can have peculiar vector in which n arbitrary constants k and −k arrayed with 0 at the center (k, k, . . . , k, 0, −k, −k, . . . , −k).
As described above, the outline extraction device 201 outputs a binary outline image. Furthermore, the outline extraction device 201 also extracts outline vertexes and sample outline points. Since an outline line, an outline vertex and an sample outline point are all related to an outline in a two-dimension image, it is hereinafter called as a two-dimension outline line, a two-dimension outline vertex and a two-dimension sample outline point, respectively, by attaching “two-dimension” to the respective heads in order to distinguish them from slip outlines in a three-dimension image.
A two-dimension outline vertex can be obtained by horizontally following an outline line from an outline point around the center of the top outline AB or bottom outline EF shown in
Furthermore, a two-dimension sample outline point used to apply segment linear approximation to extracted left/right outline lines can be obtained by selecting them at predetermined equal intervals towards the Y axis shown in
In the following description, the same expressions of each point, line segment, outline lines, etc., based on a two-dimension coordinates as those in
Next, the sunken center-folded curved-surface estimation device 202 is described. The sunk center-folded curved-surface estimation device 202 calculates the coordinates of the three-dimension sample outline point of a sunk center-folded slip assuming that the point is an intersection point of a line segment connecting obtained two-dimension sample outline point and a camera center, which is the viewpoint of an input image, (since a stand type OHR is used, a camera center is predetermined) and a plane that passes through a line connecting two two-dimension outline vertexes and that is perpendicular to the reference plane. The device 202 designates a broken line obtained by connecting the calculated three-dimension sample outline points as an outline line and estimates a curved-surface obtained by applying linear interpolation approximation to the outline line, as the three-dimension curved-surface model of a distorted slip curved-surface.
A sunken center-folded curved-surface can be horizontally divided into two curved surfaces with a center-folded outline (line segment touching the reference plane of the slip center) as a boundary. The process of the sunken center-folded curved-surface estimation device 202 is described in detail below limiting the process to the upper curved-surface. As for the lower curved-surface, the same description applies.
A point on a three-dimension outline that is related to a two-dimension sample outline point by perspective conversion is called a three-dimension sample outline point. The coordinates of both a camera center and a three-dimension sample outline point are assumed to be expressed as shown in
A three-dimension sample outline point on the three-dimension left outline line corresponding to a two-dimension sample outline point on the two-dimension left outline line can be calculated as an intersection point of a line segment connecting a camera center and the two-dimension sample outline point, and a plane that pass through a line segment AC connecting left outline vertexes A and C and that is perpendicular to xy plane.
The equation (1) of a plane perpendicular to xy plane, including line segment AC can be expressed as follows.
If it is assumed that a three-dimension sample outline point is a point where a line segment connecting the camera center and two-dimension sample outline point is internally divided at a ratio of (1-t): t, the following equation (2) holds true.
However, in the above equation,
If t is solved from equation (1) and (2), the following equation (3) is obtained.
If t obtained according to equation (3) is assigned to equation (1) and (2), the coordinates of each three-dimension sample outline point on the left outline line can be calculated.
The coordinates of a three-dimension sample outline point on the right outline can also be calculated in the same way.
Broken lines obtained by connecting the three-dimension sample outline points with a line segment are designated as the left/right outline lines, and a curved surface obtained by applying linear interpolation approximation to these outlines is designated as the three-dimension curved-surface model of a distorted slip.
For the linear interpolation approximation, for example, an interpolation method, such as linear Coons interpolation, etc., can be used. Linear Coons interpolation means to interpolate space between four three-dimension outlines with line segments if there is assumed to be four three-dimension outlines. A linear Coons curved-surface, to which linear Coons interpolation is applied, is a kind of parametric spatial curved-surface that is defined by a curved coordinate system (u, w). If it is assumed that a curved surface is surrounded by four curved surfaces P(u, 0), P(u, 1), P(0, w) and P(1, w), the coordinates Q(u, w) of a point on the curved surface can be expressed by the following equation (4) using an outline curve expression (see
Although as a method for calculating a three-dimension outline model in the sunken center-folded curved-surface estimation device 202, a method in which points scattered on a three-dimension outline line are designated as three-dimension sample outline points and the height or corresponding value of each three-dimension sample point is used as a model parameter, is described, a method for calculating a three-dimension outline model is not limited to this. Specifically, for example, for the three-dimension outline model, a curved model with a parameter, such as a spline curve, a Bezier curve, etc., can also be used.
A spline curve and a Bezier curve are parametric spatial curves. Generally, a parametric spatial curve is expressed by the following equation (5).
However, in the above equation, t is a parameter and (x, y, z) is the coordinates of a point on a three-dimension spatial curve. According to equation (5), a spline curve is expressed by the following expression (6).
Similarly, according to equation (5), a Bezier curve is expressed by the following equation (7).
However, in the above equation,
Since both a spline curve and a Bezier curve can be expressed by parameter t, a three-dimension outline model can be calculated using this parameter t as a model parameter.
Furthermore, a center-folded curved-surface estimation device (or curved-surface estimation device) can be designed to estimate a three-dimension curved surface in the same way by using information about a straight line (vertical/horizontal), a character string (vertical/horizontal) that are provided in a piece of paper, instead of outline lines.
Next, the distortion correction device 203 is described. The distortion correction device 203 obtains an image after correction, with the length of top/bottom outlines and the length of left/right outlines as width and height, respectively, by calculating a location in an input image corresponding to each pixel of an image after correction using a curved coordinate system with an outline line as each coordinate axis, and by setting the value (binary, gradation or color) of a corresponding pixel in the input image as the target pixel value of the image after correction.
In the case of a center-folded slip, both the top/bottom outline lines are obtained as line segments connecting outline vertexes. Both the left/right outline lines are obtained as broken lines connecting three-dimension sample outline points obtained by the sunken center-folded curved-surface estimation device 202. A center-folded outline is obtained as a line segment connecting three-dimension sample outline points obtained by the sunken center-folded curved-surface estimation device 202.
The center-folded slip is horizontally divided and distortion is corrected by setting a curved coordinate system on each corresponding three-dimension curved surface. A distortion correction method for the upper three-dimension curved surface is described below. The same process can also be applied to the lower curved surface.
The top and left outline lines are assigned to X and Y axes, respectively, using the top left outline vertex (point A shown in
Three-dimension coordinates are calculated by relating point L(Y) on the left outline line to Y with an integer value between 0 and height H in order to graduate Y coordinates on the left outline line. The three-dimension coordinates of L(Y) are calculated by following a broken line connecting three-dimension sample outline points representing the left outline line from the top left outline vertex and proceeding by length (H/Ac) at one time.
Similarly, three-dimension coordinates are obtained by relating R(Y) on the right outline line to Y with an integer value between 0 and height H. The three-dimension coordinates of R(Y) are calculated by following a broken line connecting three-dimension sample outline points representing the right outline line from the top right outline vertex and proceeding by length (H/Bd) at one time. It can be considered that a curved coordinate system is expressed by both L(Y) and R(Y) (see
Then, the gradation G(X, Y) (0≦X≦W, 0≦Y≦H) of a pixel corresponding to the two-dimension coordinates (X, Y) of an image after distortion correction are calculated by defining a curved coordinate system in this way.
A point corresponding to corrected two-dimension coordinates (X, Y) is point P with two-dimension curved coordinates (X, Y) on a three-dimension curved surface. It is assumed that the three-dimension coordinates of point P are expressed by the following expression (10).
xP=(xP,yP,zP) (10)
Point P is a point obtained by applying linear interpolation to both point L(Y) on the left outline line and R(Y) on the right outline line and it can be expressed as a point obtained by internally dividing line segment L(Y)R(Y) at a ratio of X/W:(1-X/W). Therefore, the three-dimension coordinates of point P can be calculated according to the following equation (11).
Then, the two-dimension coordinates of an intersection point of a straight line that starts from the camera center and passes through point P, and xy reference plane is calculated. The coordinates can be calculated according to equation (12) depending on perspective conversion conditions.
{tilde over (P)} is the intersection point of a straight line passing through both the camera center and point P, and xy reference plane.
Therefore, the gradation G(X, Y) of an image after correction can be calculated according to the following equation (13).
However, in the above equation, {tilde over (G)}({circumflex over (X)},Ŷ) indicates the gradation value of a pixel with the two-dimension coordinates ({circumflex over (X)},Ŷ) of an image before correction.
[x] is Gauss symbol and indicates the largest integer not exceeding x.
However, in equation (13), the two-dimension coordinates of the intersection point of a straight line that starts from the camera center and passes through point P, and xy reference plane are rounded by counting fractions of 5 and over as a unit and disregarding the rest since it is a real number.
In
In almost the same way as the outline extraction device 201 described in the first preferred embodiment, the outline extraction device 901 calculates the product sum of an edge-extracted outline pixel candidate and a linear filter after edge extraction and determines an outline pixel based on the calculated product sum value. Two-dimension outlines, two-dimension outline vertexes and two-dimension sample outline points are also extracted.
In this case, in order to extract the left/right vertexes of a center-folded outline (slip center), the left/right outline points that are farthest away from the rectangle are extracted as raised center-folded outline vertexes as not in the case of a sunken center-folded slip.
The outline extraction device 901 extracts two-dimension outline lines, two-dimension sample outline points and two-dimension outline vertexes based on the two-dimension coordinates shown in
Next, the raised center-folded curved-surface estimation device 902 is described. In the raised center-folded curved-surface estimation device 902, the value equivalent to the height of the center-folded outline vertex at the center is designated as the two-dimension model parameter of a raised center-folded slip with the top/bottom outlines, the height from a reference plane is zero and the center-folded outline at the center, the height of which is unknown. Then, an energy function with a restriction that the length of the top three-dimension outline is the same as length of lower three-dimension outline and that the length of the left three-dimension outline is the same as the length of right three-dimension outline, is expressed using the model parameter. In order to minimize and optimize this energy function, an optimal model parameter is calculated by a repetition method, etc. A three-dimension curved-surface model is estimated by calculating the coordinates of each three-dimension sample outline point using the calculated model parameter. A method for calculating the model parameter is described below.
Since a raised center-folded curved surface can be horizontally divided with the center-folded outline (slip center) as a boundary, the process of the raised center-folded curved-surface estimation device 902 is described in detail using the upper curved surface as an example.
If the followings are assumed,
If the followings are assumed,
The coordinates of the three-dimension left vertex c and right vertex d on a raised center-folded outline can be expressed by the following equation (16) and (17), respectively. If the internal division ratio of a line segment connecting these two points is determined, the coordinates of each three-dimension sample outline point can be calculated on conditions that each three-dimension sample outline point is on a line segment connecting camera center K and a two-dimension sample outline point, and is on a plane that includes a line segment Ac or Bd and is perpendicular to xy plane.
xmL=(xmL,ymL,zmL) (16)
xnR=(xnR,ynR,znR) (17)
Therefore, it can be said that the internal division ratio between three-dimension left vertex c and right vertex d is the two-dimension model parameter of the three-dimension model of a slip curved-surface.
The corresponding internal division ratio of the left outline line can be calculated on the conditions for three-dimension sample outline line described above using a model parameter according to the following equation (18) if the followings are assumed,
However, in the above equation, values αiL, βiL, χiL and δiL are calculated as follows.
αiL=(xK−XmL)(Y0L−YiL)−(X0L−XiL)(yK−YmL)
βiL=(YoL−YiL)XmL−(X0L−XiL)YmL+(XoLYiL−XiLY0L)
χiL=(xK−XmL)(yK−YiL)−(xK−XiL)(yK−YmL)
δiL=(xK−XiL)(Y0L−YmL)−(yK−YiL)(XoL−mL)
Similarly, the corresponding internal division ratio of the right outline line can be calculated on the conditions for a three-division sample outline point using a model parameter according to the following equation (19) if the followings are assumed,
However, in the above equation, values αjR, βjR, χjR, and δjR are calculated as follows.
αjR=(xK−XnR)(Y0R−YjR)−(X0R−XjR)(yK−YnR)
βjR=(Y0R−YjR)XnR−(X0R−XjR)YnR+(XoRYjR−XjRY0R)
χjR=(xK−XnR)(yK−YjR)−(xK−XjR)(yK−YnR)
δjR=(xK−XjR)Y0R−YnR)−(yK−YjR)(X0R−XnR)
The minimization and optimization of energy function E expressing a restriction that three-dimension top/bottom outline lines are the same in length, and three-dimension left/right outline lines are the same in length, can be formulated and an optimal model parameter can be calculated, for example, by a repetition method as described later.
Energy function E is defined by the linear sum of the squared difference in length between top outline line AB and raised center-folded outline line cd, and the squared difference in length between left outline line Ac and right outline line Bd. The value of energy function E is uniquely determined by an internal division ratio, which is the model parameter of a slip curved-surface. Therefore, energy function E can be expressed by the following equation (20).
E(sm,tn)=k1E1+k2E2=k1(AB−cd)2+k2(Ac−Bd)2 (20)
where k1 and k2 are constants (for example, k1=1 and k2=1).
Since both the top outline line (line segment AB) and a raised center-folded outline line (line segment cd) are line segments, they can be calculated from the length of three-dimension vertex coordinates according to the following equation (21) and (22), respectively.
AB=√{square root over ((X0L−X0R)2+(Y0LY0R)2)}{square root over ((X0L−X0R)2+(Y0LY0R)2)} (21)
cd=√{square root over ((xmL−xnR)2+(ymL−ynR)2+(zmL−znR)2)}{square root over ((xmL−xnR)2+(ymL−ynR)2+(zmL−znR)2)}{square root over ((xmL−xnR)2+(ymL−ynR)2+(zmL−znR)2)} (22)
The length of the left outline line Ac and that of the right outline line Bd are approximated by the respective sum of the length of line segments connecting three-dimension sample outline points. Specifically, they can be calculated according to the following equation (23) and (24), respectively.
A model parameter for minimizing energy function E is calculated by the steepest descent method. Specifically, an approximate initial value is set and a model parameter is repeatedly changed according to the following equation (25). In this case, is a minute positive number.
Equation (25) is developed using the definition of the energy function of equation (20), the following equation (26) and (27) can be obtained.
However, each term is as follows.
In this way, a model parameter can be calculated and as a result, the coordinates of each three-dimension sample outline point can be calculated. Then, the raised center-folded curved-surface estimation device 902 designates broken lines connecting obtained three-dimension sample outline points as outline lines, and estimates a curved-surface obtained by the linear interpolation approximation of the outlines. For the linear interpolation approximation, an interpolation method, such as a linear Coons interpolation, etc., is used as in the case of a sunken center-folded curved-surface estimation device 202.
Although as energy function E, the energy function E of an upper raised center-folded curved-surface is formulated, the energy function E of the entire curved-surface can also be formulated. Energy function E obtained by formulating the entire curved-surface can be expressed by the following equation (28) as shown in
However, k1, k2, k3, k4 are constants.
In this case, since the optimization problem of the entire curved-surface can be solved, accuracy is further improved than in the case where a curved-surface is horizontally divided, and a model parameter is calculated for each divided curved-surface.
Next, the distortion correction device 903 in the second preferred embodiment is the same as the distortion correction device 203 in the first preferred embodiment. Specifically, the distortion correction device 903 obtains an image after correction with the length of the top/bottom outline and that of the left/right outline as width and height, respectively, by calculating the location in an input image, corresponding to each pixel of an image after correction using a curved coordinate system with outline lines as coordinate axes and by setting the value (binary, gradation or color) of the corresponding pixel in the input image as the target pixel value of the image after correction. For detail, see the description of the first preferred embodiment.
Although sunken/raised center-folded distortion correction methods for a slip OHR image has been so far described in detail, the application is not limited to the sunken/raised center-folded distortion correction. Specifically, the same method is also applicable to line-textured curved-surface distortion. Line-textured curved-surface is a general curved-surface caused when a piece of paper is distorted.
For example, if there is raised circumference distortion (
In the description of each preferred embodiment, the outline extraction device 101 extracts outlines according to the basic configuration of the present invention shown in
The outline extraction device 1401 performs the same process as that of the outline extraction device 101. However, the distortion correction device 1402 is described using as an example, a case where an outline 1501 as shown in
However, the distortion correction method can also be executed using an information processing device (computer) as shown in
The memory 1602 includes, for example, a ROM (read-only memory), a RAM (random-access memory), etc., and stores both a program and data to be used, for the process. The CPU 1601 performs necessary processes by using the memory 1602 and executing the program. Specifically, the outline extraction device 101, curved-surface estimation device 102 and distortion correction device 103 are implemented by the program stored in the memory 1602.
Image data, such as a slip, etc., are inputted to the information processing device via the input device 1603, such as an OHR, etc. the output device 1604 includes, for example, a display, a printer, etc., and is used to out the process result, etc.
The external storage device 1605 includes, for example, a magnetic disk, an optical disk, a magneto-optical disk, etc. The information processing device can store both the program and data in this external storage device 1605 and can use them by loading them into the memory 1602 as requested.
The medium driver device 1606 drives a portable storage medium 1609 and accesses the recorded content. For the portable storage medium 1609, an arbitrary computer-readable storage medium, such as a memory card, a floppy disk, a CD-ROM (compact disk read-only memory), an optical disk, magneto-optical disk, etc., are used. Both the program and data can be stored in this portable storage medium 1609, and can be used by loading them into the memory 1602 as requested.
The network connection device 1607 communicates with an ouutside device via an arbitrary network (line), such as a LAN (local area network), etc., and transmits/receives data accompanying the communications. The information processing device can receive both the program and data from the outside device via the network connection device 1607, and can 10 use them by loading them into the memory 1602. Although a single information processing device is used in
(a) The program, etc., is installed in an information processing device 1701, such as a computer, etc., and provided. In this case, the program, etc., is installed, for example, prior to shipment.
(b) The program, etc., is stored in the portable storage medium 1609 and provided. In this case, the program, etc., stored in the portable storage medium 16609 is stalled in the external storage device 1605 of the information processing device 1701, such as a computer, etc.
(c) The program, etc., is provided from a server 1703 in the network 1702. In this case, basically the information processing device 1701, such as a computer, etc., downloads the program, etc., stored in the server 1703 and obtains the program, etc.
In this case, the server 1703 generates a propagation signal for propagating both the program and data, and transmits the signal to the information processing device 1701 via an arbitrary transmission medium in the network 1702.
As described above, according to the present invention, the three-dimension model of a slip with three-dimension distortion can be estimated using both two-dimension outlines obtained from a piece of image (OHR image) photographed from the top and a restriction that the paper is rectangular, and the three-dimension distortion in the image can be corrected using the obtained three-dimension curved-surface model. In this way, since an input image can be corrected using the distortion of two-dimension outline obtained by a piece of a paper, one camera is sufficient and both implement cost and installation space can be reduced compared with the conventional technology.
Number | Date | Country | Kind |
---|---|---|---|
2000-267511 | Sep 2000 | JP | national |
This application is a Continuation of application Ser. No. 09/819,728 filed Mar. 29, 2001 now U.S. Pat. No. 6,970,592, and incorporated by reference herein.
Number | Name | Date | Kind |
---|---|---|---|
5497236 | Wolff et al. | Mar 1996 | A |
5760925 | Saund et al. | Jun 1998 | A |
5940544 | Nako | Aug 1999 | A |
6014470 | Matsuda | Jan 2000 | A |
7072527 | Nako | Jul 2006 | B1 |
Number | Date | Country |
---|---|---|
8-306247 | Nov 1996 | JP |
10-150532 | Jun 1998 | JP |
P2000-20682 | Jan 2000 | JP |
Number | Date | Country | |
---|---|---|---|
20050175255 A1 | Aug 2005 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 09819728 | Mar 2001 | US |
Child | 11102702 | US |