Image processing device, image processing method and program

The image processing device addresses the issue of cropping distorted documents by setting crop lines based on detected document edges and distortion adjustments, improving the accuracy of document extraction.

JP7822162B2Active Publication Date: 2026-03-02SHARP KK
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2021196535
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-12-02
Publication Date
2026-03-02
Estimated Expiration
2041-12-02

AI Technical Summary

Technical Problem

Conventional image processing devices fail to appropriately crop distorted documents scanned using an automatic document feeder, resulting in the inclusion of background colors due to document distortion.

Method used

An image processing device that detects a rectangular area adjacent to the document edge, sets a crop line to include the document image when the document side is separated from the edge, and crops the image based on this line, using edge detection, skew determination, and distance measurement to adjust for distortion.

Benefits of technology

Effectively removes background components from distorted document scans, ensuring accurate cropping and reducing background interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007822162000001
    Figure 0007822162000001
  • Figure 0007822162000002
    Figure 0007822162000002
  • Figure 0007822162000003
    Figure 0007822162000003
Patent Text Reader

Abstract

To provide an image processing device and the like capable of properly cropping an image of a document.SOLUTION: The image processing device for cropping an image comprises an input unit for inputting an image and a control unit. The control unit detects a rectangular region being in contact with an edge of a document detected from the image and when a side constituting the rectangular region and an edge of the document are spaced from each other, sets a crop line at a position including an image of the document, and crops the image on the basis of the crop line.SELECTED DRAWING: Figure 2
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present disclosure relates to an image processing device and the like. [Background technology]

[0002] 2. Description of the Related Art Some image processing devices, such as multifunction peripherals, have a function of detecting an area in which an image of a document appears (document area) from a scanned image of the document, and cropping (cutting out) the document area.

[0003] Techniques for setting the cropping range have also been proposed. For example, a technique has been proposed in which, when a receipt is read with a scanner, the extracted edge state is grasped, and if part of the rectangular area is missing, the missing line segment is extended to estimate the hidden vertex, and line segments are extended from the estimated vertex to other vertices that have already been acquired to extract receipt image data (see, for example, Patent Document 1). Another technique has been proposed in which the edges on each of the four sides of a document are extracted from the edges of an image detected based on image data, and an extraction area to be extracted as document image data is specified based on the reliability of each edge and the paper size (see, for example, Patent Document 2). [Prior art documents] [Patent documents]

[0004] [Patent Document 1] Patent No. 6539844 [Patent Document 2] Japanese Patent Application Laid-Open No. 2013-123119 Summary of the Invention [Problem to be solved by the invention]

[0005] Here, when a document transported using an automatic document feeder (SPF; Single Pass Feeder) is scanned, the document may be scanned in a distorted state. For example, FIG. 19(a) illustrates a scanned image (input image) in which the document is distorted. E900 in FIG. 19(a) illustrates an image of the document in the input image. The document image is distorted, and as shown in E902, the edges of the document are particularly curved. In such a case, area E910 in FIG. 19(b) is detected as the document range from the input image. FIG. 19(c) illustrates an image (an output image, such as a printed image) after skew correction and cropping based on area E910 in FIG. 19(b). As shown in area E920 in FIG. 19(c), the cropped output image includes the colors (e.g., gray) of background components, such as the document presser and document cover, due to the adverse effects of the document distortion.

[0006] As described above, when an input image is cropped while the original is distorted, the distortion of the original is affected by the cropped image, which is a problem that has not been taken into consideration in conventional techniques.

[0007] In view of the above-mentioned problems, the present disclosure has an object to provide an image processing device and the like that can appropriately crop an image of a document. [Means for solving the problem]

[0008] In order to solve the above-mentioned problems, the image processing device disclosed herein is an image processing device that performs crop processing on an image, and is equipped with an input unit that inputs an image and a control unit, wherein the control unit detects a rectangular area that is adjacent to the edge of a document detected from the image, and if the side that constitutes the rectangular area is separated from the edge of the document, sets a crop line at a position that includes the image of the document, and crops the image based on the crop line.

[0009] In addition, the image processing method disclosed herein is an image processing method executed by an image processing device, and is characterized by including an input step of inputting an image, a step of detecting a rectangular area that is adjacent to the edge of the document detected from the image, a step of setting a crop line at a position that includes the image of the document when the side that constitutes the rectangular area is separated from the edge of the document, and a step of cropping the image based on the crop line.

[0010] The program disclosed herein is characterized by implementing into a computer an input function for inputting an image, a detection function for detecting a rectangular area that is adjacent to the edge of the document detected from the image, a setting function for setting a crop line at a position that includes the image of the document when the side that constitutes the rectangular area is separated from the edge of the document, and a crop function for cropping the image based on the crop line. [Effects of the Invention]

[0011] According to the present disclosure, it is possible to provide an image processing device and the like that is capable of appropriately cropping an image of a document. [Brief explanation of the drawings]

[0012] [Figure 1] 1 is a perspective view of an appearance of an image forming apparatus according to a first embodiment. [Figure 2] FIG. 2 is a diagram illustrating the functional configuration of the image forming apparatus according to the first embodiment. [Figure 3] FIG. 4 is a diagram showing an example of a data structure of document range information in the first embodiment. [Figure 4] FIG. 3 is a diagram showing an example of a data structure of distance information in the first embodiment. [Figure 5] FIG. 4 is a diagram showing an example of the data structure of a correction amount table in the first embodiment. [Figure 6] FIG. 4 is a flowchart showing the flow of main processing of the image forming apparatus according to the first embodiment. [Figure 7]FIG. 4 is a flowchart showing the flow of distance measurement processing in the first embodiment. [Figure 8] FIG. 4 is a flowchart showing the flow of a correction amount determination process in the first embodiment. [Figure 9] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 10] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 11] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 12] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 13] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 14] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 15] FIG. 3 is a diagram illustrating an example of operation in the first embodiment. [Figure 16] FIG. 10 is a flowchart showing the flow of a correction amount determination process in the second embodiment. [Figure 17] FIG. 10 is a diagram illustrating an example of operation in the second embodiment. [Figure 18] FIG. 11 is a flowchart showing the flow of a correction amount determination process in the third embodiment. [Figure 19] FIG. 10 is a diagram illustrating a conventional cropping process. DETAILED DESCRIPTION OF THE INVENTION

[0013] Hereinafter, an embodiment for carrying out the present disclosure will be described with reference to the drawings. Note that the following embodiment is an example for explaining the present disclosure, and the technical scope of the invention described in the claims is not limited to the following description.

[0014] [1. First embodiment] First, a first embodiment will be described. In the first embodiment, a case will be described in which an image processing device according to the present disclosure is applied to an image forming device 10. The image forming device 10 is an information processing device having a copy function, a scan function, a document print function, etc., and is also called an MFP (Multi-Function Printer / Peripheral, or multifunction device).

