I am going through the Digital Image Processing book by Woods and Gonzales.
I cam across this paragraph.
I have done some research and I think I know how can I proof this relation. I am not very strict here and there are some conditions that need to be met here. My main focus is not on a result itself so we can assume that required conditions are met.
Let $X$ be a random variable with pdf $f$ and primitive $F$.
Let $Y$ be a random variable with pdf $g$ and primitive $G$. Such that $Y = T(X)$ where $T$ is a transformation as described in the paragraph.
Now
$G(Y) = P(Y < y) = (P(T(X) < y)) = P(X < T^{-1}(y)) = F(T^{-1}(y))$
Taking derivative of both sides and using chain rule gives
$g(y) = f(T^{-1}(y))\frac{\mathrm{d}T^{-1}(y)}{\mathrm{d}y}$
Now let $y = s$ and $r = T^{-1}(y)$ we get formula from paragraph - with absolut value coming from the fact that $T$ can be increasing or decrising.
$g(s) = f(r)\frac{\mathrm{d}r}{\mathrm{d}s}$
But one thing I can't understand is that the author of the book "forgets" that $r = T^{-1}(y)$ and I don't get how can this be done. He treats $r$ as a normal variable which is not an result transforming another variable via inverse of some transformation function.
Can someone explain to me why is this?
He basically states that very important transformation in image processing is
$s = T(r) = (L-1)\int_0^r p_r(w)\ \mathrm{d}{w}$
Since, by the Leibniz's rule, we have
$\frac{ds}{dr}= \frac{\mathrm{d}T(r)}{\mathrm{d}r} = (L-1)\frac{\mathrm{d}}{\mathrm{d}r}[\int_0^r p_r(w)\mathrm{d}{w}] = (L-1)p_r(r)$
Than
$p_s(s) = p_r(r)\left|\frac{\mathrm{d}r}{\mathrm{d}s}\right|= p_r(r)\left|\frac{1}{(L-1)p_r(r)}\right| = \frac{1}{(L-1)}$
since L is intensity and it is $0 \le s \le L-1$ and $p_r(r)$ is a density.
This is what we want. We want to show that under this transformation any distribution will be transformed to uniform.
BUT I don't see anywhere the need to transform $r$ by inverse, use $r = T^{-1}(y)$ and I don't understand why we can wave it off.
Maybe this is trivial but I would appreciate if someone could explain this to me.
One way I can think about it is that the domain and image of $T$ is the set r belongs to and T is one-to-one so it doesn't really matter if we transform r or not since it will just be another element of the set. But I don't know if this is correct way of thinking.
