The technique of the invention calculates an edge gradient magnitude a(x,y) at each pixel position (x,y) and an edge width w(x,y) from luminance values of an object image, and computes an out-of-focus evaluation value M(x,y) at each pixel position (x,y) from the calculated edge gradient magnitude a(x,y) and edge width w(x,y). The technique then divides the object image into a preset number of blocks, determines a representative out-of-focus evaluation value Y(m,n) in each block, and compares the representative out-of-focus evaluation value Y(m,n) with a preset threshold value for block classification to categorize each block as an in-focus block or an out-of-focus block. The technique eventually determines the object image as in-focus or out-of-focus, based on the total number of blocks included in in-focus block areas, the total number of blocks included in out-of-focus block areas, and the relative positions of the in-focus block areas and the out-of-focus block areas to the whole image.