1. An image processing apparatus comprising: an image pickup unit that takes an image of a first face; a first extraction unit that extracts a first image pattern as a correct solution pattern from a sample image of a second face, the first image pattern being an image pattern of a target part of the second face; a second extraction unit that determines, based on the first image pattern, a second image pattern as a counterexample pattern from the sample image, the second image pattern being an image pattern adjacent to the correct solution pattern; a learning unit that learns a pattern recognition of the target part based on the first image pattern and the second image pattern; an identification unit that identifies a face area of the first face from the taken image of the first face, the face area being an area where the first face is shown; and a detection unit that detects a position of the target part from the first face area based on the pattern recognition of the target part.