Fix calculating the response function of dark images.