# US 10,313,543 B2 · Image scanning apparatus, and method and computer-readable medium therefor

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,313,543 B2
- Document ID: US10313543B2
- Status: Granted
- Kind: B2
- Application number: 15/872,235
- Filed: 2018-01-16
- Published: 2018-07-26
- Granted: 2019-06-04
- Earliest claimed: 2017-01-24
- Assignees: Brother Kogyo Kabushiki Kaisha
- Applicants: Brother Kogyo Kabushiki Kaisha
- Inventors: Seiya Sato; Shuichi Sunako; Sayaka Fujiwara
- Web page: https://patentgrep.com/patent/US10313543B2

## CPC

- H04N 1/00745: {Detecting the leading or trailing ends of a moving sheet}
- H04N 1/00716: {Thickness}
- H04N 1/0281: {with means for collecting light from a line or an area of the original and for guiding it to only one or a relatively low number of picture element detectors}
- H04N 2201/0081: Image reader (H04N2201/0091 - H04N2201/0094 take precedence)
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

An image scanning apparatus includes a controller configured to acquire image data by scanning a document and a particular range of a document pressing surface, detect black edge positions by detecting, from the image data, black pixels having gradation values less than a white gradation value, determine a sheet type of the document based on the gradation values of the black pixels, detect white edge positions by detecting, from the image data, white pixels having gradation values equal to or more than the white gradation value. The controller is further configured to, when the sheet type is a thin paper, detect, as the white pixels, pixels having gradation values equal to or more than a first threshold, and when the sheet type is a thick paper, detect, as the white pixels, pixels having gradation values equal to or more than a second threshold.

## Claims

### Claim 1

An image scanning apparatus comprising:
a document table configured to support a document sheet placed thereon;
a document pressing member having a white document pressing surface;
an image scanner comprising a light source and a plurality of light receivers arranged in line along a main scanning direction, the image scanner being configured to scan an image of the document sheet placed on the document table while moving along a sub scanning direction perpendicular to the main scanning direction and generate image data of the scanned image, the image data including a plurality of pixels each having a gradation value, the image scanner being further configured to generate a white gradation value by scanning the white document pressing surface of the document pressing member; and
a controller configured to perform:
an image data acquiring process to acquire single-page image data by controlling the image scanner to scan the document sheet placed on the document table and a particular range of the white document pressing surface, the particular range being wider than a size of the document sheet;
a black edge detecting process to detect black edge positions by detecting, from the single-page image data, positions of black pixels each having a gradation value less than the white gradation value, each black edge position being a position of a specific one of a leading end and a trailing end of the document sheet in the sub scanning direction;
a determining process to determine a sheet type of the document sheet based on the gradation values of the black pixels, the sheet type including a thin paper and a thick paper; and
a white edge detecting process to detect white edge positions by detecting, from the single-page image data, positions of white pixels each having a gradation value equal to or more than the white gradation value, each white edge position being a position of another specific one of the leading end and the trailing end of the document sheet in the sub scanning direction, the white edge detecting process comprising:
a thin-paper white edge detecting process to, when the sheet type is the thin paper, detect, as the white pixels, pixels each having a gradation value equal to or more than a first threshold by determining whether a gradation value of each pixel included in the single-page image data is equal to or more than the first threshold, the first threshold being determined based on the white gradation value; and
a thick-paper white edge detecting process to, when the sheet type is the thick paper, detect, as the white pixels, pixels each having a gradation value equal to or more than a predetermined second threshold by determining whether the gradation value of each pixel included in the single-page image data is equal to or more than the second threshold.

### Claim 2 (depends on 1)

The image scanning apparatus according to claim 1,
wherein the determining process comprises:
a black edge deviation calculating process to calculate a black edge deviation, the black edge deviation representing a deviation of the gradation values of all the black pixels detected from the single-page image data; and
a black edge deviation determining process comprising:
when the black edge deviation is equal to or more than a predetermined third threshold, determining that the sheet type of the document sheet is the thin paper; and
when the black edge deviation is less than the third threshold, determining that the sheet type of the document sheet is the thick paper.