[0015] [1.1 Functional Configuration] The functional configuration of an image forming apparatus 10 of this embodiment will be described with reference to Fig. 1 and Fig. 2. Fig. 1 is an external perspective view of the image forming apparatus 10, and Fig. 2 is a block diagram showing the functional configuration of the image forming apparatus 10.

[0016] As shown in FIG. 2, the image forming apparatus 10 includes a control unit 100, an image input unit 120, an image forming unit 130, a display unit 140, an operation unit 150, a storage unit 160, and a communication unit 190.

[0017] The control unit 100 is a functional unit for controlling the entire image forming apparatus 10. The control unit 100 realizes various functions by reading and executing various programs stored in the storage unit 160, and is configured, for example, by one or more arithmetic units (CPUs (Central Processing Units)). The control unit 100 may also be configured as an SoC (System on a Chip) having multiple functions among those described below. Some or all of the processing units included in the control unit 100 may also be configured as electronic circuits.

[0018] The control unit 100 executes the programs stored in the memory unit 160 to function as an image processing unit 102, an edge detection unit 104, a document range detection unit 106, a skew determination unit 108, a distance measurement processing unit 110, and a correction amount determination processing unit 112.

[0019] The image processing unit 102 performs various image-related processes. For example, the image processing unit 102 performs sharpening and tone conversion processes on an image of a document read and input by the image input unit 120 (hereinafter referred to as an "input image").

[0020] The edge detection unit 104 detects edges from an input document. For example, the edge detection unit 104 detects edges by generating an image in which a Prewitt filter or a Sobel filter is applied to the grayscale image of the input image in the horizontal direction (x) and vertical direction (y). The edge detection unit 104 may also detect edges by generating an image in which the brightness difference between a pixel of interest and other pixels adjacent to the pixel of interest is expressed as the brightness of the pixel of interest. In other words, the edge detection unit 104 can use an existing method for detecting edges. The image generated by the edge detection unit 104 is called an edge-detected image.

[0021] The document range detection unit 106 detects the range in which the document image appears (document range) from the input image. The document range detection unit 106 detects the document range using, for example, the method described in Patent Document 2. Note that the document range detection unit 106 may detect the image closest to the edge of the input image from the edges detected from the input image as the edge corresponding to the document edge, and detect a rectangular area that contacts the edge corresponding to the document edge as the document range. In other words, the document range detection unit 106 can use an existing method as the method for detecting the document range.

[0022] The skew determination unit 108 determines whether or not a skew has occurred in the document and determines the angle of the document. For example, the skew determination unit 108 uses a sensor to determine whether or not a skew has occurred in the document. In this case, the image forming apparatus 10 is provided with a plurality of light-emitting APS (Auto Paper Selector) sensors in the main scanning direction on the document presser or document cover, and a light-receiving APS sensor that receives light from the light-emitting APS sensors is provided on the document surface side. The skew determination unit 108 determines that a skew has occurred in the document when there is a difference in the light detection times of the light-receiving APS sensors.

[0023] The skew determination unit 108 may determine whether or not a skew has occurred in the document based on an edge detected from the input image. For example, the skew determination unit 108 detects an image closest to the edge of the input image from the edges detected in the input image as an edge indicating the edge of the document, and calculates the angle of the edge indicating the edge of the document. If the calculated angle exceeds a predetermined angle, the skew determination unit 108 determines that a skew has occurred in the document. Furthermore, the skew determination unit 108 sets the calculated angle as the angle of the document.

[0024] The above-described process is an example of a process for determining whether or not a document is skewed and for determining the angle of the document. That is, the skew determination unit 108 can use an existing method for determining whether or not a document is skewed and for determining the angle of the document.

[0025] The distance measurement processing unit 110 executes a distance measurement process to measure the distance between the side (boundary) of a rectangular area set based on the document range and the edge of the document appearing in the input image. The distance measurement process will be described in detail later.

[0026] The correction amount determination processing unit 112 executes a correction amount determination process that determines a correction amount. The correction amount is the distance from a side of a rectangular area that is set based on the document range to a crop line that is set inside the rectangular area based on the side. The correction amount is determined for each of the four sides that make up the rectangular area that is set based on the document range. The correction amount determination process will be described in detail later.

[0027] The image input unit 120 inputs an image to the image forming apparatus 10. For example, the image input unit 120 is configured with an automatic document feeder (SPF, Single pass Feeder) and a scanner device that reads an image of a document. The scanner device is a device that converts an image into an electrical signal using an image sensor such as a CCD (Charge Coupled Device) or a CIS (Contact Image Sensor), and quantizes and encodes the electrical signal. When the image of the document is read by the scanner device, the image of the document is input to the image forming apparatus 10 as digital data.

[0028] Image forming unit 130 forms (prints) an image on a recording medium such as recording paper. Image forming unit 130 is configured, for example, by a printing device such as a laser printer that uses an electrophotographic method. Image forming unit 130, for example, feeds recording paper from paper feed tray 132 in FIG. 1, forms an image on the surface of the recording paper, and discharges the recording paper from paper discharge tray 134.

[0029] The display unit 140 displays various types of information. The display unit 140 is configured by a display device such as an LCD (Liquid Crystal Display), an organic EL (Electro-Luminescence) display, or a micro LED (Light Emitting Diode) display.

[0030] The operation unit 150 accepts operation instructions from a user who uses the image forming apparatus 10. The operation unit 150 is configured with input devices such as key switches (hard keys) and touch sensors. The touch sensor may detect input by contact (touch) using any common detection method, such as a resistive film method, an infrared method, an electromagnetic induction method, or a capacitance method. The image forming apparatus 10 may be equipped with a touch panel in which the display unit 140 and the operation unit 150 are integrally formed.

[0031] The storage unit 160 stores various programs and various data necessary for the operation of the image forming apparatus 10. The storage unit 160 is configured by a storage device such as a solid state drive (SSD) or a hard disk drive (HDD), which is a semiconductor memory.

[0032] The storage unit 160 secures an original range information storage area 162 and a distance information storage area 164 as storage areas, and further stores a correction amount table 166 .

[0033] The document range information storage area 162 stores information (document range information) indicating the detection result of the document range. In this embodiment, the detection result of the document range is described as being indicated as coordinates (combinations of column numbers and row numbers) of pixels that form the sides of a rectangular area indicating the document range.

[0034] The manuscript range information includes, for example, as shown in FIG. 3, a side type (e.g., "TSTART") indicating the type of side of the rectangular area indicating the manuscript range, an index number (e.g., "0"), a row number (e.g., "42"), and a column number (e.g., "120")

