I got the following code:
import numpy as np
from skimage import data
def plot_spectrum(fft_im, vmin, scale_factor):
fshift0 = np.fft.fftshift(fft_im) #shifts the zero-frequency component to the center of the spectrum
# (log10(|(fft*(10^6)-1) / ((10^5)+1 ) / (10^5)|) + 5 ) )* 1 / (scale_factor+1)
magnitude_spectrum = (np.log10(np.abs(fshift0*(np.power(10,scale_factor+1)-1)/np.power(10,scale_factor)+1/np.power(10,scale_factor)))+scale_factor)*1/(scale_factor+1)
plt.imshow(np.abs(magnitude_spectrum), vmin=vmin)
imp = data.camera()
fft_im = np.fft.fft2(fft_im)
im_res = plot_spectrum(fft_im, vmin=0, scale_factor=5)
I don't understand the following line:
magnitude_spectrum = (np.log10(np.abs(fshift0*(np.power(10,scale_factor+1)-1)/np.power(10,scale_factor)+1/np.power(10,scale_factor)))+scale_fact
What is it doing and from what is it derived?