1. An image processing apparatus comprising: one or more processors; and one or more memories coupled to the one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the image processing apparatus to: arrange representative points on an inputted image; divide the inputted image into a plurality of areas by clustering a plurality of pixels in the inputted image based on the arranged representative points, wherein the representative points are updated based on feature amounts of the respective divided areas and the inputted image are further divided into updated areas by clustering the pixels in the inputted image based on the updated representative points; generate a graph connecting arranged representative points based on initial arrangement of the arranged representative points, wherein the connected representative points in the graph have an adjacency relationship; and unify the updated areas based on respective feature amounts of the updated areas and the generated graph.