### Claim 3 (depends on 2)

The image scanning apparatus according to claim 2,
wherein the controller is further configured to perform:
a corner average calculating process to calculate four corner averages, each corner average being obtained by averaging gradation values of a plurality of pixels in a corresponding one of four corner areas of the document table;
a corner average selecting process to select three of the four corner averages;
a white average calculating process to calculate the white gradation value by averaging the selected three corner averages;
a white deviation calculating process to calculate a white deviation, the white deviation representing a deviation of the gradation values of all the pixels included in three corner areas corresponding to the selected three corner averages; and
a first threshold calculating process to calculate the first threshold by adding the white deviation to the white gradation value,
wherein the second threshold is a maximum value of gradation values generable by the image scanner, and
wherein the third threshold is substantially 2% of a count of gradations from a minimum gradation value to the maximum gradation value of the gradation values generable by the image scanner.

### Claim 4 (depends on 3)

The image scanning apparatus according to claim 3,
wherein a downstream direction along the main scanning direction is a direction from a head pixel toward a final pixel of a single line,
wherein a downstream direction along the sub scanning direction is a direction from a scanning start position toward a scanning end position of the image scanner,
wherein the controller is further configured to calculate a fourth threshold by subtracting the white deviation multiplied by two from the white gradation value,
wherein the light source is configured to emit light in an upstream direction along the sub scanning direction,
wherein the black edge detecting process comprises:
a first black edge detecting process to detect, as a first black edge position, a black edge position in a particular position in the main scanning direction, by detecting a black pixel in the downstream direction along the sub scanning direction from a first pixel in the particular position;
a second black edge detecting process to detect black edge positions in an upstream direction along the main scanning direction from the pixel located in the first black edge position in the sub scanning direction and in the particular position in the main scanning direction; and
a third black edge detecting process to detect black edge positions in the downstream direction along the main scanning direction from the pixel located in the first black edge position in the sub scanning direction and in the particular position in the main scanning direction, and
wherein the first black edge detecting process comprises:
a target black edge pixel setting process to sequentially set, as a new target black edge pixel, a pixel adjacent to a downstream end of a current target black edge pixel in the sub scanning direction, the target black edge pixel setting process comprising:
when initially setting a target black edge pixel, setting a first pixel in the particular position as the target black edge pixel, and setting, as a black edge detection value, the maximum gradation value of the gradation values generable by the image scanner;
a black edge detection value determining process to determine whether a gradation value of the target black edge pixel is less than the black edge detection value;
a black edge detection value storing process to, when the gradation value of the target black edge pixel is less than the black edge detection value, store the gradation value of the target black edge pixel as the black edge detection value in association with a pixel number, and again perform the target black edge pixel setting process, the pixel number representing a position of the target black edge pixel in the sub scanning direction;
a black edge difference value calculating process to, when the gradation value of the target black edge pixel is equal to or more than the black edge detection value, calculate a black edge difference value by subtracting the black edge detection value from the white gradation value;
a black edge difference value determining process comprising:
when the black edge difference value is equal to or more than the fourth threshold, determining the pixel corresponding to the black edge detection value as a black pixel, and detecting the position represented by pixel number, as the first black edge position; and
when the black edge difference value is less than the fourth threshold, determining that the pixel corresponding to the black edge detection value is not a black pixel, and again performing the target black edge pixel setting process;
a background color average calculating process to calculate a background color average by averaging background color gradation values, the background color gradation values being gradation values of a first number of pixels successively arranged from a specific pixel in the downstream direction along the sub scanning direction, the specific pixel being located the first number of pixels away, in the downstream direction along the sub scanning direction, from the first black end position in the particular position; and
a background color deviation calculating process to calculate a background color deviation, the background color deviation representing a deviation of the background color gradation values of the pixels of the first number.

