AU2009227822A1 - A method for improved colour representation of image regions - Google Patents

A method for improved colour representation of image regions Download PDF

Info

Publication number
AU2009227822A1
AU2009227822A1 AU2009227822A AU2009227822A AU2009227822A1 AU 2009227822 A1 AU2009227822 A1 AU 2009227822A1 AU 2009227822 A AU2009227822 A AU 2009227822A AU 2009227822 A AU2009227822 A AU 2009227822A AU 2009227822 A1 AU2009227822 A1 AU 2009227822A1
Authority
AU
Australia
Prior art keywords
pixel
gradient
transitional
pixels
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
AU2009227822A
Inventor
Alex YEE
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to AU2009227822A priority Critical patent/AU2009227822A1/en
Publication of AU2009227822A1 publication Critical patent/AU2009227822A1/en
Abandoned legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Description

S&F Ref: 916821 AUSTRALIA PATENTS ACT 1990 COMPLETE SPECIFICATION FOR A STANDARD PATENT Name and Address Canon Kabushiki Kaisha, of 30-2, Shimomaruko 3 of Applicant : chome, Ohta-ku, Tokyo, 146, Japan Actual Inventor(s): Alex Yee Address for Service: Spruson & Ferguson St Martins Tower Level 35 31 Market Street Sydney NSW 2000 (CCN 3710000177) Invention Title: A method for improved colour representation of image regions The following statement is a full description of this invention, including the best method of performing it known to me/us: 5845c(2343769_1) A METHOD FOR IMPROVED COLOUR REPRESENTATION OF IMAGE REGIONS TECHNICAL FIELD The current invention relates to the detection and removal of extraneous colours during pixel analysis in a scanned compound document image for document image analysis. 5 BACKGROUND The proliferation of imaging technology combined with ever increasing computational processing power has led to many advances in the area of document analysis. Document analysis systems may be used to extract semantic information from a scanned document. Such technology is used in a growing number of applications. 10 One of the first processing stages in document analysis systems involves pixel colour analysis. Pixel colour analysis involves segmenting the scanned images into perceptually uniform colour regions, thereby establishing a colour composition of the document image. The most common format is a binary image, which can be obtained by various adaptive thresholding methods. Binary format is effective for simple document 15 images because generally documents have dark text on light background or light text on dark background. However, as colour printing becomes more advanced and widely used, the choice of colours on documents also gets more diverse. Consequently, the complexity of pixel colour analysis also increases as the diversity of colours on documents increases. Scanned colour document images are subject to extraneous colours caused by 20 colour bleeding, colour fringing and colour mis-registration. These extraneous colours are usually found in the vicinity of colour transitions between two flat regions due to the artefacts created from printing and scanning processes when one colour region neighbours 2343287_1 916821_spedlodge -2 another. Therefore, pixels in the vicinity of colour transitions are especially subject to extraneous colours. These extraneous colours pose multiple problems in document analysis systems. The first problem is caused by additional intermediate colour regions between two flat 5 regions. The interpretation of connected components within document analysis systems is affected by additional intermediate colour regions inserted between two flat regions, during connected component analysis. Connected component analysis is one of the main techniques used in document analysis systems to analyse the relationship of information bearing elements and region representations of the document image. 10 The second problem relates to colour reduction within a document analysis system. It is common for document analysis systems to reduce the diversity of colours in the document image thereby retaining semantically significant colours whilst reducing the complexity of the document image so that an effective document analysis can be performed. One method to achieve this is by selecting only the dominant colours from a 15 colour space histogram representation of the document image. However, the presence of extraneous colours in the colour space histogram complicates the selection of dominant colours because the extraneous colour often obscure potential dominant colours that have very similar statistics. The document analysis result can be inaccurate because of an incorrect number of dominant colours or polluted dominant colours. 20 Therefore, there is a need for pixel colour analysis that takes extraneous colours into consideration to produce accurate colour regions. Accurate colour regions improve connected component analysis and dominant colours selection within document analysis systems. 2343287_1 916821_specilodge -3 SUMMARY Disicosed is a computer implemented method of analysing colour composition in an image of a document, the computer including at least a memory for storing the image and a processor configured to execute the method. The method performs gradient 5 detection on the image to produce a gradient map and analyses said gradient map to classify pixels of said image into transitional pixels and non-transitional pixels. A colour space histogram is then generated corresponding to a colour composition of said non transitional pixels, wherein colour composition is represented by limited sets of colours. Desirably the gradient detection produces a gradient map for each pixel of said 10 image, said gradient map comprising a horizontal gradient component, a vertical gradient component and a classification of gradient pixel or non-gradient pixel. The gradient detection preferably comprises: applying a horizontal gradient filter to obtain a horizontal gradient component; applying a vertical gradient filter to obtain a vertical gradient component; and thresholding the horizontal and vertical gradient components to obtain a 15 classification of gradient pixel or non-gradient pixel. Preferably, the analysing comprises classifying non-gradient pixels as non transitional pixels and for each gradient pixel, further classifying each said gradient pixel into non-transitional or transitional pixel. The further classifying desirably comprises calculating gradient orientation using horizontal and vertical gradient components; and 20 classifying said gradient pixel into non-transitional or transitional pixel based on gradient orientation and luminance differences to adjacent pixels. Typically, the gradient detection is performedon each pixel of said image in a raster fashion and the colour space histogram is stored to a memory. 2343287_1 916821_specilodge -4 Also disicosed is a method of removing transitional colours in an image of a document. The method analyses colour composition in an image of a document according to the method described above and then maps each said non-transitional pixel to one of the colours in said limited set of colours. This method then determines a source 5 replacement pixel from the non-transitional pixels for a transitional pixel and replaces a colour of said transitional pixel with a colour of the determined source replacement pixel. Typically, this methdo further comprises reclassifying the replaced transitional pixel as a non-transitional pixel and repeating the last two steps for a further transitional pixel. 10 Other aspects are aslo disclosed. BRIEF DESCRIPTION OF THE DRAWINGS At least one embodiment of the present invention will now be described with reference to the following drawings, in which: Fig. I depicts a system in which various embodiments of the present invention can 15 be implemented; Fig. 2 is a processing flowchart of a process for detecting and removing extraneous colours in a scanned document image according; Fig. 3 is a flowchart illustrating a gradient detection process; Fig. 4 is a flowchart illustrating a process for classifying pixels as transitional or 20 non-transitional pixels; Fig. 5 illustrates a definition of gradient orientations; Fig. 6 is a flowchart illustrating a process for performing single pixel line recovery as used in the process in Fig. 4; Fig. 7 is an example demonstrating how single pixel line recovery works; 2343287_1 916821_specilodge -5 Fig. 8 is a flowchart illustrating a process for performing double pixel line recovery as used in the process in Fig. 4; Fig. 9 is an example demonstrating how double pixel line recovery works; Fig. 10 is a flowchart illustrating a process for correcting transitional pixels; 5 Fig. 11 is a flowchart illustrating a process for determining a source replacement pixel as used in the process in Fig. 10; Figs. 12A-12D, 13A - 13D and 14 illustrate three modes of selecting candidate replacement pixels for determining a source replacement pixel used in the process in Fig. 11; and 10 Figs. 15A and 15B form a schematic block diagram of a general purpose computer system upon which the arrangements described can be practiced. DETAILED DESCRIPTION INCLUDING BEST MODE Disclosed is a method of pixel colour analysis processing that analyses the colour composition of a document image and takes extraneous colours into consideration to 15 produce accurate colour regions, which improves the accuracy of later document analysis processing stages. Fig. I shows a system 100 in which a hard copy document 110 is scanned by a scanner 120 to form an input scanned document image 130 that is stored in memory as a bitmap image. The input scanned document image 130 is then subject to pixel colour 20 analysis processing, as described herein in a processing module 140. The pixel colour analysis processing in processing module 140 removes extraneous colours in the input scanned document image 130 and produces an output image 150 with significantly reduced extraneous colours. The output image 150 is suitable for further document analysis processing. 2343287_1 916821_speci_lodge -6 The hard copy document 110 may be considered a compound document since the document 110 includes a variety of different types of components which can be interpreted differently when construed as an image. Particularly, the contents of the hard copy document 110 as illustrated include features such as thick line 111, thin line 112, 5 shape region 113, graphics 114, multi-line texts 115, large text 116 and photo region 117. The hard copy document 110 can be produced with various types of printing equipment such as a printer or a facsimile (fax) machine, and therefore can contain extraneous colours caused by colour bleeding, colour fringing and colour mis-registration. The hard copy document 110 in Fig. I shows an example of extraneous colour 118 between the 10 thick line 111 and the background of the hard copy document 110. The scanner 120 that scans the hard copy document 110 can introduce additional extraneous colours into the input scanned document image 130. A sample 160 shows a representation of the input scanned document image 130 which is stored in the memory. The sample 160 is shown in Fig. I enlarged for illustration purposes only. The 15 sample 160 illustrates additional extraneous colours 161 and 162 around the shape region and large text features that result from the scanning process. The extraneous colour 118 that originates from the hard copy document 110 may also be retained by the scanner 120 and may appear in the input scanned document image 130, and is shown in 163 of the sample 160. 20 The scanner 120 and processing module 140 are not limited to any particular type of systems. Some examples of the scanner 120 is a stand-alone scanner, handheld scanners or scanners embedded in larger systems such as a multi-functional printer, all of which are capable of scanning colour documents. Some examples of the processing module 140 include a computer or a multi-functional printer, where the pixel colour 2343287_1 916821_specilodge -7 analysis processing to be described can be implemented. The output image 150 can be stored as a separate bitmap image in the memory location and displayed using a projector, a monitor or other display devices. Figs. 15A and 15B collectively form a schematic block diagram of a general 5 purpose computer system 1500, upon which the various arrangements described can be practiced and which includes examples of the scanner 120, the processing, module 140 and the display discussed above. As seen in Fig. 15A, the computer system 1500 is formed by a computer module 1501, input devices such as a keyboard 1502, a mouse pointer device 1503, a 10 scanner 1526, a camera 1527, and a microphone 1580, and output devices including a printer 1515, a display device 1514 and loudspeakers 1517. An external Modulator Demodulator (Modem) transceiver device 1516 may be used by the computer module 1501 for communicating to and from a communications network 1520 via a connection 1521. The network 1520 may be a wide-area network (WAN), such as the 15 Internet or a private WAN. Where the connection 1521 is a telephone line, the modem 1516 may be a traditional "dial-up" modem. Alternatively, where the connection 1521 is a high capacity (eg: cable) connection, the modem 1516 may be a broadband modem. A wireless modem may also be used for wireless connection to the network 1520. 20 The computer module 1501 typically includes at least one processor unit 1505, and a memory unit 1506 for example formed from semiconductor random access memory (RAM) and semiconductor read only memory (ROM). The module 1501 also includes an number of input/output (1/0) interfaces including an audio-video interface 1507 that couples to the video display 1514, loudspeakers 1517 and 2343287_1 916821_specilodge -8 microphone 1580, an 1/0 interface 1513 for the keyboard 1502, mouse 1503, scanner 1526, camera 1527 and optionally a joystick (not illustrated), and an interface 1508 for the external modem 1516 and printer 1515. In some implementations, the modem 1516 may be incorporated within the computer module 1501, for example 5 within the interface 1508. The computer module 1501 also has a local network interface 1511 which, via a connection 1523, permits coupling of the computer system 1500 to a local computer network 1522, known as a Local Area Network (LAN). As also illustrated, the local network 1522 may also couple to the wide network 1520 via a connection 1524, which would typically include a so-called "firewall" device or device 10 of similar functionality. The interface 1511 may be formed by an EthernetTM circuit card, a BluetoothTM wireless arrangement or an IEEE 802.11 wireless arrangement. The interfaces 1508 and 1513 may afford either or both of serial and parallel connectivity, the former typically being implemented according to the Universal Serial Bus (USB) standards and having corresponding USB connectors (not illustrated). 15 Storage devices 1509 are provided and typically include a hard disk drive (HDD) 1510. Other storage devices such as a floppy disk drive and a magnetic tape drive (not illustrated) may also be used. An optical disk drive 1512 is typically provided to act as a non-volatile source of data. Portable memory devices, such optical disks (eg: CD-ROM, DVD), USB-RAM, and floppy disks for example may then be used as appropriate 20 sources of data to the system 1500. The components 1505 to 1513 of the computer module 1501 typically communicate via an interconnected bus 1504 and in a manner which results in a conventional mode of operation of the computer system 1500 known to those in the relevant art. Examples of computers on which the described arrangements can be 2343287_1 916821_speci_lodge -9 practised include IBM-PC's and compatibles, Sun Sparcstations, Apple MacTM or alike computer systems evolved therefrom. The method of pixel colour analysis may be implemented using the computer system 1500 wherein the processes of Figs. 2 to 14, to be described, may be 5 implemented as one or more software application programs 1533 executable within the computer system 1500. In particular, the steps of the method of pixel colour analysis are effected by instructions 1531 in the software 1533 that are carried out within the computer system 1500. The software instructions 1531 may be formed as one or more code modules, each for performing one or more particular tasks. The software may also 10 be divided into two separate parts, in which a first part and the corresponding code modules performs the pixel colour analysis methods and a second part and the corresponding code modules manage a user interface between the first part and the user. The software 1533 is generally loaded into the computer system 1500 from a computer readable medium, and is then typically stored in the HDD 1510, as illustrated 15 in Fig. 15A, or the memory 1506, after which the software 1533 can be executed by the computer system 1500. In some instances, the application programs 1533 may be supplied to the user encoded on one or more CD-ROM 1525 and read via the corresponding drive 1512 prior to storage in the memory 1510 or 1506. Alternatively the software 1533 may be read by the computer system 1500 from the networks 1520 20 or 1522 or loaded into the computer system 1500 from other computer readable media. Computer readable storage media refers to any storage medium that participates in providing instructions and/or data to the computer system 1500 for execution and/or processing. Examples of such storage media include floppy disks, magnetic tape, CD ROM, a hard disk drive, a ROM or integrated circuit, USB memory, a magneto-optical 2343287_1 916821_specilodge -10 disk, or a computer readable card such as a PCMCIA card and the like, whether or not such devices are internal or external of the computer module 1501. Examples of computer readable transmission media that may also participate in the provision of software, application programs, instructions and/or data to the computer module 1501 5 include radio or infra-red transmission channels as well as a network connection to another computer or networked device, and the Internet or Intranets including e-mail transmissions and information recorded on Websites and the like. The second part of the application programs 1533 and the corresponding code modules mentioned above may be executed to implement one or more graphical user 10 interfaces (GUIs) to be rendered or otherwise represented upon the display 1514. Through manipulation of typically the keyboard 1502 and the mouse 1503, a user of the computer system 1500 and the application may manipulate the interface in a functionally adaptable manner to provide controlling commands and/or input to the applications associated with the GUI(s). Other forms of functionally adaptable user interfaces may 15 also be implemented, such as an audio interface utilizing speech prompts output via the loudspeakers 1517 and user voice commands input via the microphone 1580. Fig. 15B is a detailed schematic block diagram of the processor 1505 and a "memory" 1534. The memory 1534 represents a logical aggregation of all the memory devices (including the HDD 1510 and semiconductor memory 1506) that can be 20 accessed by the computer module 1501 in Fig. 15A. When the computer module 1501 is initially powered up, a power-on self-test (POST) program 1550 executes. The POST program 1550 is typically stored in a ROM 1549 of the semiconductor memory 1506. A program permanently stored in a hardware device such as the ROM 1549 is sometimes referred to as firmware. The 2343287_1 916821_speci_lodge - 11 POST program 1550 examines hardware within the computer module 1501 to ensure proper functioning, and typically checks the processor 1505, the memory (1509, 1506), and a basic input-output systems software (BIOS) module 1551, also typically stored in the ROM 1549, for correct operation. Once the POST program 1550 has run 5 successfully, the BIOS 1551 activates the hard disk drive 1510. Activation of the hard disk drive 1510 causes a bootstrap loader program 1552 that is resident on the hard disk drive 1510 to execute via the processor 1505. This loads an operating system 1553 into the RAM memory 1506 upon which the operating system 1553 commences operation. The operating system 1553 is a system level application, executable by the 10 processor 1505, to fulfil various high level functions, including processor management, memory management, device management, storage management, software application interface, and generic user interface. The operating system 1553 manages the memory (1509, 1506) in order to ensure that each process or application running on the computer module 1501 has sufficient 15 memory in which to execute without colliding with memory allocated to another process. Furthermore, the different types of memory available in the system 1500 must be used properly so that each process can run effectively. Accordingly, the aggregated memory 1534 is not intended to illustrate how particular segments of memory are allocated (unless otherwise stated), but rather to provide a general view of the memory 20 accessible by the computer system 1500 and how such is used. The processor 1505 includes a number of functional modules including a control unit 1539, an arithmetic logic unit (ALU) 1540, and a local or internal memory 1548, sometimes called a cache memory. The cache memory 1548 typically includes a number of storage registers 1544 - 1546 in a register section. One or more internal buses 1541 2343287_1 916821_speci lodge -12 functionally interconnect these functional modules. The processor 1505 typically also has one or more interfaces 1542 for communicating with external devices via the system bus 1504, using a connection 1518. The application program 1533 includes a sequence of instructions 1531 that may 5 include conditional branch and loop instructions. The program 1533 may also include data 1532 which is used in execution of the program 1533. The instructions 1531 and the data 1532 are stored in memory locations 1528-1530 and 1535-1537 respectively. Depending upon the relative size of the instructions 1531 and the memory locations 1528-1530, a particular instruction may be stored in a single memory location 10 as depicted by the instruction shown in the memory location 1530. Alternately, an instruction may be segmented into a number of parts each of which is stored in a separate memory location, as depicted by the instruction segments shown in the memory locations 1528-1529. In general, the processor 1505 is given a set of instructions which are executed 15 therein. The processor 1505 then waits for a subsequent input, to which it reacts to by executing another set of instructions. Each input may be provided from one or more of a number of sources, including data generated by one or more of the input devices 1502, 1503, data received from an external source across one of the networks 1520, 1522, data retrieved from one of the storage devices 1506, 1509 or data 20 retrieved from a storage medium 1525 inserted into the corresponding reader 1512. The execution of a set of the instructions may in some cases result in output of data. Execution may also involve storing data or variables to the memory 1534. The disclosed pixel colour analysis arrangements use input variables 1554 that are stored in the memory 1534 in corresponding memory locations 1555-1558. The 2343287_1 916821_speci_lodge - 13 pixel colour analysis arrangements produce output variables 1561 that are stored in the memory 1534 in corresponding memory locations 1562-1565. Intermediate variables may be stored in memory locations 1559, 1560, 1566 and 1567. The register section 1544-1546, the arithmetic logic unit (ALU) 1540, and the 5 control unit 1539 of the processor 1505 work together to perform sequences of micro operations needed to perform "fetch, decode, and execute" cycles for every instruction in the instruction set making up the program 1533. Each fetch, decode, and execute cycle comprises: (a) a fetch operation, which fetches or reads an instruction 1531 from a 10 memory location 1528; (b) a decode operation in which the control unit 1539 determines which instruction has been fetched; and (c) an execute operation in which the control unit 1539 and/or the ALU 1540 execute the instruction. 15 Thereafter, a further fetch, decode, and execute cycle for the next instruction may be executed. Similarly, a store cycle may be performed by which the control unit 1539 stores or writes a value to a memory location 1532. Each step or sub-process in the processes of Figs. 2 to 14 is associated with one or more segments of the program 1533, and is performed by the register section 1544 20 1547, the ALU 1540, and the control unit 1539 in the processor 1505 working together to perform the fetch, decode, and execute cycles for every instruction in the instruction set for the noted segments of the program 1533. Typically the scanned image 130 is retained in the memory 1506 or HDD 1510 and the processing is performed by the 2343287_1 916821_speci lodge - 14 processor 1505 using the memory 1506 as temporary storage. The processed image may be stored in the HDD 1510 and displayed on the display 1514. The method of pixel colour analysis may alternatively be implemented in dedicated hardware such as one or more integrated circuits performing the functions or 5 sub functions of pixel colour analysis. Such dedicated hardware may include graphic processors, digital signal processors, field programmable gate arrays (FPGA), an application specific integrated circuit (ASIC), or one or more microprocessors and associated memories. Fig. 2 shows a flowchart of a method 200 of pixel colour analysis processing 10 according to one implementation. The processing in Fig. 2 processes each pixel of the scanned image 130 in pixel raster order. The pixels are represented in YCbCr colour space and (each channel ranges from 0 to 255). The input scanned document image 130 in Fig. I is also simply referred to as "input image" or "document image". The process 200 operates to detect and remove extraneous colours in a scanned 15 document image. The process 200 is preferably implemented as an application program, typically stored in the HDD 1510 and read and executed by the processor 1505 in concert with temporary or intermediate storage of pixel process values and variables in the memory 1506. The processing begins with the processor 1505 performing a gradient detection process 210 to create a gradient map representation of the document image to 20 determine gradient pixels in the document image. Pixels that are not identified as gradient pixels are classified as non-gradient pixels. Gradient detection is used to detect significant colour changes in an image and therefore is used by the gradient detection process 210 to detect significant colour transition in the document image. Gradient pixels that are found in the vicinity of colour transition are most likely to represent extraneous 2343287_1 916821_specilodge - 15 colours. This gradient detection process 210 is expanded in Fig. 3, and is described below. The gradient map is stored in the memory 1506 so that it can be retrieved for later use. Next, in a classification process 220, the processor 1505 analyses the gradient map 5 and classifies each pixel as either transitional pixel or non-transitional pixel. The classification can be stored in the memory 1506 associated with the input image. Transitional pixels are pixels in the vicinity of colour transitions, and are subject to extraneous colours. Similarly, gradient pixels are pixels that are found in the vicinity of colour transitions. Therefore, most gradient pixels are transitional pixels, but not all are 10 transitional pixels. Gradient pixels that belong to small features may not be transitional pixels. Small features such as thin lines and thin text strokes are important features in document analysis systems. Gradient detection process 210 tends to misclassify small features as gradient pixels. This has a disadvantage if small features are considered as transitional 15 pixels and subsequently removed from the document image, resulting in small feature loss. Therefore, the classification process 220 includes a small feature recovery process to recover small features from gradient pixels. The remaining gradient pixels that are not recovered from small feature recovery process are classified as transitional pixels. The classification process 220 is expanded in Fig. 4, and is described below. 20 Next, a colour space histogram generation step 230 executed by the processor 1505 generates a colour space histogram representation of the document image, using only non-transitional pixels and thus corresponding to the colour composition information from non-transitional pixels. This colour space histogram is represented by a limited set of colours that do not contain extraneous colours because transitional pixels 2343287_1 916821_speci lodge -16 are excluded. This colour space histogram addresses the problem where dominant colours within the document image are obscured by extraneous colours due to very similar statistics, such as pixel count, between some dominant colours and extraneous colours. The absence of extraneous colours from the colour space histogram reduces the 5 complexity of the document image but retains semantically significant colours for effective document analysis. Dominant colour selection is also made simpler and more accurate without the extraneous colours. The histogram is desirably stored in the memory 1506. As each non-transitional pixel has a corresponding a limited set of colours, the colour composition of the document image is represented by limited sets of colours. 10 Next, a mapping step 240 maps each non-transitional pixel to a colour from the limited set of colours created from the colour space histogram generation step 230. The mapping step 240 is executed by the processor 1505 and ensures that all non-transitional pixels are represented by a colour from the limited set of colours, as stored in the memory 1506, that do not contain extraneous colours. The mapped non-transitional 15 pixels are required by a correction process 250 to search for candidate source replacement pixels, and is described below. In a preferred implementation, the mapping step 240 maps each non-transitional pixel to a colour from the limited set of colours with the closest colour distance. Finally, in the correction process 250, the processor 1505 corrects each 20 transitional pixel by replacing it with a source replacement pixel. When replacing a pixel, a colour of the source replacement pixel is used as a colour value for the transitional pixel, and the replacement is performed by copying the colour value from one pixel to the other. The source replacement pixel for each transitional pixel is selected from one of the mapped non-transitional pixels in the vicinity of the transitional pixel, for example as 2343287_1 916821_speci_lodge -17 obtained from the memory 1506. The correction process 250 effectively replaces extraneous colours with a better choice colour from surrounding non-extraneous colours. This prevents the creation of additional intermediate colour regions between two flat regions, and improves the connected component analysis within any associated document 5 analysis system. The correction process 250 is expanded in Fig. 10, and is described below. The processing flow described in Fig. 2 can also be applied to a document image that has been tiled, preferably in tile raster order. Tiling can be achieved by partitioning the document image into non-overlapping, uniform sized tiles, preferably of size 32 x 32 10 pixels. This form of processing is used for efficiency purposes. Alternatively, non-fixed size tiles may be used. Gradient detection Fig. 3 is a flowchart illustrating the gradient detection process 210 as described in Fig. 2 which produces a gradient map of the document image. This involves applying the 15 gradient detection process 210 to the luminance channel of a current pixel being processed. The process 210 begins with a horizontal gradient component computation step 310 in which the processor 1505 convolves the current pixel with a horizontal gradient filter Fx to obtain the horizontal gradient component GX of the current pixel, as 20 part of the colour composition analysis. Then, in a vertical gradient component computation step 320, the processor 1505 convolves the current pixel with a vertical gradient filter Fy to obtain the vertical gradient component GY of the current pixel. The gradient component computation steps 310 and 320 can be processed in a reverse order without affecting the results. 2343287_1 916821_speci_lodge - 18 There are many variants of gradient filters, such as the first and second derivatives gradient filters, which are available in a combination of various kernel sizes. An example of a first derivative gradient filter is the Sobel operator. An example of a second derivative gradient filter is the Laplacian of Gaussian (LoG) filter. The gradient 5 component computation steps 310 and 320 are not constrained to the gradient filter types and the kernel sizes. In a preferred implementation, the horizontal gradient component computation step 310 uses a first derivative horizontal gradient filter Fx with kernel size of lx3 pixels, and the vertical gradient component computation step 320 uses a first derivative vertical gradient filter Fy with kernel size of 3xl pixels. The gradient filters 10 are shown below: Fx=[-1 0 1] Eq. I Fy= 0 Eq. 2 Pixels along the boundaries of the document image may be treated differently depending on the gradient filter's kernel size. If one-dimensional gradient filters are used, 15 such as described in Eq. 1 and Eq. 2, vertical gradient components of the pixels along the top and bottom boundaries of the document image can be ignored and set to 0. Similarly, the horizontal gradient components of the pixels along the left and right boundaries of the document image can be ignored and set to 0. If two-dimensional gradient filters are used, such as the Sobel operators, missing pixels can be replaced by duplicating the boundary 20 pixels. Top boundary pixels can extend upwards, left boundary pixels can extend towards the left, right boundary pixels can extend towards the right and bottom boundary pixels can extend downwards, with respect to the document image. 2343287_1 916821_speci Jodge - 19 All corner pixels except the corner pixel to the top left of the document image are treated similarly to the boundary pixels. The vertical and horizontal gradient components of the top left corner pixel must be set to 0 so that the corner pixel is eventually classified as a non-transitional pixel during the classification process 220 and subsequently used by 5 the correction process 250, as shown in Fig. 2. This requirement is a result of pixel raster order processing. The correction process 250 searches for candidates source replacement pixels from surrounding non-transitional pixels, and assumes the pixels in the rows above and pixels left of the current pixel are non-transitional pixels. After steps 310 and 320, a pixel classification step 330 classifies the current pixel 10 as a gradient pixel or non-gradient pixel based on the magnitude of the gradient components using a thresholding technique. The selection of the threshold is dependent on the type of gradient filter and the application. As such, thresholds can be applied individually to the magnitude of each of the gradient components GX and GY, or be applied to the magnitude of the hypotenuse GXY of gradient components GX and GY 15 using the Pythagoras' theorem. The hypotenuse of gradient components GX and GY is shown below: GXY= GX 2
+GY
2 Eq. 3 In a preferred implementation, the threshold is applied to the magnitude of the hypotenuse GXY of the gradient components GX and GY. The current pixel is classified 20 as a gradient pixel when the magnitude of the hypotenuse GXY is greater than or equal to 30. Otherwise, the current pixel is classified as a non-gradient pixel. The processing steps 310, 320 and 330 produce a vector GX, GY, gradient pixel classification for each pixel in pixel raster order. These vectors make up the gradient map of the document image at the end of gradient detection process 210 in Fig. 2. 2343287_1 916821_specijlodge - 20 Classify pixels as transitional pixels or non-transitional pixels Fig. 4 is a flowchart illustrating the classification process 220 shown in Fig. 2. This classification process 220 processes every pixel in pixel raster order and classifies every pixel as a transitional pixel or as a non-transitional pixel. This classification 5 process 220 includes a small feature recovery process to recover small features from gradient pixels. The small feature recovery is required because the gradient detection technique tends to misclassify small features as gradient pixels representing extraneous colours, when they are actually not extraneous colours. The small feature recovery process involves a single pixel line recovery process 450 and a double pixel line recovery 10 process 470. The double pixel line recovery process 470 may classify both the current pixel and an adjacent pixel. Therefore, the classification process 220 does not need to process the or any adjacent pixel that has been classified, and may skip to the next unclassified pixel in pixel raster order. This classification process 220 begins with a first classification test 410 which 15 checks whether the current pixel has previously been classified as transitional or non transitional pixel. If the current pixel has already been classified, the current processing finishes and proceeds to the next pixel. Otherwise, a next gradient test 420 is carried out to determine whether the current pixel is a gradient pixel or non-gradient pixel, by referring to the gradient map produced 20 in the gradient detection process 210 in Fig. 2. If the current pixel is a non-gradient pixel, it is classified as a non-transitional pixel in step 430 and the processing proceeds to the next pixel. If the current pixel is a gradient pixel, the processing proceeds to computing the gradient orientation step 440 in preparation for small feature recovery processing. 2343287_1 916821_speci lodge -21 The gradient orientation step 440 calculates the gradient orientation of the current pixel. The gradient orientation is required by small feature recovery processing and other later processing stages. The definition of gradient orientations is shown in Fig. 5, and is described below. The gradient orientation of the current pixel is incorporated into the 5 gradient map of the document image created at the end of gradient detection process 210 in Fig. 2. Next, the processing flow proceeds to small feature recovery processing, as described below. The small feature recovery processing flow begins with single pixel line recovery process 450. The single pixel line recovery process 450 attempts to recover a single pixel 10 line feature by the processor 1505 evaluating the pixels surrounding the current pixel. If a single pixel line is recognised, the current pixel is classified as non-transitional pixel. The single pixel line recovery process 450 is expanded in Fig. 6, and is described below. Then, a second classification test 460 is carried out to identify whether the current pixel has been classified as non-transitional pixel by the single pixel line recovery 15 process 450. If the current pixel is classified as a non-transitional pixel, the current processing finishes and proceeds to the next pixel. Otherwise, the current pixel is further processed by the double pixel line recovery 470 process. The double pixel line recovery process 470 attempts to recover a double pixel line feature by evaluating the pixels surrounding the current pixel. If a double pixel line is recognised, the current pixel and 20 an adjacent pixel are both classified as non-transitional pixels. The double pixel line recovery process 470 and the classification of pixels within the process 470 are expanded in Fig. 8, and is described below. The classification process in Fig. 4 proceeds to the next pixel until all pixels have been classified. All transitional pixels classified in this classification process in Fig. 4 2343287_1 916821_speci_lodge -22 retain the same mapping to the gradient map as the gradient pixels for use in later processing stages. The non-transitional pixels do not require the gradient map. The extent of small feature recovery processing is dependent on the kernel size of the gradient filter used in gradient detection process 210 in Fig. 2. If a gradient filter with 5 larger kernel size is used, such as a filter with a kernel of 5x5 pixels, the small feature recovery processing may extend to a triple pixel line recovery or quadruple pixel line recovery. In a preferred implementation, the small feature recovery processing includes only a single pixel line recovery process 450 and a double pixel line recovery process 470. 10 Gradient orientation Fig. 5 illustrates a definition of gradient orientations used in the presently described arrangements. A two dimensional representation of a pixel 510 is shown. Each gradient pixel can be represented by one of four gradient orientations. The horizontal gradient orientation 520 is along the left and right axis. The diagonal (TR-BL) gradient 15 orientation 521 is along the top-right and bottom-left axis. The vertical gradient orientation 522 is along the top and bottom axis, and the diagonal (TL-BR) gradient orientation 523 is along the top-left and bottom-right axis. Each gradient orientation spans a 45 degree angle. The relationship between each gradient orientation and the angle in degrees is described below: 2343287_1 916821_speci_lodge - 23 337.5 degrees < Horizontal < 22.5 degrees Eq. 4 157.5 degrees < Horizontal < 202.5 degrees Eq. 5 22.5 degrees < Diagonal (TR-BL) 5 67.5 degrees Eq. 6 202.5 degrees < Diagonal (TR-BL) 5 247.5 degrees Eq. 7 5 67.5 degrees < Vertical < 112.5 degrees Eq. 8 247.5 degrees < Vertical < 292.5 degrees Eq. 9 112.5 degrees < Diagonal (TL-BR) 5 157.5 degrees Eq. 10 292.5 degrees < Diagonal (TL-BR) s 337.5 degrees Eq. 11 The gradient orientation may be calculated in degrees using Eq. 12 shown below: 10 Angle in degrees = arctan(GY / GX) Eq. 12 Single pixel line recovery Fig. 6 is a flowchart illustrating the single pixel line recovery process 450 as described in Fig. 4. The processing begins with a luminance difference detection step 610 where the luminance differences between the current pixel and adjacent pixels are 15 computed by the processor 1505. The choice of adjacent pixels is determined from the gradient orientation of the current pixel, and is described in Fig. 7 below. Then, a single line test 620 determines whether the luminance differences meet the criteria of a single pixel line. If the criteria of a single pixel line are met, the first single pixel line classification step 630 classifies the current pixel as a non-transitional pixel. Otherwise, 20 the second single pixel line classification step 640 classifies the current pixel as a transitional pixel. Then, the single pixel line recovery process 450 finishes. The criteria of a single pixel line are further described in Fig. 7 below. Fig. 7 is an example demonstrating how single pixel line recovery works. A pixel map 710 shows three pixels located adjacent to each other in the document image. 2343287_1 916821_specilodge - 24 The steps below test whether the current pixel 740 resembles a single pixel line. The vertical axis 730 of the pixel map 710 represents the luminance of the pixels 740, 741 and 742 while the horizontal axis 720 represents the location of the pixels 740, 741 and 742. In general, the processing occurs in raster scan fashion. Pixel 740 (the current 5 pixel) is always in the current scan line. The location of pixels 741 and 742 depends on the gradient orientation of current pixel, and is defined around lines 20 in the next page. For example: Horizontal gradient: 741, 742 are in current scan line. Vertical & both diagonal gradients: 741 is in scan line above, 742 is in scan line below. A first luminance difference 750 between the current pixel 740 and a first adjacent 10 pixel 741 is computed. Then a second luminance difference 760 between the current pixel 740 and a second adjacent pixel 742 is computed. The current pixel 740 meets the criteria of a single pixel line when the following conditions are met: (I) First condition: The luminance level of the current pixel 740 is higher or lower than both the luminance levels of the first adjacent pixel 741 and second 15 adjacent pixel 742, i.e. the luminance level of pixel 740 is not between the luminance levels of pixels 741 and 742; and (II) The first luminance difference 750 and second luminance difference 760 meet either one of the following conditions: (i) Second condition: The first luminance difference 750 is greater 20 than a first larger threshold and the second luminance difference 760 is greater than a second smaller threshold; and/or (ii) Third condition: The first luminance difference 750 is greater than a second smaller threshold and the second luminance difference 760 is greater than a first larger threshold; 2343287_1 916821_speci_lodge -25 In a preferred implementation, the first larger threshold is set or otherwise predetermined to be 30 and the second smaller threshold is set or otherwise predetermined to be 10 when the luminance channel is 8 bits. The choice of first adjacent pixel 741 and second adjacent pixel 742 is based on a retrieval of the gradient orientation 5 of the current pixel 740 computed in gradient orientation step 440 in Fig. 4. They are described here: (a) Gradient orientation: Horizontal (i) First adjacent pixel 741 is the pixel left of the current pixel 740. (ii) Second adjacent pixel 742 is the pixel right of the current pixel 740. 10 (b) Gradient orientation: Diagonal (TR-BL) (i) First adjacent pixel 741 is the pixel top-right of the current pixel 740. (ii) Second adjacent pixel 742 is the pixel bottom-left of the current pixel 740. (c) Gradient orientation: Vertical (i) First adjacent pixel 741 is the pixel top of the current pixel 740. 15 (ii) Second adjacent pixel 742 is the pixel bottom of the current pixel 740. (d) Gradient orientation: Diagonal (TL-BR) (i) First adjacent pixel 741 is the pixel top-left of the current pixel 740. (ii) Second adjacent pixel 742 is the pixel bottom-right of the current pixel 740. The first adjacent pixel 741 and second adjacent pixel 742 for each gradient 20 orientation can also be swapped without any issues arising. Single pixel line recovery may not be required at the boundaries of the document image. Double pixel line recovery Fig. 8 is a flowchart illustrating the double pixel line recovery process 470 as described in Fig. 4. The processing begins with a recovery mode detection step 810 2343287_1 916821 specilodge - 26 which deduces the double pixel line recovery modes that should be enabled. The double pixel line recovery modes are based on a retrieval of the gradient orientation of the current pixel computed in gradient orientation step 440 in Fig. 4. The two applicable recovery modes are horizontal recovery mode and vertical recovery mode, and are 5 described in TABLE 1. TABLE 1 Gradient Orientation Double pixel line recovery modes Enable horizontal Enable vertical recovery mode recovery mode Horizontal Yes No Diagonal (TR-BL) Yes Yes Vertical No Yes Diagonal (TL-BR) Yes Yes The process 470 proceeds to a first recovery mode test 820 to check whether a horizontal recovery mode is enabled. If the horizontal recovery mode is not enabled, the 10 processing continues to a second recovery mode test 830. Otherwise, the processing proceeds to a first luminance difference computation step 821, where the luminance differences between the current pixel and adjacent pixels, discussed above, are computed. The choice of adjacent pixels used in the first luminance difference computation step 821 is determined from the gradient orientation of the current pixel, and is described in Fig. 9 15 below. Following the first luminance difference computation step 821, a first double line test 822 determines whether the luminance differences computed in the first luminance difference computation step 821 meet the criteria of a double pixel line. If the criteria of a double pixel line are met, a first double pixel line classification step 823 then classifies 2343287_1 916821_speci-lodge - 27 both the current pixel and the adjacent pixel of the current pixel as non-transitional pixels. Otherwise, the processing continues to the second recovery mode test 830. The criteria of a double pixel line are further described in Fig. 9 below. Next, the second recovery mode test 830 is carried out to check whether a vertical 5 recovery mode is enabled. If the vertical recovery mode is not enabled, the double pixel line recovery process 470 finishes. Otherwise, the processing proceeds to a second luminance difference computation step 831, where the luminance differences between the current pixel and adjacent pixels are computed, as discussed above. The choice of adjacent pixels used in the second luminance difference computation step 831 is 10 determined from the gradient orientation of the current pixel, and is described in Fig. 9 below. Following the second luminance difference computation step 831, a second double line test 832 determines whether the luminance differences computed in the second luminance difference computation step 831 meet the criteria of a double pixel line. If the criteria are met, the second double pixel line classification step 833 classifies 15 both the current pixel and the adjacent pixel below the current pixel as non-transitional pixels. Otherwise, the double pixel line recovery process 470 finishes. The criteria of a double pixel line are further described in Fig. 9 below. Fig. 9 is an example demonstrating how double pixel line recovery works. A pixel map 910 shows four pixels adjacent to each other in the document image. The 20 steps described below test whether a current pixel 940 and a first adjacent pixel 941 resemble a double pixel line. The vertical axis 930 of the pixel map 910 represents the luminance of the pixels 940 - 943, while the horizontal axis 920 represents location of the pixels 940 - 943. Based on recovery modes defined in TABLE 1, if horizontal recovery mode is enabled, 940-943 are all in current scan line. If vertical recovery mode 2343287_1 916821_spedlodge - 28 is enabled, 940 is in current scan line, 942 in scan line above, 941 is in scan line below, 942 is in two scan lines below the current scan line. Unlike single pixel line recovery, double pixel line recovery can have both recovery modes ACTIVE at the same time. A first luminance difference 950 between the current pixel 940 and a first adjacent 5 pixel 941 is computed. Then, a second luminance difference 960 between the first adjacent pixel 941 and a second adjacent pixel 942 is computed. Finally, a third luminance difference 970 between the current pixel 940 and a third adjacent pixel 943 is computed. The current pixel 940 and the first adjacent pixel 941 meet the criteria of a double pixel line when the following conditions are met: 10 (i) First condition: The luminance levels of the current pixel 940 and the first adjacent pixel 941 are both higher or lower than the luminance levels of the second adjacent pixel 942 and the third adjacent pixel 943; (ii) Second condition: The first luminance difference is less than a first threshold; and 15 (iii) Third condition: The second luminance difference 960 and third luminance difference 970 are both greater than a second threshold. In a preferred implementation, the first threshold is set to 25 and the second threshold is set to 30 when the luminance channel is 8 bits. The choice of adjacent pixels used in the first luminance difference computation step 821 for the horizontal recovery 20 mode and the second luminance difference computation step 831 for the vertical recovery mode in Fig. 8 are described below. For the horizontal recovery mode, the first adjacent pixel 941 is the pixel to the right of the current pixel 940. The second adjacent pixel 942 is the pixel to the left of the 2343287_1 916821_speci_lodge - 29 current pixel 940, and the third adjacent pixel 943 is the pixel to the right of the second adjacent pixel 942. For the vertical recovery mode, the first adjacent pixel 941 is the pixel bottom of the current pixel 940. The second adjacent pixel 942 is the pixel top of the current 5 pixel 940, and the third adjacent pixel 943 is the pixel bottom of the second adjacent pixel 942. Double pixel line recovery may not be required near the boundaries of the document image. Correcting transitional pixels 10 Fig. 10 is a flowchart illustrating the process 250 for correcting transitional pixels as seen in Fig. 2. The processing in Fig. 10 processes each transitional pixel in pixel raster order and is repeated for each transitional pixel. All non-transitional pixels are skipped in pixel raster order. The processing 250 begins with a gradient intensity derivation step 1010 where 15 the processor 1505 operates to derive the gradient intensity change for each transitional pixel. TABLE 2 describes the outputs of the gradient intensity derivation step 1010. TABLE2 Information from gradient map Derived information Gradient Orientation Polarity Polarity Gradient of GX of GY Intensity Change Horizontal Positive Don't care TOBRIGHT Negative Don't care TODARK Diagonal (TR-BL) Positive Positive TODARK Negative Negative TOBRIGHT Vertical Don't care Positive TODARK Don't care Negative TOBRIGHT 2343287_1 916821_speci lodge -30 Diagonal (TL-BR) Positive Negative TOBRIGHT Negative Positive TODARK The first three columns of TABLE 2 describe the possible combinations of gradient orientation, polarity of horizontal gradient component GX and polarity of vertical gradient component GY for each transitional pixel. The gradient intensity change for each 5 transitional pixel is derived from the combinations of GX and GY and is represented by two values, TOBRIGHT or TODARK. A transitional pixel with horizontal gradient orientation and gradient intensity change TOBRIGHT implies that the pixel to the right of the transitional pixel is brighter than the pixel to the left of the transitional pixel. Similarly, a transitional pixel with 10 horizontal gradient orientation and gradient intensity change TODARK implies that the pixel to the right of the transitional pixel is darker than the pixel to the left of the transitional pixel. A transitional pixel with diagonal (TR-BL) gradient orientation and gradient intensity change TOBRIGHT implies that the pixel to the bottom-left of the transitional 15 pixel is brighter than the pixel to the top-right of the transitional pixel. Similarly, a transitional pixel with diagonal (TR-BL) gradient orientation and gradient intensity change TODARK implies that the pixel to the bottom-left of the transitional pixel is darker than the pixel to the top-right of the transitional pixel. A transitional pixel with vertical gradient orientation and gradient intensity change 20 TOBRIGHT implies that the pixel to the bottom of the transitional pixel is brighter than the pixel to the top of the transitional pixel. Similarly, a transitional pixel with vertical gradient orientation and gradient intensity change TODARK implies that the pixel to the bottom of the transitional pixel is darker than the pixel to the top of the transitional pixel. 2343287_1 916821_speci_lodge -31 A transitional pixel with diagonal (TL-BR) gradient orientation and gradient intensity change TOBRIGHT implies that the pixel to the bottom-right of the transitional pixel is brighter than the pixel to the top-left of the transitional pixel. Similarly, a transitional pixel with diagonal (TL-BR) gradient orientation and gradient intensity 5 change TODARK implies that the pixel to the bottom-right of the transitional pixel is darker than the pixel to the top-left of the transitional pixel. Once the gradient intensity change of the transitional pixel is determined in step 1010, a source replacement pixel selection process 1020 determines a best source replacement pixel for the transitional pixel. The source replacement pixel selection 10 process 1020 is expanded in Fig. 11, and is described below. After step 1020, a replacement step 1030 is executed during which the processor 1505 replaces the transitional pixel with the source replacement pixel determined from the source replacement pixel selection process 1020. Finally, execution of a further classification step 1040 re-classifies the replaced transitional pixel as a non-transitional pixel so that it 15 can be used as a probable source replacement pixel for next transitional pixel. The processing flow in Fig. 10 proceeds to the next transitional pixel until all transitional pixels are corrected. Source replacement pixel selection Fig. 11 is a flowchart illustrating a process of step 1020 for determining a source 20 replacement pixel for each transitional pixel. The process 1020 employs three modes of selecting two candidate replacement pixels, which are carried out in sequence by the processor 1505 executing the application program. The first mode is a neighbourhood based mode 1110 which selects two candidate replacement pixels from four pairs of adjacent pixels in designated locations according to 2343287_1 916821_speci_lodge - 32 the gradient orientation of the transitional pixel. The first mode is shown in Fig. 12. Then a first test 1120 checks whether both of the candidate replacement pixels are non transitional pixels. If both of the candidate replacement pixels are non-transitional pixels, the processing proceeds to a source replacement pixel determination step 1160. 5 Otherwise, the processing proceeds to a second mode. The second mode is a prediction based mode 1130 which selects two candidate replacement pixels from pixels in designated locations according to the gradient orientation of the transitional pixel. The second mode is shown in Fig. 13. The first candidate replacement pixel is selected from a designated location according to the 10 gradient orientation of the transitional pixel. The second candidate replacement pixel is selected based on a set of criteria, and is described now. A set of pixels from non transitional pixels in the designated locations according to the gradient orientation of the transitional pixel is selected. Next, a brightest or a darkest pixel from the set of pixels is selected according to the gradient intensity change of the transitional pixel as described in 15 TABLE 2. If the gradient intensity change is TOBRIGHT, the brightest pixel from the set of pixels is selected as the second candidate replacement pixel. If the gradient intensity change is TODARK, the darkest pixel from the set of pixels is selected as the second candidate replacement pixel. Then, a second test 1140 verifies whether the prediction based mode 1130 is 20 successful, by evaluating the first and second candidate replacement pixels according to the gradient intensity change of the transitional pixel. If the gradient intensity change is TOBRIGHT, the prediction based mode 1130 is successful when the second candidate replacement pixel is brighter than the first candidate replacement pixel. If the gradient intensity change is TODARK, the prediction based mode 1130 is successful when the 2343287_1 916821.specilodge - 33 second candidate replacement pixel is darker than the first candidate replacement pixel. If the prediction based mode 1130 is successful, the process proceeds to source replacement pixel determination step 1160. Otherwise, the process proceeds to a third mode. 5 The third mode is a fallback mode 1150 which selects two candidate replacement pixels from eight adjacent pixels in designated locations surrounding the transitional pixel. The third mode is shown in Fig. 14. A brightest non-transitional pixel and a darkest non-transitional pixel are selected from the eight adjacent pixels as the first and second candidate replacement pixels. Then, the fallback mode 1150 proceeds to the 10 source replacement pixel determination step 1160. The source replacement pixel determination step 1160 selects from the two candidate replacement pixels, the pixel with a closer colour distance to the transitional pixel as the source replacement pixel. The process as described in Fig. 11 does not imply a fixed sequence of processing 15 for the three modes. The neighbourhood based mode 1110 and prediction based mode 1130 could also be processed in a reverse order. The sequence of processing could also be varied for each transitional pixel. Figs. 12, 13 and 14 illustrate three modes of selecting two candidate replacement pixels for determining a source replacement pixel as described in Fig. 11. The 20 descriptions below make use of a coordinate system (column, row) to explain the location of candidate replacement pixels, with reference to the transitional pixel. The transitional pixels described in Figs. 12, 13 and 14 are assumed to have a coordinate of (0,0). A positive column coordinate denotes a location that is to the right of the transitional pixel, 2343287_1 916821_speci_lodge - 34 and a positive row coordinate denotes a location that is to the bottom of the transitional pixel. Figs. 12A - 12D describe the locations of the two candidate replacement pixels for neighbourhood based mode 1110 as described in Fig. II according to the gradient 5 orientation of the transitional pixel. A first pixel map 1210 of Fig. 12A shows the designated locations of the candidate replacement pixels for horizontal gradient orientation. The first candidate replacement pixel 1212 with coordinate (-1,0) is the pixel to the left of the transitional pixel 1211. The second candidate replacement pixel 1213 with coordinate (1,0) is the 10 pixel to the right of the transitional pixel 1211. A second pixel map 1220 of Fig. 12B shows the designated locations of the candidate replacement pixels for diagonal (TR-BL) gradient orientation. The two candidate replacement pixels are pixels with coordinates (1,-1) and (-1,1). A third pixel map 1230 of Fig. 12C shows the designated locations of the 15 candidate replacement pixels for vertical gradient orientation. The two candidate replacement pixels are pixels with coordinates (0,-1) and (0,1). A fourth pixel map 1240 of Fig. 12D shows the designated locations of the candidate replacement pixels for diagonal (TL-BR) gradient orientation. The two candidate replacement pixels are pixels with coordinates (-1,-1) and (1,1). 20 Figs. 13A - 13D describe the designated locations of the candidate replacement pixels for prediction based mode 1130 as described in Fig. 11 according to the gradient orientation of the transitional pixel. A first pixel map 1310 of Fig. 13A shows the designated locations of the candidate replacement pixels for horizontal gradient orientation. The first candidate 2343287_1 916821_speci_lodge - 35 replacement pixel 1312 with coordinate (-1,0) is the pixel to the left of the transitional pixel 1311. The set of pixels where the second candidate replacement pixel is selected from are pixels 1313 with coordinates (1,-I), (1,1), (2,-1), (2,0) and (2,1). A second pixel map 1320 of Fig. 13B shows the designated locations of the 5 candidate replacement pixels for diagonal (TR-BL) gradient orientation. The first candidate replacement pixel is the pixel with coordinate (1,-1). The set of pixels where the second candidate replacement pixel is selected from are pixels with coordinates (-1,0), (0,1), (-2,0), (0,2), (-2,1) and (-1,2). A third pixel map 1330 of Fig. 13C shows the designated locations of the 10 candidate replacement pixels for vertical gradient orientation. The first candidate replacement pixel is the pixel with coordinate (0,-1). The set of pixels where the second candidate replacement pixel is selected from are pixels with coordinates (-1,1), (1,1), ( 1,2), (0,2) and (1,2). A fourth pixel map 1340 of Fig. 13D shows the designated locations of the 15 candidate replacement pixels for diagonal (TL-BR) gradient orientation. The first candidate replacement pixel is the pixel with coordinate (-1,-i). The set of pixels where the second candidate replacement pixel is selected from are pixels with coordinates (1,0), (0,1), (2,0), (0,2), (2,1) and (1,2). Fig. 14 illustrates the designated locations of the adjacent pixels from where 20 candidate replacements pixels are selected, for the fallback mode 1150 as described in Fig. 11. The eight adjacent pixels that surround the transitional pixel 1411 are pixels 1412 with coordinates (-1,-I), (-1,0), (-1,1), (0,1), (1,1), (1,0), (1,-1) and (0,-I). Summary 2343287_1 916821_speci_lodge -36 The net effect of the processing described above is an output document image that has rejected erroneous and intermediate colour levels and artefacts between two solid colour regions during colour histogram creation, and thus has be analysed permitting classification. This affords improved purity of colours and improved processing accuracy 5 and performance for later document classification stages. This is due to a significantly reduce number of colours for subsequent processing and improved statistics for important (dominant) colours. INDUSTRIAL APPLICABILITY The arrangements described are applicable to the computer and data processing 10 industries and particularly for the document image processing and analysis. The foregoing describes only some embodiments of the present invention, and modifications and/or changes can be made thereto without departing from the scope and spirit of the invention, the embodiments being illustrative and not restrictive. (Australia Only) In the context of this specification, the word "comprising" 15 means "including principally but not necessarily solely" or "having" or "including", and not "consisting only of'. Variations of the word "comprising", such as "comprise" and "comprises" have correspondingly varied meanings. 20 2343287_1 916821_specilodge

