Generating random smooth monotonic functions

269 Views Asked by At

I need to create an image augmentation that would mask lighting / sensor effects.

Sensor inputs are mapped to [0; 1]. The idea is to create random smooth fuctions $f: [0; 1] \mapsto [0; 1]$ and apply them to images to warp intensities slightly. How can I do it?

I guess, a starting point is to express this function as a Taylor series like $x + \sum_2^n a_k x^k$ where $\sum_2^n a_k=0$, so the task is to generate the coefficients properly.

How to ensure that the derivative is non-negative in $[0; 1]$? Or, alternatively, is it possible to find the minimum value of the derivative to rescale coefficients after initial generation?

1

There are 1 best solutions below

1
On BEST ANSWER

You can start with creating a random polynomial: $$ f(x) = -0.69306 x^5+0.335021 x^4+0.88975 x^3-0.396266 x^2-0.0730141 x-0.475714 $$

Find it's minimum on $[0,1]$: $$ f_{\min} = \min_{x\in[0,1]} f(x) = -0.510439 $$

Create a function which is always positive on $[0,1]$: $$ g(x) = f(x)-f_{\min}+\varepsilon=\\-0.69306 x^5+0.335021 x^4+0.88975 x^3-0.396266 x^2-0.0730141 x+0.0447247 $$

and integrate it: $$ h(x) = \int_0^xg(y)dy = \\ -0.11551 x^6+0.0670042 x^5+0.222438 x^4-0.132089 x^3-0.036507 x^2+0.0447247 x $$

Then you can rescale it by $h(1)$: $H(x)=H(x)/h(1)$: $$ H(x) = -2.88337 x^6+1.67256 x^5+5.5525 x^4-3.2972 x^3-0.911291 x^2+1.11642 x $$

enter image description here

You might want to play around how you generate the initial polynomial $f(x)$ so you get nice curves and not just straight lines.