An image processing apparatus comprising: a plural focal images acquisition unit that acquires a plurality of captured images obtained by imaging a sample, wherein the sample includes a target cell, at a plurality of different focal distances; an image selection unit that selects a captured image most focused on the sample from the plurality of captured images, wherein the selection includes calculation of the contrast and selection of the captured image including the nucleus candidate region with the highest contrast and selecting that image as a reference image; a setting unit that sets an object region for detecting a target cell in each of the plurality of captured images; wherein the setting unit sets the object region for a captured image at a focal distance with a predefined range from the captured image selected by the image selection unit among the plurality of captured images; a calculation unit that calculates a three-dimensional histogram of oriented gradient, HOG, feature quantity as an image feature quantity by calculating a luminance gradient in a focal distance direction of the plurality of captured images from differences between the plurality of the captured images, the focal distance direction being defined as the direction perpendicular to the image plane, and calculating a three-dimensional luminance gradient direction having an in-plane direction and the focal distance direction in the object region and intensity; and a determination unit that performs determination about whether or not the target cell is included in the object region according to whether or not the image feature quantity satisfies conditions defined for the target cell. a plural focal images acquisition unit that acquires a plurality of captured images obtained by imaging a sample, wherein the sample includes a target cell, at a plurality of different focal distances; an image selection unit that selects a captured image most focused on the sample from the plurality of captured images, wherein the selection includes calculation of the contrast and selection of the captured image including the nucleus candidate region with the highest contrast and selecting that image as a reference image; a setting unit that sets an object region for detecting a target cell in each of the plurality of captured images; wherein the setting unit sets the object region for a captured image at a focal distance with a predefined range from the captured image selected by the image selection unit among the plurality of captured images; a calculation unit that calculates a three-dimensional histogram of oriented gradient, HOG, feature quantity as an image feature quantity by calculating a luminance gradient in a focal distance direction of the plurality of captured images from differences between the plurality of the captured images, the focal distance direction being defined as the direction perpendicular to the image plane, and calculating a three-dimensional luminance gradient direction having an in-plane direction and the focal distance direction in the object region and intensity; and a determination unit that performs determination about whether or not the target cell is included in the object region according to whether or not the image feature quantity satisfies conditions defined for the target cell.