Image reading device and document extracting method
The image reading device uses pixel analysis and edge adjustment to exclude streaks from manuscript areas, ensuring accurate cutting despite vertical streaks, improving data processing efficiency.
Patent Information
- Application Number
- JP2023113425
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-07-11
- Publication Date
- 2025-01-24
AI Technical Summary
Existing image reading devices struggle to accurately cut out manuscript areas from read image data when vertical streaks, caused by debris or dust, are misinterpreted as part of the manuscript edge, leading to incorrect cutting.
The device employs a control unit to analyze image data by dividing pixels into background and non-background colors, detecting manuscript edges, and adjusting pixel positions to exclude streak areas, using edge detection and replacement processes to ensure accurate manuscript area extraction.
This method effectively eliminates the influence of vertical streaks, allowing precise manuscript area cutting without the need for manual cleaning, thus enhancing image data processing accuracy.
Smart Images

Figure 2025011367000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to an image reading device and a document cutting method. [Background technology]
[0002] In a scanner, which is an image reading device, an image sensor, typically a CIS (Contact Image Sensor) type or a CCD (Charge Coupled Devices) type, is used as a reading unit to read an original. If there is paper dust, other dirt, dirt, or other matter adhering to the reading surface of the reading unit, this will appear as an abnormality in the read image data that is the reading result. For example, in a seed-feed type scanner that reads an original by moving the original in a specified transport direction relative to the image sensor without moving the image sensor, the presence of the adhering matter will appear in the reading result as a vertical streak extending in the transport direction (see Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2020-17856 A Summary of the Invention [Problem to be solved by the invention]
[0004] The read image data includes a document area corresponding to the document read result and a background area outside the document. The image reading device cuts out the document area, which is the necessary part, from the read image data, and stores it or uses it for various subsequent processes. However, if the read image data includes the vertical lines, the vertical lines are erroneously recognized as part of the edge of the document, and the document area cannot be correctly cut out from the read image data. Therefore, there is a need for an improvement that enables the document area to be accurately extracted even if the read result includes vertical streaks. [Means for solving the problem]
[0005] The image reading device includes a reading unit that reads an original document and generates read image data as a result of the reading, a transport unit that moves the original document and the reading unit relatively in a predetermined transport direction, and a control unit that generates analysis image data by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the original document or a second pixel not corresponding to the background color and binarizing the pixel data, identifies an original area corresponding to the original document based on the analysis image data, and cuts out the original area from the read image data. The control unit controls the read image data and the analysis image data. a corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of the corners of a second pixel region formed by the second pixels in the analysis image data, when the first axis direction of orthogonal first and second axis directions for defining position information in the image data corresponds to the transport direction, and one side in the first axis direction is considered to be up, the other side in the first axis direction is down, one side in the second axis direction is right, and the other side in the second axis direction is left, the corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of the corners of a second pixel region formed by the second pixels in the analysis image data, and a range from the topmost position to the bottommost position a left-right edge searching process for dividing a range from the leftmost position to the rightmost position into a plurality of parts in the second axial direction to set a plurality of first division positions, searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions; a top-bottom edge searching process for dividing a range from the leftmost position to the rightmost position into a plurality of parts in the second axial direction to set a plurality of second division positions, searching for the edge pixels by scanning the analysis image data from the top end to the bottom for each of the second division positions, and searching for the edge pixels by scanning the analysis image data from the bottom end to the top for each of the second division positions; and a muscle region detection process for detecting a streak-like muscle region that is part of the second pixel region and has a width in the second axial direction within a predetermined width based on the edge pixels found by the left-right edge searching process among the edge pixels;A position information changing process is executed to change the position to a position passing through an edge defined by the position information of the edge pixels not corresponding to the edge of the line region, and a document region specifying process is executed to specify, after the position information changing process, a region partitioned by the edge defined by the position information of the edge pixels as the document region.
[0006] The image reading device includes a reading unit that generates read image data as a reading result by reading a document, a transport unit that moves the document and the reading unit relatively in a predetermined transport direction, and a control unit that generates analysis image data by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing it, identifies a document area corresponding to the document based on the analysis image data, and cuts out the document area from the read image data. The control unit, in a first axis direction and a second axis direction that are orthogonal to each other for defining position information in the read image data and the analysis image data, determines a part of a second pixel area formed by the second pixels, the part having a width in the second axis direction, based on the number of consecutive second pixels in the second axis direction and the number of consecutive second pixels in the first axis direction, when the first axis direction is taken as a direction corresponding to the transport direction, one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, a line region detection process for detecting a line-like line region along the first axis direction from the analysis image data, the line region being within a predetermined width; a replacement process for replacing the second pixel of the line region with the first pixel in the analysis image data; a corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of the corners of the second pixel region in the analysis image data after the replacement process; a left / right edge search process for dividing a range from the topmost position to the bottommost position into a plurality of first division positions in the first axis direction, and searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions;A top and bottom edge searching process is executed to search for the edge pixels by scanning the analysis image data from the bottom to the top for each of the second division positions, and a document area specifying process is executed to specify, as the document area, an area partitioned by edges defined by position information of the edge pixels.
[0007] The document cutting method includes a reading step of generating read image data as a reading result by reading the document with the reading unit while moving the document and the reading unit relatively in a predetermined transport direction, a generating step of generating image data for analysis by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing the pixel, and a cutting step of specifying a document area corresponding to the document based on the image data for analysis and cutting out the document area from the read image data. In the cutting step, a corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of a corner of a second pixel region formed by the second pixels in the analysis image data, when the first axis direction is defined as a direction corresponding to the transport direction, one side in the first axis direction is defined as an upper side, the other side in the first axis direction is defined as a lower side, one side in the second axis direction is defined as a right side, and the other side in the second axis direction is defined as a left side, the corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of a corner of a second pixel region formed by the second pixels in the analysis image data, and a left-right edge search process for dividing a range from the bottom position into a plurality of parts in the first axial direction to set a plurality of first division positions, searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions; a top-bottom edge search process for dividing a range from the leftmost position to the rightmost position into a plurality of parts in the second axial direction to set a plurality of second division positions, searching for the edge pixels by scanning the analysis image data from the top end to the bottom for each of the second division positions, and searching for the edge pixels by scanning the analysis image data from the bottom end to the top for each of the second division positions; and a muscle region detection process for detecting a streak-like muscle region along the first axial direction, which is part of the second pixel region and has a width in the second axial direction within a predetermined width, based on the edge pixels found by the left-right edge search process among the edge pixels;A position information changing process is executed to change the position to a position passing through an edge defined by the position information of the edge pixels not corresponding to the edge of the line region, and after the position information changing process, a document region specifying process is executed to specify, as the document region, a region partitioned by the edge defined by the position information of the edge pixels.
[0008] The document cutting method includes a reading step of generating read image data as a reading result by reading the document with the reading unit while moving the document and the reading unit relatively in a predetermined transport direction, a generating step of generating image data for analysis by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing the first pixel and the second pixel not corresponding to the background color, and a cutting step of specifying a document area corresponding to the document based on the image data for analysis and cutting out the document area from the read image data, wherein in the cutting step, when a first axis direction and a second axis direction which are orthogonal to each other for defining position information in the read image data and the image data for analysis are taken as a direction corresponding to the transport direction, one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, a part of a second pixel area formed by the second pixels is cut out based on the number of consecutive second pixels in the second axis direction and the number of consecutive second pixels in the first axis direction, a line region detection process for detecting a line-like line region along the first axis direction from the analysis image data, the line region having a width within a predetermined width in the two axis directions; a replacement process for replacing the second pixel of the line region with the first pixel in the analysis image data; a corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of the corners of the second pixel region in the analysis image data after the replacement process; a left / right edge search process for dividing a range from the topmost position to the bottommost position into a plurality of first division positions in the first axis direction, and searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions;A top and bottom edge searching process is executed to search for the edge pixels by scanning the analysis image data from the bottom to the top for each of the second division positions, and a document area specifying process is executed to specify, as the document area, an area partitioned by edges defined by position information of the edge pixels. [Brief description of the drawings]
[0009] [Figure 1] FIG. 1 is a diagram illustrating a simplified configuration of an image forming apparatus. [Diagram 2] FIG. 2 is a simplified diagram showing the relationship between a document and a reading unit as viewed from above. [Diagram 3] 4 is a flowchart showing an image reading process. [Figure 4] 11 is a flowchart showing details of step S300. [Diagram 5] 5A and 5B are diagrams showing examples of image data for analysis. [Figure 6] FIG. 6A is a diagram for explaining an example of left and right edge pixel search processing, and FIG. 6B is a diagram for explaining an example of upper and lower edge pixel search processing. [Figure 7] 11 is a flowchart showing details of step S316. [Figure 8] 8A and 8B are diagrams for explaining a specific example of step S316. [Figure 9] 11 is a flowchart showing details of step S318. [Figure 10] FIG. 13 is a diagram for explaining a specific example of step S318. [Figure 11] 10 is a flowchart showing details of step S300 according to the second embodiment. [Figure 12] FIG. 12A is a diagram showing an example of analysis image data that is the target of step S3011, and FIG. 12B is a diagram showing an example of analysis image data after filling in step S3013. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0010] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. Note that each drawing is merely an example for explaining the present embodiment. Since each drawing is an example, the shapes, ratios, and shading may not be accurate, may not match each other, and some parts may be omitted.
[0011] 1. Overview of the device configuration: 1 shows a simplified configuration of an image reading device 10. The image reading device 10 is an entity that executes the document cutting method. The image reading device 10 includes a control unit 11, a display unit 13, an operation reception unit 14, a storage unit 15, a communication IF 16, a transport unit 17, a reading unit 18, etc. IF is an abbreviation for interface. The control unit 11 includes a CPU as a processor, a memory, and various electronic circuits. In the control unit 11, the processor executes calculations according to a reading control program 12 stored in the memory, thereby controlling the image reading device 10. The processor is not limited to one CPU, and may be configured to perform processing using multiple CPUs or a hardware circuit such as an ASIC, or may be configured to perform processing in cooperation with a CPU and a hardware circuit.
[0012] The display unit 13 is a means for displaying visual information, and is configured, for example, by a liquid crystal display, an organic EL display, etc. The display unit 13 may be configured to include a display and a drive circuit for driving the display. The operation reception unit 14 is a means for receiving operations and inputs by a user, and is realized by, for example, a physical button, a touch panel, a keyboard, etc. The operation reception unit 14 as a touch panel is realized as one function of the display unit 13.
[0013] The storage unit 15 is, for example, a hard disk drive, a solid state drive, or other memory-based storage means. A part of the memory of the control unit 11 may be regarded as the storage unit 15. The storage unit 15 may be regarded as a part of the control unit 11.
[0014] The communication IF 16 is a general term for one or more IFs for connecting the image reading device 10 to an external device (not shown) via a wired or wireless connection in compliance with a predetermined communication protocol including a known communication standard. The external device is, for example, various communication devices such as a personal computer, a server, a smartphone, a tablet terminal, and a printer.
[0015] The transport unit 17 is a means for transporting the document along a predetermined transport direction under the control of the control unit 11, and includes, for example, rollers that rotate to transport the document, a motor that provides rotational power to the rollers, etc. The transport unit 17 can be said to be a means for relatively moving the document and the reading unit 18 in the transport direction.
[0016] The reading unit 18 is a means for optically reading an original under the control of the control unit 11. The reading unit 18 has a typical configuration of a scanner, such as a light source for illuminating the original, an image sensor for receiving reflected light or transmitted light from the original and generating and outputting an electrical signal as a reading result by photoelectric conversion, and an analog front end for converting the output from the image sensor into a digital signal to obtain read image data. A part of the circuitry of the control unit 11 may be regarded as a part of the reading unit 18.
[0017] FIG. 2 shows a simplified view of the relationship between the original 30 and the reading unit 18 from an above perspective. The symbol D1 indicates the transport direction D1. The upstream and downstream of the transport direction D1 are simply called upstream and downstream. The reading unit 18 has an image sensor as described above, and the image sensor is a line sensor in which multiple photoelectric conversion elements are arranged in a main scanning direction perpendicular to the transport direction D1 from the perspective of FIG. 2. According to FIG. 2, a roller 17a is disposed at a position upstream of the reading unit 18. The roller 17a is a part of the transport unit 17. The original 30 is transported from upstream to downstream by the rotation of the roller 17a.
[0018] Needless to say, the number and arrangement of rollers in conveying unit 17 do not need to be limited to those shown in Fig. 2. For example, rollers may be arranged upstream of roller 17a or downstream of reading unit 18. When document 30 passes the position of reading unit 18, a first surface of document 30 that faces the reading surface of reading unit 18 is read by reading unit 18, and read image data is generated.
[0019] In Fig. 2, the reading unit 18 is fixed in a housing (not shown) of the image reading device 10, and the original 30 is transported from upstream to downstream, thereby realizing relative movement between the original 30 and the reading unit 18 in the transport direction D1. However, the reading unit 18 may be configured to be movable. In other words, the image reading device 10 may have a carriage (not shown) that can move the reading unit 18 back and forth along the transport direction D1, and the movement of the carriage may realize at least a part of the relative movement between the original 30 and the reading unit 18 in the transport direction D1. In this case, the carriage also corresponds to a part of the transport unit that moves the original 30 and the reading unit 18 relatively in the transport direction D1.
[0020] 2, the image reading device 10 is configured to read the first side, which is one side of the document 30, but it goes without saying that the image reading device 10 may be configured to be capable of reading both sides of the document 30 in parallel. Although details are omitted, by further providing a reading unit 18 at a position where the second side, which is the side of the document 30 visible from the viewpoint of FIG. 2, can be read, it is possible to configure the image reading device 10 to be capable of reading both sides of the document 30 in parallel.
[0021] 2.Crop the original area: 3 is a flowchart showing an image reading process executed by the control unit 11 in accordance with the reading control program 12. The embodiment described with reference to FIGS. 3 to 10 will be referred to as a "first embodiment." In step S100, the control unit 11 controls the transport unit 17 and the reading unit 18 to read the document 30. That is, the control unit 11 causes the reading unit 18 to read the document 30 while moving the document 30 and the reading unit 18 relatively in the transport direction D1, thereby causing the reading unit 18 to generate read image data as the reading result. Step S100 corresponds to the "reading step". The read image data is, for example, bitmap data having gradation values of red (R), green (G), and blue (B) for each pixel. The gradation values are expressed in 256 gradations, for example, from 0 to 255.
[0022] In step S200, the control unit 11 generates "analysis image data" by dividing each pixel from the read image data generated in step S100 into either a "first pixel" that corresponds to the background color outside the document 30 or a "second pixel" that does not correspond to the background color and binarizing it. Step S200 corresponds to the "generation process" of the analysis image data. The background color is the background color of the range that the reading unit 18 can read in the image reading device 10. The reading unit 18 reads the background color as the color at the time when the document 30 does not exist or the color of the range where the document 30 does not exist. In step S100, the reading unit 18 reads a range wider than the document 30, so a part of the read image data is the background color. The background color is, for example, a predetermined gray. In any case, the background color is known in the product.
[0023] The control unit 11 divides each pixel of the read image data into pixels corresponding to the background color and pixels not corresponding to the background color according to the color, converts the pixels corresponding to the background color to, for example, black pixels, and converts the pixels not corresponding to the background color to, for example, white pixels. A black pixel is a pixel whose R, G, and B gradation values are all 0. A white pixel is a pixel whose R, G, and B gradation values are all 255. The control unit 11 sets a certain margin for the color corresponding to the background color, converts pixels whose color belongs to the color gamut of the background color including the margin to black pixels, and converts pixels whose color does not belong to the color gamut of the background color including the margin to white pixels. Analysis image data is generated by such binarization. That is, in the analysis image data, black pixels correspond to the first pixel and white pixels correspond to the second pixel. Of course, expressing the first pixel as a black pixel and the second pixel as a white pixel is merely an example, and it is sufficient that the first pixel and the second pixel are clearly divided into different colors in the analysis image data.
[0024] In the process of generating image data for analysis from the read image data, the control unit 11 may reduce the processing load by generating image data for analysis after reducing the resolution of the read image data, etc. Also, the control unit 11 may convert the read image data into grayscale data to image data in which each pixel has only luminance information, and then binarize the data by determining whether the luminance value falls within the luminance value range of the background color.
[0025] In step S300, the control unit 11 identifies the "document area" corresponding to the document 30 based on the analysis image data generated in step S200. In step S400, the control unit 11 cuts out an original region from the read image data generated in step S100. That is, the control unit 11 cuts out, as an original region, the same region as the original region identified in the analysis image data in step S300 from the read image data.
[0026] Without going into details, the control unit 11 can, for example, store image data relating to the document area cut out from the read image data in the memory unit 15 or other memory location, transfer it to an external device via the communication IF 16, or use it for specified processing such as printing. Steps S300 and S400 correspond to the “cutting out step.” Step S300 will be described in detail below.
[0027] FIG. 4 is a flowchart showing the details of step S300. 5A and 5B each show an example of the analysis image data 20 generated in step S200. In the illustrated analysis image data 20, the dark-colored areas are "first pixel areas" formed by the first pixels, and the white areas are "second pixel areas" formed by the second pixels.
[0028] The control unit 11 treats the first axis direction as a direction corresponding to the conveying direction D1 among the orthogonal first axis direction and second axis direction for defining the position information in the read image data and the analysis image data. In the example of the figure, the first axis direction is represented as the Y axis direction, and the second axis direction is represented as the X axis direction. For example, the negative side in the Y axis direction is also referred to as one side in the Y axis direction, and the positive side in the Y axis direction is also referred to as the other side in the Y axis direction, and the negative side in the Y axis direction corresponds to the downstream side in the conveying direction D1, and the positive side in the Y axis direction corresponds to the upstream side in the conveying direction D1. In addition, the positive side in the X axis direction is also referred to as one side in the X axis direction, and the negative side in the X axis direction is also referred to as the other side in the X axis direction, and the X axis direction corresponds to the main scanning direction of the line sensor of the reading unit 18. In the following, for convenience of explanation, in the viewpoint of FIG. 5A etc., the negative side in the Y axis direction is regarded as the top, the positive side in the Y axis direction is regarded as the bottom, the positive side in the X axis direction is regarded as the right, and the negative side in the X axis direction is regarded as the left. In addition, the position in the X axis direction is also referred to as the X coordinate, and the position in the Y axis direction is also referred to as the Y coordinate. Coordinates and location information may be understood to have the same meaning.
[0029] According to Figs. 5A and 5B, the large rectangular second pixel region included in the analysis image data 20 is interpreted as the document region. However, in the example of Figs. 5A and 5B, there is a long and thin streak region along the Y-axis direction as part of the second pixel region, which is a "vertical streak" caused by adhesions such as paper powder on the reading unit 18. In other words, since the color of the adhesions is different from the background color, a streak region caused by the second pixels is generated in the analysis image data 20 by reading the adhesions. Of course, there are cases where such a streak region does not occur, but since there is no particular problem if there is no streak region, Figs. 5A and 5B illustrate a case where the second pixel region of the analysis image data 20 includes a streak region. As can be seen by comparing Figs. 5A and 5B, Fig. 5A shows an example in which the document region and the streak region of the second pixel region are integrated, and Fig. 5B shows an example in which the document region and the streak region of the second pixel region are separated from each other.
[0030] 5A and 5B show an example in which the document area is tilted with respect to the X- and Y-axis directions. That is, the document 30 was tilted when the document 30 was read by the reading unit 18, and such tilt is also reflected in the reading result. Such tilt may or may not occur due to, for example, the positional accuracy when the user sets the document 30 in the conveying unit 17, the dimensional error of the roller 17a, and the like.
[0031] In step S302, the control unit 11 detects the topmost position (upper position), the bottommost position (lower position), the leftmost position (left position), and the rightmost position (right position) of the corners of the second pixel region in the analysis image data 20. Step S302 is also called corner detection processing. The corner detection processing will be briefly explained. Note that a column in which pixels are arranged in the Y-axis direction is called a pixel column, and a column in which pixels are arranged in the X-axis direction is called a pixel row.
[0032] When detecting the top position, the control unit 11 sets the topmost pixel row of the analysis image data 20 as the first target pixel row, scans each pixel in the target pixel row from the left end to the right, and attempts to detect the second pixel. The control unit 11 repeats this process by switching the target pixel row one row at a time downward until it can detect the second pixel for the first time, and sets the position of the first detected second pixel as the top position PT.
[0033] When detecting the bottom position, the control unit 11 sets the bottommost pixel row of the analysis image data 20 as the first target pixel row, scans each pixel from the right end of the target pixel row to the left, and attempts to detect the second pixel. The control unit 11 repeats this process by switching the target pixel row one row at a time toward the top until it can detect the second pixel for the first time, and sets the position of the first detected second pixel as the bottom position PB.
[0034] When detecting the left position, the control unit 11 sets the pixel row adjacent below the pixel row including the top position PT as the first target pixel row, scans each pixel from the left end of the target pixel row to the right, and tries to detect the second pixel. The control unit 11 repeats this process by switching the target pixel row downward by one row each time it detects the second pixel, and sets the position of the lowest second pixel among the leftmost second pixels as the left position PL.
[0035] When detecting the right position, the control unit 11 sets the pixel row adjacent above the pixel row including the lower position PB as the first target pixel row, scans each pixel from the right end of the target pixel row to the left, and tries to detect the second pixel. The control unit 11 repeats this process by switching the target pixel row one row at a time upward every time it detects the second pixel, and sets the position of the uppermost second pixel among the rightmost second pixels as the right position PR. 5A and 5B respectively show the top position PT, bottom position PB, left position PL, and right position PR detected in step S302.
[0036] In step S304, the control unit 11 divides the range 21 from the top position PT to the bottom position PB into a plurality of parts in the Y-axis direction to set a plurality of "first division positions". That is, the first division positions are positions set at equal intervals in the Y-axis direction with the pixel row including the top position PT and the pixel row including the bottom position PB as the upper and lower end positions, and the number of the first division positions is, for example, 128. If there is a streak region as shown in FIG. 5A or FIG. 5B, the range 21 is ultimately the entire range of the analysis image data 20 in the Y-axis direction. Then, the control unit 11 searches for an "edge pixel" that corresponds to the edge of the second pixel region by scanning the analysis image data 20 from the left end to the right for each first division position, that is, for each pixel row corresponding to the first division position, and also searches for an edge pixel by scanning the analysis image data 20 from the right end to the left for each first division position. The edge pixel is the second pixel when the first pixel is switched to the second pixel during the search process. Step S304 is also called left and right edge search processing.
[0037] In step S306, the control unit 11 divides the range 22 from the left position PL to the right position PR in the X-axis direction into a plurality of parts to set a plurality of "second division positions". The second division positions are positions set at equal intervals in the X-axis direction with the pixel row including the left position PL and the pixel row including the right position PR as the left and right end positions, and the number of the second division positions is, for example, 128. The control unit 11 searches for edge pixels by scanning the analysis image data 20 from the top to the bottom for each second division position, i.e., for each pixel row corresponding to the second division position, and also searches for edge pixels by scanning the analysis image data 20 from the bottom to the top for each second division position. Step S306 is also referred to as upper and lower edge search processing.
[0038] In step S304, the edge pixel searched for by scanning from the left end of the analysis image data 20 toward the right for each first divided position is called a "left edge pixel," and the edge pixel searched for by scanning from the right end of the analysis image data 20 toward the left for each first divided position is called a "right edge pixel." Similarly, in step S306, the edge pixel searched for by scanning from the top end of the analysis image data 20 toward the bottom for each second divided position is called an "upper edge pixel," and the edge pixel searched for by scanning from the bottom end of the analysis image data 20 toward the top for each second divided position is called a "lower edge pixel."
[0039] 6A is a diagram for explaining the left and right edge search process in the case where the analysis image data 20 shown in FIG. 5A is targeted. In FIG. 6A, the Y coordinates of the arrows shown by solid and dashed lines respectively indicate a first division position of a part within the range 21. That is, according to the example of FIG. 6A, the control unit 11 searches for a left edge pixel from the left end of the analysis image data 20 toward the right along each solid arrow, and searches for a right edge pixel from the right end of the analysis image data 20 toward the left along each dashed arrow. In FIG. 6A, the second pixel located at the tip of each solid arrow may be interpreted as the left edge pixel, and the second pixel located at the tip of each dashed arrow may be interpreted as the right edge pixel.
[0040] FIG. 6B is a diagram for explaining the upper and lower edge search process in the case where the analysis image data 20 in FIG. 5A is targeted, like FIG. 6A. In FIG. 6B, the X coordinates of the arrows indicated by solid and dashed lines respectively indicate a part of the second division positions within the range 22. That is, according to the example of FIG. 6B, the control unit 11 searches for upper edge pixels downward from the upper end of the analysis image data 20 along the solid arrows, and searches for lower edge pixels upward from the lower end of the analysis image data 20 along the dashed arrows. In FIG. 6B, the second pixels located at the tips of the solid arrows may be interpreted as upper edge pixels, and the second pixels located at the tips of the dashed arrows may be interpreted as lower edge pixels.
[0041] As can be seen from the explanation with reference to Figures 6A and 6B, a certain left edge pixel may be an upper edge pixel or a lower edge pixel. Similarly, a certain right edge pixel may be an upper edge pixel or a lower edge pixel. The explanation of the left and right edge search process and the upper and lower edge search process is the same even when the analysis image data 20 of Figure 5B is used as the target, so figures corresponding to Figures 6A and 6B for the analysis image data 20 of Figure 5B are omitted.
[0042] Next, the control unit 11 detects a streak-like muscle region that is a part of the second pixel region and has a width in the X-axis direction within a predetermined width, along the Y-axis direction, based on the edge pixels found by the left and right edge search process, i.e., the left and right edge pixels. Steps S308, S310, and S312 are also referred to as muscle region detection process.
[0043] First, in step S308, the control unit 11 determines whether or not there is a pair of a left edge pixel and a right edge pixel whose distance in the X-axis direction is within a predetermined width. A pair is also called a set or a pair. The predetermined width is a distance set in advance, and can be said to be a value indicating the thickness of a muscle region. It is assumed that the left edge pixel and the right edge pixel that can form the pair have a common first division position, that is, the same Y coordinate. If there is one or more such pairs, the control unit 11 proceeds to step S310 from the determination of "Yes" in step S308, and if there is no such pair, the control unit 11 proceeds to step S320 from the determination of "No" in step S308. In step S320, the control unit 11 determines that there is no muscle region in the analysis image data 20, and proceeds to step S322.
[0044] In step S310, the control unit 11 determines whether the pairs continue in the Y-axis direction for a predetermined number of times or more. The predetermined number in step S310 is also set in advance and can be said to be a value indicating the minimum length required to recognize a muscle region. If the pairs continue in the Y-axis direction for a predetermined number of times or more, the control unit 11 proceeds from the determination of "Yes" in step S310 to step S312, while if the number of consecutive pairs in the Y-axis direction is less than the predetermined number, the control unit 11 proceeds from the determination of "No" in step S310 to step S320.
[0045] In step S312, the control unit 11 determines that a muscle region is present in the analysis image data 20, and proceeds to step S314. Reaching the determination in step S312 corresponds to detecting a muscle region. According to the flow leading to step S312, it can be said that the control unit 11 detects, as at least a part of a muscle region, a region in which the pairs whose distance in the X-axis direction is within a predetermined width are continuous in the Y-axis direction for a predetermined number or more.
[0046] In step S314, the control unit 11 determines whether the second pixel region including the line region is integrated. If the second pixel region including the line region is integrated as in the example of Fig. 5A, the control unit 11 proceeds to step S316 from the determination of "Yes" in step S314. On the other hand, if the second pixel region including the line region is not integrated as in the example of Fig. 5B, the control unit 11 proceeds to step S318 from the determination of "No" in step S314.
[0047] Here, among the edge pixels, edge pixels that correspond to the edge of a muscle region are referred to as "muscle region edge pixels." Moreover, edge pixels that do not correspond to the edge of a muscle region are referred to as "normal edge pixels." The left edge pixel and right edge pixel that form the pair naturally correspond to muscle region edge pixels. The left edge pixel and right edge pixel that have the same X coordinate as the left edge pixel or right edge pixel that form the pair also correspond to muscle region edge pixels. Top edge pixels that are edge pixels included in the uppermost pixel row of the analysis image data 20, and bottom edge pixels that are edge pixels included in the lowermost pixel row of the analysis image data 20 also correspond to muscle region edge pixels.
[0048] The method of determination in step S314 is not particularly limited. For example, if the shortest distance in the X-axis direction between the muscle region edge pixel and the normal edge pixel is equal to or less than a predetermined threshold value related to the distance, the control unit 11 determines that the second pixel region including the muscle region is integrated, and if the shortest distance exceeds the threshold value, determines that the second pixel region including the muscle region is not integrated. Alternatively, the control unit 11 may simply determine that the second pixel region including the muscle region is not integrated if there is a second pixel region separated in the X-axis direction from the muscle region detected as described above in the analysis image data 20, and determine that the second pixel region including the muscle region is integrated if there is no such separated second pixel region.
[0049] Steps S316 and S318 correspond to position information changing processing for changing the position information of the muscle region edge pixels to positions that pass through the edge defined by the position information of the normal edge pixels. Step S316 is position information changing processing for the muscle region that is integrated with the document region, and step S318 is position information changing processing for the muscle region that is separated from the document region.
[0050] FIG. 7 is a flowchart showing the details of step S316. In step S3161, the control unit 11 identifies the topmost edge pixel and the bottommost edge pixel from among the normal edge pixels. Here, the control unit 11 identifies the topmost edge pixel from among the upper edge pixels corresponding to the normal edge pixels as the top end, and identifies the bottommost edge pixel from among the lower edge pixels corresponding to the normal edge pixels as the bottom end. The top end and bottom end identified in step S3161 can be said to be the edge pixels at the top and bottom ends of the document area.
[0051] In step S3162, the control unit 11 changes the Y coordinates of the muscle region edge pixels of the upper group to positions within the range from the upper end to the lower end in the Y-axis direction identified in step S3161. Step S3162 and step S3165 described below correspond to a "first change process" that changes the position information of the muscle region edge pixels. In the situation of step S316, the muscle region edge pixels in the analysis image data 20 are distributed separately above and below the area surrounded by the normal edge pixels. Therefore, the control unit 11 can recognize the muscle region edge pixels as a group distributed above the area surrounded by the normal edge pixels and a group distributed below the area. Such a group of muscle region edge pixels distributed above is referred to as the "upper group," and a group of muscle region edge pixels distributed below is referred to as the "lower group."
[0052] FIG. 8A is a diagram for explaining a specific example of steps S3162, S3163, and S3164, and shows a part of the analysis image data 20 including the upper end and upper group identified in step S3161. The state before step S3162 is executed is shown in the upper part of FIG. 8A, and the state after step S3164 is executed is shown in the lower part of FIG. 8A. In FIG. 8A, left edge pixels are shown by circles (◯), right edge pixels by crosses (×), upper edge pixels by triangles (△), and lower edge pixels by squares (□). In FIG. 8A and FIG. 8B and FIG. 10 described later, ease of understanding is prioritized over accuracy, and for example, the contents are illustrated so as not to overlap, so the positions of each edge pixel are not necessarily accurate.
[0053] In the upper part of FIG. 8A, the left edge pixel, right edge pixel, and top edge pixel surrounded by a dashed ellipse are the top group 23 of the muscle region edge pixels. The top edge pixel 24 indicated by the reference symbol 24 corresponds to the top end identified in step S3161. The range indicated by the arrow indicated by the reference symbol 25 indicates a change destination range 25 of the Y coordinates of the muscle region edge pixels in step S3162. The change destination range 25 is a range in the Y-axis direction from the top edge pixel 24 to the top edge. The control unit 11 can recognize a line of normal edge pixels arranged in a straight line as one edge, and recognizes a line of upper edge pixels arranged in a straight line as normal edge pixels arranged on either side of the X coordinates of the muscle region edge pixels belonging to the upper group 23 in the X-axis direction as the top edge here. Therefore, in step S3162, the control unit 11 changes the Y coordinates of each of the muscle region edge pixels belonging to the upper group 23 to a position within the change destination range 25. In step S3162, the X coordinates of the muscle region edge pixels belonging to the upper group 23 are not changed.
[0054] In this embodiment, changing the position information of an edge pixel is not a process of moving or copying a pixel from an original position to a new position, but a process of changing the position information recognized as an edge pixel by the control unit 11. For example, in a situation where the control unit 11 recognizes a pixel at coordinates (X, Y) = (X1, Y1) as an edge pixel, changing the position information of an edge pixel is a process of newly recognizing another pixel at coordinates (X, Y) = (X2, Y2) as an edge pixel instead of recognizing this pixel at (X1, Y1) as an edge pixel.
[0055] In step S3163, the control unit 11 obtains a linear function F1 of the changed edge for the upper group. According to FIG. 8A, the changed edge is the upper edge already described. The control unit 11 may obtain a linear function F1 for defining a line in which upper edge pixels as normal edge pixels arranged on either side of the X coordinate of the line region edge pixel belonging to the upper group 23 in the X-axis direction are arranged in a straight line. A linear function is generally expressed as Y=aX+b, and can be obtained by knowing two points. a and b are coefficients. The control unit 11 may obtain a linear function F1 that passes through the upper edge pixel 24 and one upper edge pixel that is a normal edge pixel in the vicinity of the upper group 23. The timing of executing step S3163 may be before step S3162 or at the same time as step S3162.
[0056] In step S3164, the control unit 11 changes the position information of the muscle region edge pixels after the Y coordinates are changed in step S3162, by the linear function F1 obtained in step S3163. Since the Y coordinate of each of the position information of the muscle region edge pixels of the upper group 23 is determined in step S3162, the control unit 11 determines the X coordinate that gives the Y coordinate from the linear function F1 to determine the changed XY coordinates, i.e., the position information, of each of the muscle region edge pixels of the upper group 23. In the lower part of FIG. 8A, the positions of the right edge pixels of the muscle region edge pixels of the upper group 23 after the change in step S3164 are illustrated by cross marks. The position information of these right edge pixels is changed to positions that pass through the upper edge and fall within the change destination range 26 in the X-axis direction. The change destination range 26 may be interpreted as the range from the upper edge pixel 24 to the upper group 23 in the X-axis direction. Although not shown in the figure, the position information of all of the muscle area edge pixels in the upper group 23, including the left edge pixels and top edge pixels other than the right edge pixels, is changed to a position that passes through the top edge and falls within the destination range 26 in the X-axis direction.
[0057] Steps S3165, S3166, and S3167 will be briefly described as following steps S3162, S3163, and S3164. In step S3165, the control unit 11 changes the Y coordinate of the muscle region edge pixel of the lower group to a position within the range from the upper end to the lower end in the Y-axis direction identified in step S3161.
[0058] Fig. 8B is a diagram for explaining a specific example of steps S3165, S3166, and S3167, and shows a portion of analysis image data 20 including the lower edge and lower group identified in step S3161. Fig. 8B can be viewed in the same way as Fig. 8A. In the upper part of Fig. 8B, the left edge pixel, right edge pixel, and lower edge pixel enclosed in a dashed ellipse are the lower group 27 of the muscle region edge pixels. The lower edge pixel 28 indicated by the reference symbol 28 corresponds to the lower edge identified in step S3161.
[0059] The control unit 11 recognizes as the lower edge a linear line of lower edge pixels arranged as normal edge pixels on either side of the X coordinate of a muscle area edge pixel belonging to the lower group 27 in the X-axis direction. In step S3165, the control unit 11 changes the Y coordinate of each of the muscle area edge pixels belonging to the lower group 27 to a position that falls within the destination range, and does not change the X coordinate of each of the muscle area edge pixels belonging to the lower group 27. The destination range in step S3165 is, of course, the range in the Y-axis direction from the lower edge to lower edge pixel 28.
[0060] In step S3166, a linear function F2 of the changed edge for the lower group is obtained. According to Fig. 8B, the changed edge is the lower edge already described. The control unit 11 may obtain, for example, a linear function F2 that passes through the lower edge pixel 28 and one lower edge pixel that is a nearby normal edge pixel for the lower group 27. The timing of executing step S3166 may be before step S3165 or simultaneously with step S3165.
[0061] In step S3167, the control unit 11 changes the position information of the muscle region edge pixels after the Y coordinates have been changed in step S3165, using the linear function F2 calculated in step S3166. Since the Y coordinate of the position information of each of the muscle region edge pixels of the lower group 27 has been determined in step S3165, the control unit 11 determines the X coordinates that give these Y coordinates from the linear function F2, thereby determining the changed X and Y coordinates of each of the muscle region edge pixels of the lower group 27.
[0062] 8B, the left edge pixels of the muscle region edge pixels of the lower group 27 are shown with circles as examples of positions after the change in step S3167. The position information of these left edge pixels is changed to positions that pass through the lower edge and fall within a destination range in the X-axis direction. The destination range in the X-axis direction referred to here may be understood as the range from the lower edge pixel 28 to the lower group 27 in the X-axis direction. Although not shown in the figure, the position information of all the muscle region edge pixels of the lower group 27, including the right edge pixels and the lower edge pixels other than the left edge pixels, is changed to positions that pass through the lower edge and fall within the destination range in the X-axis direction.
[0063] The above is the process of step S316. The process of steps S3162 to S3164 for the upper group and the process of steps S3165 to S3167 for the lower group may be performed in the reverse order to that shown in FIG.
[0064] FIG. 9 is a flowchart showing the details of step S318. In step S3181, the control unit 11 specifies the uppermost edge pixel and the lowermost edge pixel from among the normal edge pixels. Step S3181 is the same process as step S3161. In step S3182, the control unit 11 changes the Y coordinate of each of the muscle region edge pixels to a position within the range from the upper end to the lower end in the Y-axis direction identified in step S3181. Step S3182 also corresponds to the "first change process" that changes the position information of the muscle region edge pixels. In step S3182, the X coordinate of each of the muscle region edge pixels is not changed.
[0065] FIG. 10 is a diagram for explaining a specific example of step S318. In FIG. 10, the upper edge pixels 24 and the lower edge pixels 28 corresponding to the upper and lower ends identified in step S3181, and the analysis image data 20 including the muscle region are shown with some parts omitted. FIG. 10 can be viewed in the same way as FIGS. 8A and 8B. The upper part of FIG. 10 shows the state before step S3182 is executed, and the lower part of FIG. 10 shows the state after step S3186 is executed. In the upper part of FIG. 10 as well, the left edge pixels, right edge pixels, upper edge pixels, and lower edge pixels corresponding to the muscle region edge pixels are surrounded by dashed ellipses.
[0066] In step S3183, the control unit 11 determines a linear function of the two intersecting changed edges. In the situation of step S318, the control unit 11 can recognize four lines, i.e., four edges, including a line in which upper edge pixels that are normal edge pixels are arranged in a straight line, a line in which upper edge pixels and left edge pixels that are normal edge pixels are arranged in a straight line, a line in which lower edge pixels and left edge pixels that are normal edge pixels are arranged in a straight line, and a line in which lower edge pixels that are normal edge pixels are arranged in a straight line. Therefore, the control unit 11 determines a linear function F1 for defining the line in which upper edge pixels that are normal edge pixels are arranged in a straight line on the streak region side out of these four lines, and a linear function F3 for defining the line in which lower edge pixels that are normal edge pixels are arranged in a straight line. In step S3184, the control unit 11 determines the coordinates of the intersection 29 of the two linear functions F1 and F3 determined in step S3183.
[0067] In step S3185, the control unit 11 changes the position information of the muscle region edge pixels located above intersection 29, which are the muscle region edge pixels after the Y coordinates were changed in step S3182, using the linear function F1 determined in step S3183. Since the Y coordinates of the position information of each of the muscle region edge pixels located above intersection 29 have been determined in step S3182, the control unit 11 determines the X coordinates that give these Y coordinates from the linear function F1, thereby determining the changed X and Y coordinates of each of the muscle region edge pixels located above intersection 29.
[0068] In step S3186, the control unit 11 changes position information of the muscle region edge pixels that are located below intersection 29, which are the muscle region edge pixels after the Y coordinates have been changed in step S3182, using the linear function F3 calculated in step S3183. Since the Y coordinate of the position information of each of the muscle region edge pixels that are located below intersection 29 has been determined in step S3182, the control unit 11 determines the X coordinate that gives these Y coordinates from the linear function F3, thereby determining the changed XY coordinates of each of the muscle region edge pixels that are located below intersection 29. Note that the muscle region edge pixels whose Y coordinates have been changed in step S3182 and whose Y coordinate coincides with intersection 29 may be subject to the processing of either step S3185 or S3186.
[0069] 10, the position of the right edge pixel among the muscle region edge pixels after the change through steps S3185 and S3186 is illustrated by a cross. The position information of these right edge pixels is changed to a position passing through an edge defined by the linear function F1 and falling within the range from the upper edge pixel 24 to the intersection 29 in the X-axis direction, or a position passing through an edge defined by the linear function F3 and falling within the range from the lower edge pixel 28 to the intersection 29 in the X-axis direction. Although not shown in the figure, the position information of all the muscle region edge pixels, including the left edge pixel, upper edge pixel, and lower edge pixel, other than the right edge pixel, is changed to a position passing through an edge defined by the linear function F1 and falling within the range from the upper edge pixel 24 to the intersection 29 in the X-axis direction, or a position passing through an edge defined by the linear function F3 and falling within the range from the lower edge pixel 28 to the intersection 29 in the X-axis direction. The above is the process of step S318. The execution order of steps S3185 and S3186 may be reversed from the order shown in FIG.
[0070] 4, the control unit 11 specifies, as the document area, an area defined by edges defined by the position information of the edge pixels at that time in the analysis image data 20. That is, the control unit 11 specifies, as the document area, a rectangular area surrounded by the edge pixels. Step S322, which is executed after step S316 or step S318, corresponds to the document area specification process after the position information change process.
[0071] 3. Summary of the first embodiment: Thus, according to the first embodiment, the image reading device 10 includes a reading unit 18 that generates read image data as a reading result by reading the original 30, a transport unit 17 that moves the original 30 and the reading unit 18 relatively in a predetermined transport direction D1, and a control unit 11 that generates analysis image data 20 by dividing each pixel of the read image data into either a first pixel corresponding to the background color outside the original 30 or a second pixel not corresponding to the background color and binarizing it, identifies the original area corresponding to the original 30 based on the analysis image data 20, and cuts out the original area from the read image data.The control unit 11 performs a corner detection process for detecting the topmost position, the bottommost position, the leftmost position, and the rightmost position of a corner of a second pixel region formed by second pixels in the analysis image data 20, where the first axis direction is defined as a direction corresponding to the transport direction D1, and one side in the first axis direction is defined as an upper side, the other side in the first axis direction is defined as a lower side, one side in the second axis direction is defined as a right side, and the other side in the second axis direction is defined as a left side; a left and right edge search process for dividing a range from the topmost position to the bottommost position into a plurality of first division positions to set a plurality of first division positions, searching for an edge pixel corresponding to an edge of the second pixel region by scanning the analysis image data 20 from the left end to the right for each first division position, and searching for an edge pixel by scanning the analysis image data 20 from the right end to the left for each first division position; and The process executes the following: a top-bottom edge search process in which the range from the leftmost position to the rightmost position is divided into multiple parts in the second axial direction to set multiple second division positions, edge pixels are searched for by scanning the analysis image data 20 from the top to the bottom for each second division position, and edge pixels are searched for by scanning the analysis image data 20 from the bottom to the top for each second division position; a muscle region detection process in which a muscle region that is part of the second pixel region and has a width in the second axial direction within a predetermined width, and that runs along the first axial direction, based on the edge pixels searched for by the left-right edge search process; a position information change process in which position information of edge pixels that correspond to the edge of the muscle region among the edge pixels is changed to a position that passes through an edge defined by position information of edge pixels that do not correspond to the edge of the muscle region; and a manuscript region identification process in which, after the position information change process, an area partitioned by the edges defined by the position information of the edge pixels is identified as a manuscript region.
[0072] According to the above configuration, even if the analysis image data 20 generated from the read image data contains a streak region, the control unit 11 changes the position information of the edge pixels of the streak region to a position that passes through an edge defined by the position information of edge pixels that do not correspond to the edge pixels of the streak region, and then specifies the document region. Therefore, even if there is a vertical line, i.e., a streak region, it is possible to accurately cut out the document region from the read image data while eliminating the influence of the streak region. In addition, it is possible to save the user the trouble of cleaning the reading unit 18 of any paper dust or other deposits and then rescanning the document 30.
[0073] In addition, in the muscle region detection process, the control unit 11 detects as at least part of a muscle region an area where pairs of left edge pixels, which are edge pixels searched for by scanning from the left end of the analysis image data 20 to the right, and right edge pixels, which are edge pixels searched for by scanning from the right end of the analysis image data 20 to the left, and where the distance between the said pairs in the second axial direction is within a predetermined width, are consecutive for a predetermined number or more in the first axial direction. According to the above configuration, the control unit 11 can detect a muscle region with high accuracy based on the positional relationship between the right edge pixels and the left edge pixels. However, the control unit 11 can detect a streak area corresponding to a vertical streak in the analysis image data 20 by various methods such as pattern matching.
[0074] In addition, in the position information change process, the control unit 11 identifies the topmost edge pixel and the bottommost edge pixel among the edge pixels searched for by the upper and lower edge search process that do not correspond to the edge of the muscle region, and executes a first change process to change the position information of the edge pixels that correspond to the edge of the muscle region to positions within a range in the first axial direction with the position of the topmost edge pixel as the upper end and the position of the bottommost edge pixel as the lower end, and changes the position information of the edge pixels that correspond to the edge of the muscle region after the first change process by a linear function that indicates the edge defined by the position information of the edge pixels that do not correspond to the edge of the muscle region. According to the above configuration, the control unit 11 can accurately change the position information of the muscle region edge pixels to a position that passes through an edge defined by the position information of edge pixels that do not correspond to the muscle region edge pixels.
[0075] In the explanation of steps S304 and S306, the number of first division positions and the number of second division positions are each set to 128. The number of first division positions and the number of second division positions are the number of edge pixels. This number may be changed arbitrarily by the user. In other words, the control unit 11 may receive the number of first division positions and the number of second division positions as input from the user, and set the received number of first division positions and the number of second division positions in steps S304 and S306. The user inputs the number of first division positions and the number of second division positions through an operation of the operation receiving unit 14. According to such a configuration, the user can arbitrarily change the number of first division positions and second division positions, thereby achieving a balance between reducing the processing load on the control unit 11 and the accuracy of cutting out the document area.
[0076] 4. Second embodiment: Next, a second embodiment will be described. Regarding the second embodiment, the description common to the embodiments described so far will be omitted. In the second embodiment, the control unit 11 executes a line region detection process to detect a line-like line region along the first axis direction, which is a part of the second pixel region and has a width in the second axis direction within a predetermined width, from the analysis image data 20, based on the number of consecutive second pixels in the second axis direction and the number of consecutive second pixels in the first axis direction, and a replacement process to replace the second pixel of the line region with the first pixel in the analysis image data 20. Then, after the replacement process, the control unit 11 executes a corner detection process, a left / right edge search process, an upper / lower edge search process, and a document region identification process to identify, as the document region, a region partitioned by edges defined by position information of the edge pixels.
[0077] Fig. 11 shows the details of step S300 according to the second embodiment in a flowchart. Fig. 11 is different from Fig. 4 according to the first embodiment in that it has steps S3011, S3012, and S3013 before step S302. Also, in Fig. 11, steps S308, S310, S312, S314, S316, S318, and S320 in Fig. 4 are not included, and step S322 is executed following step S306. Steps S302, S304, S306, and S322 are as described above.
[0078] In step S3011, the control unit 11 detects a streak region in a predetermined upper end region including the upper end pixel row of the analysis image data 20. In this embodiment, the reading unit 18 starts reading at a timing slightly earlier than the leading edge of the document 30 reaches the position of the reading unit 18. Therefore, at the upper end side of the analysis image data 20, a first pixel region exists above the document region. Such a region at the upper end side of the analysis image data 20 where it is assumed that the document region is almost certainly not present is called the upper end region.
[0079] FIG. 12A illustrates the analysis image data 20 in the same manner as FIG. 5A. In FIG. 12A, the range of the upper end region 20a is indicated by a broken line. The upper end region 20a is a region consisting of a determined number of pixel rows that are continuous in the Y-axis direction, including the pixel row at the top end of the analysis image data 20. The control unit 11 scans the upper end region 20a to try to detect a streak region. Specifically, a continuous second pixel region in which the number of consecutive second pixels in the X-axis direction is equal to or less than a first threshold value and the number of consecutive second pixels in the Y-axis direction is equal to or more than a second threshold value is detected as a streak region in the upper end region 20a. In other words, the number of consecutive second pixels in the X-axis direction being equal to or less than the first threshold value satisfies the condition in the second embodiment that the width in the second axis direction is within a predetermined width. The first threshold value and the second threshold value are preset to appropriately detect vertical streaks, and for example, the first threshold value is 4 pixels and the second threshold value is 8 pixels.
[0080] As a result of step S3011, if a muscle region can be detected from the upper end region 20a, the control unit 11 determines that a muscle region is present, that is, determines "Yes" in step S3012, and proceeds to step S3013. On the other hand, if a muscle region cannot be detected from the upper end region 20a as a result of step S3011, the control unit 11 determines that a muscle region is not present, that is, determines "No" in step S3012, and proceeds to step S302.
[0081] In step S3013, the control unit 11 fills in the muscle region. Filling is a replacement process that replaces the second pixel with the first pixel. However, the muscle region detected in step S3011 is only a small part of the muscle region in the analysis image data 20. It is assumed that the muscle region is continuous from the upper end to the lower end of the analysis image data 20 in the Y-axis direction. Therefore, in step S3013, the control unit 11 fills in the muscle region detected in step S3011 and the regions that are continuous above and below the muscle region and have the same width as the muscle region, from the upper end to the lower end of the analysis image data 20. The width is the length in the X-axis direction. In order to reliably fill in the muscle region, it is also possible to fill in regions that are approximately one pixel wider on both the positive and negative sides of the detected muscle region in the X-axis direction. The control unit 11 performs the processes from step S302 onward on the analysis image data 20 that has been filled in at step S3013.
[0082] Fig. 12B illustrates an example of a state in which the filling in step S3013 has been performed on the analysis image data 20 shown in Fig. 12A. As can be seen by comparing Fig. 12B with Fig. 12A, the line area included in the analysis image data 20 has been replaced with the first pixel instead of the second pixel as a result of step S3013. In an example in which the manuscript area and the line area are integrated as in Fig. 12A, the filling in step S3013 causes a vertical line formed by the first pixel to penetrate the manuscript area, but the presence of such a vertical line formed by the first pixel does not affect the processing from step S302 onwards, i.e., the identification of the manuscript area based on edge pixels.
[0083] According to the second embodiment, the control unit 11 detects and fills in the line area in the analysis image data 20 generated from the read image data, and then proceeds to the corner detection process and subsequent steps. This simplifies the steps from the corner detection process onwards, and enables the document area to be accurately cut out from the read image data while eliminating the influence of the line area.
[0084] 5.Other notes: Although the claims describe only some of the combinations of claims, the present embodiment naturally includes in its scope not only one-to-one combinations of independent claims and dependent claims, but also various combinations of multiple dependent claims. In addition to the image reading device 10, the present embodiment discloses inventions in various categories, such as a method using processes or steps executed by the device 10, and a program 12 for implementing the method in cooperation with a processor.
[0085] In other words, the document cutting method includes a reading process in which the document and the reading unit read the document while moving the document and the reading unit relative to each other in a predetermined transport direction, thereby generating read image data as the reading result; a generation process in which each pixel of the read image data is divided into either a first pixel corresponding to the background color outside the document or a second pixel not corresponding to the background color and binarized, thereby generating image data for analysis; and a cutting process in which a document area corresponding to the document is identified based on the image data for analysis, and the document area is cut out from the read image data.In the cutting out step, among orthogonal first and second axis directions for defining position information in the read image data and the analysis image data, when the first axis direction is taken as a direction corresponding to the transport direction, and one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, the cutting out step includes a corner detection process for detecting the uppermost position, the lowermost position, the leftmost position, and the rightmost position of the corners of a second pixel region formed by the second pixels in the analysis image data; a left and right edge search process for dividing a range from the uppermost position to the lowermost position into a plurality of first division positions by setting a plurality of first division positions, searching for an edge pixel corresponding to an edge of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixel by scanning the analysis image data from the right end to the left for each of the first division positions; a top-bottom edge search process for searching for the edge pixels by scanning the analysis image data from the top to the rightmost position in the second axial direction into a plurality of second division positions, and for searching for the edge pixels by scanning the analysis image data from the bottom to the top for each second division position; a streak region detection process for detecting a streak region that is part of the second pixel region and has a width in the second axial direction within a predetermined width based on the edge pixels searched for by the left-right edge search process among the edge pixels; a position information change process for changing position information of the edge pixels that correspond to an edge of the streak region to a position that passes through an edge defined by position information of the edge pixels that do not correspond to the edge of the streak region; and a manuscript region identification process for identifying, after the position information change process, an area partitioned by the edges defined by the position information of the edge pixels as the manuscript region.
[0086] The document cutting method further includes, in the cutting step, a line region detection process for detecting, from the analysis image data, a line-shaped line region that is a part of a second pixel region formed by the second pixels and has a width in the second axis direction within a predetermined width, based on the number of consecutive second pixels in the second axis direction and the number of consecutive second pixels in the first axis direction; a replacement process for replacing, in the analysis image data, the second pixels of the line region with the first pixels; a corner detection process for detecting, after the replacement process, corners of the second pixel region in the analysis image data, the topmost position, the bottommost position, the leftmost position, and the rightmost position; and a plurality of first division positions for dividing a range from the topmost position to the bottommost position into a plurality of positions in the first axis direction, and a plurality of first division positions for dividing the analysis image data into a plurality of positions. The method executes a left-right edge search process in which the image data is scanned from the left end to the right to search for edge pixels corresponding to the edge of the second pixel region, and the edge pixels are searched for by scanning the analysis image data from the right end to the left for each first division position; a top-bottom edge search process in which the range from the leftmost position to the rightmost position is divided into multiple parts in the second axial direction to set multiple second division positions, and the edge pixels are searched for by scanning the analysis image data from the top end to the bottom for each second division position, and the edge pixels are searched for by scanning the analysis image data from the bottom end to the top for each second division position; and a manuscript area identification process in which an area partitioned by edges defined by position information of the edge pixels is identified as the manuscript area. [Explanation of symbols]
[0087] 10: image reading device, 11: control unit, 12: reading control program, 13: display unit, 14: operation reception unit, 15: storage unit, 16: communication IF, 17: transport unit, 18: reading unit, 20: image data for analysis, 20a: upper end region
Claims
1. a reading unit that reads an original document and generates read image data as a result of the reading; a conveying unit that moves the document and the reading unit relative to each other in a predetermined conveying direction; a control unit that generates analysis image data by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing the pixel, identifies a document area corresponding to the document based on the analysis image data, and cuts out the document area from the read image data, The control unit is Among the orthogonal first and second axis directions for defining position information in the read image data and the analysis image data, when the first axis direction is taken as a direction corresponding to the transport direction, one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, a corner detection process for detecting the topmost, bottommost, leftmost, and rightmost corners of a second pixel region formed by the second pixels in the analysis image data; a left / right edge search process for dividing a range from the top position to the bottom position into a plurality of first division positions in the first axis direction, searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions; an upper and lower edge search process for dividing a range from the leftmost position to the rightmost position into a plurality of second division positions in the second axial direction, searching for the edge pixels by scanning the analysis image data from the upper end downward for each of the second division positions, and searching for the edge pixels by scanning the analysis image data from the lower end upward for each of the second division positions; a muscle region detection process for detecting a muscle region that is a part of the second pixel region and has a width in the second axis direction within a predetermined width, the muscle region detecting process being based on the edge pixels found by the left and right edge search process among the edge pixels; a position information changing process for changing position information of the edge pixels that correspond to the edge of the muscle region among the edge pixels to a position that passes through an edge defined by position information of the edge pixels that do not correspond to the edge of the muscle region; the position information changing process being followed by a document area specifying process for specifying, as the document area, an area partitioned by edges defined by the position information of the edge pixels.
2. 2. The image reading device according to claim 1, wherein, in the muscle region detection process, the control unit detects, as at least part of the muscle region, a region in which pairs of left edge pixels, which are edge pixels searched for by scanning from the left end of the analysis image data to the right, and right edge pixels, which are edge pixels searched for by scanning from the right end of the analysis image data to the left, and in which the distance in the second axis direction is within the predetermined width, are continuous in the first axis direction for a predetermined number or more.
3. In the position information change process, the control unit Identifying an uppermost edge pixel and a lowermost edge pixel among the edge pixels that do not correspond to an edge of the muscle region among the edge pixels searched for by the upper and lower edge search process; execute a first change process for changing position information of the edge pixel corresponding to the edge of the muscle region to a position within a range in the first axis direction, with the position of the uppermost edge pixel as an upper end and the position of the lowermost edge pixel as a lower end; 2. The image reading device according to claim 1, wherein after the first modification process, position information of the edge pixels that correspond to the edges of the muscle region is modified by a linear function that indicates an edge defined by position information of the edge pixels that do not correspond to the edges of the muscle region.
4. 2. The image reading device according to claim 1, wherein the control unit receives the number of the first division positions and the second division positions through input from a user, and sets the received number of the first division positions and the second division positions.
5. a reading unit that reads an original document and generates read image data as a result of the reading; a conveying unit that moves the document and the reading unit relative to each other in a predetermined conveying direction; a control unit that generates analysis image data by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing the pixel, identifies a document area corresponding to the document based on the analysis image data, and cuts out the document area from the read image data, The control unit is Among the orthogonal first and second axis directions for defining position information in the read image data and the analysis image data, when the first axis direction is taken as a direction corresponding to the transport direction, one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, a line region detection process for detecting, from the analysis image data, a line region that is a part of a second pixel region formed by the second pixels and that extends along the first axis direction and has a width in the second axis direction within a predetermined width, based on the number of consecutive second pixels in the second axis direction and the number of consecutive second pixels in the first axis direction; a replacement process for replacing the second pixel of the muscle region with the first pixel in the analysis image data; a corner detection process for detecting the topmost, bottommost, leftmost and rightmost corners of the second pixel region in the analysis image data after the replacement process; a left / right edge search process for dividing a range from the top position to the bottom position into a plurality of first division positions in the first axis direction, searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions; an upper and lower edge search process for dividing a range from the leftmost position to the rightmost position into a plurality of second division positions in the second axial direction, searching for the edge pixels by scanning the analysis image data from the upper end downward for each of the second division positions, and searching for the edge pixels by scanning the analysis image data from the lower end upward for each of the second division positions; and a document area specifying process for specifying, as the document area, an area partitioned by edges defined by position information of the edge pixels.
6. a reading step of generating read image data as a reading result by reading the original with the reading unit while moving the original and the reading unit relatively in a predetermined transport direction; a generating step of generating image data for analysis by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing the pixels; a cut-out step of identifying a document area corresponding to the document based on the analysis image data and cutting out the document area from the read image data, In the cutting step, Among the orthogonal first and second axis directions for defining position information in the read image data and the analysis image data, when the first axis direction is taken as a direction corresponding to the transport direction, one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, a corner detection process for detecting the topmost, bottommost, leftmost, and rightmost corners of a second pixel region formed by the second pixels in the analysis image data; a left / right edge search process for dividing a range from the top position to the bottom position into a plurality of first division positions in the first axis direction, searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions; an upper and lower edge search process for dividing a range from the leftmost position to the rightmost position into a plurality of second division positions in the second axial direction, searching for the edge pixels by scanning the analysis image data from the upper end downward for each of the second division positions, and searching for the edge pixels by scanning the analysis image data from the lower end upward for each of the second division positions; a muscle region detection process for detecting a muscle region that is a part of the second pixel region and has a width in the second axis direction within a predetermined width, the muscle region detecting process being based on the edge pixels found by the left and right edge search process among the edge pixels; a position information changing process for changing position information of the edge pixels that correspond to the edge of the muscle region among the edge pixels to a position that passes through an edge defined by position information of the edge pixels that do not correspond to the edge of the muscle region; a document area specifying process for specifying, after the position information changing process, an area partitioned by edges defined by the position information of the edge pixels as the document area, the document area specifying process being performed after the position information changing process.
7. a reading step of generating read image data as a reading result by reading the original with the reading unit while moving the original and the reading unit relatively in a predetermined transport direction; a generating step of generating image data for analysis by dividing each pixel of the read image data into either a first pixel corresponding to a background color outside the document or a second pixel not corresponding to the background color and binarizing the pixels; a cut-out step of identifying a document area corresponding to the document based on the analysis image data and cutting out the document area from the read image data, In the cutting step, Among the orthogonal first and second axis directions for defining position information in the read image data and the analysis image data, when the first axis direction is taken as a direction corresponding to the transport direction, one side in the first axis direction is taken as an upper side, the other side in the first axis direction is taken as a lower side, one side in the second axis direction is taken as a right side, and the other side in the second axis direction is taken as a left side, a line region detection process for detecting, from the analysis image data, a line region that is a part of a second pixel region formed by the second pixels and that extends along the first axis direction and has a width in the second axis direction within a predetermined width, based on the number of consecutive second pixels in the second axis direction and the number of consecutive second pixels in the first axis direction; a replacement process for replacing the second pixel of the muscle region with the first pixel in the analysis image data; a corner detection process for detecting the topmost, bottommost, leftmost and rightmost corners of the second pixel region in the analysis image data after the replacement process; a left / right edge search process for dividing a range from the top position to the bottom position into a plurality of first division positions in the first axis direction, searching for edge pixels corresponding to edges of the second pixel region by scanning the analysis image data from the left end to the right for each of the first division positions, and searching for the edge pixels by scanning the analysis image data from the right end to the left for each of the first division positions; an upper and lower edge search process for dividing a range from the leftmost position to the rightmost position into a plurality of second division positions in the second axial direction, searching for the edge pixels by scanning the analysis image data from the upper end downward for each of the second division positions, and searching for the edge pixels by scanning the analysis image data from the lower end upward for each of the second division positions; and a document area specifying process for specifying, as the document area, an area partitioned by edges defined by position information of the edge pixels.
Citation Information
Patent Citations
JP2020‐17856A