### Claim 5 (depends on 4)

The image scanning apparatus according to claim 4,
wherein the second black edge detecting process comprises:
a first target black edge pixel group setting process to set a group of first target black edge pixels including:
a first reference pixel adjacent to an upstream end, in the main scanning direction, of a pixel located in a most-upstream black edge position in the main scanning direction among already-detected one or more black edge positions, the first black edge position being initially set as the most-upstream black edge position;
a second number of pixels adjacent to an upstream end of the first reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the first reference pixel in the sub scanning direction;
a first difference value calculating process to calculate a first difference value by subtracting a first minimum value from the white gradation value, the first minimum value being a minimum value of gradation values of the first target black edge pixels; and
a first difference value determining process comprising:
determining whether the first difference value is equal to or more than the fourth threshold;
when the first difference value is equal to or more than the fourth threshold, setting a position of a pixel having the first minimum value as the most-upstream black edge position in the main scanning direction; and
re-performing the first target black edge pixel group setting process, and
wherein the third black edge detecting process comprises:
a second target black edge pixel group setting process to set a group of second target black edge pixels including:
a second reference pixel adjacent to a downstream end, in the main scanning direction, of a pixel located in a most-downstream black edge position in the main scanning direction among already-detected one or more black edge positions, the first black edge position being initially set as the most-downstream black edge position;
the second number of pixels adjacent to an upstream end of the second reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the second reference pixel in the sub scanning direction;
a second difference value calculating process to calculate a second difference value by subtracting a second minimum value from the white gradation value, the second minimum value being a minimum value of gradation values of the second target black edge pixels; and
a second difference value determining process comprising:
determining whether the second difference value is equal to or more than the fourth threshold;
when the second difference value is equal to or more than the fourth threshold, setting a position of a pixel having the second minimum value as the most-downstream black edge position in the main scanning direction; and
re-performing the second target black edge pixel group setting process.

### Claim 6 (depends on 5)

The image scanning apparatus according to claim 5,
wherein the controller is further configured to perform a fifth threshold calculating process to calculate a fifth threshold by adding the background color deviation to the background color average,
wherein the thin-paper white edge detecting process comprises:
a first white edge detecting process to detect, as a first white edge position, a position of a white pixel having a gradation value equal to or more than the first threshold, in the upstream direction along the sub scanning direction from a final pixel in the sub scanning direction in the particular position, the first white edge position being a white edge position in the particular position;
a second white edge detecting process to detect white edge positions in the upstream direction along the main scanning direction from the pixel located in the first white edge position in the sub scanning direction and in the particular position in the main scanning direction; and
a third white edge detecting process to detect white edge positions in the downstream direction along the main scanning direction from the pixel located in the first white edge position in the sub scanning direction and in the particular position in the main scanning direction,
wherein the first white edge detecting process comprises:
a first white edge start position detecting process comprising:
determining whether every pixel of a third number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the first threshold, in the upstream direction along the sub scanning direction, sequentially in an order from the final pixel in the sub scanning direction in the particular position; and
when every pixel of the third number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the first threshold, detecting, as a first white edge start position, a position of a most-upstream pixel in the sub scanning direction among the third number of the pixels;
a thin-paper threshold acquiring process to acquire, as a thin-paper threshold, the gradation value of the pixel located in the first white edge start position in the sub scanning direction and in the particular position in the main scanning direction; and
a first white edge end position detecting process comprising:
determining whether each individual pixel has a gradation value less than the fifth threshold, in the upstream direction along the sub scanning direction, sequentially in an order from the pixel located in the first white edge start position in the sub scanning direction and in the particular position in the main scanning direction; and
when a pixel has a gradation value less than the fifth threshold, detecting, as a first white edge end position, a position of the pixel having the gradation value less than the fifth threshold,
wherein the white pixels are located from the first white edge start position to the first white edge end position, and
wherein the first white edge end position is the first white edge position.

### Claim 7 (depends on 6)

