pysdic.matching_correction_exact#

matching_correction_exact(result_1, result_2, groups, *, scale=1.0)[source]#

Map the gray levels of the second view onto the statistics of the first one, with the exact derivative. For a point \(i\) of the group \(G\), with \(z_k = (g_k - m_k) / s_k\) (statistics of the group \(G\)):

\[\frac{\partial g'_{2,i}}{\partial g_{2,j}} = \text{scale} \frac{s_1}{s_2} \left( \delta_{ij} - \frac{1 + z_{2,i} z_{2,j}}{n_2} \right), \qquad \frac{\partial g'_{2,i}}{\partial g_{1,j}} = \text{scale} \frac{1 + z_{2,i} z_{1,j}}{n_1}\]

Warning

With several pairings, each pairing keeps the contrast of its first view: the pairings no longer have the same weight in the optimization.

Parameters:
Returns:

See znssd_correction_exact(). The derivative has a block coupling the second view with the first one.

Return type:

result_1, result_2, derivative