Analyzing an image to obtain a stable number of groups

Abstract: To group items (12,14,16,18) in an array, gap data (20) are obtained indicating gaps between items. The gap data are used to obtain threshold data, which are then used to obtain grouping data (22,24,26,28,30). The gaps could, for example, be distances between items in a two-dimensional array or differences between values at which items occur in a one-dimensional array. The threshold data indicate a threshold. The threshold would produce a number of groups of the items (12,14,16,18) that is stable across a range of thresholds, and the range of thresholds meets a criterion for largeness of a range. The criterion can require, for example, that the range be larger than the stable range of thresholds of any other number in a set of numbers of groups. The threshold can be obtained iteratively by applying a candidate threshold for each iteration. The candidate thresholds can be incremented, and the iterations can be counted to find a number of groups meeting the criterion. Or the candidate thresholds can be increased by differences between gaps, and a running sum of threshold ranges can be used to find a number of groups meeting the criterion. The threshold can also be obtained directly by finding the largest difference between gap extents and obtaining a threshold within the largest difference. Many types of grouping can be performed, including spatial clustering, segmentation of partially bounded regions, segmentation by local width, and global and local similarity grouping.

Description: The present invention relates to techniques for analyzing data, such as data defining an image, to obtain information about groupings. Mahoney, US-A 5,239,596, describes techniques for labeling pixels in an image based on near neighbor attributes. A discussion of linked group labeling through grouping operations begins at col. 15 line 63. "Pattern classification and scene analysis" by R. O. Duda and P. E. Hart, 1973, Chichester, Sussex, UK, Wiley-Interscience, UK, ISBN 0-471-22361-1 discloses in section 6.7 that the most obvious measure for the similarity between two samples is the distance between them. The distance is calculated by a suitable distance function. The two samples are assumed to belong to the same cluster, if the distance between them is less than some threshold distance d 0 . The section 6.10 describes how to obtain the threshold distance d 0 . This method is described with reference to figure 6.15 in which six samples are grouped. Level 1 shows the six samples as singleton clusters. At each level, the two clusters being most similar, i.e. having the smallest distance, are combined to one cluster. In more abstract terms, figure 6.15 shows that different clusterings correspond to different measures of similarity between clusters. Amongst all possible clusterings some appear intuitively natural while another grouping obtained by collapsing, two other clusters may appear forced if this collapsing corresponds to a large reduction in similarity. It is the object of this invention to provide a method, a machine and an article of manufacture for analysing data to obtain information about groupings, the method, the machine and the article of manufacture only requiring a reasonable computational effort. This object is achieved by the subject matters of the independent claims. Preferred embodiments are the subject matters of the dependent claims. The invention is to overcome problems that arise in analyzing data to obtain information about groupings or equivalence classes. Sometimes the part of an image array or other body of data that is relevant to an analysis task is a collection of items rather than an individual item. In image analysis, this may be true because coherent physical processes tend to produce collections of pixels that are coherent in space or in their geometric properties. Therefore, it is useful to be able to operate on a collection or group rather than on each individual item. The problems relate to techniques for finding an appropriate number of groups. There is a tension between, on the one hand, automatically determining a number of groups that will produce a satisfactory grouping and, on the other hand, obtaining the number of groups in a simple, principled way. The invention is based on the discovery of a new grouping technique that obtains a number of groups automatically in a simple, principled way based on a stability criterion. The technique often obtains intuitively correct and computationally useful groups of items. The groups may be more meaningful than the items they include if they correspond to meaningful structures, such as objects of interest in a scene shown by an image. The grouping technique can be performed as a computational module that is isolated from other computations required by an image analysis task. The new grouping technique obtains threshold data indicating a threshold that can be applied to data indicating gaps between items in an array. The gaps can, for example, be distances to items in a two-dimensional array that indicate values meeting a reference criterion or differences between items in a one-dimensional array that indicate non-zero values. The threshold produces a number of groups that is stable across a range of thresholds, and the range of thresholds meets a criterion for largeness. The criterion may require, for example, a range of thresholds that is larger than the range across which other numbers of groups are stable. The criterion of largeness of a range of thresholds can be applied to a set of numbers of groups to find the number in the set that is stable across the largest range. The numbers in the set are all greater than a minimum number. The minimum number should not be less than one, because a grouping with only one group is not of interest and is stable across a range of thresholds that extends into infinity. Further, in some applications of grouping, a minimum number of two can avoid a stable grouping in which one group includes only an outlier while a much larger group includes all other items; if the number of groups must be greater than two, the larger group is divided into two or more smaller groups. In general, the technique can group sets of value items that meet a transitive closure criterion subject to the threshold. For example, for grouping an array, the transitive closure criterion can require a group of value items to be a connected component within which the value items are all above or all below the threshold. Or the transitive closure criterion can require a group of value items, between each pair of which the value items in the group provide a path and each step of the path is shorter than the threshold; a criterion of this type is necessary for grouping a list or set of foreground items rather than items in an array. A one-dimensional array can include, for each value of a parameter, a value item indicating whether the value occurs in an image or other body of data. The technique can group a set of value items together whose values occur if each adjacent pair of value items in the set is separated from each other by a difference that is below the threshold. The parameter can be an attribute of features in an image, such as area, elongation, aspect ratio, width, horizontal center of area, vertical center of area, or orientation. A two-dimensional array can indicate a value for each pixel of an image or for each item in another body of data. In an array defining an image, for example, the technique can compare the threshold with each pixel's distance to a near neighbor that meets a reference criterion, such as ON or OFF. In clustering, the technique can set a pixel ON if its distance is below the threshold. In segmentation, the technique can set a pixel ON if its distance is above the threshold. The technique can obtain initial array data defining an initial array of items that indicate values, then use the initial array data to obtain gap data indicating gaps between items in the initial array. The technique can use the gap data to obtain threshold data indicating a threshold such that each gap indicated by the gap data is above or below the threshold. The technique can use the threshold to obtain grouping data grouping the items in the initial array into a number of groups that is stable across a range of thresholds that meets the criterion for largeness. To group parameter values, the technique can use parameter data indicating a set of parameter values to obtain the initial array data. The parameter's values can define the initial array, and each item in the initial array can indicate whether one of the parameter's values occurs in the set of parameter values indicated by the parameter data. The technique can use the initial array data to obtain a difference or gap between adjacent values of the parameter that occur in the set. The technique can use the gap to obtain threshold data indicating a threshold, and can use the threshold to obtain grouping data. The grouping data indicate groups of items in the initial array. The technique can use the initial array and the threshold to obtain a group identifier for each item in the initial array with a value in the set of values. If the parameter data indicate a value of the parameter for each position in an array and a position is in a set of positions with values in the set of values, the technique can use the position's value and the group identifiers to obtain a group identifier for the position. The array can, for example, be an image, and the grouping data can define a version of the image that indicates a group identifier for each pixel in the set of positions. The parameter can be an attribute of features in an image, such as area, elongation, aspect ratio, width, horizontal center of area, vertical center of area, or orientation. To group parts of an image, as in clustering or segmentation, the technique can obtain the gap data from data defining the image. For example, the gap data can indicate, for each pixel, a distance to a black pixel that is a near neighbor of the pixel. The threshold can be compared with each pixel's distance to obtain a thresholded version of the image; each pixel with a distance above the threshold can be ON, or, alternatively, each pixel with a distance below the threshold can be ON. The technique can obtain the grouping data by labeling each pixel in a part of the image with a unique identifier of the group in the thresholded version that includes the part. The technique can use gap data to obtain threshold data in any of several ways. A first approach obtains the threshold data iteratively using candidate thresholds that increase for each successive iteration and using gap data that indicate, for each value item in the initial array, a gap. Each iteration obtains thresholded data indicating, for each value item, whether its gap is above or below the iteration's candidate threshold. The thresholded data define group items, each including a set of the value items in the initial array. Each iteration uses the thresholded data to obtain group count data indicating a number of the group items. The first approach uses the group count data to obtain subsequence length data indicating a number of iterations in each subsequence of iterations with group count data indicating equal numbers of group items. Each subsequence's number of iterations represents a range of thresholds, whose size is indicated by the product of the number of iterations with the threshold increment. The first approach finds a subsequence of iterations with a range of thresholds that meets the largeness criterion. For example, the subsequence may have a larger number of iterations than the subsequence of any other number of group items that is greater than a minimum number such as one or two and less than the number of value items in the initial array. The first approach obtains threshold data indicating that the threshold is the candidate threshold of one of the iterations in the subsequence that meets the largeness criterion. A second approach performs iterations, as in the first approach, but more efficiently because each iteration can skip gaps that do not occur by increasing the threshold by a difference between gaps indicated by the gap data. The second approach uses the group count data to obtain threshold range data indicating a range of thresholds in each subsequence of iterations with group count data indicating equal numbers of group items. The second approach finds a subsequence of iterations with a range of thresholds that meets the largeness criterion, as in the first approach. The second approach obtains threshold data indicating a threshold in the range of thresholds that meets the largeness criterion. A third approach uses the gap data to obtain largest difference data indicating the largest difference between gaps that are indicated by the gap data and between which the gap data do not indicate any distances. The third approach then uses the largest difference data to obtain threshold data indicating a threshold above the gap that is below the largest difference and below the gap that is above the largest difference. The third approach can be applied in many ways. For initial array data defining an image, in which each item is a pixel value, clustering and segmentation can be performed as follows: To cluster, the gap data can indicate distance to a near neighbor for each pixel that meets a foreground neighbor border criterion, meaning that it is at a border between pixels that have different near neighbors. The threshold can be compared at each pixel with the pixel's distance to a near neighbor in the image to obtain a grouped version of the image. Pixels with distances below the threshold are grouped together into connected regions or components in the grouped version of the image. To segment partially bounded regions, the gap data can indicate distance to a near neighbor for each pixel that meets an opposing foreground neighbor border criterion, meaning that it is at a border between pixels that have near neighbors approximately 180° apart in direction. The threshold can be compared at each pixel with the pixel's distance to a near neighbor in the image. Pixels with distances above the threshold are grouped together into connected components. To segment by local width, the gap data can indicate distance to a near neighbor for each pixel that meets an opposing background neighbor border criterion, meaning that it is at a border between pixels that have near neighbors in the complement of the image that are approximately 180° apart in direction. The threshold can be compared at each pixel with the pixel's distance to a near neighbor in the complement of the image. Pixels with distances above the threshold are grouped together into connected components. The technique can be implemented with a machine that includes initial array data and data indicating grouping instructions. The initial array data define an initial array of value items, each indicating a value. The machine's processor can execute the grouping instructions. In executing the grouping instructions, the processor can access the initial array data and use them to obtain gap data indicating one or more gaps between value items in the initial array. The processor can use the gap data to obtain threshold data indicating a threshold such that each gap indicated by the gap data is above or below the threshold. The threshold is chosen so that it would produce a number of groups of the value items that is stable across a range of thresholds that meets a criterion for largeness of a range. The processor can use the threshold data to obtain grouping data indicating a grouping of the value items. The machine can be a high-speed image processing server that responds to image processing requests from a network to which it is connected. The machine can also include image input circuitry, and the processor can receive input image data defining an input image from the image input circuitry and use them to obtain the initial array data. The machine can be a fax server or a copier. The technique can also be implemented in a software product that includes a storage medium and data stored by the storage medium. The software product can be used in a machine that includes initial array data defining an initial array of value items, each indicating a value. The data stored by the storage medium can include grouping instructions the machine's processor can execute. In executing the grouping instructions, the processor can access the initial array data and use them to obtain gap data indicating one or more gaps between value items in the initial array. The processor can use the gap data to obtain threshold data indicating a threshold such that each gap indicated by the gap data is above or below the threshold. The threshold is chosen so that it would produce a number of groups of the value items that is stable across a range of thresholds that meets a criterion for largeness of a range. The processor can use the threshold data to obtain grouping data indicating a grouping of the value items. The technique described above is advantageous because it makes possible efficient grouping of items. In addition, the resulting groupings are often intuitively correct. The technique can be used to automatically group connected components or parameter values in an image. The technique is self-calibrating in the sense that it determines the appropriate number of groups without requiring a user to specify the number in advance. For a wide variety of grouping operations on data defining images, including grouping in one dimension and in two dimensions, the technique can be implemented using the same primitive operations as other image processing operations, allowing efficient grouping without converting from an image representation to another representation of information about the groups. In addition, the technique can be implemented to run on a serial machine in time linearly proportional to the number of image pixels, facilitating its use in image processing. The present invention will be described further, by way of examples, with reference to the accompanying drawings, in which:- Fig. 1 is a schematic diagram illustrating how a number of groups of items can be stable over a range of thresholds that meets a criterion for largeness; Fig. 2 is a flow diagram showing general acts in obtaining thresholded distances data defining a number of groups of items that is stable over a range of thresholds that meets a criterion for largeness; Fig. 3 is a schematic block diagram showing general components of a software product and a machine in which the software product can be used to implement the general acts in Fig. 2; Fig. 4 is a flow chart showing acts in obtaining a threshold by iteratively applying a candidate threshold that is incremented for each iteration; Fig. 5 is a flow chart showing acts in obtaining a threshold by iteratively applying a candidate threshold that is increased for each iteration by a difference between gaps; Fig. 6 is a flow chart showing another approach that obtains a threshold within a largest difference between gaps; Fig. 7 is a schematic block diagram of a machine that can perform grouping operations in analyzing an image; Fig. 8 is a flow chart of acts performed by the machine of Fig. 7 in an implementation of one-dimensional grouping; Fig. 9 is a flow chart showing in more detail how a threshold can be obtained in Fig. 8; Fig. 10 is a flow chart of acts performed by the machine of Fig. 7 in an implementation of two-dimensional grouping; Fig. 11 is a flow chart showing in more detail how a threshold can be obtained in Fig. 10; Fig. 12 shows an example of an input image and a grouped image resulting from spatial clustering; Fig. 13 shows an example of an input image and a grouped image resulting from segmentation of partially bounded regions; Fig. 14 shows an example of an input image and a grouped image resulting from segmentation by local width; Fig. 15 shows an example of an input image and a grouped image resulting from global similarity grouping; Fig. 16 is a schematic block diagram of an implementation with an image processing server; Fig. 17 is a schematic block diagram of a fax server application; and Fig. 18 is a schematic block diagram of a copier application. Fig. 1 shows schematically how data indicating gaps can be used to obtain a threshold that would produce a number of groups of items that is stable across a range of thresholds that meets a criterion for largeness of a range. Fig. 2 shows general acts in obtaining and using a threshold that would produce a number of groups of items that is stable across a range of thresholds that meets a criterion for largeness of a range. Fig. 3 shows general components of a software product and of a machine in which it can be used. In Fig. 1, initial graph 10, which could be a histogram, shows a one-dimensional array. The illustrated items in the array are binary, with items 12, 14, 16, and 18 having one binary value and the other items having the other binary value. The array could, for example, be defined by the values of a parameter. Items 12, 14, 16, and 18 could indicate that four values of the parameter are indicated by an item of data, while other values of the parameter are not indicated. Initial graph 10 can be used to produce gap graph 20, a one-dimensional array in which each item indicates a distance between it and the nearest of items 12, 14, 16, and 18. Therefore, the distances for items 12, 14, 16, and 18 are zero, while items in gaps between items 12, 14, 16, and 18 have non-zero distances. At the center of each gap between items 12, 14, 16, and 18 is a distance that indicates the gap by indicating half the extent of the gap. The gaps between items 12 and 14 and between items 16 and 18 are each two units wide, so their center distances are each one; the gap between items 14 and 17 is six units wide, so its center distance is three. Fig. 1 also shows how groups of items in initial graph 10 could be obtained using gap graph 20. A sequence of thresholds can be used to distinguish distances that are above and below each threshold. Each threshold groups together adjacent items with distances below the threshold, with adjacent groups separated by items with distances above the threshold. As shown, four groups can be obtained by applying a threshold between zero and one, and each group includes one of items 12, 14, 16, and 18; two groups 22 and 24 can be obtained by applying a threshold between one and two; two groups 26 and 28 can be obtained by applying a threshold between two and three; and only one group 30 can be obtained by applying a threshold above three. Graph 40 summarizes the group results and illustrates how one number of groups can be stable across a range of thresholds that meets a criterion for largeness of a range. Each position on the x axis represents a threshold value, while each position on the y axis represents a count of groups. As shown, the group count starts at four with a threshold below one, then decreases to two when the threshold reaches one. The group item count remains at two as the threshold increases from one to three. Then, when the threshold reaches three, the group item count decreases to its final value, one. Portion 42 of graph 40 is longer than portion 44, and is the longest stable portion of graph 40 other than portion 46. Portion 46 is not meaningful because every group count over an array that includes at least one item eventually reaches a stable value of one. Therefore, two, the number of groups of the initial items obtained by thresholds within portion 42, could meet a criterion for largeness of a range because it is stable over a larger range of thresholds than four, another number of groups which is stable only over portion 44. If the items are grouped using a threshold within the range indicated by portion 42, items 12 and 14 are in a first group, and items 16 and 18 are in a second group; but if the items are grouped using a threshold within the range indicated by portion 44, there are four groups, each with one of items 12, 14, 16, and 18. The general acts in Fig. 2 begin in box 50 by obtaining initial array data defining an initial array of items that each indicate a value. The initial array can be a one-dimensional array as illustrated in Fig. 1, or any n-dimensional array, where n is an integer greater than zero. The act in box 52 uses the initial array data to obtain gap data indicating gaps between items in the initial array. The act in box 54 uses the gap data to obtain threshold data indicating a threshold that would produce a number of groups of the items. The number of groups is stable across a range of thresholds, and the range of thresholds meets a criterion for largeness of a range. The act in box 56 uses the threshold data to obtain grouping data indicating a grouping of the items. Fig. 3 shows software product 60, an article of manufacture that can be used in a system that includes components like those shown in Fig. 3. Software product 60 includes data storage medium 62 that can be accessed by storage medium access device 64. Data storage medium 62 could, for example, be a magnetic medium such as a set of one or more tapes, diskettes, or floppy disks; an optical medium such as a set of one or more CD-ROMs; or any other appropriate medium for storing data. Data storage medium 62 stores data that storage medium access device 64 can provide to processor 66. Processor 66 is connected for accessing memory 68, which can include program memory storing data indicating instructions that processor 66 can execute and also data memory storing data that processor 66 can access in executing the instructions. Processor 66 is also connected for receiving data defining images from image input circuitry 70. The data could be obtained from facsimile (fax) machine 72; from scanner 74; from editor 76, which could be a forms editor or other interactive image editor controlled by user input devices such as a keyboard and mouse or a pen- or stylus-based input device; or from network 78, which could be a local area network or other network capable of transmitting data defining an image. In addition to data storage medium 62, software product 60 includes data stored by storage medium 62. The stored data include data indicating grouping instructions 80, which processor 66 can execute to perform acts like those in Fig. 2. In executing instructions 80, processor 66 uses initial array data to obtain gap data. Initial array data 82 could be previously stored in memory 68 as shown or could be obtained by operating on data defining an input image received from image input circuitry 70. Initial array data 82 define an initial array of items, each indicating a value. The gap data indicate gaps between items in the initial array. Processor 66 uses the gap data to obtain threshold data indicating a threshold that would produce a number of groups of the initial items; the number of groups is stable across a range of thresholds, and the range of thresholds meets a criterion for largeness of a range. Processor 66 uses the threshold data to obtain grouping data indicating a grouping of the items in the initial array. Processor 66 can also be connected for providing data defining images to image output circuitry 90. For example, software product 60 could include data indicating instructions processor 66 can execute to use the grouping data in obtaining output image data defining an output image. The output image could show a precisely formed representation of information from an input image, for example. The output image data could be provided to image output circuitry 90, and could in turn be provided to fax machine 92, to printer 94, to display 96, or to network 98. The grouping data could also be used to provide control signals. For example, memory 68 could store control instructions processor 66 can execute to use the grouping data in obtaining control data defining control signals. The control data could be provided to control output circuitry 100, which could respond by providing control signals to system 102. Rather than being used immediately, the grouping data could instead be stored in memory 68 for possible future use. This would be appropriate, for example, where information indicating an operation to be performed on an input image has not been obtained at the time data defining the input image is received. Figs. 4-6 illustrate three examples, in each of which a threshold is obtained that would produce a number of groups; the number of groups is stable across a range of thresholds, and the range of thresholds meets a criterion of largeness for a range. The approach of Fig. 4 finds a threshold that produces a stable number of groups by iteratively applying thresholds to distances data, with each iteration incrementing the threshold. The approach of Fig. 5 finds a threshold that produces a stable number of groups by iteratively applying thresholds to the distances data, with each iteration increasing the threshold by a difference between distances. The approach of Fig. 6 finds a threshold that produces a stable number of groups by using distances data to obtain differences between distances that occur, and by then using the largest of the differences to obtain a threshold. In Fig. 4, the act in box 110 obtains initial item data that define an n-dimensional array of items, each indicating a value. The act in box 112 uses the initial item data to obtain distances data indicating a distance for each item in the array. As described above in relation to Fig. 1, the distances data can indicate gaps between items. The act in box 114 obtains a starting candidate threshold, which can be chosen so that only the smallest distance indicated by the distances data from box 112 is below the starting threshold. The act in box 120 then begins a series of iterations, each of which applies a candidate threshold to the distances data from box 112. The candidate threshold of the first iteration is the starting candidate threshold. The act in box 122 begins each iteration by using the iteration's candidate threshold to obtain thresholded distances data. The thresholded distances data can indicate, for each item in the array, a thresholded distance value that indicates whether the item's distance indicated by the distances data is above or below the iteration's candidate threshold. For example, the thresholded distance value for an item can be ON if the item's distance is above the candidate threshold, and OFF if the item's distance is below the candidate threshold, or vice versa. Each iteration's thresholded distances data define a number of distinct group items, with each group item including a set of the items in the array, as illustrated in relation to graph 20 in Fig. 1. The act in box 124 counts the group items, and the act in box 130 branches based on whether the count from box 124 is different than the count from box 124 in the previous iteration. If the count has changed, the act in box 132 may save data indicating the previous iteration's candidate threshold and a count of iterations that had the same group item count as the previous iteration. The act in box 132 determines whether to save this data by comparing the count of iterations with a count of iterations saved by box 132 in an earlier iteration. If the current count of iterations is greater, then the just-completed subsequence of iterations obtained a stable number of groups over a larger range of thresholds than previous subsequences, so the act in box 132 saves data indicating a candidate threshold and a count of iterations for the just-completed subsequence. Then the act in box 132 resets the iteration count to begin counting iterations having the same group item count as the current iteration. The effect of the act in box 132 is to apply a criterion for largeness of a range of thresholds. The last candidate threshold saved in box 132 is a threshold that obtained a number of groups that was stable over the largest range of thresholds. If the count has not changed, the act in box 134 increments the iteration count so that it continues to indicate the number of iterations having the same group item count as the current iteration. The starting candidate threshold from box 114 need not be smaller than the smallest distance between items in the array. Each increment should ideally be small enough to ensure that each possible number of groups is obtained by at least one iteration; if all distances indicated by the distances data are integers, each increment could be one, but if the distances are not all integers each increment could be half the smallest difference between distances. Before completing the iteration, the act in box 136 increments the candidate threshold to obtain the next iteration's candidate threshold. When the count of group items from box 124 reaches one, the act in box 140 returns the data most recently stored in the act in box 132, indicating a threshold that obtained a grouping with the largest iteration count. The act in box 142 then uses the threshold from box 140 to group the initial items, which can be done similarly to the acts in boxes 122 and 124. The act in box 142 can also provide grouping data indicating, for each group, the initial items in the group. In Fig. 5, the acts in boxes 160 and 162 can be implemented the same, respectively, as the acts in boxes 110 and 112 in Fig. 4. The act in box 164 obtains a starting candidate threshold, which can be chosen as in box 114 in Fig. 4. The act in box 170 then begins a series of iterations, each of which applies a candidate threshold to the distances data from box 162. The acts in boxes 172, 174, and 180 can be implemented the same, respectively, as the acts in boxes 122, 124, and 130 in Fig. 4. If the count has changed, the act in box 182 may save data indicating the previous iteration's threshold and a range of thresholds that would have the same group item count as the previous iteration. The act in box 182 determines whether to save this data by comparing the range of thresholds with a range of thresholds saved by box 182 in an earlier iteration. If the current range of thresholds is greater, then the just-completed subsequence of iterations provided a stable number of groups over a larger range of thresholds than previous subsequences, so the act in box 182 saves data indicating a candidate threshold and a range of thresholds for the subsequence. Then the act in box 182 resets a running sum of ranges of thresholds to begin accumulating a range of thresholds that produce the same group item count as the current iteration. If the count has not changed, the act in box 184 increases the running sum of ranges so that it continues to indicate a range of thresholds that produce the same group item count as the current iteration. Before completing the iteration, the act in box 186 increases the candidate threshold to obtain the next iteration's candidate threshold. The amount of the increase is a difference between distances indicated by the distances data from box 162, so that the thresholds are only the distances that occur between items defined by the initial item data from box 160. In comparison with the approach of Fig. 4, this can significantly reduce the number of iterations. This is advantageous if the computation necessary to obtain the distance differences data is less than the savings in iterations. A difference between distances can be obtained when needed by the act in box 186 or all the differences could be obtained in advance and saved for use in box 186. One way to obtain a difference between distances is to first redistribute the distance values indicated by the distance data from box 162 into a one-dimensional array. To do so, an accumulate operation can be performed, similar to the first pass of the spread operation described in the European Patent Application, concurrently filed herewith, corresponding to US Serial No. 08/157,600. The accumulate operation would save, for each possible distance value up to the highest value that occurs in the distance data image, the maximum value of the pixels in the distance data image that have that value. In contrast to the spread operation, this accumulate operation is performed over each equivalence class of values rather than over each connected component, so that it is inappropriate to label each connected component with a unique identifier before the accumulate operation--each equivalence class can be, in effect, an unconnected figure; also, the accumulate operation need not be followed by a second pass to label the pixels in each equivalence class because the purpose is to produce a one-dimensional array. The accumulate operation produces an array in which each distance value that does not occur has the value zero, while each distance value that occurs has its own value. Then rightward and leftward project operations can be performed to replace each zero with the nearest non-zero value to its left or, if none, the nearest non-zero value to its right. Then the resulting array can be shifted once to the left and the unshifted array can be subtracted from the shifted array to obtain a difference array. To obtain the largest difference between distances, an accumulate operation as described above can be performed, and the largest difference with a non-zero value can be obtained from the resulting array. In subsequent iterations, the difference in box 186 in the previous iteration can be used to obtain the next smaller difference with a non-zero value from the resulting array. The amount of one iteration's threshold increase in box 186 is used as the amount of the next iteration's increase in the running sum of ranges in box 184. When the count of group items from box 174 reaches one, the act in box 190 returns the data most recently stored in the act in box 182, indicating a threshold that obtained a grouping with the largest range of thresholds. The act in box 192 then uses the threshold from box 190 to group the initial items, which can be implemented the same as box 142 in Fig. 4. The computational cost of the approach of Fig. 4 is a function of the range of values that occur in the array. For each increment, an iteration must be performed, applying a candidate threshold and counting the resulting groups. The approach of Fig. 5 can reduce the number of iterations that must be performed. In Fig. 6, the act in box 200 obtains data indicating the extents of gaps that occur in an initial array. The act in box 202 obtains data indicating the largest difference between adjacent gap extents. The act in box 202 can be implemented by sorting the gap extents or loading them into a one-dimensional array as described above in relation to Fig. 5, then obtaining differences between adjacent gap extents and finding the largest difference, which will occur between an upper gap extent and a lower gap extent. The act in box 204 then obtains a threshold that is equal to one of the gap extents between the upper and lower gap extents, and could be the lower gap extent, for example. A threshold between the upper and lower gap extents can then be used with distance data to obtain a number of groups that is stable across a range that meets a criterion of largeness. The range meets the criterion because it is larger than ranges of thresholds across which other numbers of groups are obtained. The approach in Fig. 6 might also be applied, with appropriate modifications, where an initial array does not include gaps or includes equal gaps. For example, an initial threshold could be applied to color or grey scale pixel values to obtain a version of the initial array that includes gaps. Fig. 7 shows a system in which general features described above have been implemented. System 180 in Fig. 7 includes workstation 182, a Sun SPARCStation 10 workstation. Scanner 184 can be a conventional scanner such as a Xerox Datacopy GS Plus scanner. Printer 186 can be a conventional printer such as a Xerox laser printer. Network 188 can be a conventional network operating in accordance with a standard protocol, such as the Ethernet protocol. Workstation CPU 190 is connected to receive data from scanner 184 and network 188 and is connected to provide data to printer 186 and network 188. For example, CPU 190 can receive data defining an image from scanner 184 or from network 188. In addition, workstation CPU 190 is connected to access program memory 192 and data memory 194 and other conventional workstation peripherals (not shown). Data memory 194 is illustratively storing image data 196 defining an image. Program memory 192 stores instructions CPU 190 can execute to perform operations implementing the general acts in Fig. 2. CPU 190 executes operating system instructions 200 that provide a Unix operating system or other appropriate operating system. The other instructions stored by program memory 192 make calls to operating system instructions 200 in a conventional manner. In general, the instructions can be obtained from source code in a conventional programming language such as Lisp, C, or the like with conventional compiler or interpreter techniques that produce object code. A machine can store data indicating the source code or the resulting object code on a data storage medium in manufacturing a software product as described above in relation to Fig. 3, with the source code or object code being stored for access by a storage medium access device when the software product is used in a machine like system 180. In executing image receiving instructions 202, CPU 190 receives data defining an image and stores it in data memory 194, as illustrated by image data 196. The data defining the image may be received from scanner 184 or network 188. In executing image processing instructions 204, CPU 190 calls grouping instructions 206. Grouping instructions 206 may treat image data 196 as initial array data or may use image data 196 to produce initial array data defining an initial array in which each item indicates a value. Grouping instructions 206 call gap obtaining instructions 208, threshold instructions 210, and comparing instructions 212. Gap obtaining instructions 208 can use the initial array data to produce gap data 220 indicating gaps between items in the initial array. Threshold instructions 210 use gap data 220 to produce threshold data 222 indicating a threshold that would produce a number of groups that is stable across a range of thresholds that meets a criterion for largeness of range. Comparing instructions 212 use threshold data 222 to obtain grouping data 224 indicating a grouping of the items in the initial array. Image processing instructions 204 also perform other operations relating to image analysis. Many of the acts described below in relation to grouping instructions 206, gap obtaining instructions 208, threshold instructions 210, and comparing instructions 212 are performed on items of data, each of which defines an image. Each item is referred to as a "data image." Some data images can be used in obtaining others. In general, all of the data images define images with the same number of pixels, and each operation produces an image with the same number of pixels. An operation on two images typically uses values of pairs of pixels to produce, for each pair, a pixel value in an image being produced; within each pair, one pixel is from each image and the two pixels in the pair are both at the same location as the pixel value in the image being produced. Many examples of such operations are described in the European Patent Applications, concurrently filed herewith, corresponding to US Serial Nos. 08/157,600 and 08/157,804. Fig. 8 shows acts in executing grouping instructions 206 in Fig. 7 to perform one-dimensional grouping on values from a parameter data image. Fig. 9 shows acts in obtaining a threshold in Fig. 8. The act in box 250 in Fig. 8 begins by obtaining a parameter data image in which each pixel is labeled with a value of a parameter. The parameter could, for example, be area, elongation, aspect ratio, width, horizontal center of area, vertical center of area, or orientation. Techniques for obtaining such a data image are described in the European Patent Applications, EP 654 748 A2, EP 654 766 A2, EP 654 754 A2, EP 654 750 A2, EP 654 751 A2 and EP 654 763 A2. The act in box 252 branches based on whether the parameter data image includes a sufficient number of different values for the parameter. Since the number of possible groups is at least one less than the number of different values, the act in box 254 returns the parameter data image from box 250 if there are too few different values to produce a minimum acceptable number of groups. For example, the minimum acceptable number of groups could be two or, eliminating outliers as discussed below, three; the minimum number of different values in box 252 could accordingly be three or, if outliers are being eliminated, four. The act in box 252 can be implemented by scanning the parameter data image to obtain a list of values that occur in it, then obtaining the length of the list and comparing it with the minimum number of different values. The act in box 256 obtains a threshold that would produce a number of groups that is stable across a range of thresholds that meets a criterion for largeness of range. The act in box 256 can be implemented using the list of values from box 252, as described below in relation to Fig. 9. The act in box 258 obtains an array in which each item represents a value that the parameter can have. Each item's value indicates whether the parameter data image from box 250 includes a pixel labeled with the value the item represents. The act in box 258 can be implemented by using the parameter data image from box 250 to obtain a binary data image in which each pixel is ON if it has a value greater than zero in the parameter data image. The act in box 258 can then use the binary data image and the parameter data image to perform an accumulate operation. The accumulate operation can use a sum operation to obtain a sum for each label, with each label's sum indicating the number of pixels in the parameter data image that have the label. Or the accumulate operation can use a maximum operation to obtain a binary value for each label, indicating whether or not the label occurs in the parameter data image. The act in box 260 then initializes a number of variables before beginning a first iterative loop. The current item in the array can be initialized to the zeroth item, for example, and a distance count can be initialized to one more than the threshold to ensure that the distance from the zeroth item to the first item with a non-zero value will not be treated as a gap. A group count can be initialized to zero. The act in box 262 begins the first iterative loop, in which each iteration after the first advances one item in the array from the item handled in the previous iteration. The first iterative loop continues until the uppermost item in the array is reached. The act in box 270 begins each iteration by determining whether the iteration's item in the array has the value zero. If so, the act in box 272 simply increments the distance count, so that the distance count indicates the number of zeroes since the last item with a non-zero value. If the iteration's item has a non-zero value, the act in box 274 branches based on whether the distance count is above threshold. If so, the act in box 276 increments the group count, so that the group count indicates one more than the number of strings of zeroes that extend between non-zero values and that are longer than the threshold. In other words, the group count indicates the number of groups. If the distance count is below threshold, the act in box 278 saves the current group count so that it can be accessed using data indicating the iteration's item. The act in box 278 can be implemented with a results array that is the same size as the array of items with parameter values, so that each iteration's item in the array of values is in the same position as its item in the results array. In either case, the act in box 280 resets the distance count to zero so that it can begin counting the next string of zeroes. When the first iterative loop has visited all the items in the array of values, the act in box 282 can obtain a grouped version of the parameter data image from box 250, in which each pixel with a non-zero label in the parameter data image is labeled with a group number. The act in box 282 can be implemented by a distribute operation. The distribute operation can use the results array from box 278, using each pixel's label in the parameter data image to access an item in the results array, and using the value of the accessed item in the results array to label the pixel in the grouped parameter data image. The act in box 284 then begins a second iterative loop that continues until the number of groups is at least as great as the minimum acceptable number of groups, discussed above in relation to box 252. This second iterative loop can compensate for outliers that would otherwise result in only two groups--one group including the outlier and the other including all other non-zero values. The technique used in the second iterative loop is to find a threshold that would produce a number of groups that is stable across the next largest range of thresholds when compared with the previous threshold, until the number of groups exceeds the minimum acceptable number of groups, which will be three to compensate for outliers and two if it is not appropriate to compensate for outliers. A threshold that obtains a number of groups exceeding the minimum acceptable number and that is stable across the largest range of thresholds thus meets a criterion for largeness of range. The second iterative loop is necessary because a grouping stability criterion may produce an inappropriate grouping if an outlier is present. An outlier may be defined as an extremum or near extremum value separated from the next smaller or larger value by the maximal gap. In practice, an outlier may be one of several very large or very small values clustered together. If an outlier is present, a threshold within the largest range of thresholds with a stable number of groups may have two groups--the outlier in one group and all other non-zero values in the other. In many cases, the grouping into two groups may omit important information about the non-outlier group, such as its subgroups. The second iterative loop in Fig. 8 illustrates a solution to the outlier problem. If a grouping is obtained with the minimum acceptable number of groups, a threshold within the next largest range of thresholds with a stable number of groups can be used, and so forth, until the minimum acceptable number of groups is obtained. If the minimum acceptable number of groups is three, then the resulting grouping will include information about the subgroups of the non-outlier group. Since the maximum pixel label in the grouped parameter data image from box 282 is equal to the number of groups, the act in box 284 can be implemented by finding the maximum pixel label and comparing it with the minimum acceptable number of groups. If the number of groups is below the minimum acceptable number, the act in box 286 can obtain the next threshold, similar to the act in box 256, as discussed in more detail below in relation to Fig. 9. Then, the acts in boxes 258, 260, 262, 270, 272, 274, 276, 278, 280, and 282 can be performed for the next threshold, as indicated by the circles with letters "A" and "B" in Fig. 8. The new grouped parameter data image from box 282 can then be used again in box 284. When the number of groups reaches the minimum acceptable number, the act in box 288 returns the grouped parameter data image obtained most recently. The technique in Fig. 9 can be used to implement the acts in boxes 256 and 286 in Fig. 8. The technique in Fig. 9 generally follows the acts in Fig. 6, but any of the techniques in Figs. 4-6 could be used to obtain thresholds. The act in box 300 obtains data indicating values. As shown, the data indicating values can be a list of values obtained as described above in relation to box 252 in Fig. 8. The act in box 302 sorts the values obtained in box 300 to produce a sorted list of values. The act in box 310 begins an iterative loop that handles each adjacent pair of values in the sorted list. For each pair of values, the act in box 312 obtains data indicating a gap between the values. The act in box 314 then sorts the gaps to obtain a sorted list of gaps. Alternatively, after the act in box 284 determines that the number of groups is not sufficient, the act in box 316 can obtain a sorted list of gaps by removing the largest gap from the previous sorted list of gaps. The act in box 318 prepares for another iterative loop by initializing a threshold variable and a largest difference variable to zero. The act in box 320 then begins the iterative loop, which handles each adjacent pair of gaps in the sorted list of gaps from box 314 or from box 316. For each pair of gaps, the act in box 322 obtains data indicating a difference between the gaps. The act in box 324 then compares the difference from box 322 with the largest difference variable. If the difference from box 322 is greater, the act in box 326 updates the threshold variable to the smaller of the two gaps in the current pair and updates the largest difference variable to the difference from box 324. When all the pairs of gaps have been handled, the act in box 328 returns the value of the threshold variable. The technique in Figs. 8 and 9 can perform one-dimensional grouping of several different types. The current implementation provides several types of global similarity grouping--area similarity, elongation similarity, aspect ratio similarity, width similarity, horizontal center of area similarity, vertical center of area similarity, and orientation similarity. Global similarity grouping could also be performed for other parameters. Fig. 10 shows acts in executing grouping instructions 206 in Fig. 7 to perform grouping for items in a two-dimensional array. Fig. 11 shows acts in obtaining a threshold in Fig. 10. The act in box 350 in Fig. 10 begins by obtaining a data image in which each pixel is labeled with a value of a parameter. The act in box 352 uses the data image from box 350 to obtain data indicating values. The act in box 352 can be implemented in various ways, some of which are discussed below in relation to specific types of grouping. The act in box 356 uses the values from box 352 to obtain a threshold that would produce thresholded distance data defining a number of groups. The number of groups is stable across a larger range of thresholds than another number of groups. The act in box 356 can be implemented as described below in relation to Fig. 11. The act in box 356 uses the data image from box 350 to obtain a distances data image in which each pixel is labeled with a distance to a near neighbor, in the data image from box 350, in the complement of the data image from box 350, or in another appropriate related data image. The act in box 358 compares each pixel's distance in the distances data image from box 356 to the threshold from box 354 to obtain a groups data image in which a pixel is ON if its distance compares appropriately with the threshold. The groups data image defines a number of groups of pixels, each including at least one connected component from the data image from box 350. The comparison in box 358 can be either for distances above or below the threshold, as discussed below in relation to specific types of grouping. The act in box 360 begins an iterative loop that continues until the number of groups is at least as great as the minimum acceptable number of groups, discussed above in relation to Fig. 8. The iterative loop can compensate for outliers that would otherwise result in only two groups--one group including the outlier and the other including all other connected components. The technique used in the iterative loop is to find a threshold that would produce a number of groups that is stable across the next largest range of thresholds when compared with the previous threshold, until the number of groups exceeds the minimum acceptable number of groups, which will be three to compensate for outliers and two if it is not appropriate to compensate for outliers. Other strategies could alternatively be used to compensate for outliers, such as first grouping connected components based on area, then removing any connected components in the group with the smallest areas. The act in box 360 can be implemented by counting the number of connected components in the groups data image from box 358, and by then comparing the number with the minimum acceptable number of groups. The number of connected components can be obtained by first labeling each pixel in a connected component with a unique identifier for the connected component. If the unique identifiers together form a dense set of integers starting with one, the number can be obtained simply by obtaining the maximum unique identifier. If the number of groups is below the minimum acceptable number, the act in box 362 can obtain the next threshold, similar to the act in box 354, as discussed in more detail below in relation to Fig. 11. Then, the acts in boxes 356 and 358 can be performed for the next threshold, as indicated by the circles with letters "A" and "B" in Fig. 10. Note, however, that it is not necessary to repeat the act in box 356 if the previous result was saved. The new groups data image from box 358 can then be used again in box 360. When the number of groups reaches the minimum acceptable number, the act in box 364 returns the groups data image obtained most recently. The groups data image could be used to obtain a group label data image in which each pixel in a connected component in the data image from box 350 is labeled with a number identifying the group that includes the connected component. As described in relation to box 360, each pixel in a connected component in groups data image from box 364 can be labeled with a unique identifier for its connected component, where the unique identifiers form a dense set of integers starting with one. The resulting labeled groups data image is similar to the grouped parameter data image from box 288 in Fig. 8. The technique in Fig. 11 can be used to implement the acts in boxes 354 and 362 in Fig. 10. The technique in Fig. 11 generally follows the acts in Fig. 6, but any of the techniques in Figs. 4-6 could be used to obtain thresholds. The act in box 370 obtains data indicating distances. As shown, the data indicating distances can data indicating values from box 352 in Fig. 10. The act in box 372 sorts the distances obtained in box 370 to produce a sorted list of distances. Alternatively, after the act in box 360 determines that the number of groups is not sufficient, the act in box 374 can obtain a sorted list of distances by removing the largest distance from the previous sorted list of distances. The act in box 376 prepares for an iterative loop by initializing a threshold variable and a largest difference variable to zero. The act in box 380 then begins the iterative loop, which handles each adjacent pair of distances in the sorted list of distances from box 372 or from box 374. For each pair of distances, the act in box 382 obtains data indicating a difference between the distances. The act in box 384 then compares the difference from box 382 with the largest difference variable. If the difference from box 382 is greater, the act in box 386 updates the threshold variable to the smaller of the two distances in the current pair and updates the largest difference variable to the difference from box 384. When all the pairs of distances have been handled, the act in box 388 returns the value of the threshold variable. Figs. 12-15 illustrate several types of grouping that have been implemented using techniques described above. Figs. 12-14 illustrate proximity grouping of three types--spatial clustering, segmentation of partially bounded regions, and segmentation by local width. Fig. 15 illustrates global similarity grouping. As can be seen from Figs. 12-15, each type of grouping obtains equivalence classes that may be useful for image processing. The resulting groups may be more meaningful than the items they include if they reflect meaningful scene structure, such as objects of interest. Grouping can play an important role in operations that are performed on parts of an image rather than on the image as a whole. By operating on groups, rather than on individual pixels, analysis may proceed in a coarse to fine manner. Each of the following examples of proximity grouping uses an input image to obtain a grouped image that shows equivalence classes. Each example uses data defining its input image to obtain gap data indicating gaps between items in the data defining the input image, but each example obtains its gap data differently. Each example uses its gap data to obtain a threshold, using an approach similar to that of Fig. 6 so that the threshold would produce a number of groups that is stable across a range of thresholds that meets a criterion for largeness. Each example also uses data defining its input image to obtain a distances data image indicating a distance for each pixel in the input image, but some examples obtain a distances data image differently than others. Each example compares its threshold with its distances data image to obtain data defining its grouped image, so that pixels with distances above the threshold are separated from pixels with distances above the threshold. Some examples then use data defining the grouped image to perform further operations. In Fig. 12, input image 400 shows alphanumerical characters that form terms that are perceptible as an array with three rows and four columns. Grouped image 402 shows how spatial clustering produces twelve connected components, one for each row/column combination. Each connected component in grouped image 402 includes one or more of the connected components in input image 400, so that grouping of pixels into connected components provides information that can be used to group connected components. To perform spatial clustering as in Fig. 12, the gap data can be obtained by applying a foreground neighbor border criterion that requires a pixel that is on a border between parts of the input image in which pixels have different near neighbors in the foreground, i.e. different black near neighbors. The criterion can be applied by using input image 400 to obtain a Voronoi edge data image in which each pixel at an edge between two Voronoi regions is labeled with a unique identifier for the edge. Each pixel with a non-zero value in the Voronoi edge data image meets the criterion. The Voronoi edge data image can be obtained by first performing a swap operation on a neighbor identifier data image, then gating the result with a tesselation data image, and then labeling each pixel that has a positive value in the gated data image with the concatenation of its positive value and its value in the neighbor identifier data image. The neighbor identifier data image can be obtained by first obtaining a component identifier data image in which each pixel in a connected component is labeled with a unique identifier for the connected component. Then, the component identifier data image can be used to perform a read operation, using x and y near neighbor offsets to obtain the neighbor identifier data image in which each pixel is labeled with the unique identifier of a connected component that is a near neighbor. The swap operation can be performed on the neighbor identifier data image by first performing four shift operations so that each pixel has, in addition to its value in the neighbor identifier data image, the value of each of its four-connected neighbor pixels, referred to as left, right, up, and down. Then, at each pixel that has a non-zero value in the neighbor data image, the pixel's value can be compared with its left, up, right, and down, returning the value of the first neighboring pixel that is different than the pixel's value in the neighbor data image. If none of the neighboring pixel's have a different value, the pixel's value after the swap operation is zero. The neighbor identifier data image can also be used to obtain the tesselation data image. The tesselation data image is a version of the neighbor identifier data image in which each pixel is ON if it has a four-connected neighbor that has a different value in the neighbor identifier data image, which can be obtained as an edges data image, comparing integer labels from the neighbor identifier data image. The tesselation data image can be used to gate the swapped neighbor data image so that, in the gated data image, each pixel that is ON in the tesselation data image is labeled with its value in the swapped neighbor data image, while other pixels are OFF. A foreground neighbor distances data image can be obtained indicating, for each pixel, a distance to a near neighbor in the foreground of input image 400. The pixels in each edge in the Voronoi edge data image can then be labeled with the smallest foreground neighbor distance for pixels in the edge to obtain a gap data image. A spread operation can be performed to obtain the gap data image. The gap data can be a list of the distances that occur in the gap data image or an array indicating, for each distance, whether it occurs. The gap data can be used to obtain a threshold as described above. The threshold can then be compared with each pixel's value in the foreground neighbor distances data image to obtain data defining grouped image 402, in which a pixel is ON only if its distance in the foreground neighbor distances data image is less than or equal to the threshold distance. Also, the minimum acceptable number of groups can be three to eliminate outliers; otherwise, it could be two. Segmentation of partially bounded regions as in Fig. 13 can obtain meaningful regions that are not defined by closed, connected bounding contours. Such regions are referred to as "partially bounded regions," and examples include regions defined by dotted or dashed boundaries and boundaries in which spaces may be quite wide. Partially bounded regions cannot be extracted based on connectivity of boundaries, but could in some cases be extracted by transforming disconnected boundary elements into a connected boundary. Proximity grouping, however, can extract partially bounded regions directly, without a connected boundary, by applying a threshold distance to distances at narrowings of the background region, which occur at spacings between foreground components. The narrowings can be distinguished based on background ridge points with near neighbor boundary points that are nearly diametrically opposed. To perform segmentation of partially bounded regions as in Fig. 13, the gap data can be obtained by applying an opposing foreground neighbor border criterion that requires a pixel that is on a border between parts of the input image in which pixels have near neighbors in the foreground that are approximately 180° apart. The criterion can be applied by using input image 410 to obtain a direction data image in which each pixel is labeled with a direction to a near neighbor, then using the direction data image to obtain a direction difference data image, and then comparing each pixel's value in the direction difference data image with a criterion angle, such as 140 degrees, to obtain a large angle data image in which each pixel is ON if its value in the direction difference data image is greater than the criterion angle. The direction difference data image can be obtained by labeling each pixel with the absolute values of its differences from the four four-adjacent pixels, then obtaining the maximum of the absolute values. A foreground neighbor distances data image can be obtained indicating, for each pixel, a distance to a near neighbor in the foreground of input image 410. The pixels in each connected component in the direction difference data image can then be labeled with the largest foreground neighbor distance for pixels in the connected component to obtain a gap data image. A spread operation can be performed to obtain the gap data image. The gap data can be a list of the distances that occur in the gap data image or an array indicating, for each distance, whether it occurs. The gap data can be used to obtain a threshold as described above. The threshold can then be compared with each pixel's value in the foreground neighbor distances data image to obtain data defining grouped image 412, in which a pixel is ON only if its distance in the foreground neighbor distances data image is greater than the threshold distance. In grouping to segment partially bounded regions, group image 412 can be referred to as a partial ground data image. The partial ground data image can be used to obtain other data images. One technique can obtain a partial exterior data image by first ANDing the partial ground data image with a border data image in which pixels at the image border are ON. A coloring operation can be performed on the partial ground operation using the ANDed data image as a seed to produce the partial exterior data image. Another technique can perform a remove or set difference operation to remove each connected component in the partial exterior data image from the partial ground data image, producing a partial holes data image. A growing or thickening operation can then be performed on the partial holes data image to increase it by approximately the threshold to fill an interior region, as illustrated by image 414 in Fig. 13. Another technique can obtain a partial boundaries data image in which each pixel is ON that is a Voronoi neighbor (i.e. in an adjacent Voronoi region) of a pixel that is ON in the partial holes data image. Segmentation by local width as in Fig. 14 decomposes foreground connected components into a larger number of distinct connected components. Such segmentation makes it possible to treat a connected shape as a superimposition of simpler shapes, so that each of the component shapes can be handled separately. For example, a threshold can be applied to differences in width among the component shapes if compact shapes are superimposed on narrower curvilinear figures. Narrowings in foreground connected components can be distinguished in much the same way narrowings in background regions are distinguished in segmentation of partially bounded regions. If a uniform threshold is applied at all positions, the superimposed components must all be of similar width and the components on which they are superimposed must also be of similar width. A superimposed component cannot be separated from a line if the difference in width is smaller than the difference between the superimposed component and some larger superimposed component. The difference in width between the smallest superimposed component and the line must be greater than the difference between any two superimposed components. To perform segmentation by local width as in Fig. 14, the gap data can be obtained by applying an opposing background neighbor border criterion that requires a pixel that is on a border between parts of the input image in which pixels have near neighbors in the background that are approximately 180° apart. The criterion can be applied by using input image 420 to obtain a direction data image in which each pixel is labeled with a direction to a near neighbor in the background or complement of input image 420, then using the direction data image to obtain a direction difference data image, and then a large angle data image in which each pixel is ON if its value in the direction difference data image is greater than a criterion angle, as described above in relation to Fig. 13. The complement of input image 420 can also be used to obtain a background neighbor distances data image can be obtained indicating, for each pixel, a distance to a near neighbor in the background of input image 420. The pixels in each connected component in the direction difference data image can then be labeled with the largest background neighbor distance for pixels in the connected component to obtain a gap data image. A spread operation can be performed to obtain the gap data image. The gap data can be a list of the distances that occur in the gap data image or an array indicating, for each distance, whether it occurs. The gap data can be used to obtain a threshold as described above. The threshold can then be compared with each pixel's value in the background neighbor distances data image to obtain data defining grouped image 422, in which a pixel is ON only if its distance in the foreground neighbor distances data image is greater than the threshold distance. The grey pixels in grouped image 422 indicate pixels that were ON in input image 420 but are not ON in grouped image 422 because their background neighbor distances are below the threshold. In grouping to segment by local width, grouped image 422 can be referred to as a partial foreground data image. The partial foreground data image can be used to obtain other data images. For example, a growing or thickening operation can be performed on the partial foreground data image to increase it by approximately the threshold to obtain a data image showing the full size foreground components in input image 420, as illustrated by image 424 in Fig. 14. Global similarity grouping as in Fig. 15 groups features with similar values of a given property into an equivalence class, without regard to spatial arrangement. Before grouping, each pixel can be labeled with a value of a parameter for a connected component or other feature that includes the pixel. Parameter values that occur in the labeled data image can then be grouped as described above for one-dimensional grouping. After grouping, pixels with values in the same group can all be given the same label for the group, so that all pixels with values in a group have the same label. To perform global similarity grouping as in Fig. 15, the gap data can be obtained by first using input image 430 to obtain an area data image in which each pixel in a connected component in input image 430 is labeled with the area of the connected component. Then, the values that occur in the area data image can be used to obtain a one-dimensional array in which each item represents a value of area and each item indicates the value it represents only if that value occurs in the area data image. Gap data can be obtained by performing project operations on the array to obtain a filled array, shifting the filled array, and taking a difference between the filled array and the shifted filled array, as described above, to obtain a list of differences or to obtain another array indicating, for each difference, whether it occurs. The gap data can be used to obtain a threshold as described above, by finding the largest difference between gap extents. The threshold can then be compared with the differences between non-zero values in the array to obtain grouping data indicating equivalence classes of the values of area. Each equivalence class can be given a unique identifier, and grouped image 432 can be obtained in which each pixel with a non-zero value in the area data image is labeled with the unique identifier of the equivalence class that includes the value. The difference identifiers are represented in grouped image 432 by different patterns of grey. System 490 in Fig. 16 includes network 492, workstation 494, storage server 496, and image processing server 498. A user can operate workstation 494 to provide requests on network 492 for storage of data defining images, such as from a scanner or other source. In response, storage server 496 can store the data. Then, the user can operate workstation 494 to provide requests for image processing operations like those described above. In response, image processing server 388 can perform the requested operations, executing instructions like those described above in relation to Fig. 7. Fig. 17 shows how the techniques described above could be applied in a personal computer that can operate as a fax server. Fig. 18 illustrates how the techniques described above could be applied in a copier. System 500 in Fig. 17 includes CPU 502, which can be the CPU of a personal computer such as an IBM PC compatible machine. CPU 502 is connected to receive user input signals from keyboard 504 and mouse 506, and can present images to a user through display 508. CPU 502 is also connected to a number of other peripheral devices, illustratively including disk drive 510, modem 512, scanner 514, and printer 516. Program memory 520 stores operating system (OS) instructions 522, which can be a version of DOS; user interface instructions 524; fax server instructions 526; image processing instructions 528; and grouping instructions 530. Fax server instructions 526 can be similar to the PaperWorks'" software product from Xerox Corporation. Image processing instructions 528 can be implemented as described above in relation to image processing instructions 204 in Fig. 7. Grouping instructions 530 can be implemented as described above in relation to grouping instructions 206 in Fig. 7 and in relation to Figs. 8-11. Fax server instructions 526, image processing instructions 528, and grouping instructions 530 could be obtained in the form of a software product stored on a floppy disk, diskette, or CD-ROM, and accessed for storage in program memory 520 by disk drive 510. Data memory 540 stores input image data 542, threshold data 544, and grouping data 546 as described above in relation to Figs. 7-11. Data memory 540 can also store output image data 548 if image processing instructions 528 obtain data defining an output image as described in the European Patent Applications, concurrently filed herewith, corresponding to US Serial Nos. 08/157,804; 08/158,062 and 08/157,856. System 500 can obtain input image data 542 defining an image in many ways: Data defining an image could be produced interactively, such as by executing user interface instructions 524. Any appropriate user interface techniques could be used, including pen-based techniques. Data defining a previously produced image could be retrieved from a storage medium by disk drive 510. Data defining an image could be obtained from scanner 514. A user could produce data defining an image elsewhere and provide it to system 500 through modem 512, such as by making a facsimile transmission to modem 512. CPU 502 could execute fax server instructions 526 in response to a request received by facsimile transmission through modem 512. The request could include a form indicating an image analysis operation and also indicating an output image destination such as a fax machine or printer 516. The request could also include data defining an image or could indicate an image previously obtained by system 500. Fax server instructions 526 could include calls to image processing instructions 528 to perform image analysis, and image analysis instructions 528 could in turn call grouping instructions 530 to perform acts like those shown in Figs. 8-11 if a grouping operation is appropriate. Execution of fax server instructions 526 could further provide data defining an output image, which could be provided to modem 512 for facsimile transmission or to printer 516 for printing. In Fig. 18, copier 560 can be a digital copier or other electronic reprographics system. Scanning circuitry 562 obtains data defining input image 564. User interface circuitry 570 includes touch sensing device 572, which can be a push button, a heat or pressure sensitive element, a capacitance sensing element, or other device for sensing a touching action. When a user touches device 572, user interface circuitry 570 provides touch data indicating that device 572 has been touched. Processing circuitry 580 uses the touch data to obtain request data indicating a request for an image analysis operation. Then, responding to the request, processing circuitry 580 uses data defining input image 564 to automatically obtain grouping data indicating groups of connected components or groups of values of a parameter in input image 564 or in a data image obtained using input image 564. Processing circuitry 580 then uses the grouping data to obtain data defining an output image. This data is provided to printing circuitry 590 for printing of output image 592. The invention could also be applied in combination with other techniques, including those described in the European Patent Applications EP 654 754 A2 and EP 654 750 A2.

