METHOD FOR REALIZING HIGH-SPEED STATISTIC OPERATION PROCESSING AND IMAGE DATA PROCESSING APPARATUS FOR EMBODYING THE METHOD

Abstract: According to this invention, in image data A and B which are respectively constituted by pixel groups ΣA ij and ΣB ij consisting of N pixels A ij and B ij (N is a positive integer; i and j respectively indicate a row position and a column position), and in which density data A dij and B dij of the pixels are expressed by n(2m)-bit data ( n and m are positive integers), designated 2m-bit portion a ij of each density data A dij of image data A is divided into upper m-bit portion a Uij and lower m-bit portion a Lij . A histogram processor (16) calculates Σa ij ·b ij between 2m-bit portions a ij and b ij using a histogram obtained by the upper or lower m-bit portion a Uij or a Lij and designated 2m-bit portion b ij of each density data B dij of pixel group ΣB ij . An average can also be calculated by a calculation section (32) using the histogram. Therefore, a covariance can be calculated at high speed.

Description: The present invention relates to a method for realizing high-speed statistic operation processing such as covariance operation processing between two image data, and an image data processing apparatus for embodying the method. Covariance σ AB between pixel groups ΣA ij and ΣB ij (where i and j respectively indicate a row position and a column position) respectively corresponding to two image data A and B in which density data A dij and B dij of pixels A ij and B ij can be expressed by 8-bit data, can be expressed by the following equation (1) if the number of pixels of image data A and B is given as N and density averages of image data A and B are respectively given as µ A and µ B : where since then, The first term in equation (1) can be obtained from the following equation: where histogram h (2⁸K A + k B ) represents a histogram wherein the value of density data A dij of pixel A ij is k A (k A = 0 to 255) and the value of density data B dij of pixel B ij at the same position as pixel A ij is k B (k B = 0 to 255). This histogram can be obtained using a 16-bit histogram processor. Since the histogram processor is used for various image data processing operations as is known, it is inevitable hardware for the image data processing apparatus. Therefore, a method for obtaining Σ A / ijdij B dij using the histogram processor is advantageous in view of an effective operation of hardware of the image data processing apparatus. However, the 16-bit histogram processor used in this method has a complicated hardware arrangement, and requires 2⁸ x 2⁸, i.e., 64K data entry in order to store a histogram operation result of 8-bit image data A and B. Therefore, an arithmetic operation volume is considerable, and a high-speed operation cannot be performed. The present invention as claimed has been made in consideration of the above situation and has as its object to provide a method for carrying out a statistic operation between first and second image data at high speed in a data processing apparatus. The first image data is constituted by pixel group ΣA ij consisting of N pixels A ij (N is a positive integer; i and j respectively indicate a row position and a column position), and density data A dij of each pixel A ij is expressed by 2mn-bit data ( n and m are positive integers). The second image data is constituted by pixel group ΣBij consisting of N pixels Bij (N is said positive integer; i and j respectively indicate a row position and a column position), and density data Bdij of each pixel Bij is expressed by 2mn-bit data ( n and m are said positive integers). The method comprises: carrying out, in accordance with an input ΣAB processing command, a 3m-bit histogram operation for obtaining histogram h U (2 2m k U + k B ) representing the number of sets of pixels A ij and B ij , in which a value of upper m-bit portion a Uij of a first designated 2m-bit portion a ij is k U and a value of a second designated 2m-bit portion of pixel B ij at the same position as pixel A ij is k B , from designated 2m-bit portion a ij of each density data A dij of input pixel group ΣA ij and designated 2m-bit portion bij of each density data B dij of pixel group ΣB ij , and calculating upper correlation weight T U from following equation (1) using resultant histogram h U (2 2m k U + k B ) : carrying out, in accordance with the input ΣAB processing command, the 3m-bit histogram operation for obtaining h L (2 2m k L + k B ) representing the number of sets of pixels A ij and B ij , in which a value of lower m-bit portion a Lij of designated 2m-bit portion a ij is k L and a value of designated 2m-bit portion of pixel B ij at the same position as pixel A ij is k B , from designated 2m-bit portion a ij of each density data A dij of input pixel group ΣA ij and designated 2m-bit portion b ij of each density data B dij of pixel group ΣB ij , and calculating lower correlation weight T L from following equation (2) using resultant histogram h L (2 2m k L + k B ) : and, calculating, in accordance with the input σAB processing command, correlation weight Tab from resultant upper and lower correlation weights T U and T L using following equation (3): T ab = 2 m T U + T L (3) It is another object of the present invention to provide an image data processing apparatus for carrying out a statistic operation between first and second image data at high speed. The apparatus comprises: a first image memory for storing first image data, wherein the first image data is constituted by pixel group ΣA ij consisting of N pixels A ij (N is a positive j integer more than two; i and j respectively indicate a row position and a column position), and density data A dij of each pixel A ij is expressed by 2mn-bit data ( n and m are positive integers); a second image memory for storing second image data, wherein the second image data is constituted by pixel group ΣB ij consisting of N pixels B ij (N is said positive integer more than 2; i and j respectively indicate a row position and a column position), and density data B dij of each pixel B ij if expressed by 2mn-bit data ( n and m are said positive integers); histogram processor for carrying out, in accordance with a ΣAB processing command input thereto, a 3m-bit histogram operation for obtaining h U (2 2m k + k B ) or h L (2 2m k + k B ) representing the number of sets of pixels A ij and B ij , in which a value of upper or lower m-bit portion a Uij or a Lij of a first designated 2m-bit portion a ij is k (k = 0 to 2 m -1) and a value of a second designated 2m-bit portion of pixel B ij at the same position as pixel A ij is k B , from upper or lower m-bit portion a Uij or a Lij of the designated 2m-bit portion a ij of each density data A dij read out from the first image memory and the designated 2m-bit portion b ij of each density data B dij read out from the second image memory; calculation section for calculating, in accordance with the ΣAB processing command input thereto, upper correlation weight TU from equation (1) using the histogram h U (2 2m k + k B ) , and lower correlation weight T L from equation (2) using the histogram h L (2 2m k + k B ) , and for calculating, in accordance with the input ΣAB processing command, correlation weight T ab using equation (3) from the upper and lower correlation weights TU and TL: and, controller for controlling the histogram processor and the calculation section. As described above, according to the image data processing apparatus of the present invention, in 2m-bit density data A dij of each pixel A ij of pixel group ΣA ij constituting image data A and 2m-bit density data B dij of each pixel Bij of pixel group ΣBij constituting image data B, since a 3m-bit histogram processor can be used in order to obtain total sum of a product of density data Adij and Bdij, the hardware arrangement of the apparatus can be simplified. As compared to a case wherein a 4m-bit histogram processor is used, the number of results of histogram operation can be decreased to 2{2 3m /2 4m } = 1/2 m-1 . More specifically, a data volume necessary for calculating total sum can be considerably decreased. Therefore, arithmetic operation processing can be performed at high speed. The apparatus of the present invention can be applied to a statistic operation (average, variance, and covariance) associated with image data exceeding 2m bits, and can contribute to the high-speed operation of this type. This invention can be more fully understood from the following detailed description when taken in conjunction with the accompanying drawings, in which: Fig. 1 is a block diagram showing an arrangement of an image data processing apparatus according to a first embodiment of the present invention; Fig. 2 is a memory map showing a histogram storage area in a main memory shown in Fig. 1; Fig. 3 is a flow chart for explaining the operation of the first embodiment; Fig. 4 is a flow chart for explaining the operation of a second embodiment; Fig. 5 is a block diagram showing an arrangement of a third embodiment; and Fig. 6 is a flow chart for explaining the operation of the third embodiment. An embodiment of an image data processing apparatus according to the present invention will now be described with reference to the accompanying drawings. Fig. 1 is a block diagram showing an arrangement of an image data processing apparatus according to a first embodiment of the present invention. Referring to Fig. 1, calculation control section 11 connected to system bus 19 controls the overall operation, and executes calculation processing. Image memories 14 and 15, and histogram processor 16 are connected to each other through image bus 20. They are also connected to control section 11 through system bus 19 as well as main memory 12. Image memories 14 and 15 respectively store image data A and B consisting of pixels A ij and B ij whose density data is expressed by n(2m) bits. A data length of histogram processor 16 corresponds to 3m bits. In the first embodiment n = 1 and m = 4. Therefore, the data lengths of image memories 14 and 15 and processor 16 are respectively 8, 8, and 12 bits. The data length of image bus 20 is also 8 bits. Main memory 12 has histogram storage area 21 for storing the histogram operation results of processor 16 and register area 22 for holding the intermediate results of the operation. Storage area 21 consists of 16 blocks as shown in Fig. 2, and in each block, the number of entries is 256. The number of entries corresponds to the number of bits of density data. Control section 11 comprises controller 31 and calculation section 32 for arithmetic operation unit 41 and Σ operation unit 42. Controller 31 generates various processing commands in accordance with an input statistic operation command. When an average operation command is input, controller 31 generates a 2m weight processing command including a 2m histogram processing command. When a covariance operation command is input, controller 31 generates a ΣAB processing command, an average processing command, and a arithmetic operation command. The ΣAB processing command consists of an upper correlation weight processing command including an upper histogram processing command, a lower correlation weight processing command including a lower histogram processing cammand, and an addition command. The average processing command causes controller 31 to generate the 2m weight processing command including the 2m histogram processing command, as in the average operation command. Processor 16 reads out density data of each pixel from a designated image memory in accordance with the histogram operation command, i.e., the upper histogram processing command, the lower histogram processing command, or the 2m histogram processing command, and executes the histogram operation. The obtained histogram operation result is stored in histogram storage area 21 of main memory 12. Processor 16 reads out image data A or B from designated image memory 14 or 15 in accordance with the 2m histogram processing command, and executes an 8-bit histogram operation. Processor 16 also executes a histogram operation between an upper or lower 4-bit portion of image data A stored in image memory A and image data B stored in image memory 15 in accordance with the upper or lower histogram processing command. Prior to the description of the first operation of the first embodiment with reference to the flow chart shown in Fig. 3, the basic principle of the present invention will be explained with reference to covariance operation processing between 8-bit image data A and B. Assume that image data A and B are respectively stored in image memories 14 and 15. Image data A is constituted by pixel group ΣA ij ( i and j respectively indicate a row position and a column position). Density data A dij of each pixel A ij is expressed by 8-bit data, and its value is k A (k A = 0 to 255). This also applies to image data B. Density data A dij of each pixel A ij is divided into upper and lower 4-bit portions. If an upper 4-bit portion is given as a Uij and a lower 4-bit portion is given as a Lij , density data A dij of pixel A ij can be expressed by: A dij = 16a Uij + a Lij (3) Therefore, covariance σ AB expressed by equation (1) can be rewritten as: When sets of pixels A ij and B ij are classified in accordance with a value of upper 4-bit portion a Uij of density data A dij of pixel A ij and a value of density data B dij of pixel B ij at the same position as pixel A ij , histogram h U (2⁸k U + k B ) presents the number of sets of pixels A ij and B ij in which the value of upper 4-bit portion a Uij is k U (k U = 0 to 15) and a value of density data B dij is k B (k B = 0 to 255). The total sums (to be referred to upper and lower correlation weights hereinafater) in parentheses of equation (4) is anything but obtaining weight between density data of pixel groups Σ Aij and Σ Bij . Therefore, if the upper and lower correlation weights are respectively given as T U and T L , they can be expressed as follows by utilizing histograms h U (2⁸k U + k B ) and h L (2⁸k L + k B ) : If values of density data A dij and B dij are respectively given as k A and k B (k A , k B = 0 to 255), averages µ A and µ B can be expressed as follows by utilizing 8-bit histogram operation results h A (k A ) and h B (k B ): Therefore, covariance σ AB can be expressed as follows on the basis of equations (1), (4), (5), and (6): σ AB = (1/N)(2⁴T U + T L ) - µ A µ B (7) (24T U + T L ) is called correlation weight T AB . The first operation of the first embodiment of the image data processing apparatus according to the present invention which can obtain a covariance at high speed by utilizing the above relations will be described with reference to Fig. 3. Assume that a covariance operation command for calculating covariance σ AB between image data A and B is input. In step S2, an average processing command is generated. The 2m histogram processing command of the average processing command for image data A is output to histogram processor 16. The 2m histogram processing command is designated to use density data A dij of image data A and to set bit "0" for the remaining 4-bit portion. In response to this command, density data A dij for image data A is transferred from image memory 14 to processor 16 via image bus 20. Processor 16 classifies pixels of transferred image data A in accordance with density data A dij , and determines histogram h A (k A ) (k A = 0 to 255) indicating the number of pixels for each density. Resultant histogram h A (k A ) is stored in histogram storage area 21 of main memory 12 via system bus 19. Thereafter, in accordance with the 2m weight processing command generated according to the covariance operation command, Σ operation unit 42 calculates average µ A for image data A from equation (6) using transferred histogram h A (k A ). Calculated µ A is stored in register area 22 of main memory 12. After the execution of the average processing command for image data A, in step S4, the average processing command for image data B is output to processor 16 in the same manner as for image data A. In accordance with the 2m histogram processing command of the average processing command for image data B, image data B is transferred from image memory 15 to processor 16 in the same manner as image data A, and histogram h B (k B ) is calculated. Calculated histogram h B (k B ) is transferred to histogram storage area 21 of memory 12 via system bus 19. In accordance with the 2m weight processing command of the average processing command generated according to the covariance operation command, average µ B is calculated from equation (6) by utilizing transferred histogram h B (k B ). Calculated average µ B is stored in register area 22 as in average µ A . In the above description, after average µ A is calculated, image data B is transferred to processor 16. If the 2m histogram processing command for image data B is generated while average µ A is calculated, covariance σ AB can be calculated at a higher speed. When averages µ A and µ B are calculated, in step S6, the upper correlation weight processing command is output to 12-bit histogram processor 16 in order to calculate a weight for upper 4-bit portion a Uij of density data A dij of pixel A ij and density data B dij of pixel B ij . In order to calculate its histogram h U (2⁸k U + k B ) , the upper histogram processing command of the upper correlation weight processing command is instructed via system bus 19. In response to this command, density data A dij of image data A and density data B dij of image data B are fetched by processor 16 from image memories 14 and 15. Processor 16 executes a histogram operation for obtaining histogram h U (2⁸k U + k B ) from transferred upper 4-bit portion a Uij of image data A and image data B. Resultant histogram h U (2⁸k U + k B ) is stored in storage area 21 of memory 12. An mth entry of an sth block of storage area 21 stores the number of pixels whose density is k B of pixels B ij at the same position as pixels A ij which have value k U of upper 4 bits of density data A dij . When histogram h U (2⁸k U + k B ) for upper 4 bits of density data A dij of pixel A ij is obtained, in step S8, Σ operation unit 42 calculates upper correlation weight T U from equation (5) by utilizing stored histogram h U (2⁸k U + k B ) in accordance with the upper correlation weight processing command. Obtained value T U is stored in register area 22. Thereafter, in step S10, the lower histogram processing command of the lower correlation weight processing command generated according to the covariance operation command is generated in the same manner as upper 4-bit portion a Uij so as to calculate histogram h L (2⁸k L + k B ) of lower 4-bit portion a Lij of density data A dij of image data A and image data B. Thus, density data A dij of pixels A ij of pixel group ΣA ij and density data B dij of pixels B ij of pixel group ΣB ij stored in image memory 15 are sequentially transferred to processer 16 via image bus 20, and histogram h L (2⁸k L + k B ) is calculated. Calculated histogram h L (2⁸k L + k B ) is stored in storage area 21 of memory 12. Thereafter, in step S12, lower correlation weight T L is calculated from equation (5) in accordance with the lower correlation weight processing command. Calculated valve T L is stored in register area 22. In the above description, after value T U for upper 4-bit portion a Uij of pixel A ij is obtained, image data A and B are transferred to processor 16 so as to obtain a histogram for lower 4-bit portion a Lij . If the histogram processing command is generated while value T U is being calculated, covariance AB can be calculated at a higher speed. At this time, even if the histogram operation is completed, if the operation for obtaining value T U is not completed, the histogram operation result can be stored in histogram storage area 21 after completion of the operation of value T µ . In step S14, arithmetic operation unit 41 calculates covariance σ AB by utilizing equation (7) using data µ A , µ B , T U , and T L stored in register area 22 in accordance with the σ arithmetic processing command generated according to the covariance operation command. In this case, a command for executing an operation of 2⁴TU + TL is referred to as an addition processing command. The upper correlation weight processing command including the upper histogram processing command, the lower correlation weight processing command including the lower histogram processing command, and the addition processing command are referred to as the ΣAB processing command as a whole. Covariance σ AB of 8-bit image data A and B can be obtained using the 12-bit processor, as described above. In the description of the first embodiment, averages µ A and µ B for image data A and B are calculated in accordance with the 2m weight processing command. However, averages µ A and µ B can be calculated by utilizing the histogram operation results of 12-bit histogram processor 16. A second embodiment for realizing it will be described below. The second embodiment has the same arrangement as in that of the first embodiment except for the following point. In the second embodiment, an average processing command includes an upper weight processing command, and a lower weight processing command. The operation of the second embodiment of the image data processing apparatus which can calculate averages of 8-bit image data A and B, and hence, a covariance, from the histogram operation results of 12-bit histogram processor 16 will be described below. As can be seen from equation (6), average µ A of image data A ij can be calculated by dividing the total sum of density data of pixels A ij by total number N of pixels. Therefore, by utilizing the histogram, the weights of pixels are multiplied, and the product is divided by pixel number N, thereby calculating average µ. More specifically, if density data A dij of image data A is expressed by equation (3), average µ A can be: Similarly, average µ B can be: More specifically, in the case of average µ B , the number of pixels for certain density k B is obtained, and average µ B is calculated based on the number of pixels. Therefore, the order of the total sum is reversed as compared with a case of equation (8). If an upper A weight, and upper B weight, a lower A weight, and a lower B weight are respectively given as U UA , U UB , U LA , and U LB , they can be expressed by: Therefore, equation (7) can be rewritten as: The operation of the second embodiment will now be described with reference to Fig. 4. In step S20, the upper correlation weight processing command is generated in accordance with the input convariance operation command in the same manner as in the first embodiment. Histogram processor 16 reads out upper 4-bit portion a Uij of image data A stored in image memory 14 and density data B dij of image data B stored in image memory 15 in accordance with an upper histogram processing command of the upper correlation weight processing command, and executes a histogram operation. Calculated histogram h U (2⁸k U + k B ) is stored in histogram storage area 21 of main memory 12. Thereafter, in step S22, Σ operation unit 42 calculates upper correlation weight T U in accordance with the generated upper correlation weight processing command, and calculates upper A weight U UA and upper B weight U UB in accordance with the generated upper weight processing command. In step S24, a lower correlation weight processing command is output to processor 16 in the same manner as for upper 4-bit portion a Uij . Processor 16 calculates histogram h L (2⁸k L + k B ) for a Lij and B dij in accordance with the lower histogram processing command of the lower correlation weight processing command. Resultant histogram h L (2⁸k L + k B ) is stored in area 21. In step S26, by utilizing the stored histogram, lower correlation weight T L is calculated in accordance with the generated lower correlation weight processing command, and lower A weight U LA and lower B weight U LB is calculated in accordance with the lower weight processing command of the generated average processing command. Calculated values T L , U LA , and U LB are stored in register area 22. In step S28, arithmetic operation unit 41 calculates covariance AB based on equation (11) from values T U , U UA , and U UB obtained in step S22 and values T L , U LA , and U LB obtained in step S26, in accordance with the σ arithmetic operation command generated according to the covariance operation command. In this manner, the covariance can be calculated faster than the operation of the first embodiment. In the above description, the covariance is calculated. When variance σ A 2 is to be obtained, density data for pixels A ij can be read out twice from image memory 14 or 15. Resultant σ AB is made as σ A 2. A third embodiment of an image data processing apparatus according to the present invention which can execute a statistic operation associated with image data A and B whose density data is expressed by 16 bits or more, e.g., an operation for calculating an average, variance, and a covariance, will be described hereinafater. In the third embodiment, calculation control section 111 controls the overall operation, and executes calculation processing. n(2m)-bit image memories 114 and 115, histogram processor section 116 including 3m-bit histogram processors 116-1 and 116-2, and main memory 112 are connected to section 111 via system bus 119. Image memories 114 and 115 and histogram processors 116-1 and 116-2 are connected to each other through image bus 120 having a 16-bit data length. Memory 112 has histogram storage areas 121-1 and 121-2 for respectively storing histogram operation results from processors 116-1 and 116-2. Memory 112 has register area 122 for storing data necessary for controlling intermediate operation results, and the like. Section 111 comprises controller 131 for generating various processing commands in accordance with an input statistic operation command, and calculation unit 132 for executing calculation processing. Calculation unit 132 comprises arithmetic operation unit 141 and Σ operation section 142 including Σ operation units 142-1 and 142-2. When controller 131 receives an average operation command, it generates a total 2m-bit average processing command including a 2m histogram processing command and a total µ arithmetic operation command. When controller 131 receives a covariance operation command, it generates a total ΣAB processing command, a total 2m-bit weight processing command, and a total σ arithmetic operation command. Prior to the description of the operation of the third embodiment, 16- and 24-bit average, covariance and variance operations will be described below. Assume that n(2m)-bit image data A and B (in this embodiment 2m = 8) are respectively stored in image memories 114 and 115. Density data A dij and B dij of pixels A ij and B ij of image data A and B whose density is expressed by n(2m) bits are classified in units of 8 bits. If lower pth 8-bit portions of the density data are respectively given as a pij and b pij , density data A dij and B dij can be expressed by: Therefore, if image data A and B are 16-bit data, i.e., if n = 2, average µ A can be expressed by: Average µ B can be expressed as follows in the same manner as in average µ A : µ B = 2⁸µ 2B + µ 1B (14) where µ 2A , µ 1A , µ 2B , and µ 1B are average values obtained from equation (6). Covariance σ AB of image data A and B is: If upper and lower correlation weights between a pth 8-bit portion of image data A and a qth 8-bit portion of image data B obtained from equation (5) are respectively given as T Upq and T Lpq and if an upper A weight, an upper B weight, a lower A weight, and a lower B weight for image data A and B obtained from equation (10) when p = q are respectively given as U UAp , U UBp , U LAp , and U LBp , equation (15) can be rewritten as: Variance σ A 2 of image data A can be expressed by: This also applies to image data B. The above method applies to image data of 16 bits or more, e.g., 24-bit data, that is, image data A of n = 3. Pixels A ij and B ij of 24-bit image data A and B can be expressed by: A dij = 2¹⁶ a 3ij + 2⁸ a 2ij + a 1ij B dij = 2¹⁶ b 3ij + 2⁸ b 2ij + b 1ij (18) Therefore, if image data A and B are 24-bit data, average µ A can be expressed by: Average µ B can be expressed as follows in the same manner as average µ A : µ B = 2¹⁶ µ 3B + 2⁸µ 2B + µ 1B (20) where µ 3A , µ 2A , µ 1A , µ 3B , µ 2B , and µ 1B are averages obtained from equation (6). Covariance σ AB of image data A and B can be given as: If upper and lower correlation weights betwen a pth 8-bit portion of image data A and qth 8-bit portion of image data B obtained from equation (5) are respectively given as T Upq and T Lpq and if an upper A weight, an upper B weight, a lower A weight, and a lower B weight for image data A and B obtained from equation (10) when p = q are respectively given as U UAp , U UBp , U LAp , and U LBp , equation (15) can be rewritten as: Variance σ A 2 of image data A can be expressed by: The operation of the third embodiment will now be described with reference to Fig. 6. Assume that density data of image data stored in image memories 114 and 115 are expressed by 24-bit data. A case will first be described wherein the average operation command for image data A is input as the statistic operation command. When the average operation command for image data A is input, a total 2m-bit average processing command is generated in step S30. The total 2m-bit average processing command includes the 2m-bit average processing command including the 2m histogram processing command for each of the 2m-bit portion a pij . The 2m-bit average processing command is output to histogram processor 116-1. Variable p is set to be n 1 (=1 in this example), and variable q is set to be n 2 (=3 in this example). It is checked in step S32 if an input command is an average or covariance operation command. If N in step S32, step S54 is executed. If Y in step S32, step S34 is executed. In this case, since the input command is the average operation command, step S34 is executed. In step S34, 8-bit portion a 3ij designated by variables p and q is read out by processor 116-1. Readout 8-bit portion a 3ij is subjected to processing in step S36. This step executes various processing operations of 8-bit image data in the first or second embodiment, and is called an 8-bit image data processing module. Processor 116-1 executes a histogram operation asociated with 8-bit data a qij whose remaining 4 bits are fetched as bit "0" in accordance with the 2m histogram processing command of the 2m-bit average processing command. If a value of 8-bit data a qij is given as k, histogram operation result h q (k) (k = 0 to 255) is stored in histogram storage area 121-1 of main memory 112. Unit 142-1 calculates µ 3A for 8-bit portion a 3ij from resultant histogram h₃(k) using equation (6). µ 3A is stored in register area 122. Subsequently, it is checked in step S38 if q = 1. If Y in step S38, step S42 is executed. If N in step S38, step S40 is executed. In this case, since q = 3, step S40 is executed. In step S40, value q is decremented by 1. Thereafter, step S32 is again executed. In this manner, µ 2A for 8-bit portion a 2ij and µ 1A for 8-bit portion a 1ij are calculated in the same manner as for 8-bit portion a 3ij . µ 2A and µ 1A are stored in register area 122. When µ 1A is calculated, q = 1, and Y is determined in step S38. It is checked in step S42 if p = 1. If N in step S42, step S44 is executed. If Y in step S42, step S46 is executed. In this case, since p is left to be 1, Y is determined in step S42, and the flow advances to step S46. It is checked in step S46 if the input command is the average operation command. If N in step S46, step S50 is executed; otherwise, step S48 is executed. In this case, since Y is obtained in step S46, step S48 is executed, and average µ A for image data A is calculated by arithmetic operation unit 141 using equation (19) in accordance with the µ arithmetic processing command. A case will be described wherein the covariance operation command is input as the statistic operation command. When the covariance operation command is input, the total ΣAB processing command, the total 2m-bit weight processing command, and the total arithmetic processing command are generted in step S30. The upper histogram processing command included in the upper correlation weight processing command of the ΣAB processing command for 2m-bit portions a pij and b qij of the total ΣAB processing command and the lower histogram processing command included in the lower correlation weight processing command thereof are respectively output to histogram processors 116-1 and 116-2. n₁ and n₂ are set to be 3. More specifically, initial values of variables p and q are 3. Since the covariance operation command has already been input, Y is determined in step S32. 8-bit portions a 3ij and b 3ij designated by variables p and q are read out, and are supplied to histogram processors 116-1 and 116-2, respectively. In step S36, histogram h U (2⁸k U + k B ) is calculated from an upper 4-bit portion of data a 3ij and data b 3ij by processor 116-1, and histogram h L (2⁸k L + k B ) is calculated from a lower 4-bit portion of data a 3ij and data b 3ij by processor 116-2, and they are stored in storage areas 121-1 and 121-2, respectively. Units 142-1 and 142-2 respectively calculate upper and lower correlation weights T U33 and T L33 based on equation (5) using the histograms stored in storage areas 121-1 and 121-2, in accordance with the upper or lower correlation weight processing command. Calculated upper and lower correlation weights T U33 and T L33 are stored in register area 122. Since p = q, units 142-1 and 142-2 calculate upper A weight U UA3 , upper B weight U UB3 , lower A weight U LA3 , and lower B weight U LB3 according to equation (10) using the histograms stored in storage areas 121-1 and 121-2. Calculated U UA3 , U UB3 U LA3 , and U LB3 are also stored in register area 122. Since variable q is 3, variable q is decremented by 1 in step S40, and steps S32 to S36 are repeated. More specifically, in the second cycle, upper and lower correlation weights T U32 and T L32 for 8-bit portions a 3ij and b 2ij are calculated. Since variables p and q are respectively 3 and 2, p = q. Therefore, no weight can be calculated. Similarly, in the third cycle, upper and lower correlation weights T U31 and T L31 for 8-bit portions a 3ij and b 1ij are calculated. Calculated upper and lower correlation weights T U32 , T L32 , T U31 , and T L31 are strored in register area 122. After all the combinations of variable q for variable p = 3 are completely calculated, N is determined in step S42, and step S44 is executed. In step S44, variable p is decremented by 1 to be 2. Variable q is set to be n₂, i.e., 3. Thereafter, the same processing as above is executed, so that upper and lower correlation weights T U23 , T L23 , T U22 , T L22 , T U21 , and T L21 for 8-bit portions a 2ij and b 3ij , 8-bit portions a 2ij and b 2ij , and 8-bit portions a 2ij and b 1ij are calculated. Values U UA2 , U UB2 , U LA2 , and U LB2 are calculated when p = q, i.e., p = 2 and q = 2. Variable is decremented in step S44. When p = 1, upper and lower correlation weights T U13 , T L13 , T U12 , T L12 , T U11 , and T L11 for 8-bit portions a 1ij and b 3ij , 8-bit portions a 1ij and b 2ij , and 8-bit portions a 1ij and b 1ij are calculated. In addition, values U UA1 , U UB1 , U LA1 , and U LB1 are calculated when p = 1 and q = 1. Since variables p and q are 1, Y is determined in step S38 and S42, and step S46 is executed. Since the input command is the covariance operation command, N is determined in step S46, and Y is determined in step S50 for the same reason. Therefore, the flow advances to step S52. In step S52, arithmetic operation unit 141 calculates covariance σ AB from equation (21) in accordance with the total σ arithmetic processing command. When the variance operation command for image data A is input as the statistic operation command, image data A is used as image data B, and the same processing as for the covariance operation command is performed. In this case, since N is determined in step S32 and Y is determined in step S54, step S56 is executed. It is checked in step S56 if p ≧ q. If N in step S56, the flow advances to step S38. If Y in step S56, the 8-bit image data processing module is executed. In this case, the order of 8-bit portions a pij and a qij designated by variables p and q does not influence the operation result. Finally, N is determined in step S50, and step S54 is executed. Then, variance A 2 is calculated from equation (22).

