主权项 |
1. An image-reading device comprising:
a reading unit configured to optically read an object at a reading position, the object including a sheet, the reading unit being further configured to generate a plurality of sets of line data respectively representing a plurality of lines in an image of the object, each of the plurality of lines having pixels arranged in a first direction, the sheet having a sheet edge; a conveyance unit configured to convey the sheet in a second direction intersecting with the first direction; a detector positioned upstream of the reading position in the second direction and configured to detect the sheet and output a sheet detection signal when the sheet is detected; a first determination unit configured to determine a plurality of sets of target data from among the plurality of sets of line data in response to the sheet detection signal, the plurality of sets of target data respectively representing a plurality of target lines among the plurality of lines and being used to detect the sheet edge; an edge image generation unit configured to generate a plurality of sets of edge image data by performing an edge detection process on the plurality of sets of target data, the plurality of sets of edge image data respectively corresponding to the plurality of target lines, the plurality of target lines having a first target line and being apposed sequentially on a line-to-line basis in the second direction from the first target line, the plurality of sets of edge image data including a first set of edge image data and a second set of edge image data, the first set of edge image data corresponding to the first target line, the second set of edge image data corresponding to a second target line apposed next to the first target line; a mask setting unit configured to determine whether an edge pixel is included in the first set of edge image data, the edge pixel representing at least part of the sheet edge, the mask setting unit being configured to, when the edge pixel is included in the first set of edge image data, set a mask region on the image; and an edge detection unit configured to detect the edge pixel by sequentially referring to each of the plurality of sets of edge image data except the first set of edge image data according to a line order from the second target line and detect a positional coordinate of the edge pixel from among pixels in the plurality of sets of edge image data outside the mask region, wherein once the edge pixel is included in the first set of edge image data, the mask setting unit is configured to set the mask region continuously and dynamically from the first target line to a target line on which detection of the edge pixel ends in the second direction. |