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