I want to try and modify my sepia method, I have a sepia matrix
But I want the user to give a value between 0 and 1 to adjust the matrix, Im not sure how to apply this this n value to the matrix, which values should be multiplied with the matrix.
I start by user giving the value 0, which will proved the identity matrix
Any hints on what and how to multiply the identity matrix with n? If n is 1 it should return the sepia_matrix over
CodePudding user response:
The key here is that you want to interpolate between the identity matrix and your own matrix in a meaningful way. It has already been suggested to use
interp_matrix = (1-t)*np.identity(3) t*sepia_matrix
This would definitely work to some degree, but I'd argue you should use a multiplicative interpolation, so use
interp_matrix = scipy.linalg.fractional_matrix_power(sepia_matrix, t**p)
Where p
is e.g. 2 or 4 or so, depending how "quickly" you want the interpolation to happen.
Both of them are the identity matrix for t=0
and your sepia_matrix
for t=1
, but I think the latter would be more natural. Not