[0035] The side type is information for identifying the four sides that form the sides (boundaries) of a rectangular area that indicates the document range. In this embodiment, any of the following information is stored as the side type: TSTART: Top edge of the rectangular area that indicates the document range REND: Right side of the rectangular area that indicates the document range BEND: Bottom edge of the rectangular area that indicates the document range LSTART: The left side of the rectangular area that indicates the document range

[0036] The index number is a sequential number assigned to the pixels that make up each side for each side type, and is, for example, an integer equal to or greater than 0.

[0037] The column number is the number of horizontal pixels between the top left pixel of the image and the pixel of interest, with the origin being the top left pixel. The row number is the number of vertical pixels between the top left pixel of the image and the pixel of interest, with the origin being the top left pixel. In other words, if the number of horizontal pixels between the origin and the pixel of interest is x and the number of vertical pixels between the origin and the pixel of interest is y, then the column number corresponds to x and the row number corresponds to y.

[0038] Distance information storage area 164 stores information (distance information) relating to the distance between the sides of a rectangular area set based on the document range and the edges of the document appearing in the input image. For example, as shown in Fig. 4, the distance information includes a distance type (e.g., "TDIS") indicating the type of distance, an index number (e.g., "0"), and a distance (e.g., "2"). The unit of distance is pixels.

[0039] In this embodiment, the following information is stored as the distance type: TDIS: Distance from the top side of the rectangular area indicating the document range to the edge of the document RDIS: Distance from the right side of the rectangular area that indicates the document range to the edge of the document BDIS: Distance from the bottom edge of the rectangular area that indicates the document range to the edge of the document LDIS: Distance from the left side of the rectangular area that indicates the document range to the edge of the document

[0040] The correction amount table 166 is a table that stores the correction amount for each side that constitutes the boundary of a rectangular area. For example, as shown in Fig. 5, the correction amount table 166 stores correction amount types and corresponding correction amounts in association with each other. The unit of the correction amount is pixels.

[0041] The correction amount type is information for identifying the type of correction amount. In this embodiment, any of the following information is stored as the correction amount type: ShrinkT: Correction amount for the top side of the rectangular area that indicates the document range ShrinkR: Correction amount for the right side of the rectangular area that indicates the document range ShrinkB: Correction amount for the bottom side of the rectangular area that indicates the document range ShrinkL: Correction amount for the left side of the rectangular area that indicates the document range

[0042] The communication unit 190 communicates with external devices via a LAN (Local Area Network) or a WAN (Wide Area Network). The communication unit 190 is configured by, for example, a communication device or a communication module such as a NIC (Network Interface Card) used in a wired / wireless LAN.

[0043] [1.2 Processing flow] The flow of processing executed by image forming apparatus 10 in this embodiment will be described with reference to Figures 6 to 8. The processing shown in Figures 6 to 8 is executed by control unit 100 reading out a program stored in storage unit 160. The processing shown in Figures 6 to 8 is also executed when a user performs an operation to start execution of a job that reads a document, such as a copy job or a scan job.

[0044] [1.2.1 Main Processing] First, the flow of the main processing will be described with reference to Fig. 6. The control unit 100 controls the image input unit 120 to read the document conveyed by the automatic document feeder and acquire a scanned image (input image) of the document (step S100). Even if the document is distorted, the image input unit 120 also inputs an image of the document and an image of background members (such as members that hold down the document or members of a document cover) located behind the document. This allows the control unit 100 to acquire, as the input image, an image obtained by reading an area including the document.

[0045] Next, the control unit 100 (edge ​​detection unit 104) detects edges from the input image (step S102). As a result, the edge detection unit 104 generates an edge-detected image. The edge-detected image is, for example, a grayscale image made up of pixels whose pixel values ​​(brightness) are any value between 0 and 255. Note that, in order to highlight the detected edges, the edge detection unit 104 may perform binarization processing on the edge-detected image or apply a high-pass filter to clarify parts where there are sudden changes in brightness. Particularly in this embodiment, the edge detection unit 104 generates the edge-detected image so that the pixel value of the edge part in the edge-detected image is 255.

[0046] Next, the control unit 100 (original area detection unit 106) detects the original area of ​​the input image (step S104). For example, of the edges detected by the edge detection unit 104, the original area detection unit 106 detects the edge closest to the image edge of the input image as the edge of the original (the circumscribing original edge), and determines the rectangular area that contacts the circumscribing original edge as the rectangular area indicating the original area. In this way, the original area detection unit 106 detects the determined rectangular area as the original area. The original area detection unit 106 stores original area information based on the detected original area in the original area information storage area 162.

[0047] Next, the control unit 100 (skew determination unit 108) determines the skew (step S106). For example, the skew determination unit 108 determines whether or not the document is skewed, and determines the angle of the document.

[0048] Next, the control unit 100 selects one side from among the sides of the rectangular area indicating the document range (step S108).

[0049] Next, the control unit 100 (distance measurement processing unit 110) executes distance measurement processing for the side selected in step S108 (step S110). The distance measurement processing will be described later. The distance measurement processing unit 110 stores distance information for the side selected in step S108 in the distance information storage area 164.

[0050] Next, the control unit 100 (correction amount determination processing unit 112) executes a correction amount determination process for the side selected in step S108 (step S112). The correction amount determination process will be described later. The correction amount determination processing unit 112 stores the correction amount for the side selected in step S108 in the correction amount table 166.

[0051] Next, the control unit 100 determines whether or not all of the sides of the rectangular area indicating the document range have been selected (step S114). If all of the sides have not been selected, the control unit 100 returns to step S108 (step S114; No → step S108).

[0052] On the other hand, when all the sides of the rectangular area indicating the document range have been selected, the control unit 100 sets crop lines in accordance with the correction amount (step S114; Yes→step S116).

[0053] For example, the control unit 100 reads out the correction amount corresponding to each side of the rectangular area indicating the document range, and sets a straight line parallel to the side and away from the side by the number of pixels corresponding to the correction amount value as a crop line inside the rectangular area. For example, if the correction amount type "ShrinkT" and the correction amount "4" are stored in the correction amount table 166, the control unit 100 sets a straight line parallel to the top side of the rectangular area indicating the document range and away from the top side by four pixels inside the rectangular area (i.e., downward) as a crop line.

[0054] In this way, control unit 100 does not use the document range detected in step S104 as the crop line, but sets the crop line inside the document range according to the correction amount. As a result, control unit 100 can set the crop line so that the background portion of the document (portions showing document pressing members and document cover members) is reduced in the input image after cropping. As a result, control unit 100 can remove as much unnecessary background portion as possible from the input image by cropping the input image based on the crop line in the cropping process described below, even if the document is read by a scanner device or the like in a distorted state.

[0055] The control unit 100 determines, according to the correction amount, to set the crop line at a position that includes the image of the document. Here, the image of the document when setting the crop line is an image included in the input image, and refers to the image of the document itself that is read by a scanner device or the like, such as objects (for example, characters or photos) printed on the document or the margins (background) of the document.

