Calculate the X4 kernel from the X2 kernel (for proof see appendix in paper)
(k)
| 46 | |
| 47 | |
| 48 | def analytic_kernel(k): |
| 49 | """Calculate the X4 kernel from the X2 kernel (for proof see appendix in paper)""" |
| 50 | k_size = k.shape[0] |
| 51 | # Calculate the big kernels size |
| 52 | big_k = np.zeros((3 * k_size - 2, 3 * k_size - 2)) |
| 53 | # Loop over the small kernel to fill the big one |
| 54 | for r in range(k_size): |
| 55 | for c in range(k_size): |
| 56 | big_k[2 * r:2 * r + k_size, 2 * c:2 * c + k_size] += k[r, c] * k |
| 57 | # Crop the edges of the big kernel to ignore very small values and increase run time of SR |
| 58 | crop = k_size // 2 |
| 59 | cropped_big_k = big_k[crop:-crop, crop:-crop] |
| 60 | # Normalize to 1 |
| 61 | return cropped_big_k / cropped_big_k.sum() |
| 62 | |
| 63 | |
| 64 | def anisotropic_Gaussian(ksize=15, theta=np.pi, l1=6, l2=6): |
nothing calls this directly
no outgoing calls
no test coverage detected