Claims: A method of operating a machine to analyze an image, the method comprising the steps of: receiving input image data (196; 542) defining an input image; using the input image data to obtain (50) initial array data (10; 82); the initial array data defining an initial array of value items (12,14,16,18), each value item indicating a value; the initial array including a set of value items that indicate values that meet a reference criterion; storing the initial array data in a memory; accessing the initial array data in the memory and using the initial array data to obtain (52) gap data (20; 220) indicating, for each value item in the initial array, a distance to the closest value item that is in the set of value items indicating values meeting a reference criterion; comparing the obtained gap data to a plurality of candidate thresholds; each candidate threshold being above or below said gap data; for each candidate threshold determining the number of groups of value items which are separated by a gap associated with gap data larger than the candidate threshold; fixing a threshold indicated by threshold data (222; 544) in a range of thresholds in which the number of said groups is stable and said range is larger than a range of thresholds across which any other number of groups in a set of numbers of groups is stable; and using the threshold data to obtain (56) grouping data (224; 546) indicating a grouping of the value items in the initial array. The method of claim 1 in which the grouping data indicate groups of value items, each group meeting a transitive closure criterion subject to the threshold in the initial array. The method of claim 1 or 2 in which the number of groups of the value items is one of a set of numbers of groups. The method of claim 3 in which the numbers in the set of numbers of groups are all greater than a minimum number of groups. The method of claim 4 in which the minimum number of groups is one or two. The method of one of claims 1 to 5 in which the gap data indicate, for each value item in the initial array, a distance; the threshold data indicating a threshold gap value; the act of using the threshold data to obtain grouping data comprising: comparing (274) the threshold gap value with each (262, 270, 272) distance indicated by the gap data. The method of one of claims 1 to 6 in which the reference criterion requires a value item indicating a value that is ON or OFF. The method of claim 1 in which the act of using the threshold data to obtain grouping data comprises: obtaining thresholded data that indicate a set of the value items in the initial array; each value item in the set having a distance to another value item that meets a reference criterion; the distances of all the value items in the set meeting a comparison criterion in relation to the threshold; the set of value items including two or more subsets of value items, each subset meeting a transitive closure criterion subject to the threshold in the initial array; and using the thresholded data to obtain the grouping data by obtaining, for each subset of value items, a group identifier. The method of claim 8 in which the thresholded data include a binary value for each value item in the initial array, the comparison criterion requiring a value item's distance to be above the threshold; each value item's binary value being ON if the value item's distance is above the threshold; or each value item's binary value being ON if the value item's distance is below the threshold; or each value item's binary value indicating whether the value item's distance meets the comparison criterion; the transitive closure criterion requiring a subset of value items to be a connected component; or the initial array data defining an image that includes pixels, each value item in the initial array being a pixel value; the grouping data defining a version of the image indicating, for each value item that is in a group of value items defined by the thresholded data, the group's identifier. The method of claim 9 in which the value items in the initial array define connected components; the grouping data defining groups that cluster the connected components and, optionally in which the grouping data define groups that segment the image. The method of one of claims 1 to 10 in which values of a parameter define the initial array; the method further comprising, before the act of storing initial array data: obtaining parameter data indicating a set of values of the parameter; and using the parameter data to obtain the initial array data; each value item in the initial array indicating, for one of the values of the parameter, whether its value is in the set of values indicated by the parameter data; using the initial array data to obtain gap data comprising: using the initial array data to obtain difference data indicating a difference between adjacent values of the parameter for which value items in the initial array indicate that their values are in the set of values indicated by the parameter data; and using the difference data to obtain the gap data. The method of claim 11 in which the act of using the threshold data to obtain grouping data comprises: using the initial array data and the threshold data to obtain, for each value item in the initial array that indicates that its value is in the set of values, a group identifier that identifies a group that includes the value item; and using the group identifiers to obtain the grouping data. The method of claim 12 in which the parameter data indicate, for each position in a parameter array, a value of the parameter; the parameter data indicating values that are in the set of values for a set of the positions; the act of using the group identifiers to obtain the grouping data comprising: for each position in the set of positions, using the value indicated for the position by the parameter data and the group identifiers to obtain a group identifier for the position; the grouping data indicating a group identifier for each position in the set of positions. The method of claim 13 in which the parameter data define an image; the grouping data defining a version of the image indicating, for each position, a group identifier. The method of claim 13 in which the parameter is an attribute of features in images, each value of the parameter indicating a value of the attribute. The method of claim 15 in which the attribute is area, elongation, aspect ratio, width, horizontal center of area, vertical center of area, or orientation. The method of one of claims 1 to 16 in which the gap data indicate a gap for each value item in the initial array; the acts of comparing the gap data, determining the number of groups and fixing a threshold comprising: performing a sequence of iterations, the iterations including a first iteration and a number of following iterations, each following iteration having a preceding iteration, each iteration having threshold candidate data indicating a candidate threshold, the threshold candidate data of each following iteration indicating a candidate threshold that is greater than the preceding iteration's candidate threshold; each iteration comprising: using the iteration's threshold candidate data to obtain thresholded data, the thresholded data indicating, for each value item in the initial array, whether the gap indicated by the gap data for the value item is above or below the iteration's candidate threshold; the thresholded data defining a number of groups of the value items in the initial array; and using the iteration's thresholded data to obtain group count data indicating the number of groups defined by the thresholded data. The method of claim 17 in which the acts of comparing the gap data, determining the number of groups and fixing a threshold further comprise: using the iterations' group count data to obtain subsequence length data indicating a number of iterations in each subsequence of iterations with group count data indicating equal numbers of groups; and using the subsequence length data to obtain the threshold data; the threshold data indicating the candidate threshold of an iteration with group count data indicating a first number of groups; the subsequence length data indicating that a subsequence of iterations with group count data indicating the first number of groups includes a range of thresholds that meets the criterion for largeness of a range. The method of claim 17 in which each following iteration further comprises: using the preceding iteration's threshold data to obtain the following iteration's threshold data, the following iteration's threshold data indicating a threshold that is greater than the preceding iteration's threshold by a gap difference, the gap difference being a difference between gaps indicated by the gap data between which no indicated gaps occur; the acts of comparing the gap data, determining the number of groups and fixing a threshold further comprising: using the iterations' group count data to obtain threshold range data indicating a range of thresholds in each subsequence of iterations with group count data indicating equal numbers of groups; and using the threshold range data to obtain the threshold data; the threshold data indicating the candidate threshold of an iteration with group count data indicating a first number of groups; the threshold range data indicating that a subsequence of iterations with group count data indicating the first number of groups includes a range of thresholds that meets the criterion for largeness of a range. The method of claim 1 in which the gap data indicate a gap for each value item in the initial array; the acts of comparing the gap data, determining the number of groups and fixing a threshold comprising: using the gap data to obtain largest difference data, the largest difference data indicating, for the gaps indicated by the gap data, a largest difference between gaps between which no indicated gaps occur; the largest difference occurring between a lower gap and an upper gap; and using the largest difference data to obtain the threshold data, the threshold data indicating a threshold that is above the lower gap and below the upper gap; the act of using the threshold data to obtain grouping data comprising: using the initial array data to obtain distance data indicating a distance for each value item in the initial array; and using the threshold data and the distance data to compare the threshold to each value item's distance. The method of claim 20 in which the gap data indicate, for value items in the initial array that meet a foreground neighbor border criterion, a distance to a near neighbor in the initial array; the distance data indicating a distance to a near neighbor for each value item in the initial array; the act of using the threshold data to obtain grouping data further comprising: grouping value items together that have distances that are below the threshold or grouping value items together that have distances that are above the threshold or in which the gap data indicate, for value items in the initial array that meet an opposing background neighbor border criterion, a distance to a near neighbor in the complement of the initial array; the distance data indicating a distance to a near neighbor in the complement of the initial array for each value item in the initial array; the act of using the threshold data to obtain grouping data further comprising: grouping value items together that have distances that are above the threshold. A machine comprising: memory (68; 192, 194; 520, 540) for storing data; and a processor (66; 190; 520) connected for accessing data stored in the memory; the data stored in the memory comprising initial array data (10; 82) defining an initial array of value items (12, 14 16, 18), each value item indicating a value; the initial array including a set of value items that indicate values that meet a reference criterion; the data stored in the memory further comprising instruction data (192; 520) indicating grouping instructions (112; 530) the processor can execute; the processor, in executing the grouping instructions: accessing the initial array data in the memory and using the initial array data to obtain (52) gap data (20; 220) indicating, for each value item in the initial array, a distance to the closest value item that is in the set of value items indicating values meeting a reference criterion; comparing the obtained gap data to a plurality of candidate thresholds; each candidate threshold being above or below said gap data; for each candidate threshold determining the number of groups of value items which are separated by a gap associated with gap data larger than the candidate threshold; fixing a threshold indicated by threshold data (222; 544) in a range of thresholds in which the number of said groups is stable and said range is larger than a range of thresholds across which any other number of groups in a set of numbers of groups is stable; and using the threshold data to obtain (56) grouping data (224; 546) indicating a grouping of the value items in the initial array. The machine of claim 22 in which the machine further comprises input image circuitry (70) for obtaining data defining images as input; the instruction data further indicating image processing instructions (204; 528) the processor can execute; the processor further, in executing the image processing instructions: receiving input image data from the image input circuitry, the input image data defining an input image; and using the input image data to obtain (50) the initial array data and providing the initial array data to the memory. The machine of claim 23 in which the input image circuitry is connected for receiving facsimile transmissions (72). The machine of claim 22 in which the machine is an image processing server (498); the image processing server being connected to a network (492) for receiving requests for image processing operations; the network including the image input circuitry; the instruction data further indicating request handling instructions the processor can execute; the processor, in executing the request handling instructions, determining whether to execute the grouping instructions. The machine of claim 22 in which the machine is a fax server (500) or a copier (560). An article of manufacture for use in a machine that includes: a storage medium access device (64) for accessing a medium (62) that stores data; memory (68; 192, 194; 520, 540) for storing data; the data stored in the memory comprising initial array data defining an initial array of value items, each value item indicating a value; the initial array including a set of value items that indicate values that meet a reference criterion; and a processor (66; 190; 502) connected for receiving data from the storage medium access device and also connected for accessing data in the memory; the article comprising: a storage medium (62) that can be accessed by the storage medium access device when the article is used in the machine; and data (80) stored by the storage medium so that the storage medium access device can provide the stored data to the processor when the article is used in the machine; the stored data comprising instruction data indicating instructions (192; 520) the processor can execute; the processor, in executing the instructions: accessing the initial array data in the memory and using the initial array data to obtain (52) gap data (20; 220) indicating, for each value item in the initial array, a distance to the closest value item that is in the set of value items indicating values meeting a reference criterion; comparing the obtained gap data to a plurality of candidate thresholds; each candidate threshold being above or below said gap data; for each candidate threshold determining the number of groups of value items which are separated by a gap associated with gap data larger than the candidate threshold; fixing a threshold indicated by threshold data (222; 544) in a range of thresholds in which the number of said groups is stable and said range is larger than a range of thresholds across which any other number of groups in a set of numbers of groups is stable; and using the threshold data to obtain (56) grouping data (224; 546) indicating a grouping of the value items in the initial array.

Inventors: MAHONEY JAMES V, RAO SATYAJIT, MAHONEY, JAMES V., RAO, SATYAJIT
Applicants: XEROX CORP, XEROX CORPORATION
Application year: 1994
Main classification: G06K9
IPC codes: G06T7, G06K9