PROBLEM TO BE SOLVED: To provide a practical image processing technology for separating a diagnostic object into a plurality of parts.SOLUTION: Contraction processing is performed to a plurality of follicles F in binarized image data in (A), and the plurality of follicles F are separated into follicles F1-F3 as shown in (B). Further, in image data after contraction processing shown in (B), labeling processing is performed to assign a label O to a background part as shown in (C), and labels 1-3 are assigned to the follicles F1-F3 respectively. In image data after labeling processing shown in (C), expansion processing is performed to each of the plurality of follicles. In the expansion processing, boundaries are formed at the mutual overlap parts of the expansion parts overlapped with one another when expansion processing is performed, to restore the size of the plurality of follicles. Consequently, as shown in (D), the size of each follicle is restored to the size before contraction processing while forming the boundaries between the follicles.