1. An image processing apparatus for outputting a binary mask image in which an image is separated into an object and a background region, comprising: trimap image obtaining means for obtaining the image and a trimap image in which the image is divided into an object region, a background region, and the other region; pre-dividing means for classifying pixels in the image on the basis of correlation among the pixels, thereby dividing the image into a set of small regions; small region adjacent energy calculating means for calculating a small region adjacent energy on the basis of a difference in pixel value of a pixel set at the vicinity of a boundary of a pair of small regions adjacent to each other in the set of small regions; small region likelihood energy calculating means for selecting the object region and background region in the set of small regions on the basis of the trimap image, constructing a probability model function, obtaining object likelihoods and background likelihoods of the respective sets of small regions using the probability model function, and calculating a small region likelihood energy using the object likelihoods and the background likelihoods; dividing means for dividing the image into a binary mask image of the foreground and the background using the small region adjacent energy and the small region likelihood energy; and output means for outputting the binary mask image divided by the dividing means.