The image scanning apparatus according to claim 6,
wherein the thick-paper white edge detecting process comprises:
a fourth white edge detecting process to detect, as the first white edge position, a position of a white pixel having a gradation value equal to or more than the second threshold, in the upstream direction along the sub scanning direction from the final pixel in the sub scanning direction in the particular position;
the second white edge detecting process; and
the third white edge detecting process,
wherein the fourth white edge detecting process comprises:
a second white edge start position detecting process comprising:
determining whether every pixel of a fourth number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the second threshold, in the upstream direction along the sub scanning direction, sequentially in an order from the final pixel in the sub scanning direction in the particular position; and
when every pixel of the third number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the second threshold, detecting, as a second white edge start position, a position of a most-upstream pixel in the sub scanning direction among the fourth number of the pixels; and
a second white edge end position detecting process comprising:
determining whether each individual pixel has a gradation value less than a sixth threshold, the sixth threshold being substantially 98% of the count of gradations from the minimum gradation value to the maximum gradation value, in the upstream direction along the sub scanning direction, sequentially in an order from the pixel located in the second white edge start position in the sub scanning direction and in the particular position in the main scanning direction; and
when a pixel has a gradation value less than the sixth threshold, detecting, as a second white edge end position, a position of the pixel having the gradation value less than the sixth threshold,
wherein the white pixels are located from the second white edge start position to the second white edge end position, and
wherein the second white edge end position is the first white edge position.

### Claim 8 (depends on 7)

The image scanning apparatus according to claim 7,
wherein the second white edge detecting process comprises:
a threshold setting process comprising:
when the sheet type is the thin paper, setting the thin-paper threshold as a white edge threshold; and
when the sheet type is the thick paper, setting the sixth threshold as the white edge threshold;
a first target white edge pixel group setting process to set a group of first target white edge pixels including:
a third reference pixel adjacent to an upstream end, in the main scanning direction, of a pixel located in a most-upstream white edge position in the main scanning direction among already-detected one or more white edge positions, the first white edge position being initially set as the most-upstream white edge position;
the second number of pixels adjacent to an upstream end of the third reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the third reference pixel in the sub scanning direction;
a first target white edge determining process comprising:
determining whether each individual pixel has a gradation value equal to or more than the white edge threshold, in the downstream direction along the sub scanning direction, sequentially in an order from a most-upstream pixel in the sub scanning direction among the first target white edge pixels; and
when a pixel has a gradation value equal to or more than the white edge threshold, setting a position of the pixel having the gradation value equal to or more than the white edge threshold as the most-upstream white edge position in the main scanning direction, and
wherein the third white edge detecting process comprises:
a second white edge pixel group setting process to set a group of second target white edge pixels including:
a fourth reference pixel adjacent to a downstream end, in the main scanning direction, of a pixel located in a most-downstream white edge position in the main scanning direction among already-detected one or more white edge positions, the first white edge position being initially set as the most-downstream white edge position;
the second number of pixels adjacent to an upstream end of the fourth reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the fourth reference pixel in the sub scanning direction; and
a second target white edge determining process comprising:
determining whether each individual pixel has a gradation value equal to or more than the white edge threshold, in the downstream direction along the sub scanning direction, sequentially in an order from a most-upstream pixel in the sub scanning direction among the second target white edge pixels; and
when a pixel has a gradation value equal to or more than the white edge threshold, setting a position of the pixel having the gradation value equal to or more than the white edge threshold as the most-downstream white edge position in the main scanning direction.

### Claim 9 (depends on 1)

The image scanning apparatus according to claim 1,
wherein the controller comprises:
a processor; and
a memory storing processor-executable instructions configured to, when executed by the processor, cause the processor to perform the image data acquiring process, the black edge detecting process, the determining process, and the white edge detecting process.

### Claim 10