Claims (18)

1. A computer implemented method of analysing colour composition in an image of a document, the computer including at least a memory for storing the image and a 5 processor configured to execute the method, the method comprising the steps of: (a) performing gradient detection on said image to produce a gradient map; (b) analysing said gradient map to classify pixels of said image into transitional pixels and non-transitional pixels; and (c) generating a colour space histogram corresponding to a colour 10 composition of said non-transitional pixels, wherein colour composition is represented by limited sets of colours.
2. The method of claim 1, wherein the gradient detection step (a) produces a gradient map for each pixel of said image, said gradient map comprising a horizontal gradient 15 component, a vertical gradient component and a classification of gradient pixel or non gradient pixel, the gradient detection step comprising the steps of: (aa) applying a horizontal gradient filter to obtain a horizontal gradient component; (ab) applying a vertical gradient filter to obtain a vertical gradient component; 20 and (ac) thresholding the horizontal and vertical gradient components to obtain a classification of gradient pixel or non-gradient pixel.
3. The method of claim 1, wherein the analysing step (b) comprises the steps of: 2343287_1 916821_speci_lodge -38 (ba) classifying non-gradient pixels as non-transitional pixels; and (bb) for each gradient pixel, further classifying each said gradient pixel into non-transitional or transitional pixel, the further classifying comprising the steps of: (bb-i) calculating gradient orientation using horizontal and vertical 5 gradient components; and (bb-ii) classifying said gradient pixel into non-transitional or transitional pixel based on gradient orientation and luminance differences to adjacent pixels.
4. A method according to claim 1, wherein step (a) comprises performing said 10 gradient detection on each pixel of said image in a raster fashion and step (c) comprises storing the colour space histogram to a memory.
5. A method of removing transitional colours in an image of a document, the method comprising the steps of: 15 (1) analysing colour composition in an image of a document according to the method of any one of claims I to 3; (2) mapping each said non-transitional pixel to one of the colours in said limited set of colours; (3) determining a source replacement pixel from the non-transitional pixels 20 for a transitional pixel; and (4) replacing a colour of said transitional pixel with a colour of the determined source replacement pixel.
6. A method according to claim 5, further comprising the step of: 2343287_1 916821_speci_lodge -39 (5) reclassifying the replaced transitional pixel as a non-transitional pixel and repeating steps (3) to (4) for a further transitional pixel.
7. The method of claim 5, wherein the determining step (3) comprises, for each 5 transitional pixel, the steps of: (3a) retrieving said gradient orientation; (3b) searching for two candidate replacement pixels based on said gradient orientation; and (3c) selecting from said two candidate replacement pixels, the pixel with closer 10 colour distance to said transitional pixel as the source replacement pixel.
8. The method of claim 5, wherein the determining step (3) comprises, for each transitional pixel, the steps of: (3a) retrieving said gradient map and gradient orientation; 15 (3b) deriving gradient intensity change from said gradient map and gradient orientation; (3c) searching for two candidate replacement pixels based on said gradient orientation and gradient intensity change; and (3d) selecting from said two candidate replacement pixels, the pixel with closer 20 colour distance to said transitional pixel as the source replacement pixel.
9. A computer readable storage medium having a program recorded thereon, the program being executable by computer apparatus to analyse colour composition in an image of a document, the program comprising: 2343287_1 916821_specilodge - 40 (a) code for performing gradient detection on said image to produce a gradient map; (b) code for analysing said gradient map to classify said image into transitional pixels and non-transitional pixels; and 5 (c) code for generating a colour space histogram corresponding to a colour composition of said non-transitional pixels, wherein colour composition is represented by limited sets of colours.
10. The computer readable storage medium of claim 9, wherein code for gradient 10 detection produces a gradient map for each pixel of said image, said gradient map comprising a horizontal gradient component, a vertical gradient component and a classification of gradient pixel or non-gradient pixel, the code for gradient detection step comprising: (aa) code for applying a horizontal gradient filter to obtain a horizontal gradient 15 component; (ab) code for applying a vertical gradient filter to obtain a vertical gradient component; and (ac) code for thresholding the horizontal and vertical gradient components to obtain a classification of gradient pixel or non-gradient pixel. 20
11. The computer readable storage medium of claim 9, wherein the code for analysing comprises: (ba) code for classifying non-gradient pixels as non-transitional pixels; and 2343287_1 916821_speci_lodge -41 (bb) code, for each gradient pixel, for further classifying each said gradient pixel into non-transitional or transitional pixel, the code for further classifying comprising: (bb-i) code for calculating gradient orientation using horizontal and 5 vertical gradient components; and (bb-ii) code for classifying said gradient pixel into non-transitional or transitional pixel based on gradient orientation and luminance differences to adjacent pixels. 10
12. A computer readable storage medium having a program recorded thereon, the program be executable by computer apparatus to remove transitional colours in an image of a document, the program comprising: (1) code for analysing colour composition in an image of a document, said code for analysing comprising: 15 (a) code for performing gradient detection on said image to produce a gradient map; (b) code for analysing said gradient map to classify said image into transitional pixels and non-transitional pixels; and (c) code for generating a colour space histogram corresponding 20 to a colour composition of said non-transitional pixels, wherein colour composition is represented by limited sets of colours; (2) code for mapping each non-transitional pixel to one of the colours in a corresponding said limited set of colours; 2343287_1 916821_specijlodge -42 (3) code for determining a source replacement pixel for each transitional pixel; and (4) code for replacing said transitional pixel with the source replacement pixel determined by the code for determining. 5
13. The computer readable storage medium of claim 12, wherein the code for determining comprises, code executable for each transitional pixel: (3a) for retrieving said gradient orientation; (3b) for searching for two candidate replacement pixels based on said gradient 10 orientation; and (3c) for selecting from said two candidate replacement pixels, the pixel with closer colour distance to said transitional pixel as the source replacement pixel.
14. The computer readable storage medium of claim 12, wherein the code for 15 determining comprises, code executable for each transitional pixel: (3a) for retrieving said gradient map and gradient orientation; (3b) for deriving gradient intensity change from said gradient map and gradient orientation; (3c) for searching for two candidate replacement pixels based on said gradient 20 orientation and gradient intensity change; and (3d) for selecting from said two candidate replacement pixels, the pixel with closer colour distance to said transitional pixel as the source replacement pixel. 2343287_1 916821_speci_lodge - 43
15. Computer apparatus configured to remove transitional colours in an image of a document, said computer apparatus comprising: a processor, a memory and a display device; means for analysing colour composition in an image of a document, said means 5 for analysing comprising: (a) means for performing gradient detection on said image to produce a gradient map; (b) means for analysing said gradient map to classify said image into transitional pixels and non-transitional pixels; and 10 (c) means for generating a colour space histogram corresponding to a colour composition of said non-transitional pixels, wherein colour composition is represented by limited sets of colours; means for mapping each non-transitional pixel to one of the colours in a corresponding said limited set of colours; 15 means for determining a source replacement pixel for each transitional pixel; and means for replacing said transitional pixel with the source replacement pixel determined by the code for determining.
16. A method of processing an image of a document, said method being substantially 20 as described herein with reference to any one of the embodiments as that embodiment is illustrated in the drawings.
17. Computer apparatus for performing the method of claim 16. 2343287_1 916821_speci_lodge - 44
18. A computer readable storage medium having a program recorded thereon, the program being executable by computer apparatus to perform the method of claim 15. Dated this 16th day of October 2009 5 CANON KABUSHIKI KAISHA Patent Attorneys for the Applicant Spruson&Ferguson 2343287_1 916821_sped lodge
AU2009227822A 2009-10-16 2009-10-16 A method for improved colour representation of image regions Abandoned AU2009227822A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
AU2009227822A AU2009227822A1 (en) 2009-10-16 2009-10-16 A method for improved colour representation of image regions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
AU2009227822A AU2009227822A1 (en) 2009-10-16 2009-10-16 A method for improved colour representation of image regions

