1. An image processing apparatus for detecting a target area including at least a portion of an object from image data generated by capturing at least the portion of the object, the apparatus comprising: a map generation unit that acquires a map of scores in which each score pertaining to a degree—to which a corresponding unit area of the image data is likely to be contained in the target area—is associated with a position of the corresponding unit area in the image data; a temporary area arrangement unit that arranges a temporary area of a predetermined shape in a position on the map of scores, the position being determined in accordance with a predetermined condition; and a target area detection unit that performs, at least once, at least one of: (1) processing of changing the position of the temporary area on the map of scores, on a basis of a distribution of scores of unit areas included in the temporary area, and (2) processing of changing a ratio of a length of the temporary area in a predetermined direction to a length of the temporary area in a direction orthogonal to the predetermined direction, on a basis of positions and scores of unit areas included in a predetermined adjacent area adjacent to the temporary area, the target area determination unit that determines the temporary area as the target area when another predetermined condition is met, the target area determination unit that outputs the determined target area.