Finding DC gain of a signal I have a gray scale image produced by an optical photon simulation and I am trying to find the DC gain of the image using Matlab. For that, I simulate a slant edge image in the simulation where N number of photons are incident on the optical plate. 

I use the edge image to find the line spread function of the edge by taking the first derivative of the edge spread function (LSF=diff(ESF)). Then I use the Matlab FFT function to find the DC gain at frequency = 0.

I am not sure if this method is correct or not. How do I correctly find the DC gain in my image?.
The 0 FFT bin "DC Value" is equal to the mean of the signal scaled by the number of samples in the FFT.  So a more direct method to compute the DC value is to compute the mean value of the signal directly.

$$FFT_{bin0} =\sum_{n=0}^{N-1}x_n = N\overline x$$