A method implementable on a processor coupled with an image scanning apparatus, the image scanning apparatus comprising:
a document table configured to support a document sheet placed thereon;
a document pressing member having a white document pressing surface; and
an image scanner comprising a light source and a plurality of light receivers arranged in line along a main scanning direction, the image scanner being configured to scan an image of the document sheet placed on the document table while moving along a sub scanning direction perpendicular to the main scanning direction and generate image data of the scanned image, the image data including a plurality of pixels each having a gradation value, the image scanner being further configured to generate a white gradation value by scanning the white document pressing surface of the document pressing member, the method comprising:
acquiring single-page image data by controlling the image scanner to scan the document sheet placed on the document table and a particular range of the white document pressing surface, the particular range being wider than a size of the document sheet;
detecting black edge positions by detecting, from the single-page image data, positions of black pixels each having a gradation value less than the white gradation value, each black edge position being a position of a specific one of a leading end and a trailing end of the document sheet in the sub scanning direction;
determining whether a sheet type of the document sheet is a thin paper or a thick paper, based on the gradation values of the black pixels;
detecting white edge positions by detecting, from the single-page image data, positions of white pixels each having a gradation value equal to or more than the white gradation value, each white edge position being a position of another specific one of the leading end and the trailing end of the document sheet in the sub scanning direction;
when determining that the sheet type is the thin paper, detecting, as the white pixels, pixels each having a gradation value equal to or more than a first threshold by determining whether a gradation value of each pixel included in the single-page image data is equal to or more than the first threshold, the first threshold being determined based on the white gradation value; and
when determining that the sheet type is the thick paper, detecting, as the white pixels, pixels each having a gradation value equal to or more than a predetermined second threshold by determining whether the gradation value of each pixel included in the single-page image data is equal to or more than the second threshold.

### Claim 11

A non-transitory computer-readable medium storing computer-readable instructions that are executable by a processor coupled with an image scanning apparatus, the image scanning apparatus comprising:
a document table configured to support a document sheet placed thereon;
a document pressing member having a white document pressing surface; and
an image scanner comprising a light source and a plurality of light receivers arranged in line along a main scanning direction, the image scanner being configured to scan an image of the document sheet placed on the document table while moving along a sub scanning direction perpendicular to the main scanning direction and generate image data of the scanned image, the image data including a plurality of pixels each having a gradation value, the image scanner being further configured to generate a white gradation value by scanning the white document pressing surface of the document pressing member, the instructions being configured to, when executed by the processor, cause the processor to perform:
an image data acquiring process to acquire single-page image data by controlling the image scanner to scan the document sheet placed on the document table and a particular range of the white document pressing surface, the particular range being wider than a size of the document sheet;
a black edge detecting process to detect black edge positions by detecting, from the single-page image data, positions of black pixels each having a gradation value less than the white gradation value, each black edge position being a position of a specific one of a leading end and a trailing end of the document sheet in the sub scanning direction;
a determining process to determine a sheet type of the document sheet based on the gradation values of the black pixels, the sheet type including a thin paper and a thick paper; and
a white edge detecting process to detect white edge positions by detecting, from the single-page image data, positions of white pixels each having a gradation value equal to or more than the white gradation value, each white edge position being a position of another specific one of the leading end and the trailing end of the document sheet in the sub scanning direction, the white edge detecting process comprising:
a thin-paper white edge detecting process to, when the sheet type is the thin paper, detect, as the white pixels, pixels each having a gradation value equal to or more than a first threshold by determining whether a gradation value of each pixel included in the single-page image data is equal to or more than the first threshold, the first threshold being determined based on the white gradation value; and
a thick-paper white edge detecting process to, when the sheet type is the thick paper, detect, as the white pixels, pixels each having a gradation value equal to or more than a predetermined second threshold by determining whether the gradation value of each pixel included in the single-page image data is equal to or more than the second threshold.

### Claim 12 (depends on 11)

