Apparatus and method for cropping an image5781665Abstract A method and apparatus for cropping an image in digital form. The image to be cropped is represented as a first digital array which is operated on by an edge enhancement transformation to generate a second, binary digital array wherein edges of the image are emphasized. The second digital array is then partitioned into predetermined segments which are typically rows and columns of the array and the pixel values of each row and column are summed to generate brightness sums. The second digital array is then partitioned into a first, brighter, central group of rows and a second, less bright group consisting of upper and lower borders of rows; and a third, brighter, central group of column and left and right borders of columns in accordance with predetermined criteria relating to the brightness sums. The boundaries between the borders and the central groups are then applied to the first digital array and only those pixel values corresponding to pixel values common to the first and third groups are output to generate a cropped image. Claims What is claimed: Description BACKGROUND OF THE INVENTION
TABLE I
__________________________________________________________________________
mask1 mask2 mask3 mask4
__________________________________________________________________________
1 0 -1 -1
0 1 1 1 1 -1
-1
-1
1 0 -1 -1
0 1 0 0 0 0 0 0
1 0 -1 -1
0 1 -1
-1
-1 1 1 1
__________________________________________________________________________
The output of filter 22-1 is then applied to noise filter 24 which is preferably a conventional "blurring" filter to remove artifacts which might be interpreted as false edges. The output of noise filter 24 is then applied to threshold 26-1 to produce a binary second digital array. Threshold values of approximately 200 have provided satisfactory results where the pixel values of first digital array represented a 256-level greyscale. Turning to FIG. 2 a first digital array is produced, and a second digital array is cropped and applied to the first digital array to produce cropped image CI in a manner substantially identical to that described with respect to FIG. 1 and apparatus 16-2 differs from apparatus 16-1 only in the manner in which the second digital array is generated. In apparatus 16-2 the first digital array is applied to non-linear edge enhancement filter 22-2 which sequentially convolves two 3.times.3 masks, shown in Table II below, with the first digital array. The absolute values of these convolution operations are then summed to provide the output of filter 22-2. In another embodiment of the subject invention the RMS value of the convolution operations may be taken as the output. Threshold 26-2 is then applied to the output of filter 22-2 to generate the second digital array. By using a non-linear filter and appropriately selecting threshold 26-2 apparatus 16-2 eliminates the need for a noise filter.
TABLE II
______________________________________
maskl mask2
______________________________________
-1 0 1 1 2 1
-2 0 2 0 0 0
-1 0 1 -1 -2 -1
______________________________________
Determination of the proper threshold value to use in apparatus 16-2 is a function of background B. For a given background color, lighting conditions, and camera position and parameters, threshold 26-2 may be calibrated by repeatedly generating a second digital image of background B only; i.e. without a foreground subject, and adjusting threshold 26-2 to minimize the number of asserted noise pixels. This calibration process can readily be automated by a person skilled in the art. Where background B is known threshold 26-2 may be preset; or, where background B may vary threshold 26-2 can be calibrated in the field. Preferably apparatus 16-1 and 16-2 are implemented by programming a general purpose digital computer to carry out the various functions illustrated. Programming of such a computer to implement appropriate sub-routines to carry out the illustrated functions would be a routine matter for a person of ordinary skill in the art and need not be discussed further here for an understanding of the subject invention. FIG. 3 is an illustration of one manner in which second array cropping element 30 can operate. Image 40 is a line drawing representation corresponding to the second digital array and showing an edged enhanced image of subject S. By emphasizing edges and de-emphasizing variations within areas of constant or slowly varying intensity image 40 concentrates brightness (i.e. asserted pixels) in areas of high detail, thus emphasizing face F and particularly high detail areas such as the eyes of face F. Pixel values are summed for the rows and columns of the second digital array to obtain brightness sums for image 40. Histogram 42 represents a plot of horizontal row brightness sums as a function of vertical position and histogram 44 represents a plot of vertical column brightness sums as a function of horizontal position. (Histograms shown in FIGS. 3 and 5 are intended as illustrative only and are not actually derived from the line drawing representations shown.) In accordance with the embodiment of the subject invention illustrated in FIG. 3 the second digital array is first partitioned into two groups of horizontal rows of pixel values; a first, central, brighter group 46-3 and a second, less bright group consisting of upper border 48-3 and lower border 50-3 in accordance with criteria which require that first group 46-3 contain a predetermined fraction TB.sub.v of the total brightness of image 40 and that the remaining fraction of the total brightness be evenly divided between upper border 48-3 and lower border 50-3. The columns of the second digital array are then divided into a third, central brighter group 54-3 and a forth, less bright group consisting of left border 56-3 and right border 58-3. The criteria for dividing the columns into groups are similar to the criteria applied to the rows with group 54-3 containing a predetermined fraction TB.sub.h of the total brightness of image 40 and borders 56-3 and 58-3 having the remaining total brightness evenly divided between them. Once these groups are identified the borders between groups are applied to the first digital array by cropping element 32; which outputs only those pixel values of the first digital array which correspond to pixel values common to both central common brighter groups 46-3 and 54-3 to printer 18 to generate cropped image CI. Values of 80% for TB.sub.v and TB.sub.h have been found to provide substantial reduction in the number of pixels required to represent cropped image CI while still retaining sufficient detail so that cropped image CI is easily recognizable. FIG. 4 shows a flow diagram of the operation of cropping element 30 in implementing the embodiment described above with respect to FIG. 3. At 60 element 30 sums pixel values for the second array rows and columns to generate row and column brightness sums. Then at 61 the next (i.e. outer most remaining) upper row is deleted and at 62 element 30 tests to determine if the upper row brightness criteria have been meet; that is, for the preferred embodiment described above, has approximately 10% of the total brightness been deleted. If the criteria has not been meet element 30 returns to 61 to delete the next upper row, and, if the criteria has been met, at 64 stores the upper border between group 46-3 and upper border 48-3. Then at step 65, 66 and 68 the lower boundary between border 50-3 and central group 46-3 is determined and stored in the same manner. Then at step 70, 71 and 72; and at steps 74, 76, and 77 the columns of the second digital array are divided into central group 54-3 and borders 56-3 in the same manner. Then, as described above identified boundaries are applied to the first digital array to generate cropped image CI. (Those skilled in the art will recognize that, since only whole rows or columns can be deleted the above described brightness criteria (and those described below with respect to FIGS. 5 and 6) will, in general, only be met approximately.) In other embodiments of the subject invention values for fractions TB.sub.v and TB.sub.h can be unequal and the total brightness in boundaries 48-3 and 50-3, and 56-3 and 58-3 need not be equal. In embodiments where face F is symmetrically positioned central groups 46-3 and 54-3 may simply be positioned symmetrically about the horizontal and vertical axes of image 40 by deleting the outermost pairs of rows or columns until the predetermined fraction of the total image brightness is left. FIG. 5 shows an illustration of an other embodiment of the invention wherein cropping element 30 operates on the second digital array to divide the rows into a first, central, brighter group 46-5 having a predetermined height H and a second, less bright group consisting of upper border 48-5 and lower border 50-5; and to divide the columns into a third, central, brighter group 54-5 having a predetermined width W; and a fourth less bright group consisting of left border 56-6 and right border 58-5. FIG. 6 shows a flow diagram of the operation of cropping element 30 on the second digital array in the embodiment described with respect to FIG. 5. At 80 element 30 sums the pixel values for the second digital array rows and columns. Then at 82 the left end lower borders are set equal to zero. That is group 46-5 is initially assumed to begin at the left edge of image 40 and group 54-5 is initially assumed to begin at the lower edge of image 40. Then at 86 the next (i.e. outermost) column is added to the left border and the next (i.e. innermost) column is deleted from the right border; and at 88 element 30 tests to determine if the left border total brightness equals the right border total brightness as closely as possible. If not element 30 returns to 86 to delete and add the next pair of columns; and, if the total brightness of the left and right borders are equal, stores the left and right boundaries between groups 54-3 and borders 56-3 and 58-3 at step 90. Then at steps 94, 96, and 98 element 30 operates on the rows of the second digital array to divide the pixel values into groups corresponding to groups 46-3 and border 48-3 and 50-3 in the same manner. In other embodiments of the subject invention the boundaries between the central and border groups of the rows and columns may be taken at the outermost peaks of histograms 42 and 44 respectively and still other embodiments of the subject invention the second digital array may be partitioned into segments other than rows and columns. For example, the segments may be taken as concentric, and annular rings of approximately equal area and the image may be cropped radially. EXAMPLE
TABLE III
__________________________________________________________________________
Pixel Area Reduction: (Area measured in pixels.sup.2)
Manual Crop
Auto-Cropped
Auto-Cropped
Auto-Cropped
12 pixels/side
(90%) (85%) (80%)
Original % of % of % of % of
Area Area
Original
Area
Original
Area
Original
Area
Original
__________________________________________________________________________
Albert
32279
24215
75.02%
16256
50.36%
13221
40.96%
10816
33.51%
Eric 32279
24215
75.02%
18445
57.14%
15038
48.59%
13066
40.48%
GeorgeH
32279
24215
75.02%
23760
73.61%
20808
64.46%
15960
49.44%
James
32279
24215
75.02%
19398
60.09%
16872
52.27%
15080
46.72%
Lady 22879
16159
70.63%
15729
68.75%
13700
59.88%
11500
50.26%
Mayur
32279
24215
75.02%
19602
60.73%
16912
52.39%
14214
44.03%
Steve
32279
24215
75.02%
18207
56.41%
15194
47.07%
12544
38.86%
Theresa
32279
24215
75.02%
18048
49.72%
12669
39.25%
9890
30.64%
Averages: 59.60% 50.36% 41.74%
__________________________________________________________________________
Table III shows examples of the subject invention where subject's faces were scanned to generate a first, 169.times.191, 256 greyscale level array of pixel values. The first array was operated on by a four mask linear filter and a conventional noise filter as described above, and a threshold of 200 applied to generate a second, binary array. The second array was then cropped to central groups of rows and columns having the various percentages of to total brightness shown. For each percentage of total brightness the percentage of pixels in the cropped image (i.e. pixels common to the two central groups) is given. A predetermined fixed cropping of 12 pixels/side is also shown for purposes of comparison Table IV shows the same percentages where the images are also compressed using the well known JPEG compression algorithm; demonstrating substantial benefits even with compression of the images. The embodiments of the subject invention described above have been given by way of illustration only, and those skilled in the art will recognize numerous other embodiments of the subject invention from the detailed descriptions set forth above and the attached drawings. Accordingly, limitations on the subject invention are found only in the claims set forth below.
|
Same subclass Same class |
||||||||||
