1. A method to generate a stereoscopic image from a single two-dimensional image based on depth data, comprising: calculating a value of a spatial frequency component of image data in a local image area around a pixel of interest from the single two-dimensional image, wherein the image data is representative of one or more objects on which a spatial light pattern is projected and blurring of the spatial light pattern in the image data increases in a first depth direction and decreases in a second depth direction, the value of the spatial frequency component being based on the increase or decrease of the blurring; determining depth data corresponding to the calculated value of the spatial frequency component from the single two-dimensional image by utilizing a preset relationship between depths and values of the spatial frequency component, the values corresponding to the increase or decrease of the blurring; and generating the stereoscopic image from the determined depth data corresponding to the calculated value of the spatial frequency component from the single two-dimensional image.