An image processing apparatus includes an acquiring unit that acquires a plurality of pixel value rows aligned in a depth direction of an object to be measured based on interference light obtained by causing return light of scanned measurement light from the object to be measured and reference light corresponding to the measurement light to interfere with each other. A forming unit forms a two-dimensional image based on pixel values selected in accordance with a predetermined selection criterion from the plurality of pixel value rows, one of the pixel values being selected from one of the plurality of pixel value rows. In addition, a setting unit sets a selection range which is a range in the depth direction for selecting the pixel values in the plurality of pixel value rows, and a criterion changing unit changes the predetermined selection criterion in accordance with the set selection range.