Patent ID: 8922627

Claim:
A device for processing an image comprising: an input unit that receives a first image and a second image that are taken from different positions, the first image and the second image each including a plurality of pixels arranged in a two-dimensional matrix; a first cutting unit that cuts a first block of a given size from the first image at a position corresponding to a pixel in N-th row and L-th column (N and L are each an integer of 1 or larger) of the first image; a second cutting unit that moves a second block of the given size by P (P is an integer of 1 or larger) pixels in a row direction, in a moving limit set in a processing area of the second image in accordance with the position of the first block, and cuts the second block from the second image in the moving limit; a correlation value calculating unit that calculates a correlation value between the first block and the second block by comparing the first block with the second block each time the second block is cut; a deviation amount calculating unit that calculates a largest value of the correlation value at each position of the first block and calculates an amount of deviation between the first image and the second image at each position of the first block based on a moving distance of the second block corresponding to the largest value of the correlation value; and a setting unit that sets the moving limit, wherein the setting unit narrows the moving limit based on the correlation value calculated in the N-th row when the amount of deviation is calculated in the (N+1)-th row of the first image.