Claims: A method for executing a statistic operation between image data A and B at high speed in a data processing apparatus, where the image data A is constituted by pixel group ΣA ij consisting of N pixels A ij (N is a positive integer more than 2; i and j respectively indicate a row position and a column position), and density data A dij of each pixel A ij is expressed by 2mn-bit data ( n and m are positive integers), and the image data B is constituted by pixel group ΣB ij consisting of N pixels B ij (N is said positive integer more than 2; i and j respectively indicate a row position and a column position), and density data B dij of each pixel B ij is expressed by 2mn-bit data ( n and m are said positive integers), comprising: carrying out, in accordance with an input ΣAB processing command, a 3m-bit histogram operation for obtaining histogram h U (2 2m k U + k B ) representing the number of sets of pixels A ij and B ij , in which a value of upper m-bit portion a Uij of a first designated 2m-bit portion a ij is k U and a value of a second designated 2m-bit portion b ij of the pixel B ij at the same position as the pixel A ij is k B , from the designated 2m-bit portion a ij of the pixel group ΣA ij and the designated 2m-bit portion b ij of the pixel group ΣB ij , and calculating upper correlation weight T U from equation (1) using the histogram h U (2 2m k U + k B ) : carrying out, in accordance with the input ΣAB processing command, the 3m-bit histogram operation for obtaining histogram h L (2 2m k L + k B ) representing the number of sets of pixels A ij and B ij , in which a value of lower m-bit portion a Lij of the designated 2m-bit portion a ij is k L and the value of the designated 2m-bit portion bij of pixel B ij at the same position as the pixel A ij is k B , from the designated 2m-bit portion a ij of the pixel group ΣA ij and the designated 2m-bit portion b ij of the pixel group ΣB ij , and calculating lower correlation weight T L from equation (2) using the histogram h L (2 2m k L + k B ) : and, calculating, in accordance with the input ΣAB processing command, correlation weight T ab from the calculated upper and lower correlation weights T U and T L using equation (3): T ab = 2 m T U + T L (3) The method according to claim 1, characterized in that n is 1, and the method further comprises: generating the ΣAB processing command in accordance with a 2m-bit covariance operation command as an input statistic operation command, calculating averages µ A and µ B for the designated 2m-bit portion a ij of the pixel group ΣA ij and the designated 2m-bit portion b ij of the pixel group ΣB ij in accordance with the input 2m-bit covariance operation command, and calculating covariance σ AB2m for the designated 2m-bit portions a ij and b ij from the calculated correlation weight T ab and the calculated averages µ A and µ B using equation (4) in the input 2m-bit covariance operation command: σ AB2m = (1/N)T ab - µ A ·µ B (4) The method according to claim 2, characterized in that said calculating the averages µ A and µ B includes: calculating, in accordance with the input 2m-bit covariance operation command, an upper A weight U UA for the pixel group ΣA ij from equation (5) and an upper B weight U UB for the pixel group ΣB ij from equation (6) using the histogram h U (2 2m k U + k B ) obtained by calculating the upper correlation weight T U : calculating, in accordance with the input 2m-bit covariance operation command, lower A weight U LA for the pixel group ΣA ij from equation (7) and lower B weight U LB for the pixel group ΣB ij from equation (8) using the histogram h L (2 m k L + k B ) obtained by calculating the lower correlation weight T L : and determining, in accordance with the input 2m-bit covariance operation command, the averages µ A and µ B from the upper A weight U UA , the upper B weight U UB , the lower A weight U LA , and the lower B weight U LB using equations (9) and (10): µ A = (1/N)(2 m U UA + U LA ) (9) µ B = (1/N)(U UB + U LB ) (10) The method according to claim 2, further comprising executing a 3m-bit histogram operation for obtaining histogram h A (k A ) while setting the upper m-bit portion to be "0" and using the pixel group ΣA ij as pixel group ΣB ij , and calculating average µ A from the histogram h A (k A ) using equation (11), in accordance with a 2m-bit average operation command for the pixel group ΣA ij as an input statistic operation command: The method according to claim 2, further comprising: using the pixel group ΣA ij as the pixel group ΣB ij in accordance with a 2m-bit variance operation command for pixel group ΣA ij as an input statistic operation command, and determining the covariance σ AB2m obtained for the designated 2m-bit portions a ij and b ij in the 2m-bit covariance operation command, to be variance σ A 2. The method according to claim 1, characterized in that n is an integer equal to or larger than 2, and the method further comprises: generating, in accordance with an input total ΣAB processing command, the ΣAB processing command for all the combinations of designated 2m-bit portions a pij (p = 1 to n) and b qij (q = 1 to n) using the designated 2m-bit portion a pij as the designated 2m-bit portion a ij and the designated 2m-bit portion b qij as the designated 2m-bit portion b ij , in association with combinations of the designated 2m-bit portions a pij and b qij arbitrarily designated from n 2m-bit portions a pij (p = 1 to n) associated with pixel group ΣA ij and n 2m-bit portions b qij (q = 1 to n) associated with pixel group ΣB ij , and calculating from equation using the correlation weight T ab obtained for each of all the combinations of the designated 2m-bit portions a pij and b qij as pq correlation weight T pq in accordance with the total ΣAB processing command: The method according to claim 6, further comprising: generating the total ΣAB processing command in accordance with an input 2mn-bit covariance operation command as the input statistic operation command, determining averages µ AT and µ BT for the pixel groups ΣA ij and ΣB ij in accordance with the 2mn-bit covariance operation command, and calculating, in accordance with the 2mn-bit covariance operation command, covariance σ ABT using equation from the ΣA dij ·B dij and the averages µ AT and µ BT : The method according to claim 7, characterized in that said determining the averages µ A and µ B comprises: calculating, in accordance with the input 2mn-bit covariance operation command, upper A weight U UAp for the pixel group ΣA ij from equation (14) and upper B weight U UBp for the pixel group ΣB ij from equation (15) using histogram h Up (2 2m k U + k B ) as the histogram h U (2 2m k U + k B ) for a combination of p = q in the combinations of the designated 2m-bit portions a pij and b qij : calculating, in accordance with the input 2mn-bit covariance operation command, lower A weight U LAp for the pixel group ΣA ij from equation (16) and lower B weight U LBp for the pixel group ΣB ij from equation (17) using the histogram h Lp (2 2m k U + k B ) as the histogram h L (2 2m K L + k B ) for a combination of p = q in the combinations of the designated 2m-bit portions a pij and b qij : and and calculating, in accordance with the input n(2m)-bit covariance operation command, the averages µ AT and µ BT using equations (18) and (19) from the upper A weight U UAp and the upper B weight U UBp and the lower A weight U LAp and the lower B weight U LBp from equations (18) and (19): The method according to claim 7, further comprising generating the 2mn-bit covariance operation command using the pixel group ΣA ij as the pixel group ΣB ij in accordance with an 2mn-bit variance operation command for the pixel group ΣA ij as the input statistic operation command, generating the ΣAB processing command for combinations of the designated 2m-bit portions a pij and b qij which can satisfy p ≦ q, and determining the covariance σ AB as variance σ A 2. The method according to claim 7, further comprising: generating the 2m-bit average processing command for all the designated 2m-bit portions a pij in accordance with the 2mn-bit average operation command for the pixel group ΣA ij as the input statistic operation command, calculating average µ AT from equation (20) using an average µ pA as the average µA obtained for the designated 2m-bit portion a pij in accordance with the 2mn-bit average operation command: An image data processing apparatus for executing a statistic operation between image data A and B at high speed, comprising: a first image memory (114) for storing the image data A, wherein the image data A is constituted by pixel group ΣA ij consisting of N pixels A ij (N is a positive integer more than 2; i and j respectively indicate a row position and a column position), and density data A dij of each pixel A ij is expressed by 2mn-bit data ( n and m are positive integers); a second image memory (115) for storing the image data B, wherein the image data B is constituted by pixel group ΣB ij consisting of N pixels B ij (N is said positive integer more than 2; i and j respectively indicate a row position and a column position), and density data B dij of each pixel B ij is expressed by 2mn-bit data ( n and m are said positive integers); comprising: histogram operation means (116) for carrying out, in accordance with a ΣAB processing command input thereto, a 3m-bit histogram operation for obtaining h U (2 2m k + k B ) or h L (2 2m k + k B ) representing the number of sets of pixels A ij and B ij , in which a value of upper or lower m-bit portion a Uij or a Lij of a first designated 2m-bit portion a ij is k (k = 0 to 2 m - 1) and a value of a second designated 2m-bit portion of pixel B ij at the same position as the pixel A ij is k B (k B = 0 to 2 2m - 1), from upper or lower m-bit portion a Uij or a Lij of the designated 2m-bit portion a ij of each density data A dij read out from said first image memory and the designated 2m-bit portion b ij of each density data B dij read out from said second image memory; calculation means (132) for calculating, in accordance with the ΣAB processing command input thereto, upper correlation weight T U from equation (1) using the histogram h U (2 2m k + k B ) , and lower correlation weight T L , from equation (2) using the histogram h L (2 2m k + k B ) and for calculating, in accordance with the ΣAB processing command, correlation weight T ab using equation (3) from the upper and lower correlation weights T U and T L : and, control means (131) for controlling said histogram operation means (116) and said calculation means (132). The apparatus according to claim 11, characterized in that said calculation means (132) comprises: Σ operation means (142) for calculating, in accordance with the ΣAB processing command, the upper correlation weight T U using equation (1) from the histogram h U (2 2m k + k B ) and the lower correlation weight T L using equation (2) from the histogram h L (2 2m k + k B ) ; and arithmetic operation means (141) for calculating a correlation weight T ab from the upper and lower correlation weights T U and T L using equation (3) in accordance with the ΣAB processing command, and said control means (131) includes means for sequentially controlling said histogram operation means (116) and Σ operation means (142) to obtain the upper correlation weight T U and the lower correlation weight T L , and thereafter said arithmetic operation means (141) to obtain the correlation weight T ab . The apparatus according to claim 12, characterized in that said histogram operation means (116) comprises: first histogram processing means (116-1) for executing the 3m-bit histogram operation associated with the upper m-bit portion a Uij of the designated 2m-bit portion a ij and the designated 2m-bit portion b ij in accordance with the ΣAB processing command; and second histogram processing means (116-2) for executing the 3m-bit histogram operation associated with the lower m-bit portion a Lij of the designated 2m-bit portion aij and the designated 2m-bit portion b ij in accordance with the ΣAB processing command, said Σ operation means (142) comprises: first Σ processing means (142-1) for calculating, in accordance with the ΣAB processing command, the upper correlation weight T U using equation (1) from the 3m-bit histogram obtained from said first histogram processing means (116-1); and second Σ processing means (142-2) for calculating, in accordance with the ΣAB processing command, the lower correlation weight T L using equation (2) from the 3m-bit histogram obtained from said second histogram processing means (116-2), and said control means (131) includes means for simultaneously controlling said first and second histogram processing means (116-1 and 116-2) and said first and second Σ processing means (142-1 and 142-2) to obtain the upper and lower correlation weights T U and T L , and for subsequently controlling said arithmetic operation means (141) to obtain the correlation weight T ab . The apparatus according to claim 12, characterized in that n is 1, and the input statistic operation command is a 2m-bit covariance operation command, said control means (131) further comprises means (131) for generating the ΣAB processing command and a 2m-bit weight processing command, in accordance with the 2m-bit covariance operation command, said calculation means (132) further comprises means (132) for calculating upper A weight U UA and upper B weight U UB from equations (4) and (5) using the histogram h U (2 2m k + k B ) in accordance with the 2m-bit weight processing command when the upper correlation weight T U is calculated in accordance with the ΣAB processing command, for calculating lower A weight U LA and lower B weight U LB from equations (6) and (7) using the histogram h L (2 2m k + k B ) in accordance with the 2m-bit weight procesing command when the lower correlation weight T L is calculated in accordance with the ΣAB processing command, and for calculating covariance ΣAB using equation (8) from the correlation weight T ab , the upper A weight U UA , the upper B weight U UB , the lower A weight U LA , and the lower B weight U LB in accordance with the 2m-bit covariance operation command: The apparatus according to claim 14, characterized in that said control means (131) further comprises means (131) for generating a 2m-bit average processing command in accordance with an average operation command for the pixel group ΣA ij as the input statistic operation command, said histogram operation means (116) further comprises means (116) for executing the 3m-bit histogram processing while setting the m-bit portion a Uij or a Lij as "0" and using pixel group ΣA ij designated by the average operation command as pixel group ΣB ij in accordance with the 2m-bit average processing command, said calculation means (132) further comprises means (132) for calculating average µ A from the calculated 3m-bit histogram h A (k A ) (k A = 0 to 2 2m - 1) using equation (9) in accordance with the input 2m weight processing command: The apparatus according to claim 15, characterized in that said control means (131) further comprises means (131) for generating the ΣAB processing command, and the 2m-bit weight processing command in which pixel group ΣA ij is used as pixel group ΣB ij , in accordance with the variance operation command for pixel group ΣA ij as the input statistic operation command, and for making the obtained covariance σ AB become variance σ A 2. The apparatus according to claim 11, characterized in that n is an interger of not less than 2, said control means (131) further comprises means (131) for generating, in accordance with an input total ΣAB processing command, the ΣAB processing command for all the combinations of the designated 2m-bit portions a pij and b qij using the designated 2m-bit portion a pij as the 2m-bit portion a ij and designated 2m-bit portion b qij as the 2m-bit portion b ij in association with combinations of the designated 2m-bit portions a pij and b qij arbitrarily designated from n 2m-bit portions a pij (p = 1 to n) associated with pixel group ΣA ij and n 2m-bit portions b qij (q = 1 to n) associated with pixel group ΣB ij , and said arithmetic operation means (141) further comprises means (141) for calculating, in accordance with an input total addition processing command, ΣA dij ·B dij from equation (10) using correlation weight Tab obtained for each of the combinations of the designated 2m-bit portions a pij and b qij as pq correlation weight T pq : The apparatus according to claim 17, characterized in that said control means (131) further comprises: means (131) for generating the total ΣAB processing command, a total 2m-bit weight processing command, and a total σ arithmetic operation command in accordance with the input convariance operation command; and means (131) for generating a 2m-bit weight processing command for the combinations of the designated 2m-bit portions a pij and b qij when p = q, in accordance with the total 2m-bit weight processing command, and said arithmetic operation means (141) further comprises means (141) for determining upper A weight U UA , upper B weight U UB , lower A weight U LA , and lower B weight U LB obtained for each of the combinations of the designated 2m-bit portions a pij and b pij in accordance with the 2m-bit weight processing command when p = q, to be upper A weight U UAp , upper B weight U UBp , lower A weight U LAp , and lower B weight U LBp , and for calculating, in accordance with the total arithmetic σ operation command, covariance σ AB from equation (11): The apparatus according to claim 18, characterized in that said control means (131) further comprises means (131) for generating the covariance operation command in which pixel group ΣB dij is used as pixel group ΣA ij , in accordance with a variance operation command as the input statistic operation command, and for making the obtained covariance σ AB become a variance σA 2.

Inventors: KASANO, AKIRA C/O PATENT DIVISION
Applicants: KABUSHIKI KAISHA TOSHIBA
Application year: 1987
Main classification: G06F15
IPC codes: G06F17, G06T7, G06T5