sanghviyashiitb / structured-kernel-cvpr23

Official Code for "Structured Kernel Estimation for Photon-Limited Deconvolution" (CVPR 2023)
https://sanghviyashiitb.github.io/structured-kernel-webpage/
MIT License
32 stars 8 forks source link

How to infer custom images #2

Closed CX-XC closed 9 months ago

CX-XC commented 9 months ago

hello! I would like to ask how to enhance my own image. The input in the code is a grayscale image, can only handle single channel images? thanks

sanghviyashiitb commented 9 months ago

For color images, you can first estimate the kernel using the grayscale version of the image and the deblur each of the channels using the kernel. The pseduocode would look something like this.

# Get the grayscale image as follows:
y_grayscale = (y[:,:,0] + y[:,:,1] + y[:,:,2])/3
k_est = estimate_kernel(y_grayscale) ## Your kernel estimation method here

x_out = np.copy(y)*0
for ii in range(3):
  x_out[:,:,ii] = deblur(y[:,:,ii], k_est) ## Use the non-blind solver here.
return x_out