[0056] Furthermore, the correction amount used when setting the crop line is determined by the distance measurement process and the correction amount determination process based on the distance between the side of the rectangular area set based on the document range and the edge of the document. Therefore, the control unit 100 can set the crop line at a position that is inside the detected document range and that includes as much of the document image as possible.

[0057] If the correction amount is "0", the control unit 100 sets the crop line at a position that overlaps with the side of the rectangular area that indicates the document range.

[0058] In this way, when there is one or more sides with a correction amount of 1 or more, the control unit 100 sets a crop line parallel to one or more sides that make up a rectangular area indicating the document range (for example, a rectangular area that is adjacent to the edge of the document) inside the rectangular area.

[0059] Next, the control unit 100 (image processing unit 102) performs skew correction on the input image (step S118). For example, if the control unit 100 determines in step S106 that the document is skewed, the control unit 100 rotates the input image by the angle of the document in the direction opposite to the tilt direction, thereby eliminating the skew of the document.

[0060] Next, the control unit 100 (image processing unit 102) executes cropping based on the crop lines set in step S116 (step S120).

[0061] Next, the control unit 100 outputs the input image that has been subjected to skew correction and crop processing (step S122). For example, the control unit 100 controls the image forming unit 130 to form and output the corrected input image. Note that the control unit 100 may output the data of the corrected input image by storing it in the storage unit 160 or by transmitting it to another device.

[0062] [1.2.2 Distance measurement processing] The flow of the distance measurement process will be described with reference to Fig. 7. The distance measurement process is executed by distance measurement processing unit 110. Fig. 7 is a flow diagram illustrating the flow of the distance measurement process executed for the right side (hereinafter referred to as "right side of the document") of the sides of a rectangular area indicating the document range.

[0063] First, distance measurement processing unit 110 initializes index number variable N by substituting 0 (step S140). Distance measurement processing unit 110 also substitues the value of REND[N].row for column number variable R and the value of REND[N].col for column number variable C (step S142). REND[N].row is the row number value of the pixel that makes up the right side of the document and has index number N, specifically the row number value included in document range information that has the side type "REND" and index number N. REND[N].col is the column number value of the pixel that makes up the right side of the document and has index number N, specifically the column number value included in document range information that has the side type "REND" and index number N.

[0064] Next, the distance measurement processing unit 110 accesses P[R,C] (step S144). Note that P[R,C] indicates the pixel at row R and column C (the pixel at coordinates (C,R)) in the edge-detected image. That is, the distance measurement processing unit 110 makes the pixel value of P[R,C] available for reference.

[0065] Next, the distance measurement processing unit 110 assigns 1 to the distance variable distance (step S146). Furthermore, the distance measurement processing unit 110 accesses P[R,C-distance] and determines whether the pixel value of P[R,C-distance] is equal to 255 (step S148).

[0066] If the pixel value of P[R,C-distance] is equal to 255, the distance measurement processing unit 110 assigns the value of the variable distance to the value of RDIS[N] (step S148; Yes → step S150). For example, the control unit 100 stores distance information in the distance information storage area 164, where the distance type is "RDIS", the index number is N, and the distance is the variable distance. In this way, the distance measurement processing unit 110 analyzes the state of the edge near the document edge based on the document range, and if the outermost document edge is inside the document range, it can measure and obtain the distance from the document range to the outermost document edge.

[0067] On the other hand, if the pixel value of P[R,C-distance] is not 255, the distance measurement processing unit 110 determines whether the value of the variable distance is equal to a predetermined constant DMAX (step S148; No → step S152). The constant DMAX is the maximum number of pixels to search from the pixels of the document range detection result (document edge based on the document range) to the circumscribed document edge. The constant DMAX is, for example, 1% of the length of one side (e.g., the length of the long side) of the detected document range (document size).

[0068] If the value of the variable distance is equal to the constant DMAX, the distance measurement processing unit 110 assigns 0 to the value of RDIS[N] (step S152; Yes→step S154). For example, the control unit 100 stores distance information in which the distance type is “RDIS”, the index number is N, and the distance is 0 in the distance information storage area 164.

[0069] On the other hand, if the value of the variable distance is not the constant DMAX, the distance measurement processing unit 110 adds 1 to the value of the variable distance and returns to step S148 (step S152; No → step S156 → step S148). In this way, the distance measurement processing unit 110 increments the variable distance to sequentially access the pixels of the edge-detected image on the Cth row, starting from the pixel on the right side of the document and moving leftward. That is, the distance measurement processing unit 110 searches for an edge inward from the pixel of the detection result of the document range. Then, the distance measurement processing unit 110 searches for the pixel of the circumscribing document edge that is closest to the pixel on the right side of the document in the Cth row of the edge-detected image.

[0070] After executing the process of step S150 or step S154, distance measurement processing unit 110 determines whether variable N is equal to constant RMAX (step S158). Constant RMAX is the maximum index number among distance information whose side type is "REND".

[0071] 7 (step S158; Yes). On the other hand, if the value of variable N is not the constant REND, distance measurement processing unit 110 adds 1 to variable N and returns to step S142 (step S160; No→step S142).

[0072] By performing the above-described processing, the distance measurement processing unit 110 can obtain and store the distance between a pixel on the right side of the document and the pixel on the document edge that is closest to that pixel. When the distance measurement processing unit 110 performs distance measurement processing on the top, bottom, and left sides of the rectangular area that indicates the document range, the processing content is changed as follows.

[0073] (1) When performing distance measurement processing on the upper side of the rectangular area indicating the document range In step S142, the distance measurement processing unit 110 assigns the value of the row number (TSTART[N].row) included in the document range information having the side type "TSTART" and the index number N to the variable R. The distance measurement processing unit 110 also assigns the value of the column number (TSTART[N].col) included in the document range information having the side type "TSTART" and the index number N to the variable C.

[0074] In step S148, distance measurement processing unit 110 determines whether P[R-distance, C] is equal to 255. In step S150, distance measurement processing unit 110 stores distance information whose distance type is "TDIS", whose index number is N, and whose distance is the variable distance in distance information storage area 164. In step S154, distance measurement processing unit 110 stores distance information whose distance type is "TDIS", whose index number is N, and whose distance is 0 in distance information storage area 164.

[0075] (2) When performing distance measurement processing on the bottom side of the rectangular area indicating the document range In step S142, the distance measurement processing unit 110 assigns the value of the row number (BEND[N].row) included in the document range information having the side type "BEND" and the index number N to the variable R. The distance measurement processing unit 110 also assigns the value of the column number (BEND[N].col) included in the document range information having the side type "BEND" and the index number N to the variable C.

