IMAGE PROCESSING APPARATUS, IMAGE SCANNING APPARATUS, AND IMAGE PROCESSING METHOD
In an image processing apparatus, an inclination detecting unit acquires, with respect to each line of image data, positions of a left edge pixel and a right edge pixel that are positioned at a boundary between an original document and a background. A feature point position is acquired based on features of the positions of the edge pixels of a plurality of lines. Based on a feature of the position of at least one of the left edge pixel and the right edge pixel of the line that includes the feature point position or of the line that is near the former line, a status regarding a direction of the document is acquired. Furthermore, the acquired statuses are counted, the most counted status is determined, two feature points are selected from the feature points having a status that matches the most counted status, and the document inclination is calculated from the two feature point positions. Thereafter, the inclination of the document can be compensated for.
Latest MURATA MACHINERY, LTD. Patents:
This application claims priority under 35 U.S.C. 119 to Japanese Patent Application No. 2007-278877, filed on Oct. 26, 2007, which application is hereby incorporated by reference in its entirety.
BACKGROUND OF THE INVENTION1. Field of the Invention
The present invention primarily relates to an image processing apparatus that automatically detects inclination of image data acquired by scanning an original document.
2. Description of the Related Art
In an image scanner apparatus, for example, a copier, a facsimile machine, an Optical Character Reader (OCR), or other suitable image scanner apparatus, when an original document is scanned in an inclined state, an inclined image is acquired, thereby deteriorating an image quality. In order to prevent such deterioration, an image scanning apparatus has been suggested which includes an image processing apparatus arranged to automatically detect an inclination angle of the original document by analyzing image data, and to electronically adjust the inclination by performing a process of rotating the image data based on the acquired inclination angle.
For example, an inclination extracting apparatus that can increase the speed of an inclination extracting process by including a pixel position detecting unit, a local minimum point extracting unit, and an inclination extracting unit is well known. In such an apparatus, the pixel position detecting unit scans acquired image data in one direction and detects, with respect to each scan line, a position of a character pattern starting edge pixel that is detected in a prescribed order sequentially counted on the scan line. The local minimum point extracting unit extracts a position of a pixel that is a minimum of the starting edge pixels detected with respect to each scan line. The inclination extracting unit extracts the inclination of an information medium based on the position of the extracted minimum pixel.
In order to easily and effectively detect the inclination of a scanned image, after the scanned image is stored in an image memory by a scanning unit, such as an image scanner, another well-known apparatus extracts consecutive black pixel components by scanning the scanned image and detects inclination of the scanned image by using the height and width, for example, of a circumscribed rectangle of the consecutive black pixel components.
However, in the above-described configuration of the inclination extracting apparatus, when the pixel that forms a character pattern cannot be detected, the inclination cannot be detected. Similarly, in the above-described configuration of the other well-known apparatus, when the consecutive black pixel components cannot be detected, the inclination cannot be detected.
In each configuration described above, when an original document having an inclined text due to its design, for example, or an original document having a slant line is scanned, even if such original documents are properly positioned, the inclination is incorrectly detected at the time of scanning, and the image data may be unintentionally rotated. Therefore, an image processing apparatus that can properly correct the inclination regardless of the content of an original document is desirable. Moreover, when the original document is not in good condition, such as when a corner portion of the original document is dog-eared, torn, curled up, twisted, or wrinkled, for example, it is difficult to position these types of documents accurately on the apparatus to scan them. Therefore, an image processing apparatus has been desired that can properly correct the inclination even in the above-described cases.
SUMMARY OF THE INVENTIONTo overcome the problems described above, preferred embodiments of the present invention provide an image processing apparatus, an image scanning apparatus, and an image processing method.
According to a first preferred embodiment of the present invention, an image processing apparatus includes an edge pixel acquiring unit, a feature point detecting unit, a status acquiring unit, and an inclination calculating unit. The edge pixel acquiring unit acquires, with respect to each line of image data acquired by scanning an original document, positions of a first edge pixel and a second edge pixel that are positioned at a boundary between the original document and a background. The feature point detecting unit detects a feature point of an outline of the original document based on the feature of the position of at least one of the first edge pixel and the second edge pixel of a plurality of lines. Based on the feature of the position of at least one of the first edge pixel and the second edge pixel of the line including a position of the feature point or of the line that is in the vicinity of the line including a position of the feature point, the status acquiring unit acquires, with respect to each feature point, a status indicating that the original document is not inclined, a status indicating that the document is inclined towards one side, or a status indicating that the document is inclined towards the other side. The inclination calculating unit counts the statuses of a plurality of feature points, acquires the most counted status, selects two feature points from the feature points having the status that matches the most counted status, and calculates a value regarding the inclination of the original document from the positions of the two selected feature points.
The status of “no inclination” includes a status that means that no rotation is required. The status of “inclination towards one (or the other) side” includes a status that means that the document should be rotated in a direction that corrects the inclination.
In the above-described configuration, since the inclination is detected based on an outline feature of the original document, and not on the content of the original document, the inclination of the original document can be directly and accurately detected. Furthermore, since the inclination is detected based on a comprehensive determination using the feature points of an outline and statuses thereof of the original document, the inclination of the original document can be accurately detected, and the inclination of original documents having various shapes including a non-rectangular original document (such as an original document having a non-straight side) can be properly detected.
The inclination calculating unit preferably selects, in accordance with a predetermined priority order, two feature points from the feature points having the status that matches the most counted status.
By properly predetermining the priority order, the accuracy of inclination detection can be further improved. In particular, even when a corner portion or other portion of the original document is, for example, dog-eared, torn, curled up, twisted, or wrinkled or otherwise damaged, the inclination can be properly detected. Moreover, since the process of selecting the feature points can be simplified, a processing time for the inclination detection can be reduced.
The feature point detecting unit can preferably detect the corner portion of the original document as the feature point.
By using the corner portion of the original document as the feature point, two sufficiently separated feature points can be selected for the inclination calculation, and a value representing the inclination of the original document can be accurately detected.
The image processing apparatus according to preferred embodiments of the present invention preferably performs the following functions. (1) When the corner portion of the original document is detected as the feature point, the feature point detecting unit determines whether or not an angle of the corner portion is approximately a right angle based on the position of at least one of the first edge pixel and the second edge pixel. (2) When the angle of the corner portion is not a right angle, the inclination calculating unit excludes the feature point thereof, counts the statuses, and then, after excluding the corner portion from the feature points having the status that matches the most counted status, the inclination calculating unit selects the two feature points.
Since the calculation of the value regarding the inclination based on the non-right-angle corner portion can be prevented, erroneous detection of the inclination can be prevented.
Preferably, the feature point detecting unit can acquire, as the feature points, at least two points that are positioned on one of parallel sides that face each other on each side in a longitudinal direction of a line, the two points being positioned on a portion other than the corner portion of the original document.
Even when an original document having an irregular shape (such as an original document having a round-cornered rectangular shape, a non-rectangular shape, or a non-square shape, for example) is scanned, as long as the document includes a parallel side, the inclination of the original document can be properly detected based on the two feature points that are positioned on the parallel side. For example, an original written document is often dog-eared, torn, curled up or otherwise damaged at its corner portion after a lapse of a period of time from its creation. However, even in such cases, the inclination can be properly detected based on a parallel side. Moreover, even when a sheet of an original document is crumpled up and then smoothed out, and thus has an irregular shape, if a portion of a parallel side is detected at one portion of the original document, the inclination can be detected with constant accuracy based on the detected parallel side.
In the image processing apparatus, when the most counted status cannot be acquired, the inclination calculating unit preferably calculates the value regarding the inclination of the original document from the positions of the two feature points positioned on one of the parallel sides of the original document.
Thus, even when it is difficult to detect an accurate position of a corner portion of an original document having, for example, a round corner, as long as the document has a parallel side, the inclination of the original document can be properly detected based on the parallel side. Accordingly, the inclination detection can be performed with high versatility.
According to a second preferred embodiment of the present invention, an image scanning apparatus including the image processing apparatus includes an image scanning unit arranged to acquire image data by scanning an original document, and a rotation processing unit arranged to perform a rotation process on the image data so as to correct inclination thereof.
With respect to the image data scanned by the image scanning unit, the inclination of the original document can be accurately detected and corrected based on a comprehensive determination using a plurality of feature points and statuses thereof. Moreover, the inclination of an original document having a wide width can be properly corrected.
In the image scanning apparatus according to this preferred embodiment of the present invention, the edge pixel acquiring unit of the image processing apparatus preferably acquires the positions of the first edge pixel and the second edge pixel in each line arranged along a main scanning direction of the image scanning unit.
The position of the edge pixel can be preferably acquired while data of the pixels consecutively input in the main scanning direction at the time of scanning are sequentially processed. Accordingly, since storing of the data in a memory and the scanning process can be omitted, the processes can be simplified, and the time required for the inclination of the scanned image to be detected can be reduced.
In the image scanning apparatus according to this preferred embodiment of the present invention, the image scanning unit preferably includes a flat bed unit.
In the above-described configuration, even when the original document is not positioned in a proper or straightened state on the flat bed unit, an image that is corrected in a normal direction by the inclination calculating unit and the rotation processing unit can be acquired. Accordingly, the original document may be positioned on the flat bed unit in any direction and scanned, thereby facilitating operational performance.
Other features, elements, processes, steps, characteristics and advantages of the present invention will become more apparent from the following detailed description of preferred embodiments of the present invention with reference to the attached drawings.
Preferred embodiments of the present invention will be described with respect to
As illustrated in
A detailed description thereof will be provided below. The image scanner apparatus 101 includes an original document table 103 having a platen glass 102 on which an original document is placed, and an original document table cover 104 arranged to maintain the original document in an orientation such that the document is pressed against the platen glass. The image scanner apparatus 101 also includes an operation panel (not illustrated) to commence the start of original document scanning, or other suitable operations. A pressing pad 121 that presses the original document downward is preferably attached to a lower surface of the original document table cover 104 such that the pad 121 faces the platen glass 102.
The original document table cover 104 preferably includes an ADF device 107. The ADF device 107 preferably includes an original document tray 111 arranged on an upper portion of the original document table cover 104 and a discharge tray 112 arranged below the original document tray 111.
As illustrated in
The pick up roller 51 picks up the original document placed on the original document tray 111, and the separation roller 52 and the separation pad 53 separate the picked up original document one sheet at a time. The transportation roller 55 transports the separated original document to an original document scanning position P, and the discharge roller 58 discharges the scanned original document onto the discharge tray 112. A pressing member 122 facing the platen glass is preferably arranged at the original document scanning position P.
In the above-described configuration, the original documents stacked and placed on the original document tray 111 are separated one sheet at a time and transported along the curved original document transportation path 113. Then, after the original document passes through the original document scanning position P and is scanned by a scanner unit 21, which will be described below, the document is discharged on the discharge tray 112.
As illustrated in
The carriage 30 preferably includes a fluorescent lamp 22 as a light source, reflection mirrors 23, a condenser lens 27, and a Charge Coupled Device (CCD) 28. The fluorescent lamp 22 irradiates light to the original document. After the light reflected from the original document is reflected by the plurality of reflection mirrors 23, the light passes through the condenser lens 27, converges, and forms an image on a front surface of the CCD 28. The CCD 28 converts the irradiated and converged light into an electrical signal and outputs the signal.
In the present preferred embodiment of the present invention, the CCD 28 is preferably a 3-line color CCD. The CCD 28 includes a one-dimensional line sensor with respect to each color of Red, Green, and Blue (RGB). Each of the line sensors substantially extends in a main scanning direction (i.e., a width direction of an original document). The CCD 28 also preferably includes different color filters that correspond to each line sensor.
A driving pulley 47 and a driven pulley 48 are preferably rotationally supported inside the original document table 103. An endless drive belt 49 is preferably arranged between the driving pulley 47 and the driven pulley 48 in a tensioned state. The carriage 30 is fixed to a proper position of the drive belt 49. In the above-described configuration, by forwardly and reversely driving the driving pulley 47 using an electric motor (not illustrated), for example, the carriage 30 can travel horizontally along a sub scanning direction.
In the above-described configuration, when the carriage 30 is disposed ahead of a position that corresponds to the original document scanning position P, the ADF 107 is driven. Accordingly, the original document to be transported in the original document transportation path 113 is scanned at the original document scanning position P. The reflection light, which is irradiated from the fluorescence lamp 22 and reflected by the original document, is introduced into the carriage 30, directed to the CCD 28 by the reflection mirrors 23, via the condenser lens 27, and forms an image. Thus, the CCD 28 can output an electrical signal that corresponds to the scanned content.
When using a flat bed scanner, while the carriage 30 is moved at a prescribed speed along the platen glass 102, an original document placed on the platen glass 102 is scanned. The reflection light from the original document is similarly introduced into the CCD 28 of the carriage 30 and forms an image.
The CPU 41 functions as a control unit that controls, for example, the scanner unit 21, the inclination detecting unit 67, the inclination correcting unit 68, and the output control unit 70 which are included in the image scanner apparatus 101. Programs and data, or other suitable control elements, are stored in the ROM 42 which defines a storage unit.
The scanner unit 21 preferably includes an Analog Front End (AFE) 63. The AFE 63 is connected with the CCD 28. At the time of scanning the original document, the line sensor of each color of RGB included in the CCD 28 scans one line of the original document content by scanning in the main scanning direction, and the signal of each line sensor is converted from an analog signal into a digital signal by the AFE 63. By this main scanning, pixel data of one line is output as a tone value of each color of RGB from the AFE 63. By repeating the above-described process while the original document is being transported through the original document scanning position, or the carriage 30 is moved in the sub scanning direction of the flat bed, image data of the entire original document can be acquired as digital signals.
The scanner unit 21 includes an image processing unit 65, and the digital signals of the image data output from the AFE 63 are input into the image processing unit 65. The image processing unit 65 preferably performs shading correction on the pixel data input line by line with respect to each main scanning operation, and corrects scanned unevenness that arises from an optical system of the scanner unit 21. The image processing unit 65 preferably performs, on the pixel data, correction that corrects color shift caused by line gaps of the line sensor of each color of RGB in the CCD 28.
The image memory 66 stores images scanned by the scanner unit 21. After a well-known image processing method (such as filter processing) is performed in the image processing unit 43, the image data scanned by the scanner unit 21 is input into the image memory 66 where it is stored.
The image scanner apparatus 101 includes an inclination detecting unit (image processing apparatus) 67 arranged to detect the inclination of the original document scanned by the CCD 28. When the image data is input line by line from the image processing unit 65 of the scanner unit 21, the inclination detecting unit 67 preferably performs a process of analyzing the image data and detects the inclination (i.e., an angle to be rotated to correct the inclination) of the original document.
The inclination detecting unit 67 includes, for example, an edge pixel acquiring unit 71, a feature point detecting unit 72, a status acquiring unit 73, and an inclination calculating unit 74.
Each time the image data is input line by line from the scanner unit 21, the edge pixel acquiring unit 71 preferably acquires, with respect to each line, a position of an edge pixel positioned at an outline portion (in other words, a boundary between the original document and a background) of the original document.
The feature point detecting unit 72 can store the positions of the edge pixels of a prescribed number of lines, the edge pixels being acquired by the edge pixel acquiring unit 71. Based on features of the positions of the edge pixels of the plurality of lines, feature points related to an outline of the original document are detected, and positions of the feature points can be acquired. In the present preferred embodiment, the “feature point” refers to a point that is positioned at a graphic characteristic portion of the outline of the original document, such as the top of a corner portion of the original document.
The status acquiring unit 73 checks the positions of the edge pixels of the line including the feature points acquired by the feature point detecting unit 72 or of the line that is in the vicinity of the previous line. Based on the checked result, the status acquiring unit 73 preferably acquires a status of the original document that indicates whether the original document is not inclined, is inclined towards one side, or is inclined towards the other side.
Preferably, the inclination calculating unit 74 counts the status of each feature point and acquires the most commonly counted status, selects two feature points from the feature points that have a status that matches the most commonly counted status, calculates and acquires a value (i.e., a parameter that expresses the inclination, and, in the present preferred embodiment of the present invention, refers to a tangent value) regarding the inclination of the original document from the positions of the selected feature points.
An inclination detecting process performed by the above-described edge pixel acquiring unit 71, feature point detecting unit 72, status acquiring unit 73, and inclination calculating unit 74 will be described in detail below.
Based on the inclination (tangent value) acquired by the inclination detecting unit 67, the inclination correcting unit 68 performs a rotation process at the time of reading the image data stored in the image memory 66, and electronically corrects the inclination of the original document.
The code converting unit 69 encodes the image data stored in the image memory 66 by performing a well-known compression process, such as, a Joint Photographic Experts Group (JPEG), for example.
The output control unit 70 transmits the encoded image data to, for example, a personal computer (not illustrated) defining a higher-level device connected with the image scanner apparatus 101. A transmission method may be selected and includes, for example, a method that uses a Local Area Network (LAN) and a method that uses a Universal Serial Bus (USB).
In the present preferred embodiment of the present invention, the image processing unit 65, the inclination detecting unit 67, the inclination correcting unit 68, the code converting unit 69, or other suitable units, are implemented by using hardware such as, Application Specific Integrated Circuits (ASIC) or a Field Programmable Gate Array (FPGA), for example. The image processing unit 65 and the inclination detecting unit 67, or other suitable units, may be implemented by a combination of the CPU 41 and various programs, for example.
Next, a process of detecting the inclination of the original document performed by the inclination detecting unit 67 according to a preferred embodiment of the present invention will be described with reference to the flowchart of
When the main routine of
In the present preferred embodiment of the present invention, the detecting process of the original document pixel and the background pixel is preferably performed as follows. A white sheet (i.e., a platen sheet) that is preferably brighter than a normal sheet of paper is attached to a front surface of the pressing pad 121 and the pressing member 122 (
Thus, in the process of S102, image processing that calculates luminance (Y component) from RGB components of the pixel data is performed in accordance with a well-known expression. When the calculated luminance is greater than or equal to a prescribed threshold value, a binarization process that determines that a pixel is a background pixel is performed, and when the calculated luminance is below the threshold value, a binarization process that determines a pixel as the original document pixel is performed. In the present preferred embodiment of the present invention, “0” refers to the background pixel, and “1” refers to the original document pixel.
In view of detection accuracy of the original document pixel and the background pixel, proper image processing, such as shading correction and gamma correction may preferably be performed on the original image data before the process of S102 is performed. In the shading correction, the original document can be easily distinguished from the background by a process of adding a prescribed value of white shading data to generate a value that is brighter than a normal value. Alternatively, a black pressing pad 121 and a pressing member 122 could be used, and the original document can be distinguished from the background by determining black pixels scanned at an edge portion side of the main scanning direction as being the background pixels. When the image scanner apparatus 101 is used as a flat bed scanner, and an original document from, for example, a book is scanned in a state in which the original document table cover 104 is open, the black pixels scanned around the edge portion of the main scanning direction may similarly be determined as the background pixels.
Accordingly, as illustrated in
In
As described above, in the process of S102 of
The two edge pixels (the left edge pixel and the right edge pixel) acquired as described above indicate the boundary between the original document and the background (i.e., the outline of the original document) on the respective line. In the process of S103, the positions of the left edge pixel and the right edge pixel are properly stored in the memory defining a proper storage unit.
The inclination detecting unit 67 of the present preferred embodiment of the present invention can store the positions of the two acquired edge pixels of the currently processed line, and the positions of each of the two acquired edge pixels of the immediately previously processed eight lines, that is, the positions of each of the two acquired edge pixels of the nine lines in total. In
After the detection process of the edge pixels, based on features of the positions of the left pixels 12L and the right edge pixels 12R of the nine lines, feature points (for example, the top of a corner portion of the original document) regarding the outline of the original document are detected (S104).
Now, with reference to
In the sub routine of
If the conditions are met, as the earliest processed line comes closer line by line to the currently processed line, it is checked whether each of the right edge pixels are consecutively checked to determine whether they stay at the same position or move towards the right (S202). If the conditions of S202 are met, the leading corner portion is recognized (S203). If the conditions are not met, it is determined that the leading corner portion has not been detected, and the sub routine is ended.
The determinations made in S201 and S202 will be described in detail with reference to
In this case, in the process of S201 of
For example, in
In the process of S202, in the area of the nine lines, as the past line comes closer line by line to the new line, it is determined whether each of the right edge pixels stays at the same position or moves towards the right.
In the example of
Accordingly, in the example of
When the leading corner portion of the original document is detected as described above, it is then determined in the process of S204 of
The determination of the right angle is made based on the features of the positions of the left edge pixels and the right edge pixels of the nine lines. More specifically, a distance DLx by which the left edge pixel moves from the earliest processed line S9 to the current line S1 towards a left edge side and a distance DRx by which the right edge pixel moves from the earliest processed line S9 to the current line S1 towards a right edge side are calculated.
When the “DLx>DRx”, it is checked whether or not a distance DL by which the left edge pixel moves towards the left edge side while the earliest processed line S9 shifts to the next line by DRx lines substantially equals about 8. When the distance DL substantially equals about 8, it is determined that the corner portion has a right angle. When the distance DL does not substantially equal about 8, it is determined that the corner portion does not have a right angle.
When the “DLx<DRx”, it is checked whether or not a distance DR by which the right edge pixel moves towards the right edge side while the earliest processed line S9 shifts to the new line by DLx lines substantially equals about 8. When the distance DR substantially equals about 8, it is determined that the corner portion has a right angle. When the distance DR does not substantially equal about 8, it is determined that the corner portion does not have a right angle.
In the example of
In the process of S205, the status regarding the direction of the original document is acquired. The status indicates whether the original document is not inclined, the document is rotated in a clockwise direction, or the document is rotated in a counterclockwise direction. In addition to the process described above, the status preferably indicates whether the original document is not required to be rotated, the document is required to be rotated in the counterclockwise direction, or the document is required to be rotated in the clockwise direction.
More specifically, when the distances DLx and DRx satisfy the relationship of “DLx>DRx”, the rotation in the counterclockwise direction is determined, and when the distances DLx and DRx satisfy the relationship of “DLx<DRx”, the rotation in the clockwise direction is determined. When the “DLx=0” and the “DRx=0”, it is determined that the document is not inclined.
In the example of
Next, with reference to
When the sub routine of
When the conditions of S301 are met, the positions of the right edge pixels of the five lines from the center line S5 to the currently processed line S1 are checked (S302). More specifically, in the lines of S5 through S1, as the previous line comes closer line by line to the new line, it is checked whether each of the left edge pixels stays at the same position or moves towards the right. When these conditions are met, the left-hand corner portion is recognized (S303). When the conditions are not met, it is determined that the left-hand corner portion has not been detected, and the sub routine is ended.
The determinations made in S301 an S302 will be described in detail with reference to
In this case, as described above, in the process of S301 of
In
In the process of S302, in the area of the five lines from S5 to S1, as the previous line comes closer line by line to the new line, it is determined whether each of the left edge pixels stays at the same position or moves towards the right.
In the example of
Accordingly, in the example of
When the left-hand corner portion of the original document is detected, it is determined in the process of S304 of
The determination of the right angle is performed as follows. That is, a distance DLxa by which the left edge pixel moves from the earliest processed line S9 to the center line S5 towards the left edge side is acquired. A distance DLxb by which the left edge pixel moves from the center line S5 to the currently processed line S1 towards the right edge side is also acquired.
Then, when the “DLxa>DLxb”, it is checked whether or not a distance DL by which the left edge pixel moves towards the right edge side while the center line S5 shifts to the old line by DLxb lines substantially equals 4. When the distance DL substantially equals about 4, it is determined that the corner portion has a right angle. When the distance DL does not substantially equal about 4, it is determined that the corner portion does not have a right angle.
When the “DLxa<DLxb”, it is checked whether or not a distance DL by which the left edge pixel moves towards the right edge side while the center line S5 shifts to the new line by DLxa lines substantially equals about 4. When the distance DL substantially equals about 4, it is determined that the corner portion has a right angle, and when the distance DL does not substantially equal about 4, it is determined that the corner portion does not have approximately a right angle.
In the example of
In the process of S305, the status regarding the direction of the original document is acquired. More specifically, when the distances DLxa and DLxb satisfy the relationship of “DLxa>DRxb”, the rotation in the counterclockwise direction is determined, and when the distances DLxa and DLxb satisfy the relationship of “DLxa<DRxb”, the rotation in the clockwise direction is determined.
In the example of
Next, with reference to
In the sub routine of
The determination made in S401 will be described in detail with reference to
In this case, as described above, it is checked in the process of S401 whether or not the distance between the left edge pixel and the right edge pixel in each of the nine lines S1 through S9 is the same.
For example, in
Accordingly, in the case of
Next, in the process of S403 of
In the example of
When a substantially rectangular original document is scanned, a plurality of feature points is consecutively detected on a substantially parallel side. In order to prevent such a situation, once the substantially parallel side is detected, it is preferable that a prescribed number of lines will not be detected. The prescribed number of lines is determined in accordance with the resolution and accuracy of a detection angle, or other suitable parameter. For example, when the scan resolution is 200 dpi, and the number of lines by which the detection of the substantially parallel side is skipped is set to be about 200, the feature points on the parallel side are detected at an interval of at least about 25.4 mm, for example.
By executing the above-described three sub routines, the leading corner portion, the left-hand corner portion, and the parallel sides can be detected. In addition to the above, in the process of S104 of the main routine, sub routines are preferably executed to detect a corner portion (a trailing corner portion) positioned on a trailing side of the original document and a corner portion (a right-hand corner portion) positioned on the right side. Description of the sub routine for detecting the right-hand corner portion will be omitted since the routine can be performed by reversing a positional relationship in the main scanning direction in the above-described sub routine for detecting the left-hand corner portion.
The sub routine to detect the trailing corner portion will be described with reference to
When the conditions of S501 are met, as the earliest processed line comes closer line by line to the line immediately before the current line, it is checked whether each of the right edge pixels consecutively stays at the same position or moves towards the left (S502). When these conditions are not me, it is determined that the trailing corner portion has not been detected, and the sub routine is ended.
When the conditions of S502 are met, in the currently processed line, it is checked whether or not the left edge pixel and the right edge pixel are detected (S503). When the pixels are not detected, the trailing corner portion is recognized, and the position thereof is acquired and stored (S504). When the pixels are detected, it is determined that the trailing corner portion has not been detected, and the sub routine is ended.
As the line comes closer to the trailing corner portion of the original document, the left edge pixel moves towards the right side, and the right edge pixel moves towards the left side. When the line passes through the trailing corner portion, the original document pixel is not detected. The processes of S501 through S504 automatically determine the trailing corner portion by using the features of the trailing corner portion.
Next, it is determined whether or not the detected trailing corner portion is approximately a right angle, and a determination result is stored (S505). The status regarding the direction of the original document is acquired and stored (S506). Since the processes of S505 and S506 are essentially similar to the detection process of the leading corner portion (
When each of the above-described sub routines is ended, and the process of S104 of
Each time one line is input, the processes of S103 and S104 are repeated until the original document scanned data of all lines are input by the above-described flow. Accordingly, by looping the processes of S101 through S104, the feature points indicating the leading corner portion, the left-hand corner portion, the trailing corner portion, the right-hand corner portion, and the substantially parallel side of the original document are detected. Each time the feature point is detected, the position thereof, the determination result indicating whether or not the corner portion has a right angle, and the status regarding the direction of the original document are stored.
When the process performed for the data of all lines is completed, the main routine preferably proceeds to the process of S106 of
Next, the statuses of the acquired feature points are counted, and the most commonly counted status is determined (S107). In the example of
Next, in the process of S108 of
In the example of
Next, the process proceeds to the process of S109 of
In the calculating process of S107, the statuses of the feature points may be dispersed, and the most commonly counted status may not be acquired. In such a case, regardless of the status, the inclination of the original document is acquired based on the two points of the substantially parallel side if the two points on the parallel side have been acquired.
By the above-described process, similar to the scanned data of the CCD 28, based on the data consecutively output pixel by pixel with respect to each line, the parameter regarding the inclination of the original document can be calculated and acquired. Then, by sending the parameter (i.e., the tangent value) to the inclination correcting unit 68, an image rotating process of an appropriate angle can be performed, and a preferable scanned image in which the inclination is electronically corrected can be acquired.
In the above-described inclination detecting process, even if the original document is dog-eared, torn, or otherwise damaged, the inclination can be preferably detected. For example, an example of a scanned result is illustrated in
In
In this case, in the process of S106 of
The inclination detecting process of the above-described present preferred embodiment of the present invention detects and analyzes the original document pixels, and thus, can properly detect the inclination of the original document regardless of the content of the original document. Moreover, the inclination of original documents of various shapes or in various states can be accurately detected even when the original document is dog-eared, torn, for example, or has a round-cornered rectangular shape, a non-rectangular shape, a non-square shape, or other unconventional shape.
As described above, the inclination detecting unit 67 of the image scanner apparatus of the present preferred embodiment of the present invention includes, for example, the edge pixel acquiring unit 71, the feature point detecting unit 72, the status acquiring unit 73, and the inclination calculating unit 74. The edge pixel acquiring unit 71 inputs image data line by line, and detects, with respect to each line, a left edge pixel and a right edge pixel that are positioned at the boundary between the original document and the background. Based on the position of at least one of the left edge pixel and the right edge pixel of the nine lines, the feature point detecting unit 72 preferably detects the positions (positions of each point on the corner portion and on the substantially parallel side) of the feature points of the original document. Based on the position of at least one of the left edge pixel and the right edge pixel of the nine lines that includes the position of the feature point, with respect to each of the feature points, the status acquiring unit 73 acquires the status regarding the inclination of the original document. The inclination calculating unit 74 preferably counts the statuses of a plurality of feature points, acquires the most commonly counted status, selects two feature points from the feature points having the status that matches the most counted status, and calculates, from the positions of the two feature points, a tangent value that represents the inclination of the original document, for example.
Thus, the inclination detection performed by a comprehensive determination using the feature points and the statuses thereof of the original document can be achieved. Therefore, the accuracy of the inclination detection can be improved. Moreover, the inclination of original documents having various shapes can be properly detected.
In accordance with the predetermined priority order, the inclination detecting unit 67 preferably selects two feature points from the feature points having the status that matches the most commonly counted status.
Thus, by properly predetermining the priority order, the accuracy of the inclination detection can be further improved. Moreover, since the process of selecting the feature points can be simplified, the time required for the process of the inclination detection can be reduced. Furthermore, the scanned original document may not have a substantially rectangular shape. However, by changing the priority order, a user can set from which portion of the original document the feature point is detected in priority. Accordingly, various requirements in which the leading side of the original document is prioritized, the left side of the original document is prioritized, or other portions of the original document are prioritized, can be met.
The feature point detecting unit 72 can detect the corner portion of the original document as the feature point, for example.
Thus, by using the corner portion of the original document as the feature point, the two sufficiently separated feature points, such as the leading corner portion and the left-hand corner portion, can be selected for the inclination calculation, for example. Accordingly, the inclination of the original document (i.e., a tangent value) can be accurately detected.
When the corner portion of the original document is detected as the feature point, based on the feature of the position of at least one of the left edge pixel and the right edge pixel, the feature point detecting unit 72 preferably determines whether or not an angle of the corner portion is an approximate right angle. When the angle of the corner portion is not an approximate right angle, the inclination calculating unit 74 excludes the feature point thereof and then counts the statuses. Then, after excluding the corner portion from the feature points having the status that matches the most commonly counted status, the inclination calculating unit 74 preferably selects the two feature points to calculate the inclination.
Thus, when the original document has the shapes illustrated in
As illustrated by the points (1) and (2) on the substantially parallel side of
Thus, even when an original document having an irregular shape (such as an original document having a non-rectangular shape or a non-square shape, for example) is scanned, as long as the document has a substantially parallel side, the inclination of the original document can be properly detected based on the two feature points positioned on the substantially parallel side.
When the most commonly counted status cannot be acquired, the inclination calculating unit 74 calculates the inclination (i.e., a tangent value) of the original document based on the positions of the two feature points positioned on one of the substantially parallel sides of the original document.
Thus, even if the original document has a round-cornered shape, for example, and it is difficult to detect the accurate position of the corner portion, as long as the document has a substantially parallel side, the inclination of the original document can be properly detected based on the substantially parallel side. Accordingly, the inclination detection with high versatility can be performed.
As illustrated in
Thus, by accurately detecting the inclination of the original document in accordance with the comprehensive determination, the inclination correction can be performed. Moreover, the inclination correction can be properly performed on an original document having various shapes.
In the image scanner apparatus 101, the edge pixel acquiring unit 71 of the inclination detecting unit 67 preferably acquires the positions of the left edge pixel and the right edge pixel of each line that is arranged along the main scanning direction of the image scanning unit 115.
Thus, by matching the main scanning direction and a direction of the lines, while the pixel data consecutively input in the main scanning direction at the time of image scanning is sequentially processed, the positions of the left edge pixel and the right edge pixel can be acquired. Accordingly, since a process of accumulating the image data in the memory and then reading out the pixel data in the line direction can be omitted, the processes can be simplified, and the detection of the inclination of the scanned image can be performed at high speed.
In the present preferred embodiment of the present invention, as illustrated in
Accordingly, even when the original document is placed on the flat bed unit in an inclined state, an image that is corrected in a proper direction can be acquired by the inclination correcting unit 68. Therefore, the original document can be placed in any direction or orientation on the platen glass 102 of the flat bet unit and scanned, thereby facilitating operational performance.
The preferred embodiments of the present invention have been described above, however, the above-described configuration may be modified as follows.
In the process of S102 of
Alternatively, an original document may be placed on the platen glass 102 of the flat bed unit and scanned in a state in which the original document table cover 104 is open. In such a case, the reflection light is not detected in an area on which the original document is not disposed, and the area is detected as black pixels. Thus, the pixels detected as black on both sides of a line can be recognized as background pixels. More specifically, a sensor to detect the opening and closing of the original document table cover 104 may be provided to the image scanner apparatus 101, and the above-described process may be performed when the sensor detects that the original document table cover 104 is open, for example.
In the process of S103 of
The feature point detecting process of S104 preferably detects the feature points based on the positions of the left edge pixels and the right edge pixels of the nine lines. However, in view of accuracy required to detect angles, scan resolution, a memory capacity, and processing load, for example, the number of lines used to detect the feature points from the positions of the left edge pixels and the right edge pixels may be appropriately modified.
The process of S104 may be modified such that, in addition to the four corner portions and the parallel side, the right edge pixel on a line of the left-hand corner portion and the left edge pixel on a line of the right-hand corner portion are detected as the feature points. The process of S104 may also be modified such that three or more points are detected on the parallel side.
In addition to the “no inclination” status, the “clockwise rotation” status, and the “counterclockwise rotation” status, a status of “rotation by 45 degrees” of the feature point, for example, may be detected and stored.
Alternatively, it may be modified such that the inclination is detected only when the most commonly counted status acquired by counting a plurality of statuses of the feature points exceeds the status of a clear majority of feature points, and the inclination detection is discontinued when the most commonly counted status does not exceed the clear majority. Moreover, instead of the clear majority, it may be modified such that the inclination is detected only when the most commonly counted status exceeds approximately two-thirds, for example.
The priority order illustrated in
If possible, it may be modified such that by withdrawing from the loop of S101 through S104 of
The above-described inclination detecting process according to preferred embodiments of the present invention may be applied not only to a color image but also to a monochrome image.
The above-described inclination detecting process according to preferred embodiments of the present invention may be applied not only to the image scanner apparatus 101 but also to other image scanning apparatuses such as a copier, a facsimile machine, a Multi Functional Peripheral, an Optical Character Reader (OCR), for example.
While the present invention has been described with respect to preferred embodiments thereof, it will be apparent to those skilled in the art that the disclosed invention may be modified in numerous ways and may assume many embodiments other than those specifically set out and described above. Accordingly, the appended claims are intended to cover all modifications of the present invention that fall within the true spirit and scope of the present invention.
Claims
1. An image processing apparatus comprising:
- an edge pixel acquiring unit arranged to acquire, with respect to each line of image data acquired by having an original document scanned, positions of a first edge pixel and a second edge pixel that are positioned at a boundary between the original document and a background;
- a feature point detecting unit arranged to detect a feature point of an outline of the original document based on a feature of the position of at least one of the first edge pixel and the second edge pixel of a plurality of lines of the image data;
- a status acquiring unit arranged to acquire, with respect to each feature point, a status indicating that the original document is one of not inclined, inclined towards one side, or inclined towards the other side, based on the feature of the position of at least one of the first edge pixel and the second edge pixel, of the line that includes a position of the relevant feature point, or of the line that is in the vicinity of the line that includes a position of the relevant feature point; and
- an inclination calculating unit arranged to count the statuses of a plurality of feature points, determine the most commonly counted status, select two feature points from the feature points that have the status that matches the most commonly counted status, and calculate a value regarding an inclination of the original document from the positions of the two feature points.
2. The image processing apparatus according to claim 1, wherein the inclination calculating unit selects, in accordance with a predetermined priority order, the two feature points from the feature points that have the status that matches the most commonly counted status.
3. The image processing apparatus according to claim 1, wherein the feature point detecting unit is arranged to detect a corner portion of the original document as the feature point.
4. The image processing apparatus according to claim 3, wherein
- when the corner portion of the original document is detected as the feature point, the feature point detecting unit determines whether or not the corner portion has an approximate right angle based on the feature of the position of at least one of the first edge pixel and the second edge pixel; and
- when the corner portion does not have an approximate right angle, the inclination calculating unit excludes the relevant feature point, then counts the statuses, and selects the two feature points after excluding the corner portion from the feature points that have the status that matches the most commonly counted status.
5. The image processing apparatus according to claim 3, wherein the feature point detecting unit is arranged to acquire, as the feature points, at least two points that are positioned on one of a plurality of substantially parallel sides of the original document opposing each other on each side of the original document in a longitudinal direction thereof and that are not positioned on the corner portion of the original document.
6. The image processing apparatus according to claim 5, wherein when the most commonly counted status cannot be determined, the inclination calculating unit calculates the value regarding the inclination of the original document from the two feature points that are positioned on the substantially parallel side of the original document.
7. An image scanning apparatus comprising:
- an image scanning unit arranged to acquire image data by scanning an original document;
- an edge pixel acquiring unit arranged to acquire, with respect to each line of the image data, positions of a first edge pixel and a second edge pixel that are positioned at a boundary between the original document and a background;
- a feature point detecting unit arranged to detect a feature point of an outline of the original document based on a feature of the position of at least one of the first edge pixel and the second edge pixel of a plurality of lines;
- a status acquiring unit arranged to acquire, with respect to each feature point, a status indicating that the original document is one of not inclined, inclined towards one side, or inclined towards the other side, based on the feature of the position of at least one of the first edge pixel and the second edge pixel of the line that includes a position of the relevant feature point or of the line that is in the vicinity of the former line;
- an inclination calculating unit arranged to count the statuses of a plurality of feature points, determine the most commonly counted status, select two feature points from the feature points that have the status that matches the most commonly counted status, and calculate a value regarding inclination of the original document from the positions of the two feature points; and
- a rotation processing unit arranged to perform a rotation process on the image data so as to correct the inclination thereof based on the value regarding the inclination.
8. The image scanning apparatus according to claim 7, wherein the edge pixel acquiring unit is arranged to acquire the positions of the first edge pixel and the second edge pixel of each line that is arranged along a main scanning direction of the image scanning unit.
9. The image scanning apparatus according to claim 7, wherein the image scanning unit includes a flat bed unit.
10. The image scanning apparatus according to claim 7, wherein the inclination calculating unit selects, in accordance with a predetermined priority order, two feature points from the feature points that have the status that matches the most commonly counted status.
11. The image scanning apparatus according to claim 7, wherein the feature point detecting unit is arranged to detect a corner portion of the original document as the feature point.
12. The image scanning apparatus according to claim 11, wherein
- when the corner portion of the original document is detected as the feature point, the feature point detecting unit determines whether or not the corner portion has an approximate right angle based on the feature of the position of at least one of the first edge pixel and the second edge pixel; and
- when the corner portion does not have an approximate right angle, the inclination calculating unit excludes the feature point corresponding to the corner portion, then counts the statuses, and selects the two feature points from the feature points that have the status that matches the most commonly counted status after excluding the feature point of the corner portion.
13. The image scanning apparatus according to claim 11, wherein the feature point detecting unit is arranged to acquire, as the feature points, at least two points that are positioned on one of a plurality of substantially parallel sides of the original document facing each other on each side of the original document in a longitudinal direction thereof and are not positioned on the corner portion of the original document.
14. The image scanning apparatus according to claim 13, wherein when a number of the most commonly counted status cannot be acquired, the inclination calculating unit calculates a value regarding the inclination of the original document from the positions of the two feature points positioned on the substantially parallel side of the original document.
15. An image processing method comprising:
- an edge pixel acquiring step of acquiring, with respect to each line of image data acquired by having an original document scanned, positions of a first edge pixel and a second edge pixel that are positioned at a boundary between the original document and a background;
- a feature point detecting step of detecting a feature point of an outline of the original document based on a feature of the position of at least one of the first edge pixel and the second edge pixel of a plurality of lines;
- a status acquiring step of acquiring, with respect to each feature point, a status indicating that the original document is one of not inclined, inclined towards one side, or inclined towards the other side, based on the feature of the position of at least one of the first edge pixel and the second edge pixel of the line that includes a position of the relevant feature point or of the line that is in the vicinity of the line that includes a position of the relevant feature point; and
- an inclination calculating step of counting the statuses of a plurality of feature points, determining the most commonly counted status, selecting two feature points from the feature points that have the status that matches the most commonly counted status, and calculating a value regarding an inclination of the original document from the positions of the two feature points.
16. The image processing method according to claim 15, wherein the inclination calculating step selects, in accordance with a predetermined priority order, two feature points from the feature points that have the status that matches the most commonly counted status.
17. The image processing method according to claim 15, wherein the feature point detecting step detects a corner portion of the original document as the feature point.
18. The image processing method according to claim 17, wherein
- when the corner portion of the original document is detected as the feature point, the feature point detecting step determines whether or not the corner portion has an approximate right angle based on the feature of the position of at least one of the first edge pixel and the second edge pixel; and
- when the corner portion does not have an approximate right angle, the inclination calculating step excludes the relevant feature point, counts the statuses, and then selects the two feature points that match the most commonly counted status after excluding the corner portion from the feature points that have the status.
19. The image processing method according to claim 17, wherein the feature point detecting step acquires, as the feature points, at least two points that are positioned on one of a plurality of substantially parallel sides of the original document facing each other on each side of the original document in a longitudinal direction thereof and are not positioned on the corner portion of the original document.
20. The image processing method according to claim 19, wherein when the most counted status cannot be acquired, the inclination calculating step calculates the value regarding the inclination of the original document from the positions of the two feature points that are positioned on the substantially parallel side of the original document.
Type: Application
Filed: Aug 13, 2008
Publication Date: Apr 30, 2009
Applicant: MURATA MACHINERY, LTD. (Minami-ku)
Inventor: Katsushi MINAMINO (Kyoto-shi)
Application Number: 12/190,625
International Classification: H04N 1/047 (20060101);