xrenaa/Deblur-by-Fitting

How to perform the (reversed) gamma correction

sczhou opened this issue · 2 comments

Hi Xuanchi,

I notice that you performed reversed gamma correction before convolution with blur kernel. And you demonstrated it works a lot. I wonder how did you perform the reversed gamma correction and gamma correction. Because it may be hard to get a general inverse camera response function for different cameras.

Thanks!

Thanks for your question and sorry for late reply due to the exam weeks.
The code for making blur is as below:

_im = tf.sign(im) * (tf.abs(im)) ** (2.2)
B,H,W,C = im.get_shape()
c1 = tf.nn.conv2d(_im[:,:,:,0:1], kernel, strides=[1,1,1,1], padding='SAME')
c2 = tf.nn.conv2d(_im[:,:,:,1:2], kernel, strides=[1,1,1,1], padding='SAME')
c3 = tf.nn.conv2d(_im[:,:,:,2:3], kernel, strides=[1,1,1,1], padding='SAME')
result = tf.concat([c1,c2,c3], axis = 3)
result = tf.sign(result) * (tf.abs(result)) ** (1/2.2)

This works for specific scenarios. We set a commonly used parameter.

Got it! Thanks for your answer!