[0076] In step S148, distance measurement processing unit 110 determines whether P[R+distance, C] is equal to 255. In step S150, distance measurement processing unit 110 stores distance information whose distance type is "BDIS", whose index number is N, and whose distance is the variable distance in distance information storage area 164. In step S154, distance measurement processing unit 110 stores distance information whose distance type is "BDIS", whose index number is N, and whose distance is 0 in distance information storage area 164.

[0077] (3) When performing distance measurement processing on the left side of the rectangular area indicating the document range In step S142, the distance measurement processing unit 110 assigns to the variable R the value of the row number (RSTART[N].row) included in the document range information having the side type "RSTART" and the index number N. The distance measurement processing unit 110 also assigns to the variable C the value of the column number (RSTART[N].col) included in the document range information having the side type "RSART" and the index number N.

[0078] In step S148, distance measurement processing unit 110 determines whether P[R,C+distance] is equal to 255. In step S150, distance measurement processing unit 110 stores distance information in which the distance type is "RDIS", the index number is N, and the distance is the variable distance in distance information storage area 164. In step S154, distance measurement processing unit 110 stores distance information in which the distance type is "RDIS", the index number is N, and the distance is 0 in distance information storage area 164.

[0079] [1.2.3 Correction amount determination process] The flow of the correction amount determination process will be described with reference to Fig. 8. The correction amount determination process is executed by the correction amount determination processing unit 112. The correction amount determination processing unit 112 also executes the process shown in Fig. 8 for each side of the rectangular area indicating the document range.

[0080] First, the correction amount determination processing unit 112 generates a distance histogram for the sides of a rectangular area indicating the document range that is the target of the correction amount determination processing (step S180). For example, when the side that is the target of the correction amount determination processing is the right side of the document, the correction amount determination processing unit 112 reads out distance information whose distance type is "RDIS" from the distance information storage area 164, and tallies the distances stored in the distance information by value.

[0081] Next, the correction amount determination processing unit 112 calculates the cumulative frequency for the distance histogram generated in step S180, starting from the smallest distance (step S182). Furthermore, the correction amount determination processing unit 112 acquires the distance at which the calculated cumulative frequency is equal to or greater than a predetermined value (e.g., a value corresponding to 90%) (step S184). The predetermined value is a value (parameter) used to determine the amount of correction for document distortion in cropping, and may be determined in advance or may be set by the user. The control unit 100 determines the acquired distance as the correction amount (step S186). For example, the control unit 100 stores "ShrinkR," which indicates the amount of correction for the right side of the rectangular area, in association with the determined distance in the correction amount table 166.

[0082] If the side to be subjected to the correction amount determination process is the top side of the rectangular area indicating the document range, the correction amount determination processor 112 reads out distance information whose distance type is "TDIS" in step S180. In addition, in step S186, the correction amount determination processor 112 stores "ShrinkT" indicating the correction amount for the top side of the rectangular area in association with the determined distance.

[0083] Similarly, if the side to be subjected to the correction amount determination process is the bottom side of the rectangular area indicating the document range, the correction amount determination processor 112 reads out distance information whose distance type is "BDIS" in step S180. In addition, in step S186, the correction amount determination processor 112 stores "ShrinkB," which indicates the correction amount for the top side of the rectangular area, in association with the determined distance.

[0084] Similarly, if the side to be subjected to the correction amount determination process is the left side of the rectangular area indicating the document range, the correction amount determination processor 112 reads out distance information whose distance type is "LDIS" in step S180. In addition, in step S186, the correction amount determination processor 112 stores "ShrinkL" indicating the correction amount for the top side of the rectangular area in association with the determined distance.

[0085] In this way, the correction amount determination processing unit 112 determines the distance when the cumulative frequency of the distance between the side of the rectangular area indicating the document range and the circumscribing document edge, which is the edge of the document, reaches a predetermined value as the correction amount. As a result, if the distance when the cumulative frequency of the distance reaches the predetermined value is a value of 1 or more, the correction amount determination processing unit 112 determines that the side of the rectangular area indicating the document range and the document edge are separated, and can determine the correction amount used when setting the crop line based on the distance histogram. Furthermore, the correction amount determination processing unit 112 can determine the correction amount for each side of the rectangular area indicating the document range.

[0086] [1.3 Example of operation] An example of the operation of this embodiment will be described with reference to Fig. 9 to Fig. 15. Fig. 9(a) is a diagram showing an input image. In Fig. 9, the white area E100 indicates the area of ​​the image of the original, and the gray (halftone dot) area E102 indicates the area where the color of the background material appears. Here, as shown in E104 in Fig. 9(a), the boundary between the original and the background material is curved in the right part of the original, causing distortion in the original.

[0087] 9(b) is a diagram showing an edge detection image. A solid line L100 in FIG. 9(b) indicates the detected edge of the document (the circumscribed document edge). A dashed line L102 indicates a rectangular area that is set to include the solid line L100, which is the detected document edge, and indicates the document range.

[0088] 10 is a diagram showing the positional relationships in the distance measurement process. Area E110 is an area that includes the top side L110 of the rectangular area that indicates the document range, area E112 is an area that includes the right side L112 of the rectangular area that indicates the document range, area E114 is an area that includes the bottom side L114 of the rectangular area that indicates the document range, and area E116 is an area that includes the left side L116 of the rectangular area that indicates the document range. In this way, for the top, right, bottom, and left edges of the document, the distances from the pixels of the document range detection results (document edges based on the document range) to the pixels of the circumscribing document edge are measured.

[0089] Here, the distance measurement process in area E118 in Fig. 10 will be described in detail. E120 in Fig. 11 is an enlarged view of area E118 in Fig. 10. The squares included in E120 represent pixels. Of the pixels, pixels with a dotted background as shown in P120 represent pixels that indicate the detection result of the document range (pixels that constitute the rectangular area that indicates the document range). Furthermore, pixels with a white background as shown in P122 represent pixels of the detected edge. Furthermore, pixels with a black background as shown in P124 represent pixels that are neither pixels that constitute the rectangular area that indicates the document range nor edge pixels.

[0090] The arrow P126 in Fig. 11 indicates the correspondence between the pixels constituting the rectangular region indicating the document range and the edge pixels to be searched. As shown in Fig. 11, edge pixels present inside the document range are searched for with respect to the pixels resulting from the document range detection. In addition, the distance between the pixels resulting from the document range detection and the edge pixels is measured.

[0091] Also, T120 in FIG. 11 is a table showing the distance measured for each row. For example, in row L120, the pixel indicating the document range detection result is five pixels away from the edge pixel. Therefore, the distance in row L120 is 5. In this manner, the distance is measured for each row. Also, T122 in FIG. 11 shows a distance histogram based on the measured distance. For example, as shown in L122 in FIG. 11, if the frequency at a distance of 3 is 6, this indicates that there are six rows where the distance is 3.

