1. An apparatus for detecting an obstacle, comprising: a memory configured to store program instructions; and a processor configured to execute the program instructions, the program instructions when executed configured to: compensate a position of a second image based on a first image based on a moving distance of a vehicle between the first image and the second image captured at different times; respectively generate a difference image based on a difference between the first image and the second image and between the first image and the second image in which the position is compensated; perform binarization of the difference image based on a difference value of each difference image; generate a synthetic image for the two difference images based on a bit value of corresponding pixels between the two binarized difference images; and detect the obstacle by selecting a pixel that corresponds to an area where the bit value is detected from the synthetic image.