The non-transitory computer-readable medium according to claim 11,
wherein the determining process comprises:
a black edge deviation calculating process to calculate a black edge deviation, the black edge deviation representing a deviation of the gradation values of all the black pixels detected from the single-page image data; and
a black edge deviation determining process comprising:
when the black edge deviation is equal to or more than a predetermined third threshold, determining that the sheet type of the document sheet is the thin paper; and
when the black edge deviation is less than the third threshold, determining that the sheet type of the document sheet is the thick paper.

### Claim 13 (depends on 12)

The non-transitory computer-readable medium according to claim 12,
wherein the instructions are further configured to, when executed by the processor, cause the processor to perform:
a corner average calculating process to calculate four corner averages, each corner average being obtained by averaging gradation values of a plurality of pixels in a corresponding one of four corner areas of the document table;
a corner average selecting process to select three of the four corner averages;
a white average calculating process to calculate the white gradation value by averaging the selected three corner averages;
a white deviation calculating process to calculate a white deviation, the white deviation representing a deviation of the gradation values of all the pixels included in three corner areas corresponding to the selected three corner averages; and
a first threshold calculating process to calculate the first threshold by adding the white deviation to the white gradation value,
wherein the second threshold is a maximum value of gradation values generable by the image scanner, and
wherein the third threshold is substantially 2% of a count of gradations from a minimum gradation value to the maximum gradation value of the gradation values generable by the image scanner.

### Claim 14 (depends on 13)

The non-transitory computer-readable medium according to claim 13,
wherein a downstream direction along the main scanning direction is a direction from a head pixel toward a final pixel of a single line,
wherein a downstream direction along the sub scanning direction is a direction from a scanning start position toward a scanning end position of the image scanner,
wherein the instructions are further configured to, when executed by the processor, cause the processor to calculate a fourth threshold by subtracting the white deviation multiplied by two from the white gradation value,
wherein the light source is configured to emit light in an upstream direction along the sub scanning direction,
wherein the black edge detecting process comprises:
a first black edge detecting process to detect, as a first black edge position, a black edge position in a particular position in the main scanning direction, by detecting a black pixel in the downstream direction along the sub scanning direction from a first pixel in the particular position;
a second black edge detecting process to detect black edge positions in an upstream direction along the main scanning direction from the pixel located in the first black edge position in the sub scanning direction and in the particular position in the main scanning direction; and
a third black edge detecting process to detect black edge positions in the downstream direction along the main scanning direction from the pixel located in the first black edge position in the sub scanning direction and in the particular position in the main scanning direction, and
wherein the first black edge detecting process comprises:
a target black edge pixel setting process to sequentially set, as a new target black edge pixel, a pixel adjacent to a downstream end of a current target black edge pixel in the sub scanning direction, the target black edge pixel setting process comprising:
when initially setting a target black edge pixel, setting a first pixel in the particular position as the target black edge pixel, and setting, as a black edge detection value, the maximum gradation value of the gradation values generable by the image scanner;
a black edge detection value determining process to determine whether a gradation value of the target black edge pixel is less than the black edge detection value;
a black edge detection value storing process to, when the gradation value of the target black edge pixel is less than the black edge detection value, store the gradation value of the target black edge pixel as the black edge detection value in association with a pixel number, and again perform the target black edge pixel setting process, the pixel number representing a position of the target black edge pixel in the sub scanning direction;
a black edge difference value calculating process to, when the gradation value of the target black edge pixel is equal to or more than the black edge detection value, calculate a black edge difference value by subtracting the black edge detection value from the white gradation value;
a black edge difference value determining process comprising:
when the black edge difference value is equal to or more than the fourth threshold, determining the pixel corresponding to the black edge detection value as a black pixel, and detecting the position represented by pixel number, as the first black edge position; and
when the black edge difference value is less than the fourth threshold, determining that the pixel corresponding to the black edge detection value is not a black pixel, and again performing the target black edge pixel setting process;
a background color average calculating process to calculate a background color average by averaging background color gradation values, the background color gradation values being gradation values of a first number of pixels successively arranged from a specific pixel in the downstream direction along the sub scanning direction, the specific pixel being located the first number of pixels away, in the downstream direction along the sub scanning direction, from the first black end position in the particular position; and
a background color deviation calculating process to calculate a background color deviation, the background color deviation representing a deviation of the background color gradation values of the pixels of the first number.