[0092] Fig. 12 shows a distance histogram and cumulative frequency generated for each side that constitutes the boundary of a rectangular area that indicates the document range. In Fig. 12, the frequency for each distance is shown as a bar graph, and the percentage of the cumulative frequency is shown as a line graph. Also in Fig. 12, the location where the cumulative frequency is 0.9 (90%) is indicated by a horizontal dotted line. That is, the horizontal dotted line indicates the position of the default value.

[0093] For example, Fig. 12(a) is a diagram corresponding to the left side L116 of the rectangular area shown in Fig. 10. Here, the distance when the cumulative frequency exceeds the default value of 90% is "1." Therefore, the correction amount ShrinkL for the left side of the rectangular area indicating the document range is 1.

[0094] Similarly, FIG. 12(b) is a diagram corresponding to the right side L112 of the rectangular area shown in FIG. 10. When the cumulative frequency exceeds 90%, the distance is "13", so the correction amount ShrinkR for the left side of the rectangular area indicating the document range is 13. FIG. 12(c) is a diagram corresponding to the top side L110 of the rectangular area shown in FIG. 10. When the cumulative frequency exceeds 90%, the distance is "4", so the correction amount ShrinkT for the top side of the rectangular area indicating the document range is 4. FIG. 12(d) is a diagram corresponding to the bottom side L114 of the rectangular area shown in FIG. 10. When the cumulative frequency exceeds 90%, the distance is "4", so the correction amount ShrinkB for the bottom side of the rectangular area indicating the document range is 4.

[0095] FIG. 13 is a diagram showing crop lines determined based on the correction amount. P130 in FIG. 13 is an edge-detected image. Dashed line L130 indicates the top side of a rectangular area indicating the document range. Because the correction amount ShrinkT for the top side is 4, a straight line parallel to dashed line L130 is set as the crop line at a position shifted from dashed line L130 by the correction amount ShrinkT inward into the document range. In other words, a dotted line L131 positioned four pixels (interval D130) inward from dashed line L130 is set as the crop line corresponding to dashed line L130.

[0096] Similarly, dashed line L132 indicates the right side of the rectangular area indicating the document range. Because the correction amount ShrinkR for the right side is 13, dotted line L133, located 13 pixels (distance D132) inward from dashed line L132, is set as the crop line. Dashed line L134 indicates the bottom side of the rectangular area indicating the document range. Because the correction amount ShrinkB for the bottom side is 4, dotted line L135, located 4 pixels (distance D134) inward from dashed line L134, is set as the crop line. Dashed line L136 indicates the left side of the rectangular area indicating the document range. Because the correction amount ShrinkL for the left side is 1, dotted line L137, located 1 pixel (distance D136) inward from dashed line L136, is set as the crop line. In this way, the detection range of the document range is corrected.

[0097] Fig. 14 shows images before and after cropping. Fig. 14(a) shows an input image before cropping. In Fig. 14(a), dashed line L140 indicates the original range, and dotted line L142 indicates a crop line set based on the amount of correction. Fig. 14(b) shows the input image (output image) cropped based on dotted line L142, which is the crop line in Fig. 14(a).

[0098] Here, if the input image is cropped based on the dashed line L140, which is the original document range, the color of the background material will be included in the upper right of the output image, as shown in FIG. 19(c). On the other hand, if the input image is cropped based on the dotted line L142, which is the crop line set based on the correction amount, the color of the background material will be hardly included in the upper right region E140 of the output image. In other words, the image forming apparatus 10 crops the input image so that the background portion included in the cropped image is reduced compared to when cropping is based on the original document range. In this way, the image forming apparatus 10 can prevent the output image from being adversely affected by distortion of the original document that occurred when the original image was input.

[0099] Fig. 15 shows a case where an outlier is detected at the edge of a document. Fig. 15(a) shows an edge detection image when an outlier is detected at the edge of a document. P150 indicates the outlier at the edge of the document.

[0100] In this case, if the default value used to calculate the correction amount is 100%, the correction amount is determined based on the outlier of the document edge, and ultimately, the crop line is set at the position where the outlier of the document edge exists. FIG. 15(b) is a diagram showing the document edge L150 and the crop line L152 set when the default value used to calculate the correction amount is 100%. When the image forming apparatus 10 crops the input image based on the crop line L152, the input image is cropped significantly inside the document range relative to the position where the document edge L150 exists. Therefore, by setting the default value to a value less than 100%, the image forming apparatus 10 can avoid cropping the input image significantly inside the document range even if the detected document edge includes an outlier.

[0101] 6 to 8 for each input document, the control unit 100 executes the processes described in Fig. 6 to 8 for each input document, thereby enabling the crop line to be set for each document according to the distortion.

[0102] It should be noted that, apart from the above description, the order of steps may be changed, some steps may be omitted, or steps may be added, as long as there is no contradiction. For example, after executing the process in step S116, control unit 100 may prompt the user to select whether or not the crop line is appropriate. At this time, control unit 100 may display a preview of the image before and after the crop process (for example, the diagram shown in FIG. 14(b)) on display unit 140, which is a display device provided in image forming apparatus 10. If the user selects that the crop line is appropriate, control unit 100 performs cropping based on the selected crop line.

[0103] On the other hand, if it is selected that the crop line is inappropriate, the control unit 100 may accept an operation to change (set) the default value. After changing the default value, the control unit 100 re-executes the process in step S112 to redetermine the correction amount based on the default value changed by the user. Furthermore, the control unit 100 re-executes the process in step S116 to reset the crop line according to the redetermined correction amount. At this time, the control unit 100 may prompt the user to select again whether the reset crop line is appropriate, and may perform cropping or reset the crop line according to the user's selection. In this way, the control unit 100 can set the crop line desired by the user.

[0104] The method of storing information may be changed as appropriate. For example, the document range information may be a structure array having as members the column number (col) and row number (row) of the document range detection result.

[0105] In this way, the image forming apparatus of this embodiment sets a crop line inside the document range and crops the scanned image even when the document is scanned by a scanner or other device in a distorted state when the document pressing member or document cover member has a gray background. In other words, the image forming apparatus of this embodiment can correct the crop position. This allows the image forming apparatus of this embodiment to output the document image without including the gray background portion of the document pressing member or document cover member.

[0106] Furthermore, the image forming apparatus of this embodiment determines the correction amount, which is the distance between the document range and the crop line, for each side that constitutes the boundary of the rectangular area set based on the document range. Specifically, the image forming apparatus determines the correction amount for each side from a histogram based on the distance between the document edge pixel based on the document range and the pixel of the edge that is detected as the most circumscribed document edge. This allows the image forming apparatus of this embodiment to perform correction processing according to the amount of distortion (magnitude of distortion) on each side of the document.

