An image processing apparatus comprises: shape obtaining means for obtaining information indicating a surface shape of a target object discrimination means for discriminating a contact portion and a noncontact portion between the target object and an imaging surface of an ultrasonic probe which captures an ultrasonic image of the target object position and orientation obtaining means for obtaining information indicating a position and orientation of the ultrasonic probe at the time of imaging and alignment means for estimating deformation of the target object based on information indicating the surface shape, a discrimination result obtained by the discrimination means, and information indicating the position and orientation, and aligning the surface shape with the ultrasonic image.