### Claim 15 (depends on 14)

The non-transitory computer-readable medium according to claim 14,
wherein the second black edge detecting process comprises:
a first target black edge pixel group setting process to set a group of first target black edge pixels including:
a first reference pixel adjacent to an upstream end, in the main scanning direction, of a pixel located in a most-upstream black edge position in the main scanning direction among already-detected one or more black edge positions, the first black edge position being initially set as the most-upstream black edge position;
a second number of pixels adjacent to an upstream end of the first reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the first reference pixel in the sub scanning direction;
a first difference value calculating process to calculate a first difference value by subtracting a first minimum value from the white gradation value, the first minimum value being a minimum value of gradation values of the first target black edge pixels; and
a first difference value determining process comprising:
determining whether the first difference value is equal to or more than the fourth threshold;
when the first difference value is equal to or more than the fourth threshold, setting a position of a pixel having the first minimum value as the most-upstream black edge position in the main scanning direction; and
re-performing the first target black edge pixel group setting process, and
wherein the third black edge detecting process comprises:
a second target black edge pixel group setting process to set a group of second target black edge pixels including:
a second reference pixel adjacent to a downstream end, in the main scanning direction, of a pixel located in a most-downstream black edge position in the main scanning direction among already-detected one or more black edge positions, the first black edge position being initially set as the most-downstream black edge position;
the second number of pixels adjacent to an upstream end of the second reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the second reference pixel in the sub scanning direction;
a second difference value calculating process to calculate a second difference value by subtracting a second minimum value from the white gradation value, the second minimum value being a minimum value of gradation values of the second target black edge pixels; and
a second difference value determining process comprising:
determining whether the second difference value is equal to or more than the fourth threshold;
when the second difference value is equal to or more than the fourth threshold, setting a position of a pixel having the second minimum value as the most-downstream black edge position in the main scanning direction; and
re-performing the second target black edge pixel group setting process.

### Claim 16 (depends on 15)

The non-transitory computer-readable medium according to claim 15,
wherein the instructions are further configured to, when executed by the processor, cause the processor to perform a fifth threshold calculating process to calculate a fifth threshold by adding the background color deviation to the background color average,
wherein the thin-paper white edge detecting process comprises:
a first white edge detecting process to detect, as a first white edge position, a position of a white pixel having a gradation value equal to or more than the first threshold, in the upstream direction along the sub scanning direction from a final pixel in the sub scanning direction in the particular position, the first white edge position being a white edge position in the particular position;
a second white edge detecting process to detect white edge positions in the upstream direction along the main scanning direction from the pixel located in the first white edge position in the sub scanning direction and in the particular position in the main scanning direction; and
a third white edge detecting process to detect white edge positions in the downstream direction along the main scanning direction from the pixel located in the first white edge position in the sub scanning direction and in the particular position in the main scanning direction,
wherein the first white edge detecting process comprises:
a first white edge start position detecting process comprising:
determining whether every pixel of a third number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the first threshold, in the upstream direction along the sub scanning direction, sequentially in an order from the final pixel in the sub scanning direction in the particular position; and
when every pixel of the third number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the first threshold, detecting, as a first white edge start position, a position of a most-upstream pixel in the sub scanning direction among the third number of the pixels;
a thin-paper threshold acquiring process to acquire, as a thin-paper threshold, the gradation value of the pixel located in the first white edge start position in the sub scanning direction and in the particular position in the main scanning direction; and
a first white edge end position detecting process comprising:
determining whether each individual pixel has a gradation value less than the fifth threshold, in the upstream direction along the sub scanning direction, sequentially in an order from the pixel located in the first white edge start position in the sub scanning direction and in the particular position in the main scanning direction; and
when a pixel has a gradation value less than the fifth threshold, detecting, as a first white edge end position, a position of the pixel having the gradation value less than the fifth threshold,
wherein the white pixels are located from the first white edge start position to the first white edge end position, and
wherein the first white edge end position is the first white edge position.