[0107] Furthermore, the image forming apparatus of this embodiment does not require advanced image processing because it determines the correction amount from a histogram based on the distance between the pixels at the document edge based on the document range and the pixels at the detected edge of the most circumscribed document edge, thereby enabling the image processing apparatus of this embodiment to achieve improved processing speed and reduced memory usage.

[0108] [2. Second Embodiment] Next, a second embodiment will be described. The second embodiment differs from the first embodiment in that the correction amount is calculated using an approximation curve rather than a distance histogram. In this embodiment, FIG. 8 of the first embodiment is replaced with FIG. 16. The following description will focus on the differences from the first embodiment.

[0109] In this embodiment, the correction amount determination processing unit 112 executes the correction amount determination processing shown in Fig. 16. In this embodiment, the correction amount determination processing unit 112 calculates an approximation curve based on distance information of sides of a rectangular area indicating the document range that is the target of the correction amount determination processing (step S200).

[0110] For example, the correction amount determination processing unit 112 reads distance information for the side that is the target of the correction amount determination processing from the distance information storage area 164, and generates a graph in which line numbers and distances to the lines are plotted. Next, the correction amount determination processing unit 112 calculates an approximation curve based on all the points plotted on the generated graph. For example, the correction amount determination processing unit 112 uses the least squares method to calculate the approximation curve.

[0111] In the process of step S200, if the side to be subjected to the correction amount determination process is the left side or the right side, as described above, the correction amount determination processor 112 generates a graph plotting the line number (the vertical position of the pixel at the edge of the document based on the document range) and the distance to the line. On the other hand, if the side to be subjected to the correction amount determination process is the top side or the bottom side, the correction amount determination processor 112 generates a graph plotting the column number (the horizontal position of the pixel at the edge of the document based on the document range) and the distance to the column.

[0112] Next, the correction amount determination processing unit 112 obtains the value of the approximation curve at the position of the image edge of the input image (step S202).

[0113] Here, if the side targeted for the correction amount determination process is the left side or the right side, the image edges of the input image will be the two left and right sides. On the other hand, if the side targeted for the correction amount determination process is the top side or the bottom side, the image edges of the input image will be the two top and bottom sides. Therefore, the correction amount determination processing unit 112 acquires two values ​​as values ​​of the approximation curve corresponding to the positions of the image edges of the input image.

[0114] Next, the correction amount determination processing unit 112 determines the larger of the two values ​​acquired in step S202 as the correction amount (step S204).

[0115] An example of the operation of this embodiment will be described with reference to Fig. 17. Fig. 17(a) is a diagram showing a graph in which line numbers (the positions of the document edges based on the document range) and the distances to the lines are plotted based on the correction information on the right side. The black circles in Fig. 17(a) indicate the plotted points. P200 and P202 indicate the positions of the image edges of the input image. Furthermore, the straight line L200 indicates an approximation curve calculated based on the plotted points.

[0116] Here, the line L200 intersects with the vertical lines at P200 and P202. The value of the line L200 at this time is the value of the approximation curve at the image edge position of the input image. The value of the line L200 at P200 is 8, while the value of the line L200 at P202 is less than 0. Since the value of the line L200 at P200 is greater than the value at P202, the image forming apparatus 10 acquires the value "8" at P200 as the value of the approximation curve at the image edge position of the input image. The image forming apparatus 10 also sets the correction amount ShrinkR for the right side to 8.

[0117] Since the image forming apparatus 10 determines the correction amount using an approximation curve, even if there is an outlier in the detected edge, for example, as shown in P204 of Figure 17(a), the image forming apparatus 10 can determine the correction amount appropriately without being affected by the outlier.

[0118] Figure 17(b) is a diagram showing a crop line set based on the correction amount. Dashed line L210 in Figure 17(b) indicates the right side of the rectangular area indicating the document range. Because the correction amount ShrinkR for the right side is 8, dotted line L211, located 8 pixels (distance D210) inward from dashed line L210, is set as the crop line.

[0119] In the above description, a graph is generated in which the line number and the distance to the line are plotted, but the control unit 100 may obtain an approximate curve without generating a graph. Also, the method for obtaining the approximate curve may be a method other than the least squares method.

[0120] In this way, according to this embodiment, the correction amount can be appropriately determined without generating a histogram.

[0121] 3. Third Embodiment Next, a third embodiment will be described. The third embodiment differs from the first embodiment in that it automatically selects a default value to be used when determining the correction amount. In this embodiment, FIG. 8 of the first embodiment is replaced with FIG. 18. Note that the same processes are denoted by the same reference numerals, and descriptions thereof will be omitted.

[0122] In this embodiment, the correction amount determination processing unit 112 executes the correction amount determination process shown in Fig. 18. In this embodiment, after executing the processes in step S180 and step S182, the correction amount determination processing unit 112 acquires a distance (first distance) at which the cumulative frequency is equal to or greater than a first preset value (for example, a value equivalent to 90%) (step S300).

[0123] Next, the correction amount determination processing unit 112 determines whether the first distance exceeds the upper limit of the correction amount (step S302). For example, if the first distance is 20 pixels and the upper limit of the correction amount is 15 pixels, the correction amount determination processing unit 112 determines that the first distance exceeds the upper limit of the correction amount. The upper limit of the correction amount may be determined in advance or may be set by the user. The correction amount determination processing unit 112 may set the upper limit of the correction amount based on the size of the document, or may set the upper limit of the correction amount based on the positional relationship between an area of ​​the document image that contains information such as text or a photo and the edge of the document. In this way, the correction amount determination processing unit 112 can automatically set the upper limit of the correction value from the read image.

[0124] If the first distance exceeds the upper limit of the correction amount, the correction amount determination processing unit 112 acquires a distance (second distance) at which the cumulative frequency is equal to or greater than a second preset value (e.g., a value corresponding to 80%) (step S302; Yes → step S304). The second preset value is set to a value smaller than the first preset value. The correction amount determination processing unit 112 then determines the acquired second distance as the correction amount (step S306). In this way, the correction amount determination processing unit 112 reduces the correction amount when the correction amount exceeds the upper limit of a predetermined correction amount.

[0125] If the first distance is equal to or less than the correction amount, the correction amount determination processing unit 112 determines the first distance as the correction amount (step S302; No→step S308).

[0126] In this way, the image forming apparatus of this embodiment can reduce the amount of correction when the amount of correction exceeds a predetermined upper limit. This makes it possible to avoid a situation where the crop line is set too far inward due to a large distortion of the document and a large variance in the distances between the pixels that make up the sides of the rectangular area that represents the document range and the detected edge pixels. As a result, the image forming apparatus of this embodiment can set the crop line at an appropriate position, and by cropping based on the crop line, it is possible to avoid deleting information contained in the document image (e.g., text, graphics, etc. within the document).

[0127] If the first distance exceeds the upper limit of the correction amount, the image forming apparatus may determine the upper limit of the correction amount as the correction amount.

