I am very new to computer vision and image processing and working on a problem of detecting light direction (sun azimuth and elevation) using only a single image. I attempted the method mentioned in "Determining Light Direction in Spheres using Average Gradient by Richard Dosselmann". But I couldn't get the azimuth or elevation angles properly. I tried to calculate image gradients (gx and gy) using sobel operator and taken average of gx and gy. Using arctan(gy,gx), I was trying to get an elevation angle. but it didn't work properly. To elaborate my problem, from the following lunar crater image, the solar azimuth with respect to north is 90degree and elevation is 45degree, what I suppose to find.lunar crater. Please help me in finding lighting source direction by using only an image.