### Claim 17 (depends on 16)

The non-transitory computer-readable medium according to claim 16,
wherein the thick-paper white edge detecting process comprises:
a fourth white edge detecting process to detect, as the first white edge position, a position of a white pixel having a gradation value equal to or more than the second threshold, in the upstream direction along the sub scanning direction from the final pixel in the sub scanning direction in the particular position;
the second white edge detecting process; and
the third white edge detecting process,
wherein the fourth white edge detecting process comprises:
a second white edge start position detecting process comprising:
determining whether every pixel of a fourth number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the second threshold, in the upstream direction along the sub scanning direction, sequentially in an order from the final pixel in the sub scanning direction in the particular position; and
when every pixel of the third number of pixels successively arranged in the sub scanning direction has a gradation value equal to or more than the second threshold, detecting, as a second white edge start position, a position of a most-upstream pixel in the sub scanning direction among the fourth number of the pixels; and
a second white edge end position detecting process comprising:
determining whether each individual pixel has a gradation value less than a sixth threshold, the sixth threshold being substantially 98% of the count of gradations from the minimum gradation value to the maximum gradation value, in the upstream direction along the sub scanning direction, sequentially in an order from the pixel located in the second white edge start position in the sub scanning direction and in the particular position in the main scanning direction; and
when a pixel has a gradation value less than the sixth threshold, detecting, as a second white edge end position, a position of the pixel having the gradation value less than the sixth threshold,
wherein the white pixels are located from the second white edge start position to the second white edge end position, and
wherein the second white edge end position is the first white edge position.

### Claim 18 (depends on 17)

The non-transitory computer-readable medium according to claim 17,
wherein the second white edge detecting process comprises:
a threshold setting process comprising:
when the sheet type is the thin paper, setting the thin-paper threshold as a white edge threshold; and
when the sheet type is the thick paper, setting the sixth threshold as the white edge threshold;
a first target white edge pixel group setting process to set a group of first target white edge pixels including:
a third reference pixel adjacent to an upstream end, in the main scanning direction, of a pixel located in a most-upstream white edge position in the main scanning direction among already-detected one or more white edge positions, the first white edge position being initially set as the most-upstream white edge position;
the second number of pixels adjacent to an upstream end of the third reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the third reference pixel in the sub scanning direction; and
a first target white edge determining process comprising:
determining whether each individual pixel has a gradation value equal to or more than the white edge threshold, in the downstream direction along the sub scanning direction, sequentially in an order from a most-upstream pixel in the sub scanning direction among the first target white edge pixels; and
when a pixel has a gradation value equal to or more than the white edge threshold, setting a position of the pixel having the gradation value equal to or more than the white edge threshold as the most-upstream white edge position in the main scanning direction, and
wherein the third white edge detecting process comprises:
a second white edge pixel group setting process to set a group of second target white edge pixels including:
a fourth reference pixel adjacent to a downstream end, in the main scanning direction, of a pixel located in a most-downstream white edge position in the main scanning direction among already-detected one or more white edge positions, the first white edge position being initially set as the most-downstream white edge position;
the second number of pixels adjacent to an upstream end of the fourth reference pixel in the sub scanning direction; and
the second number of pixels adjacent to a downstream end of the fourth reference pixel in the sub scanning direction; and
a second target white edge determining process comprising:
determining whether each individual pixel has a gradation value equal to or more than the white edge threshold, in the downstream direction along the sub scanning direction, sequentially in an order from a most-upstream pixel in the sub scanning direction among the second target white edge pixels; and
when a pixel has a gradation value equal to or more than the white edge threshold, setting a position of the pixel having the gradation value equal to or more than the white edge threshold as the most-downstream white edge position in the main scanning direction.
