c# - wp - convert image to grayscale according to slider value -
i'm trying convert image colored grayscale grayscale level depended on slider level. of tutorial found in internet making absolute grayscale. answers, appreciate it
you should use interpolation between full-color image , grayscale version coefficient determined slider's value. example, if convert grayscale using colormatrix
, described here, then, partially grayed image, should apply interpolated matrix. say, "slider=0" full-color , "slider=1" grayscale, matrix apply defined:
<color_matrix_to_apply> = slider * <grayscale_matrix> + (1 - slider) * <identity_matrix>
as colormatrix
not provide ariphmetic operations, should implement formula "manually", each item of matrices.
matrixtoapply.matrix00 = slider * grayscalematrix.matrix00 + (1 - slider) * identitymatrix.matrix00; ... matrixtoapply.matrix44 = slider * grayscalematrix.matrix44 + (1 - slider) * identitymatrix.matrix44;
Comments
Post a Comment