[][src]Function opencv::core::norm_sparse

pub fn norm_sparse(src: &SparseMat, norm_type: i32) -> Result<f64>

Calculates the absolute norm of an array.

This version of #norm calculates the absolute norm of src1. The type of norm to calculate is specified using #NormTypes.

As example for one array consider the function inline formula. The inline formula and inline formula norm for the sample value inline formula is calculated as follows \f{align*} | r(-1) |{L_1} &= |-1| + |2| = 3 \ | r(-1) |{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \ | r(-1) |{L\infty} &= \max(|-1|,|2|) = 2 \f} and for inline formula the calculation is \f{align*} | r(0.5) |{L_1} &= |0.5| + |0.5| = 1 \ | r(0.5) |{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \ | r(0.5) |{L\infty} &= \max(|0.5|,|0.5|) = 0.5. \f} The following graphic shows all values for the three norm functions inline formula and inline formula. It is notable that the inline formula norm forms the upper and the inline formula norm forms the lower border for the example function inline formula. Graphs for the different norm functions from the above example

When the mask parameter is specified and it is not empty, the norm is

If normType is not specified, #NORM_L2 is used. calculated only over the region specified by the mask.

Multi-channel input arrays are treated as single-channel arrays, that is, the results for all channels are combined.

Hamming norms can only be calculated with CV_8U depth arrays.

Parameters

  • src1: first input array.
  • normType: type of the norm (see #NormTypes).
  • mask: optional operation mask; it must have the same size as src1 and CV_8UC1 type.

Overloaded parameters

  • src: first input array.
  • normType: type of the norm (see #NormTypes).