Publications (1)

Publication Number Publication Date
AU2009227822A1 true AU2009227822A1 (en) 2011-05-12

Family

ID=43971580

Family Applications (1)

Application Number Title Priority Date Filing Date
AU2009227822A Abandoned AU2009227822A1 (en) 2009-10-16 2009-10-16 A method for improved colour representation of image regions

Country Status (1)

Country Link
AU (1) AU2009227822A1 (en)

Similar Documents

Publication Publication Date Title
US8031963B2 (en) Noise filter
US8768052B2 (en) Image processing apparatus, image processing method, and non-transitory computer readable medium
JP2010525486A (en) Image segmentation and image enhancement
RU2721188C2 (en) Improved contrast and noise reduction on images obtained from cameras
US7386171B2 (en) Activity detector
Savakis Adaptive document image thresholding using foreground and background clustering
JP4535584B2 (en) Digital image processing method
WO2014160433A2 (en) Systems and methods for classifying objects in digital images captured using mobile devices
JP2008148298A (en) Method and apparatus for identifying regions of different content in image, and computer readable medium for embodying computer program for identifying regions of different content in image
JP2001109895A (en) Processing method for digital images
US9176043B2 (en) Cell image analysis apparatus, cell image analysis method, and program
JP2006067585A (en) Method and apparatus for specifying position of caption in digital image and extracting thereof
US20150010233A1 (en) Method Of Improving Contrast For Text Extraction And Recognition Applications
US20180232888A1 (en) Removal of background information from digital images
US8396261B2 (en) Method for red-eye detection
JP2009032299A (en) Document image processing method, document image processor, document image processing program, and storage medium
AU2011265380B2 (en) Determining transparent fills based on a reference background colour
KR101377910B1 (en) Image processing method and image processing apparatus
JP5864936B2 (en) Image processing apparatus, image processing method, and program
AU2008264171A1 (en) Print quality assessment method
WO2021174506A1 (en) Image edge detection method and apparatus, and image signal processor
AU2018229526B2 (en) Recursive contour merging based detection of text area in an image
AU2009227822A1 (en) A method for improved colour representation of image regions
AU2014277851A1 (en) Detecting a gap between text columns from text line fragments
JP2007328652A (en) Image processing device and image processing program

Legal Events

Date Code Title Description
MK4 Application lapsed section 142(2)(d) - no continuation fee paid for the application