1. An image processing apparatus for detecting, from image data generated by an image sensor constituted by a plurality of pixels, a signal from a defective pixel of the image sensor, comprising: first determination means for obtaining a first determination value indicating a magnitude of a difference in signal level between a pixel of interest and a plurality of pixels located in the neighborhood of the pixel of interest; second determination means for obtaining a second determination value indicating a width of distribution of the difference in signal level between the pixel of interest and the plurality of pixels located in the neighborhood of the pixel of interest; and detection means for detecting whether or not the signal from the pixel of interest is a defective pixel signal, using the first determination value and the second determination value, wherein the first determination value is a value that increases as the magnitude of the difference increases, and the second determination value is a value that increases as the width of distribution of the magnitude of the difference decreases, and the detection means detects the signal from the pixel of interest as a defective pixel signal when both the first determination value and the second determination value are greater than or equal to a predetermined threshold.