colour_hdri.correct_vignette#
- colour_hdri.correct_vignette(image: ArrayLike, characterisation_data: DataVignetteCharacterisation, method: Literal['2D Function', 'Bivariate Spline', 'RBF'] | str = 'RBF', **kwargs: Any) NDArrayFloat [source]#
Correct the vignette of given image using given method.
- Parameters:
image (ArrayLike) – Image to correct the vignette of.
characterisation_data (DataVignetteCharacterisation) – Vignette characterisation data for given function.
method (Literal['2D Function', 'Bivariate Spline', 'RBF'] | str) – Vignette characterisation method.
function – {
colour_hdri.distortion.correct_vignette_2D_function()
}, Characterisation function.degree – {
colour_hdri.distortion.correct_vignette_bivariate_spline()
}, Degree of the bivariate spline.smoothing – {
colour_hdri.distortion.correct_vignette_RBF()
}, Smoothing parameter, seescipy.interpolate.RBFInterpolator
class.kernel –
- {
colour_hdri.distortion.correct_vignette_RBF()
}, Type of RBF, see
scipy.interpolate.RBFInterpolator
class.
- {
epsilon – {
colour_hdri.distortion.correct_vignette_RBF()
}, Shape parameter that scales the input to the RBF, seescipy.interpolate.RBFInterpolator
class.kwargs (Any)
- Returns:
Vignette corrected image.
- Return type:
Examples
>>> image = apply_radial_gradient(np.ones([5, 7])) >>> characterisation_data = characterise_vignette(image) >>> np.around(correct_vignette_RBF(image, characterisation_data), 3) array([[ 0. , 0.091, 0.841, 1.134, 0.841, 0.091, 0. ], [ 0. , 0.967, 2.03 , 2.552, 2.03 , 0.967, 0. ], [ 0. , 1.323, 2.647, 3.97 , 2.647, 1.323, 0. ], [ 0. , 0.967, 2.03 , 2.552, 2.03 , 0.967, 0. ], [ 0. , 0.091, 0.841, 1.134, 0.841, 0.091, 0. ]]) >>> characterisation_data = characterise_vignette(image, method="RBF") >>> np.around(correct_vignette(image, characterisation_data, method="RBF"), 3) array([[ 0. , 0.091, 0.841, 1.134, 0.841, 0.091, 0. ], [ 0. , 0.967, 2.03 , 2.552, 2.03 , 0.967, 0. ], [ 0. , 1.323, 2.647, 3.97 , 2.647, 1.323, 0. ], [ 0. , 0.967, 2.03 , 2.552, 2.03 , 0.967, 0. ], [ 0. , 0.091, 0.841, 1.134, 0.841, 0.091, 0. ]]) >>> characterisation_data = characterise_vignette(image, method="2D Function") >>> np.around( ... correct_vignette(image, characterisation_data, method="2D Function"), ... 3, ... ) array([[-0. , 0.122, 0.597, 0.747, 0.781, 1.08 , -0. ], [ 0. , 0.413, 0.676, 0.82 , 0.76 , 0.576, 0. ], [ 0. , 0.468, 0.759, 1.103, 0.838, 0.611, 0. ], [ 0. , 0.439, 0.709, 0.858, 0.801, 0.628, -0. ], [-0. , 0.193, 0.742, 0.913, 1.049, -0.477, -0. ]]) >>> characterisation_data = characterise_vignette(image, method="Bivariate Spline") >>> np.around( ... correct_vignette(image, characterisation_data, method="Bivariate Spline"), ... 3, ... ) array([[ 0. , 0.345, 3.059, 4.072, 3.059, 0.345, 0. ], [ 0. , 3.624, 7.304, 9.058, 7.304, 3.624, 0. ], [ 0. , 4.936, 9.481, 14.032, 9.481, 4.936, 0. ], [ 0. , 3.624, 7.304, 9.058, 7.304, 3.624, 0. ], [ 0. , 0.345, 3.059, 4.072, 3.059, 0.345, 0. ]])