1. A motion vector detecting device comprising: a motion predicting and compensating means for (i) calculating cost values of a plurality of motion vectors, wherein the motion vectors are candidates of an optimal motion vector, with a first pixel precision for each prediction mode of a plurality of prediction modes, and (ii) calculating the optimal motion vector with a second pixel precision and a cost value of the optimal motion vector with the second pixel precision on the basis of a gradient of the cost values with the first pixel precision by determining whether a comparison result of at least two cost values among the cost values with the first pixel precision is in accordance with a predetermined condition.