1. A method for encoding an intra prediction mode of an image, the method comprising: detecting a similarity of a prediction direction of a neighbor block with respect to a current block based on a position of the neighbor block and an intra prediction direction of the neighbor block with respect to the current block; and determining a candidate prediction mode of the current block based on the similarity and the number of candidate intra prediction modes (N).