I have $2$ known grayscale images ($256 \times 256$ matrices) $A$ and $B$ and want to find the unknown variable $x$ so that
$$\text{minimize} \quad \| xA-B\|_F^2$$
The goal is to find the best multiplier $x$ that is able to scale the brightness of $A$ to $B$.
I don't know how I should approach a problem like this and how to solve it. Is it an optimization problem? If so, then of what kind and how can I solve it? I'd also appreciate mentioning books or references in this field of work.
Thanks.
Let $f : \mathbb R \to \mathbb R_0^+$ be defined as follows
$$f (x) := \| x \mathrm A - \mathrm B \|_{\text{F}}^2 = x^2 \| \mathrm A \|_{\text{F}}^2 - 2 x \langle \mathrm A , \mathrm B \rangle + \| \mathrm B \|_{\text{F}}^2$$
Taking the 1st derivative and finding where it vanishes, we obtain the least-squares solution
$$\hat{x} := \frac{\langle \mathrm A , \mathrm B \rangle}{\| \mathrm A \|_{\text{F}}^2} = \frac{\langle \mathrm A , \mathrm B \rangle}{\langle \mathrm A , \mathrm A \rangle}$$