[0128] [4. Modifications] The present invention is not limited to the above-described embodiments and various modifications are possible. In other words, embodiments obtained by combining technical means modified appropriately within the scope of the present invention are also included within the technical scope of the present invention. For example, although the above description has been given of the image processing device of the present disclosure implemented as an image forming device, the present disclosure may also be applied to an image reading device such as a scanner device. The image reading device can obtain an image by reading an original placed on a platen and capturing an area including the original.

[0129] The image processing device of the present disclosure may also be realized as a program or service. When the image processing device of the present disclosure is provided as a program or service, the program or service accepts input of an image obtained by scanning an area including a document using a scanner device or the like. For example, the program or service may input the image by receiving the image from another device via a communication unit. Note that the program or service may also input an image based on image data by acquiring image data stored in a location designated by a user. In other words, the program or service may input an image using an existing method.

[0130] 6 to 8, the program or service may perform skew correction and cropping on the input image and output the skew-corrected and cropped image. In this case, the program or service may perform software processing to realize functions such as detecting the document range and determining skew. This allows the program or service to perform cropping on the area including the document from the image obtained by scanning the area including the document.

[0131] Although the above-described embodiments are described separately for convenience of explanation, they may be combined within a technically feasible range. For example, the second embodiment and the third embodiment may be combined. In this case, if the correction amount determined using the approximation curve exceeds the upper correction amount limit, the image forming apparatus may set the correction amount to the upper correction amount limit to prevent the correction amount from becoming an excessively large value.

[0132] In addition, the programs that run on each device in the embodiments are programs that control the CPU, etc. (programs that make a computer function) so as to realize the functions of the above-described embodiments. Information handled by these devices is temporarily stored in a temporary storage device (e.g., RAM) during processing, and then stored in various storage devices such as ROMs (Read Only Memories) and HDDs, and is read, modified, and written by the CPU as needed.

[0133] Here, the recording medium for storing the program may be any of semiconductor media (e.g., ROM, non-volatile memory card, etc.), optical recording media / magneto-optical recording media (e.g., DVD (Digital Versatile Disc), MO (Magneto Optical Disc), MD (Mini Disc), CD (Compact Disc), BD (Blu-ray (registered trademark) Disc), etc.), magnetic recording media (e.g., magnetic tape, flexible disk, etc.), etc. Furthermore, not only are the functions of the above-described embodiments realized by executing the loaded program, but the functions of the present invention may also be realized by processing in cooperation with an operating system or other application programs, etc., based on instructions from the program.

[0134] Furthermore, when distributing the program on the market, the program can be stored on a portable recording medium and distributed, or transferred to a server computer connected via a network such as the Internet. In this case, the storage device of the server computer is of course included in the present invention. [Explanation of symbols]

[0135] 10 Image forming device 100 control section 102 Image processing section 104 Edge detection unit 106 Document range detection unit 108 Skew judgment unit 110 Distance measurement processing unit 112 Correction amount determination processing unit 120 Image input unit 130 Image forming unit 140 Display section 150 Operation section 160 Storage section 162 Original range information storage area 164 Distance information storage area 166 Correction amount table 190 Communications Department

Claims

1. An image processing device that performs crop processing on an image, An input unit for inputting an image of a document and a background of the document, and a control unit, The control unit A rectangular area that contacts the edge of the document detected from the image is detected; If the sides constituting the rectangular area are spaced apart from the edges of the document, a crop line is set at a position including an image of the document; a position where the image of the document is included is set by a correction amount based on the sides constituting the rectangular area and the edges of the document; setting the crop line, which is parallel to the side constituting the rectangular area, inside the side constituting the rectangular area by a distance indicated by the correction amount; Cropping the image based on the crop line 1. An image processing device comprising:

2. 2. The image processing apparatus according to claim 1, wherein the control unit determines the correction amount in accordance with a distance between pixels on a side of the rectangular area and pixels on an edge of the document.

3. The image processing device according to claim 2 , wherein the control unit determines the correction amount for each side that constitutes the rectangular area.

4. 4. The image processing device according to claim 2, wherein the control unit sets the distance when the cumulative frequency of the distance reaches a predetermined value as the correction amount.

5. The image processing device according to claim 3 , wherein the control unit determines the amount of correction based on an approximation curve calculated based on the distance.

6. An image processing device as described in any one of claims 1 to 5, characterized in that when the correction amount exceeds the upper limit value of the correction amount, the control unit determines a second correction amount smaller than the correction amount, and sets the crop line based on the second correction amount.

7. An image processing device that performs crop processing on an image, An input unit for inputting an image of a document and a background of the document, and a control unit, The control unit A rectangular area that contacts the edge of the document detected from the image is detected; If the sides constituting the rectangular area are spaced apart from the edges of the document, a crop line is set at a position including an image of the document; a position where the image of the document is included is set by a correction amount based on the sides constituting the rectangular area and the edges of the document; When the correction amount exceeds an upper limit value of the correction amount, a second correction amount smaller than the correction amount is determined, and the crop line is set based on the second correction amount; Cropping the image based on the crop line 1. An image processing device comprising:

8. the input unit inputs an image obtained by reading an area including a document; The image processing apparatus according to claim 1 , wherein the control unit crops an area including the document from the image.

9. Further comprising a display unit, The control unit a preview of the image when cropped based on the crop line is displayed on the display unit; If it is selected that the crop line is not appropriate, the value of the parameter used to set the crop line is changed, and then the crop line is set.

9. The image processing device according to claim 1, wherein the image processing device is a computer.

10. An image processing method executed by an image processing device, an input step of inputting an image of a document and a background of the document; detecting a rectangular area that contacts the edge of the document detected from the image; If the sides of the rectangular area are spaced apart from the edges of the document, setting a crop line at a position where an image of the document is included; setting a position including the image of the document using a correction amount based on the sides constituting the rectangular area and the edges of the document; setting the crop line, which is parallel to the side of the rectangular area, inside the side of the rectangular area by a distance indicated by the correction amount; cropping the image based on the crop line; An image processing method comprising:

11. On the computer, A function of inputting an image of a document and its background; a function of detecting a rectangular area that contacts the edge of the document detected from the image; a function of setting a crop line at a position including an image of the document when the side constituting the rectangular area is separated from the edge of the document; a function of setting a position where the image of the document is included by a correction amount based on the sides constituting the rectangular area and the edges of the document; a function of setting the crop line, which is parallel to the side constituting the rectangular area, inside the side constituting the rectangular area by a distance indicated by the correction amount; cropping the image based on the crop line; A program characterized by realizing the above.

Citation Information

Patent Citations

  • Image processor

    JP1996315107A

  • Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium

    JP2013123119A

  • Image reading device, image reading method, and program

    JP2015170927A

  • Voucher image acquisition method and accounting processing system using the same

    JP6539844B2