This is more or less the next question for a two-dimensional color ramp (256x256 matrix) interpolated from 4 corner colors , to which jadsq answered today.
For linear gradients, the previous answer works very well. However, if someone wants to better control the stop-paint gradient, this method does not seem very practical. What can help in this situation is to have some color reference points in the matrix (look-up table), which are used to interpolate color values ββfor an empty position in the look-up table. What I mean may be easier to read from the image below.

The whole idea is taken from http://cartography.oregonstate.edu/pdf/2006_JennyHurni_SwissStyleShading.pdf page 4-6. I read the article, I understand theoretically that this is unsuccessful, due to my low experience in using interpolation methods and, frankly, general mathematical skills. It is also interesting that they use a sigmoid Gaussian bell as an interpolation method (p. 6). They argue that Gaussian weighting gave visually better results and was easy to calculate (equation 1 with k = 0,0002 for a 256 by 256 cell table).
Edit (best illustrations):


I have other parts of their methods presented, but filling the empty values ββin the matrix is ββreally a key part and does not allow me to continue. Thank you again for your help!
What I have right now:
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt # the matrix with the reference color elements ref=np.full([7, 7, 3], [255,255,255], dtype=np.uint8) ref[0][6] = (239,238,185) ref[1][1] = (120,131,125) ref[4][6] = (184,191,171) ref[6][2] = (150,168,158) ref[6][5] = (166,180,166) # s = ref.shape # # from scipy.ndimage.interpolation import zoom # zooming as in https:
python numpy scipy matrix image-processing
hetsch
source share