sunreef / BlindSR

Independent implementation of the algorithm from the paper "Blind Image Super-Resolution with Spatially Variant Degradations"
GNU General Public License v3.0
59 stars 9 forks source link

Not getting degradation function #6

Closed nanmehta closed 4 years ago

nanmehta commented 4 years ago

thanks al ton for the code and for the excellent paper, but going through the code, I was not able to get the code wriiten in degradation.py for building the kernel. Can you help me out please, I am new in this field

sunreef commented 4 years ago

What part of the degradation function is confusing to you ?

The degradation is formed by a convolution with a certain kernel (anisotropic Gaussian in our case) followed by a downsampling operation (taking one pixel out of two in both spatial dimensions).

nanmehta commented 4 years ago

Thanks for your reply sir, actually i am not ab;e to understand how is this being defined in the code. a = cos_theta_2 / sigma_x_2 + sin_theta_2 / sigma_y_2 b = sin_theta * cos_theta * (1.0 / sigma_y_2 - 1.0 / sigma_x_2) c = sin_theta_2 / sigma_x_2 + cos_theta_2 / sigma_y_2 gaussian = lambda x,y: (- ( a * (x ** 2) + 2.0 * b * x * y + c * (y ** 2))).exp()

Sorry sir i am new to this so I am having trouble in understanding , like gaussian kernel as i have known is defined as -exp(x^2)/2(variance^2), so why we are using a,b,c

sunreef commented 4 years ago

This is because we are using 2D anisotropic gaussian kernels in this code. The coefficients depend on the orientation of the kernel as well as the two standard deviations.

nanmehta commented 4 years ago

okay. thanks alot sir