AU2006294425B2 - Vectorisation of colour gradients - Google Patents

Vectorisation of colour gradients Download PDF

Info

Publication number
AU2006294425B2
AU2006294425B2 AU2006294425A AU2006294425A AU2006294425B2 AU 2006294425 B2 AU2006294425 B2 AU 2006294425B2 AU 2006294425 A AU2006294425 A AU 2006294425A AU 2006294425 A AU2006294425 A AU 2006294425A AU 2006294425 B2 AU2006294425 B2 AU 2006294425B2
Authority
AU
Australia
Prior art keywords
colour
pixels
gradient
image
generating
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.)
Ceased
Application number
AU2006294425A
Other versions
AU2006294425A1 (en
Inventor
Matthew James Allen
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
Priority claimed from AU2005211665A external-priority patent/AU2005211665A1/en
Application filed by Canon Inc filed Critical Canon Inc
Priority to AU2006294425A priority Critical patent/AU2006294425B2/en
Publication of AU2006294425A1 publication Critical patent/AU2006294425A1/en
Application granted granted Critical
Publication of AU2006294425B2 publication Critical patent/AU2006294425B2/en
Ceased legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Description

WO 2007/033429 PCT/AU2006/001393 -1 VECTORISATION OF COLOUR GRADIENTS FIELD OF INVENTION The current invention relates to computer graphics and in particular to generating a vector description of colour gradients in images. 5 BACKGROUND It is often desirable to convert image data into a higher-level form. Such conversion may allow the image data to be stored more efficiently. In addition, the resultant higher-level description may be required for further processing of the image data. 10 Prior art methods for converting an image from a simple raster bitmap into a higher level form like a vector graphics description involve either leaving the colour data in bitmap form or converting small areas of similar colour to flat filled objects. In the first case where a bitmap is used for the colour data of the converted image, lots of memory is used in storing the bitmap. In the second case in which small areas 15 are converted to flat filled objects, the main problem is that rendering all the areas of flat colour is computationally expensive. An example of this is shown in Fig. 3, where shape 352 having a gradient, or blend, fill has been converted to a format in which areas of similar colour are replaced by objects with a flat colour fill. The rings of colour labelled 350 are distinct objects with no relationship in the output. Each of the rings 20 350 has a flat colour.
WO 2007/033429 PCT/AU2006/001393 -2 In both of the described cases, the resultant colour data may be difficult to edit using simple controls (for example, changing the start and/or end points for a linear gradient). In addition, the colour data consumes a non-trivial amount of memory. SUMMARY OF THE INVENTION 5 It is an object of the present invention to substantially overcome, or at least ameliorate, one or more disadvantages of existing arrangements. According to one aspect of the present invention there is provided a method of generating a vector description of a colour gradient in an image, said method comprising the steps of: 10 receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; generating, in each gradient area, a path comprising pixels having substantially the same colour; 15 determining one or more control points defining a line substantially perpendicular to the path; calculating representative colour values at points along the line; and generating a piecewise-linear colour function from the representative colour values, 20 wherein the one or more control points and the piecewise-linear colour function form said vector description of the colour gradient in the gradient area.
WO 2007/033429 PCT/AU2006/001393 -3 According to another aspect of the present invention there is provided an apparatus for generating a vector description of a colour gradient in an image, said apparatus comprising: means for receiving the image comprising an array of pixels, each pixel having 5 one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; means for generating, in each gradient area, a path comprising pixels having substantially the same colour; means for determining one or more control points defining a line substantially 10 perpendicular to the path; means for calculating representative colour values at points along the line; and means for generating a piecewise-linear colour function from the representative colour values, wherein the one or more control points and the piecewise-linear colour function 15 form said vector description of the colour gradient in the gradient area. According to still another aspect of the present invention there is provided a computer program product comprising machine-readable program code recorded on a machine-readable recording medium, for controlling the operation of a data processing machine on which the program code executes to perform a method of generating a 20 vector description of a colour gradient in an image, said method comprising the steps of: receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; WO 2007/033429 PCT/AU2006/001393 -4 generating, in each gradient area, a path comprising pixels having substantially the same colour; determining one or more control points defining a line substantially perpendicular to the path; 5 calculating representative colour values at points along the line; and generating a piecewise-linear colour function from the representative colour values, wherein the one or more control points and the piecewise-linear colour function form said vector description of the colour gradient in the gradient area. 10 According to still another aspect of the present invention there is provided a computer program comprising machine-readable program code for controlling the operation of a data processing apparatus on which the program code executes to perform a method of generating a vector description of a colour gradient in an image, said computer program comprising: 15 code for receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; code for generating, in each gradient area, a path comprising pixels having substantially the same colour; 20 code for determining one or more control points defining a line substantially perpendicular to the path; code for calculating representative colour values at points along the line; and WO 2007/033429 PCT/AU2006/001393 -5 code for generating a piecewise-linear colour function from the representative colour values, wherein the one or more control points and the piecewise-linear colour function form said vector description of the colour gradient in the gradient area. 5 BRIEF DESCRIPTION OF THE DRAWINGS One or more embodiments of the present invention will now be described with reference to the following drawings, in which: Fig. 1 is a flow chart of a method of generating a vector description of one or more colour gradients in an image; 10 Fig. 2 shows an object used to illustrate the path generation step of the method of Fig. 1; Fig. 3 shows an object used to illustrate a prior art method for approximating a raster bitmap fill; Fig. 4 shows an object used to illustrate finding the parameters of a linear gradient 15 according to the method of Fig. 1; Fig. 5 shows an object used to illustrate finding the parameters of a radial gradient according to the method of Fig. 1; Fig. 6 is a schematic block diagram of a system in which the method of Fig. 1 may be applied; and 20 Fig. 7 is a schematic block diagram of a general-purpose computer on which the described methods may be practiced.
WO 2007/033429 PCT/AU2006/001393 -6 DETAILED DESCRIPTION INCLUDING BEST MODE There are many circumstances in which it may be desired to convert a raster bitmap into a higher-level description. One such application is in processing scanned images, as described below with reference to Fig. 6. However, the described methods 5 are not limited to this particular application, but may be used more generally where there is a need to identify gradient information in an input image and to convert the gradient information to a vector description. Such a need may arise, for example, when processing the output of a renderer. The output may contain too much detail to provide an efficient description for further 10 processing. Generating a vector description may help to accelerate any further processing or to reduce the size of the output description. Operating environment Fig. 6 illustrates a system in which the methods described herein may be applied. 15 Scanner 600 is used to convert a document or image to an electronic bitmap, which may be sent to computer 700 for further processing. The bitmap may be converted into a searchable form, for example by applying Optical Character Recognition (OCR). Converting the bitmap to a vector graphics format may provide a more efficient description for storage or further processing. 20 The scanner 600 includes a plate 602 for supporting and positioning an input document or image. The input is illuminated by the lamp 604, which may be a xenon lamp or a cold cathode fluorescent lamp, for example. A lens assembly 606 conveys images of all or part of the input to a system of optical filters 608. The scanner may WO 2007/033429 PCT/AU2006/001393 -7 have three sets of filters to transmit red, green and blue light respectively. The scanning assembly 610, which may include charge-coupled device (CCD) arrays, scans the output of filters 608. The CCD arrays include light-sensitive diodes that convert photons into electrons, thus forming an electronic description of the image arriving via the lens 5 system 606 and filters 608. In a single-scan arrangement, there is a separate CCD array for each of the red, green and blue components. Alternatively, the input may be scanned repeatedly, with a different filter being placed before a CCD array for each scan to register a different colour component of the image. The image description may be transferred to a computer 700 for storage or processing. Driver software running on the 10 computer 700 controls communication between the computer 700 and the scanner 600. The devices 600, 700 may be linked via a network, which may also communicate with one or more printers for printing copies of the input document. Description of general-purpose computer 15 The algorithms and displays presented herein are not inherently related to any particular computer or other apparatus. Various general purpose machines may be used with programs in accordance with the teachings herein. Alternatively, the construction of more specialized apparatus to perform the required method steps may be appropriate. The structure of a conventional general purpose computer will appear from the 20 description below. In addition, the present invention also implicitly discloses a computer program, in that it would be apparent to the person skilled in the art that the individual steps of the methods described herein are to be put into effect by computer code. The computer WO 2007/033429 PCT/AU2006/001393 -8 program is not intended to be limited to any particular programming language and implementation thereof. It will be appreciated that a variety of programming languages and coding thereof may be used to implement the teachings of the disclosure contained herein. 5 Such a computer program may be stored on any computer readable medium. The computer readable medium may include storage devices such as magnetic or optical disks, memory chips, or other storage devices suitable for interfacing with a general purpose computer. The computer readable medium may also include a hard-wired medium such as exemplified in the Internet system, or wireless medium such as 10 exemplified in the GSM mobile telephone system. The computer program when loaded and executed on such a general-purpose computer effectively results in an apparatus that implements the steps of the preferred method. The method of converting colour gradients to a vector description is preferably practiced using a general-purpose computer system 700, such as that shown in Fig. 7 15 wherein the processes of Fig. 1 may be implemented as software, such as an application program executing within the computer system 700. In particular, the method steps are effected by instructions in the software that are carried out by the computer. The instructions may be formed as one or more code modules, each for performing one or more particular tasks. The software may be stored in a computer readable medium, 20 including the storage devices described below. The software is loaded into the computer from the computer readable medium, and then executed by the computer. A computer readable medium having such software or computer program recorded on it is a computer program product. The use of the computer program product in the computer WO 2007/033429 PCT/AU2006/001393 -9 preferably effects an advantageous apparatus for generating a vector description of colour gradients. The computer system 700 is formed by a computer module 701, input devices such as a keyboard 702 and mouse 703, output devices including a printer 715, a display 5 device 714 and loudspeakers 717. A Modulator-Demodulator (Modem) transceiver device 716 is used by the computer module 701 for communicating to and from a communications network 720, for example connectable via a telephone line 721 or other functional medium. The modem 716 can be used to obtain access to the Internet, and other network systems, such as a Local Area Network (LAN) or a Wide Area Network 10 (WAN), and may be incorporated into the computer module 701 in some implementations. The computer module 701 typically includes at least one processor unit 705, and a memory unit 706, for example formed from semiconductor random access memory (RAM) and read only memory (ROM). The module 701 also includes an number of 15 input/output (1/0) interfaces including an audio-video interface 707 that couples to the video display 714 and loudspeakers 717, an 1/0 interface 713 for the keyboard 702 and mouse 703 and optionally a joystick (not illustrated), and an interface 708 for the modem 716 and printer 715. In some implementations, the modem 716 may be incorporated within the computer module 701, for example within the interface 708. A 20 storage device 709 is provided and typically includes a hard disk drive 710 and a floppy disk drive 711. A CD-ROM drive 712 is typically provided as a non-volatile source of data. The components 705 to 713 of the computer module 701, typically communicate WO 2007/033429 PCT/AU2006/001393 -10 via an interconnected bus 704 and in a manner which results in a conventional mode of operation of the computer system 700 known to those in the relevant art. Typically, the application program is resident on the hard disk drive 710 and read and controlled in its execution by the processor 705. Intermediate storage of the 5 program and any data fetched from the network 720 may be accomplished using the semiconductor memory 706, possibly in concert with the hard disk drive 710. In some instances, the application program may be supplied to the user encoded on a CD-ROM or floppy disk and read via the corresponding drive 712 or 711, or alternatively may be read by the user from the network 720 via the modem device 716. Still further, the 10 software can also be loaded into the computer system 700 from other computer readable media. The term "computer readable medium" as used herein refers to any storage or transmission medium that participates in providing instructions and/or data to the computer system 700 for execution and/or processing. Examples of storage media include floppy disks, magnetic tape, CD-ROM, a hard disk drive, a ROM or integrated 15 circuit, a magneto-optical 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 701. Examples of transmission media 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 20 Websites and the like. The method of converting colour gradients in images to a higher-level vector description may alternatively be implemented in dedicated hardware such as one or WO 2007/033429 PCT/AU2006/001393 -11 more integrated circuits. Such dedicated hardware may include graphic processors, digital signal processors, or one or more microprocessors and associated memories. Converting colour gradients to vector description Fig. 1 shows a method 10 of generating a vector description of one or more colour 5 gradients in a source image 12. The image 12 is described as an array of pixels arranged on a plurality of scanlines. Initially this array of pixels describing the source image 12 is received by the processor 705 for processing. Each pixel is described by a set (i.e., one or more) of associated colour values, which may be the triplet (R,G,B), describing a red, blue and green colour value respectively for the pixel. The pixel may also have a fourth 10 associated value indicative of opacity. Other colour spaces, for example, may also be used to describe the image 12. The image 12 could also be a greyscale image, in which each pixel is described by a single scalar luminance value. Method 10 starts with step 100 (the detection phase) which aims to detect the areas in the source image 12 that contain a smooth colour gradient. The detection phase 15 100 involves two sub-steps. Firstly, sub-step 101 detects colour slopes, using smoothed pixel differences. In sub-step 101, the image 12 is read a scanline at a time, and an array of integers is constructed that contains the colour differences between each pixel and an adjacent pixel (i.e., a neighbouring pixel) on the same scanline. The colour difference between two neighbouring pixels, each containing a red, green and blue colour 20 component, is calculated using this formula: Diff= abs(R 1 - R 2 ) + abs(G 1 - G 2 ) + abs(B 1 - B 2 ) Equation (1) where (R 1 , G 1 , B 1 ) are colour component values of the first pixel and (R 2 , G 2 , B 2 ) are colour component values of the second pixel. The difference value returned is WO 2007/033429 PCT/AU2006/001393 -12 stored. After the scanline has been fully read, a smoothing function is applied to the array of colour differences. This is done by averaging a given colour difference value with n neighbouring colour differences (i.e., colour difference values from neighbouring pixels) on each side (where in one arrangement, n is 5) and then storing the average 5 back into the given colour difference's location. Areas of high difference, such as text, have high colour difference values after averaging and areas of flat colour have no difference. Areas of slowly changing colour, like a gradient, have a low colour difference value. So by applying a band pass filter to the colour difference values, sub-step 101 extracts a set of pixels that are on a colour 10 gradient. Pixels that form areas of flat colour are preferably excluded from the set of possible gradient pixels, by detecting runs of k adjacent pixels with zero smoothed colour difference values, where k is a predetermined parameter (in one arrangement k is 5). Pixels having a smoothed colour difference value above a predetermined threshold are also removed from the set of possible gradient pixels. 15 When scanning in a horizontal direction across the scanline, sub-step 101 cannot detect a vertical linear gradient, as the colour does not vary across the scanline. To work around this, sub-step 101 also repeats the scanning vertically along each pixel column, adding more pixels to the set of pixels found in the 1 st horizontal pass. The vertical colour differences are also calculated and smoothed before scanning for candidate 20 gradient pixels. Thus the output of sub-step 101 is a set of pixels in the image 12 that appear to be on a colour gradient. Not all the pixels in the colour gradient(s) are found this way so sub-step 102 is used to expand the set of gradient pixels to the edges of the gradient area, filling all the WO 2007/033429 PCT/AU2006/001393 -13 gaps left by sub-step 101. Sub-step 102 applies a standard flood fill, or region growing, algorithm starting from each of the pixels output from sub-step 101. The boundary for the flood fill is found by using the difference function (Equation (1)) used in step 101 with a configurable predetermined threshold. If the difference between two 5 neighbouring colour values (i.e. a pixel within the gradient set and a neighbouring pixel) is less than the configurable predetermined threshold, the neighbouring pixel is added to the set of gradient pixels. That is, the flood fill algorithm uses the pixels detected in step 101 as seeds (or seed pixels), which were determined based on the colour difference values. The flood fill algorithm may then be applied to the seed pixels to determine 10 surrounding pixels that satisfy a similarity criterion. This stops the flood fill from continuing to expand the set of gradient pixels when the difference between a pixel in the gradient set and a pixel on the edge of the flood fill is above the configurable predetermined threshold. Thus the output for sub-step 102 is a set of all pixels in the input image that form a colour gradient area. That is, the colour gradient area is a result 15 of the flood fill. All steps after sub-step 102 only operate on the set of gradient pixels output from sub-step 102; pixels not in that set are no longer considered. There may be multiple distinct areas of colour gradient in the input image, so sub-step 102 also keeps track of contiguous areas of colour gradient using a numbering scheme. One method of storing 20 the sub-set of pixels accumulated by sub-step 102 is using a mask, which consists of a two-dimensional array of bytes having the same dimensions as the source image, each value in the mask storing the classification of the corresponding pixel in the source image. A value of zero (0) means that the source pixel is not part of a colour gradient WO 2007/033429 PCT/AU2006/001393 -14 area. A non-zero value is used to indicate that the corresponding pixel in the source image is in a colour gradient area, and the actual value in the mask can store an index such that contiguous areas of colour gradient have the same mask value. For example, if two colour gradient areas exist in the source image 12, all the mask values for the first 5 gradient area have the value one (1) and all the mask values for pixels in the second gradient area have the value two (2). After the source image is classified into contiguous areas of colour gradient in the detection phase 100, step 200 (the vectorise phase) of method 10 decides the parameters of the colour gradients and constructs a vector description of those gradients. The 10 detection phase 100 and its sub-steps in some cases may not be required at all depending on the application. Those skilled in the art will recognise that other methods of classifying pixels into contiguous areas of colour gradient may be used in place of the described step 100. Step 200 (the vectorise phase) is executed on each of the contiguous areas of 15 colour gradient. Step 200 firstly needs to decide whether the gradient in question is a linear gradient or a radial gradient. This is the aim of sub-step 210 (the path generation step), and based on the output from sub-step 210, either sub-step 220 is executed in the case that the gradient is linear, or sub-step 230 is executed in the case that the gradient is radial. After either case 220, 230 sub-step 240 is executed to generate 'colour stops' at 20 points of inflexion. The path generation sub-step 210 includes four sub-steps, 211, 212, 213 and 214, which generate, in each colour gradient area, a path comprising pixels having substantially the same colour, and determine its linearity. The path generation sub-step WO 2007/033429 PCT/AU2006/001393 -15 210 begins by executing sub-step 211, which finds a sub-set of pixels in the colour gradient area that are of very similar values according to a similarity measure. This is achieved by picking one of the pixels already in the gradient area and identifying all similarly coloured pixels (i.e., pixels having substantially the same colour) in the 5 gradient area, starting with exact matches and then increasing the predetermined threshold of difference between the starting pixel and the rest of the gradient area until a large enough sub-set of pixels is found. This is illustrated in Fig. 2, which shows an area 312 containing a radial gradient. Reference numeral 310 indicates an annular region of pixels having similar colour. Thus, for example, sub-step 211 may identify the 10 pixels in region 310. The suitability of the current sub-set is defined by the number of pixels returned by sub-step 212. Sub-step 212 takes the current sub-set found in sub-step 211 and culls the current sub-set down, thereby finding a smaller sub-set such that each pixel in the smaller sub-set is at least some a predetermined minimum distance away from and not 15 more than some predetermined maximum distance away from any other pixel in the smaller sub-set. An example of this is shown in Fig. 2, where the set of pixels labelled 320 is an exemplary sub-set of the pixels in the annular region 310. Sub-step 212 has the effect of outputting a set of pixels, or points, that runs along a colour contour in the gradient. If not enough pixels are in this set at the end of sub-step 212 then sub-step 20 211's difference threshold is increased and execution resumes with sub-step 211. If there are enough pixels in the sub-set after sub-step 212 has executed then step 200 is allowed to continue to sub-step 213. In one arrangement the minimum number of pixels is five (5), but a minimum of eight (8) pixels may also be used.
WO 2007/033429 PCT/AU2006/001393 -16 Sub-step 213 takes the sub-set of gradient points as an 'unsorted' array of points with (x,y) co-ordinates and sorts the sub-set of gradient points such that the points form a polyline path. This is done by first scanning the array of points and finding end points, or pixels with only one neighbouring point. A neighbouring point is one that is within a 5 certain distance, being defined by: Dist = sqrt( (X1 - X 2
)
2 + (Yi - Y2)2 where (X 1 , Yi) is the first point and (X 2 , Y 2 ) is a possible neighbouring point. One end point is taken out of the 'unsorted' array and put into a new 'sorted' array. Then the nearest remaining point is moved into the sorted array. After that the 10 remaining points are sorted in sequence by their distance from the last point placed in the sorted array, and the nearest remaining point is moved from the unsorted array to the end of the sorted array. If there are no end points identified, for example if an entire ring of similar pixels is present, then any point may be selected as a starting point for the sorting step 213. 15 Once the sorted point list is complete, sub-step 214 looks at the polyline path segments examining the gradient of each line segment. If the line segment gradients are all similar within some configurable tolerance then the polyline path is substantially linear, indicating a linear gradient. Otherwise it is assumed that the gradient is radial. If sub-step 214 indicated that the gradient is linear then linear sub-step 220 (which 20 includes sub-steps 221 and 222) is executed. Sub-step 220 determines one or more control points defining a line substantially perpendicular to the polyline path generated at step 213, as will be described in detail below. In particular, sub-step 221 determines the geometric parameters, i.e. the bounds of the linear gradient in gradient space. The WO 2007/033429 PCT/AU2006/001393 -17 bounds consist of two end points (or extremities) delimiting a line that is perpendicular to the colour contours of the gradient area, as illustrated with respect to Fig. 4, which shows an area 405 containing a linear colour blend. The position of the area 405 is defined in the image co-ordinate system with x-axis 407 and y-axis 406. 5 A contour of the linear blend in area 405 is identified in sub-step 211, and the points 403 along the contour are identified in sub-step 212. Line 402 is perpendicular to the colour contour. The contour and line 402 define co-ordinate axes in 'gradient space'. Rectangle 401 is a bounding box of area 405, the sides of the bounding box being parallel to the axes of the gradient space. Point 408 is the beginning point of the 10 linear gradient and point 404 is the ending point of the linear gradient. Colour gradients specify their colour at discrete points, or 'colour stops' in unit parameter space between zero (0) and one (1) where zero (0) is the parameter at the beginning point 408 and one (1) is the parameter at the ending point 404. Any number of colour stops may be determined and placed in the range zero (0) to one (1) including 15 the end points 0.0 and 1.0. A colour stop comprises the colour and position of a given point in this unit, or normalised, parameter space. Colour varies at a constant rate (linear fashion) between two colour stops. To decide the location of the start and end point 408, 404 of the linear gradient, sub-step 221 needs to scan through all the pixels in the gradient area and transform the position of each pixel into gradient space. Gradient 20 space is defined with one axis (the x-axis) along the colour contour lines and the other axis (the y-axis) along the contour's normal line marked as 402 in Fig 4. The normal line's angle is calculated by taking the average gradient of the polyline path segments created from the points labelled 403 and calculating the perpendicular angle as arctan(1 / WO 2007/033429 PCT/AU2006/001393 -18 average _gradient). The angle a between the gradient normal 402 and the image's y-axis 406 is calculated and used to rotate each gradient pixel's co-ordinates such that the colour contours are horizontal (i.e. the normal 402 is vertical). The maximum and minimum of all the rotated co-ordinates' x and y values are calculated and these form a 5 rectangular bounding box 401 for the gradient area as defined in gradient space. Two points 408, 404 on the left edge of the gradient area's bounding box 401, at the bottom left corner and the top-left corner respectively, are transformed from gradient space back into the image's co-ordinate space by reversing the rotation applied earlier and these points 408, 404 forn the start and end points of the linear gradient, thus completing sub 10 step 221. Sub-step 222 constructs a colour ramp array with a configurable number of buckets (in one arrangement 1024 buckets are used), each of which contains three accumulated sums of Red, Green and Blue colour components respectively and a count of pixels. This array of buckets will be referred to as the colour ramp array. The 15 purpose of the colour ramp array is to collect an average colour value (or representative colour value) at corresponding points on a notional vertical axis 402 in the gradient unit parameter space. Each representative colour value is an average taken over colour values of pixels in the gradient area lying on a contour that is parallel to the polyline path and intersects the perpendicular line 402 at the corresponding point. 20 Sub-step 222 scans through all the pixels in the gradient area and maps the co ordinates (or position) of each pixel into the gradient unit parameter space by using the gradient space bounding box 401 calculated in sub-step 221. Given the angle between the image space vertical (y) axis 406 and the gradient space axis 402 normal to the WO 2007/033429 PCT/AU2006/001393 -19 colour contours is a and the co-ordinates of the pixel in the gradient area are (XI, Y 1 ) then the point's coordinates in gradient space are given by the following image to linear gradient-space transform: XG = cos(a).X1 - sin(a).Yi 5 Yo = sin(a).Xi + cos(a).Y1 Given the bounding box 401 in gradient space calculated in sub-step 221 is delimited by (Xmin, Ymin, Xmax, Ymax) the pixel's position P in the gradient unit parameter space is: P = (YG - Ymin) / (Ymax - Ymin) 10 Where P >= 0.0 and P <= 1.0 So by calculating P for every pixel in the gradient area, sub-step 222 determines a corresponding bucket for the pixel in the colour ramp array. The sub-step 222 of adding the pixel to the colour ramp array simply adds the Red, Green and Blue colour components to the respective accumulators in the bucket and increments the bucket's 15 pixel count. Execution then passes to sub-step 240. In the case that sub-step 210 decides that the gradient is a radial gradient, sub-step 230 is executed instead of sub-step 220. Sub-step 230's purpose is to decide the geometric parameters of the radial gradient by defining a line substantially perpendicular to the path generated in sub-step 213. 20 These parameters consist of a centre point and a radius. The radial sub-step 230 includes sub-steps 231, 232 and 233, which determine the radial parameters. The determination of the radial parameters is illustrated with reference to Fig. 5, which shows an area 505 containing a radial blend.
WO 2007/033429 PCT/AU2006/001393 -20 Substep 231 calculates the centre of the gradient by starting with the polyline path generated in sub-step 213, which forms a line along a colour contour in the gradient area. In this case the path is an arc of a circle. A subset of the points defining the polyline path (e.g. the points marked 501 in Fig. 5), forming less than half a circle, is 5 identified by comparing gradients of each line segment in the polyline path until the angle has changed through more than 90* and less than 1800. A line 502 is formed between the two end points (or two end pixels) of this subset of points 501 and the mid point of the line 502 is calculated. A new line 503 is formed from the midpoint of line 502 along the normal to line 502 and extending away from the existing points 501 in the 10 polyline subset. This line 503 should come close to intersecting with the centre of the circle defining the radial blend, however the exact co-ordinates of the centre are not yet known. Accordingly, the line 503 is a perpendicular bisector of the line 502 joining the two end points. By iteratively advancing a point (some examples of this point's movement are 15 marked 504 in Fig. 5) along this line 503 and calculating the distances from point 504 to the polyline path's points until such distances are almost equal (i.e., the polyline path's points are substantially equidistant), sub-step 231 can find a fairly accurate approximation of the centre point of the radial gradient. The centre is a control point of the gradient and the line 503 is substantially perpendicular to the polyline path (i.e., the 20 points marked 501 in Fig. 5). This method is only one such possible method and those skilled in the art will understand that other methods could be used as sub-step 231. Once the centre is known, sub-step 232 scans through all the pixels in the gradient area, calculating their distance from the centre, and retaining a maximum distance WO 2007/033429 PCT/AU2006/001393 -21 representing the distance from the centre to a furthest pixel of the gradient area. This maximum becomes the radius of the radial gradient. Given the centre and radius, sub-step 233 proceeds to generate the colour ramp array. This is similar to sub-step 222 for linear gradients in that the purpose of the 5 colour ramp array is to determine a representative colour value at corresponding points in gradient unit parameter space. Each representative colour value is an average of the corresponding colour values of pixels in the gradient area lying on a circular contour centred on the blend centre and passing through the corresponding point. Each pixel in the gradient area is scanned again and the distance between the pixel's co-ordinates and 10 the centre is calculated, and that distance value is transformed into a gradient unit parameter space value between 0 and 1 using the radius. Given a gradient area pixel co ordinate (X 1 , Y 1 ) the distance to the centre (Xc, Yc) is: Distance = sqrt( (Xe - X1)2 + (Ye -Yi)2) The distance is mapped into the gradient unit parameter space using the image to 15 radial gradient space transform: P = Distance / Radius. This position is mapped into an array of colour buckets, similar to sub-step 222. The colour components of the gradient pixel are added to the bucket's accumulators and the bucket's count is incremented. 20 Once sub-step 220 or 230 has completed execution passes on to sub-step 240 (the stop generation sub-step), which takes the ramp array of colour buckets from sub-step 222 or 233 and builds a list of colour stops in the gradient unit parameter space (0 -> 1).
WO 2007/033429 PCT/AU2006/001393 -22 Sub-step 241 takes the array of colour buckets and marks any entries that have too small a pixel count (indicating that the corresponding bucket does not contain enough source image pixels to get a good average) to be ignored in all further processing. A configurable lower limit on the pixel count is preferably set to three (3) pixels. Thus, 5 the unused entries are ignored for subsequent processing. At this point each of the colour component accumulators is divided by the number of pixels contributing to the component to get an average (or representative) colour value for that component across all the pixels that contributed to that bucket. The remaining colour buckets tend to have some noise in the colour components 10 due to stray pixels, scanning artefacts and the effects of anti-aliasing. Sub-step 242 takes the colour ramp array and runs a smoothing function over the representative colour values to remove particularly bad spikes in the data. The smoothing operation can be implemented by any number of suitable algorithms. One such algorithm is to look at each colour bucket component and compare the current bucket to the previous and next 15 buckets. If the value of the current bucket is far enough outside the value of the neighbouring buckets then an average of the neighbouring buckets is used instead. Sub-step 243 then takes the smoothed colour ramp array and creates a list of colour stops that describes the colour ramp at discrete points in the gradient unit parameter space such that, when rendered, the colour stops, with linear interpolation in 20 between, form a piecewise-linear functional approximation of the full colour gradient. Accordingly, sub-step 243 generates a piecewise-linear colour function from the smoothed representative colour values in the colour ramp array. This sub-step 243 scans the colour ramp array from start to finish and emits colour stops when the gradient WO 2007/033429 PCT/AU2006/001393 -23 of any of the colour components changes significantly, i.e. whenever an inflexion point is identified. That is, a colour stop is added to the piecewise-linear colour function if a difference between the colour component values predicted based on a linear model of colour values at previously considered points and corresponding representative colour 5 values exceeds a predetermined threshold. This calculation is done by moving a "current" pointer through the colour ramp array as well as maintaining a "last" pointer. The last pointer starts at the beginning of the array and is updated to the current position when a colour stop is emitted. The colour ramp can be visualized in a two dimensional plane, where the x-axis is the gradient unit parameter space (where the first colour ramp 10 entry is at x=0 and the last colour ramp entry is at x=1), and the y-axis has the colour component's value for that colour ramp bucket. Each component traces out a rough line across this plane. Sub-step 243 converts the line for each colour component, made of discrete samples, into a vector polyline. The current pointer is advanced from x=O, checking that all the colour component values of each bucket between the current 15 pointer and the last pointer fall on a straight line, or near enough to such a line, within a predetermined threshold. This is done for each colour component individually each time the current pointer is advanced. If any of the colour components between the two (2) pointers are outside the line then a colour stop is emitted and the last pointer is moved to the location of the new colour stop. This sub-step 243 is continued until the 20 end of the colour ramp is reached. The vectorisation phase 200 ends with the output of vector gradient information 14 (or a vector description), which includes either two end points (i.e., the extremities) for a linear colour gradient or a centre point and a radius for a radial colour gradient WO 2007/033429 PCT/AU2006/001393 -24 (i.e., one or more control points). In addition, the vector gradient information 14 includes a list of colour stops, each having a normalised position coordinate and a colour value. As described above, the colour stops can be used to form a piecewise linear functional approximation of the full colour gradient. 5 The benefits of the described arrangements include lower memory usage, faster rendering time and being able to quickly change the gradient parameter of the output vector data. Industrial Applicability It is apparent from the above that the arrangements described are applicable to the 10 computer and data processing industries. 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.

Claims (15)

1. A method of generating a vector description of a colour gradient in an image, said method comprising the steps of: 5 receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; generating, in each gradient area, a path comprising pixels having substantially the same colour; 10 determining one or more control points defining a line substantially perpendicular to the path; calculating representative colour values at points along the line; and generating a piecewise-linear colour function from the representative colour values, 15 wherein the one or more control points and the piecewise-linear colour function form said vector description of the colour gradient in the gradient area.
2. A method according to claim 1, wherein the path is substantially linear and the control points are the extremities of the perpendicular line. 20
3. A method according to claim 1, wherein the path is an arc of a circle and a control point is a centre of the circle. WO 2007/033429 PCT/AU2006/001393 -26
4. A method according to claim 2 wherein the representative colour value at a point along the line is an average of the corresponding colour values of the pixels in the gradient area lying on a contour that is parallel to the path and intersects the perpendicular line at the point. 5
5. A method according to claim 3 wherein the representative colour value at a point along the line is an average of the corresponding colour values of the pixels in the gradient area lying on a circular contour centred on the centre and passing through the point. 10
6. A method according to claim 1 wherein the piecewise-linear colour function is defined by one or more colour stops and wherein said step of generating the colour function considers the points in sequence and, for a currently-considered point, said generating step comprises the substeps of: 15 predicting one or more colour values at the currently-considered point based on a linear model of colour values at previously-considered points; and adding a colour stop to the colour function if a difference between the one or more predicted colour values and corresponding representative colour values exceeds a predetermined threshold, 20 wherein the colour stop comprises a position and colour of the currently considered point. WO 2007/033429 PCT/AU2006/001393 -27
7. A method according to claim 6 further comprising the step of smoothing the representative colour values prior to generating the piecewise-linear function.
8. A method according to claim 1 wherein said step of generating the path 5 comprises the substeps of: picking a pixel in the gradient area; identifying pixels in the gradient area that have a similar colour to the picked pixel according to a similarity measure dependent on the associated colour values and a predetermined threshold; 10 finding a subset of identified pixels such that pixels in the subset are at least a predetermined minimum distance from other pixels in the subset and are less than a predetermined maximum distance from other pixels in the subset; and sorting the subset of pixels to form the path. 15
9. A method according to claim 8 comprising the further step of changing the predetermined threshold and repeating said identifying, finding and sorting substeps until a large enough subset of pixels is found.
10. A method according to claim 1 wherein the path is an arc of a circle and wherein 20 said step of determining control points comprises the substeps of: identifying a subset of pixels in the path, the subset bounded by two end pixels and forming less than half the circle; calculating a perpendicular bisector of a line joining the two end points; and WO 2007/033429 PCT/AU2006/001393 -28 determining a centre point lying on the perpendicular bisector and substantially equidistant from the pixels in the subset, wherein the centre point is a control point forming part of the vector description. 5
11. A method according to claim 1, further comprising the step of detecting the at least one gradient area.
12. A method according to claim 11, wherein said detecting step comprises the substeps of: 10 calculating colour differences between neighbouring pixels in the image; identifying seed pixels based on the colour differences; and applying a flood fill to the seed pixels, wherein the at least one gradient area is a result of the flood fill. 15
13. An apparatus for generating a vector description of a colour gradient in an image, said apparatus comprising: means for receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; 20 means for generating, in each gradient area, a path comprising pixels having substantially the same colour; means for determining one or more control points defining a line substantially perpendicular to the path; WO 2007/033429 PCT/AU2006/001393 -29 means for calculating representative colour values at points along the line; and means for generating a piecewise-linear colour function from the representative colour values, wherein the one or more control points and the piecewise-linear colour function 5 form said vector description of the colour gradient in the gradient area.
14. A computer program product comprising machine-readable program code recorded on a machine-readable recording medium, for controlling the operation of a data processing machine on which the program code executes to perform a method of 10 generating a vector description of a colour gradient in an image, said method comprising the steps of: receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; 15 generating, in each gradient area, a path comprising pixels having substantially the same colour; determining one or more control points defining a line substantially perpendicular to the path; calculating representative colour values at points along the line; and 20 generating a piecewise-linear colour function from the representative colour values, wherein the one or more control points and the piecewise-linear colour function form said vector description of the colour gradient in the gradient area. WO 2007/033429 PCT/AU2006/001393 -30
15. A computer program comprising machine-readable program code for controlling the operation of a data processing apparatus on which the program code executes to perform a method of generating a vector description of a colour gradient in an image, 5 said computer program comprising: code for receiving the image comprising an array of pixels, each pixel having one or more associated colour values, the image having at least one gradient area in which at least one of the colour values varies between neighbouring pixels; code for generating, in each gradient area, a path comprising pixels having 10 substantially the same colour; code for determining one or more control points defining a line substantially perpendicular to the path; code for calculating representative colour values at points along the line; and code for generating a piecewise-linear colour function from the representative 15 colour values, wherein the one or more control points and the piecewise-linear colour function form said vector description of the colour gradient in the gradient area. 20
AU2006294425A 2005-09-23 2006-09-22 Vectorisation of colour gradients Ceased AU2006294425B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
AU2006294425A AU2006294425B2 (en) 2005-09-23 2006-09-22 Vectorisation of colour gradients

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
AU2005211665 2005-09-23
AU2005211665A AU2005211665A1 (en) 2005-09-23 2005-09-23 Vectorisation of colour gradients
PCT/AU2006/001393 WO2007033429A1 (en) 2005-09-23 2006-09-22 Vectorisation of colour gradients
AU2006294425A AU2006294425B2 (en) 2005-09-23 2006-09-22 Vectorisation of colour gradients

Publications (2)

Publication Number Publication Date
AU2006294425A1 AU2006294425A1 (en) 2007-03-29
AU2006294425B2 true AU2006294425B2 (en) 2010-12-09

Family

ID=39233129

Family Applications (1)

Application Number Title Priority Date Filing Date
AU2006294425A Ceased AU2006294425B2 (en) 2005-09-23 2006-09-22 Vectorisation of colour gradients

Country Status (1)

Country Link
AU (1) AU2006294425B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655969B (en) * 2008-08-19 2011-12-21 方正国际软件(北京)有限公司 Method for editing color gradient attributes

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6121976A (en) * 1996-02-06 2000-09-19 Ulead Systems, Inc. Digital image-processing method for conducting color gradient
US6912309B2 (en) * 2003-03-06 2005-06-28 Lockheed Martin Corporation Method and system for identifying objects in an image

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6121976A (en) * 1996-02-06 2000-09-19 Ulead Systems, Inc. Digital image-processing method for conducting color gradient
US6912309B2 (en) * 2003-03-06 2005-06-28 Lockheed Martin Corporation Method and system for identifying objects in an image

Also Published As

Publication number Publication date
AU2006294425A1 (en) 2007-03-29

Similar Documents

Publication Publication Date Title
US8055065B2 (en) Vectorisation of colour gradients
US6839466B2 (en) Detecting overlapping images in an automatic image segmentation device with the presence of severe bleeding
US5892854A (en) Automatic image registration using binary moments
EP1081648B1 (en) Method for processing a digital image
JP4587832B2 (en) Method and apparatus for organizing identified areas in image data
EP0434415B1 (en) Method of measuring skew angles
US7342572B2 (en) System and method for transforming an ordinary computer monitor into a touch screen
US6990235B2 (en) Color image processing apparatus and pattern extracting apparatus
US7046850B2 (en) Image matching
JP3883696B2 (en) Method for scanning and detecting multiple photos and removing artificial edges
JPH1083447A (en) Image registrating method and skew detecting method
US5483606A (en) Method for automatically registering a document having a plurality of pages
US8396261B2 (en) Method for red-eye detection
US5796877A (en) Method and apparatus for automatically fitting an input image to the size of the output document
US6771842B1 (en) Document image skew detection method
EP0526197A2 (en) Image processing
US5687252A (en) Image processing apparatus
US6993208B2 (en) Image processing apparatus and its processing method
US20080025643A1 (en) Image processing system, method for processing image and computer readable medium
Sarkar et al. Spatial sampling of printed patterns
AU2006294425B2 (en) Vectorisation of colour gradients
EP0849935A2 (en) Illuminant color detection
JP2001222683A (en) Method and device for processing picture, device and method for recognizing character and storage medium
EP0702320A1 (en) Skew detection
US20090016613A1 (en) Image processing apparatus, image processing method, and computer program product

Legal Events

Date Code Title Description
FGA Letters patent sealed or granted (standard patent)
MK14 Patent ceased section 143(a) (annual fees not paid) or expired