1. An image processing device comprising: a hardware processor including, an estimated plane calculation portion that calculates, for inputted image data, a plurality of estimated planes defined by luminance values on a block-by-block basis, each block containing a predetermined number of pixels including a reference pixel to be subjected to filter processing; an optimal estimated plane selection portion that selects an optimal estimated plane having a least summation of errors between luminance values of respective pixels in a block and luminance values in an estimated plane among the plurality of estimated planes; a weighting factor calculation portion that calculates a weighting factor for the reference pixel on the basis of a luminance value of the reference pixel and a luminance value in the optimal estimated plane; and a weighted smoothing portion that computes a sum of products of relative luminance differences between the luminance values of the respective pixels in the block and luminance values in the optimal estimated plane and the weighting factor for the reference pixel and adds a luminance value in the optimal estimated plane at a reference pixel position to a result of computation.