1. Field of the Invention
The present invention relates to boundary detection, and, more particularly, to a method for determining corners of an object represented by image data.
2. Description of the Related Art
An imaging apparatus is used to process image data, and may be used to generate a printed output corresponding to the image data. The image data may be received, for example, from an application program executing on a computer, from memory, or from a scanner. For example, the scanner, which may be included in the imaging apparatus, may be used to generate a digital representation of a substrate object being scanned. Such a substrate object, such as a document, may include any of a variety of media types, such as paper, card stock, etc., and may be regular (e.g., rectangular) or irregular in shape. On the substrate object there may be formed, for example, text, graphics or a picture, e.g., a photo, or a combination thereof. During a scanning operation, image data is generated, including background image data associated with a backing surface of the scanner and foreground image data representing the scanned object, e.g., substrate, along with any text, graphics or a picture formed on the substrate
Knowing the boundaries of the scanned object, such as a business card or photograph, is useful to increase the accuracy of skew correction. Knowing the boundaries of the scanned object also enables the accurate placement of the contents of the object, e.g., text, graphics, or picture, with respect to a printed output. However, often it may be difficult to detect the appropriate boundaries, and particular the corners, of the object. For example, the corners of the object may be damaged prior to scanning, or the scanning process may generate imaging distortion, i.e., “noise” present in the image data, thereby making the determination of the corners of the object difficult. The knowledge of corners may help to determine the size, shape and orientation of objects. The size, shape and orientation information may be used to format and perform skew correction of the image. This information also may be used for other cosmetic corrections.
The invention, in one form thereof, is directed to a method for determining corners of an object represented by image data. The method includes determining edge data associated with the object; finding estimated corners for the edge data; determining segment data of the edge data by ignoring data within a predetermined distance from the estimated corners; extending the segment data to define a plurality of lines having points of intersection; and defining ideal corners at the points of intersection of the plurality of lines.
The invention, in another form thereof, is directed to a method for determining corners of an object represented by image data. The method includes processing the image data to generate a cyclic edge data list of connected points along edges of the object; identifying an origin point P0 from the connected points; fetching a first point P−n a distance DL from point P0 in a clockwise direction in the cyclic edge data list, wherein n is a count value; fetching a second point P+n a distance DR from P0 in a counterclockwise direction in the cyclic edge data list; determining a distance DH between the first point P−n and the second point P+n; and if DH2=DL2+DR2+Tr, wherein Tr is a tolerance range, then point P0 is designated as an estimated corner.
The invention, in another form thereof, is directed to a method for determining corners of an object represented by image data. The method includes (a) processing the image data to generate a cyclic edge data list of connected points along edges of the object; (b) filtering out any branched edges in the cyclic edge data list; (c) identifying an origin point P0 from the connected points; (d) fetching a first point P−n a distance DL from point P0 in a clockwise direction in the cyclic edge data list, wherein n is a count value; (e) fetching a second point P+n, a distance DR from P0 in a counterclockwise direction in the cyclic edge data list; (f) determining a distance DH between the first point P−n and the second point P+n; and (g) if DH2>DL2+DR2+Tr, then point P0 is not at an estimated corner, then the method further (h) selecting a new origin point P0=P0+k, wherein k is an offset count value; and (i) repeating acts (d) though (g).
The above-mentioned and other features and advantages of this invention, and the manner of attaining them, will become more apparent and the invention will be better understood by reference to the following description of embodiments of the invention taken in conjunction with the accompanying drawings, wherein:
Corresponding reference characters indicate corresponding parts throughout the several views. The exemplifications set out herein illustrate embodiments of the invention, and such exemplifications are not to be construed as limiting the scope of the invention in any manner.
Referring now to the drawings and particularly to
Imaging apparatus 12 may be, for example, an ink jet printer and/or copier; an electrophotographic printer and/or copier; a thermal transfer printer and/or copier; an all-in-one (AIO) unit that includes a print engine, a scanner unit, and possibly a fax unit; or may be simply just a scanner unit. An AIO unit is also known in the art as a multifunction machine. In the embodiment shown in
Controller 18 includes a processor unit and associated memory 28, and may be formed as one or more Application Specific Integrated Circuits (ASIC). Memory 28 may be, for example, random access memory (RAM), read only memory (ROM), and/or non-volatile RAM (NVRAM). Alternatively, memory 28 may be in the form of a separate electronic memory (e.g., RAM, ROM, and/or NVRAM), a hard drive, a CD or DVD drive, or any memory device convenient for use with controller 18. Controller 18 may be a printer controller, a scanner controller, or may be a combined printer and scanner controller. In the present embodiment, controller 18 communicates with print engine 20 via a communications link 30. Controller 18 communicates with scanner unit 24 via a communications link 32. User interface 26 is communicatively coupled to controller 18 via a communications link 34. Controller 18 serves to process print data and to operate print engine 20 during printing, as well as to operate scanner unit 24 and process data obtained via scanner unit 24.
In the context of the examples for imaging apparatus 12 given above, print engine 20 can be, for example, an ink jet print engine, an electrophotographic print engine or a thermal transfer engine, configured for forming an image on a print medium 36, such as a sheet of paper, transparency or fabric. As an ink jet print engine, for example, print engine 20 operates printing cartridge 22 to eject ink droplets onto print medium 36 in order to reproduce text and/or images. As an electrophotographic print engine, for example, print engine 20 causes printing cartridge 22 to deposit toner onto print medium 36, which is then fused to print medium 36 by a fuser (not shown), in order to reproduce text and/or images.
Host 14, which may be optional, may be, for example, a personal computer, including memory 40, such as RAM, ROM, and/or NVRAM, an input device 42, such as a keyboard, and a display monitor 44. Host 14 further includes a processor, input/output (I/O) interfaces, and at least one mass data storage device, such as a hard drive, a CD-ROM and/or a DVD unit.
Host 14 includes in its memory a software program including program instructions that function as an imaging driver 46, e.g., printer/scanner driver software, for imaging apparatus 12. Imaging driver 46 is in communication with controller 18 of imaging apparatus 12 via communications link 16. Imaging driver 46 facilitates communication between imaging apparatus 12 and host 14, and may provide formatted print data to imaging apparatus 12, and more particularly, to print engine 20, to print an image.
In some circumstances, it may be desirable to operate imaging apparatus 12 in a standalone mode. In the standalone mode, imaging apparatus 12 is capable of functioning without host 14. Accordingly, all or a portion of imaging driver 46, or a similar driver, may be located in controller 18 of imaging apparatus 12 so as to accommodate printing during a copying or facsimile job being handled by imaging apparatus 12 when operating in the standalone mode.
Scanner unit 24 may be of a conventional scanner type, such as for example, a sheet feed or flat bed scanner. In the context of the present invention, in some embodiments either scanner type may be used. As is known in the art, a sheet feed scanner transports a document to be scanned past a stationary sensor device.
Referring to
In the present embodiment, surface 66 of document pad 64 may be made of a phosphorescent material that forms a phosphorescent area 72 located opposite sensor 70. The phosphorescent material may be obtained, for example, from United Minerals and Chemical Corporation (UMC) of Lyndhurst, N.J. The phosphorescent material is charged, i.e., absorbs light, when exposed to a light source, and discharges, i.e., emits, light after being charged. In one embodiment, for example, phosphorescent area 72 is formed by a phosphorescent coating, such as a phosphorescent paint, applied to a substrate, such as a plastic plate forming a portion of document pad 64. Also, it is contemplated that the phosphorescent material may be sprinkled, in a dry or liquid form, on to a holding layer, which may include an adhesive binder. In these examples, therefore, the phosphorescent material may be applied uniformly or non-uniformly in phosphorescent area 72. In addition, the phosphorescent material may be applied in phosphorescent area 72 in a predetermined pattern, such as for example, a grid pattern.
The light source that charges the phosphorescent material may be, for example, illuminant 68, or some other controlled illuminant, providing dedicated or leaked light, or may be ambient light. In order to charge the phosphorescent material using ambient light, scanner lid 54 is place in the open position so that ambient light may reach phosphorescent area 72. Illuminant 68 may be, for example, the same illuminant used to collect RGB data from substrate objects 60, 62 via scanner head 50.
In the embodiment shown in
As shown in
Referring to
For example, in order to generate the dark image data, sensor 70 provides signals to controller 18 relating to light emitted by the phosphorescent material at various locations on phosphorescent area 72, wherein substrate objects 60, 62 is sensed by sensor 70 as dark image 78 and dark image 80 in comparison to the background 82 formed by the portion of phosphorescent area 72 not attenuated by substrate object 60 (see
In some embodiments of the present invention, the dark image data (D) may be generated to be interleaved with regular RGB image data, and this may be achieved in several different ways.
For example, one way is for controller 18 to take one or more dark image readings with sensor 70 after every RGB image reading taken with sensor 70. This may be represented by the sequence: RGB.DDD.RGB.DDD. . . , where D represents a dark image reading and RGB represent the red, green, blue image readings, respectively.
In the event it is determined that taking triple dark image readings after each RGB reading is not necessary in order to build a suitable boundary edge map of boundaries 84, 86 of dark images 78 and 80, respectively, representing the edges 74 of substrate object 60 and the edges 76 of substrate object 62, then controller 18 may take multiple RGB readings with sensor 70 before taking each of the triple dark image readings with sensor 70, so that the overall number of dark image readings may be reduced. For example, this sequence may be: RGB.RGB.RGB.DDD.RGB.RGB. . . . As a further reduction, each of the triple dark image readings may be reduced to a double or single dark image reading, exhibited by the sequence: RGB.RGB.RGB.D.RGB.RGB. . . . By reducing the number of dark image readings D, the RGB image resolution is increased.
In embodiments where illuminant 68 is used in collecting RGB image data relating to the content of substrate objects 60, 62 and for charging the phosphorescent material at phosphorescent area 72, the phosphorescent material is charged when illuminant 68 is ON, and controller 18 executes program instructions to turn OFF illuminant 68 while light emitted by the phosphorescent material is being sensed by sensor 70.
As another example, where ambient light is used to charge the phosphorescent material, the ambient light is substantially blocked, such as by closing scanner lid 54, while the light emitted by the phosphorescent material is being sensed by sensor 70.
The present invention provides corner detection and correction for objects, such as substrate objects 60, 62. The corner information may then be used, for example, by controller 18 to define and de-skew the RGB image data that corresponds to substrate objects 60, 62. Thereafter, print engine 20 may be used to print the de-skewed RGB image data associated with substrate objects 60, 62, if desired.
At step S100, edge data associated with the object, such as substrate object 60, is determined. In the present example, the image data is generated during a scanning operation, and substrate object 60 may be, for example, a business card, or a photograph.
As illustrated in
Referring to
As a more particular example, the image data is processed through a Depth First Search (DFS) algorithm to generate a cyclic edge data list 92 of connected points along the edges of the object, e.g., edges 74, of substrate object 60. Cyclic edge data list 92 may be established, for example, in memory 28 (see
At step S102, the estimated corners for the edge data are found. The details of one embodiment for performing step S102 for estimating corners will be described with respect to the flowchart of
At step S102-1, an origin point P0 from the plurality of connected points in the cyclic edge data list 92 is identified.
At step S102-2, referring to
At step S102-3, a second point P+n, a distance DR from P0 in a counterclockwise direction in the cyclic edge data list 92 is fetched from the cyclic edge data list 92, wherein n is a count value and the distance is an aerial distance.
At step S102-4, a distance DH between the first point P−n and the second point P+n is determined, wherein the distance is an aerial distance.
At step S102-5, it is determined whether the Pythagorean equality DH2=(DL2+DR2)+Tr is satisfied. The variable Tr is an optional tolerance range. For example, by setting Tr=0, the tolerance factor is removed from the equation. In embodiments that include a tolerance range, one example is that the tolerance range Tr may be: 0.0<Tr<0.1 millimeters.
If the result of the determination at step S102-5 is NO, then DH2>DL2+DR2+Tr, and it is determined that the estimated corner has not been found. In this case, the process proceeds to step S102-6.
At step S102-6, referring to
In this case, the next point Pk, i.e., the new origin point P0, may be selected as follows:
First: (DL+DA)2+DB2=DH2
Or, DL2+DA2+2·DL·DA+DB2=DH2
Also, DA+DB2=DR2
Combining the above two equations, we get:
DA is the aerial distance of the desired point from the previous origin point P0. However, the pixel counts k from P0 in the cyclic edge data list 92 to fetch the point Pk, i.e., new P0=P0+k. The aerial distance DL is known and corresponds to pixel counts n. Therefore, count k can be calculated by the equation:
Notice that all the variables on the right hand side of above equation are known. The point Pk is fetched from the cyclic edge data list 92 that is k counts from P0 in a counterclockwise direction in the cyclic edge data list 92.
A similar approach is used for the situation illustrated in
Notice also that if P−n, P0 and P+n are collinear then DL2=DR2 and DH2=4 ·DL2. Hence, k=2·n in Equation 1. Thus, the algorithm will make a big leap whenever it operates in a collinear region, i.e., the algorithm will make big leaps until it comes close to a corner.
The process then returns to step S102-2.
If the result of the determination at step S102-5 is YES, then point P0 is designated as an estimated corner, and the process proceeds to step S102-7 to determine if more estimated corners are to be determined.
At step S102-7, it is determined whether all estimated corners been detected, i.e., located, in cyclic edge data list 92. If the determination at step S102-7 is NO, then the process returns to step S102-1 to process the cyclic edge data list 92 and locate the next corner.
Accordingly, if the determination at step S102-7 is YES, then the process proceeds to step S104.
At step S104, referring to
At step S106, the segment data corresponding to the edge segments 98-1, 98-2, 98-3 and 98-4 is extended linearly to define a plurality of lines 100-1, 100-2, 100-3 and 100-4 having points of intersection 101-1, 101-2, 101-3, and 101-4. The segment data is extended, for example, by processing the segment data representing the points of each edge segment by using a least squares fit algorithm to obtain a straight line corresponding to each edge segment, and then projecting each straight line a distance sufficient to establish the points of intersection.
At step S108, referring also to
Those skilled in the art will recognize that the process described above may be repeated to determine the corners of each object under consideration.
While this invention has been described with respect to embodiments of the invention, the present invention may be further modified within the spirit and scope of this disclosure. This application is therefore intended to cover any variations, uses, or adaptations of the invention using its general principles. Further, this application is intended to cover such departures from the present disclosure as come within known or customary practice in the art to which this invention pertains and which fall within the limits of the appended claims.