5.3.4.2. Function _features_compute_magnitude

5.3.4.2.1. Function Documentation

void _features_compute_magnitude(const uint8_t **img, const uint32_t img_width, const uint32_t img_height, const uint32_t **labels, const uint32_t *RoIs_xmin, const uint32_t *RoIs_xmax, const uint32_t *RoIs_ymin, const uint32_t *RoIs_ymax, const uint32_t *RoIs_S, uint32_t *RoIs_magnitude, uint32_t *RoIs_sat_count, const size_t n_RoIs)

Compute magnitude features. The magnitude represents the brightness of a RoI. In a first time, the sum of the pixels intensities is performed. In a second time, the noise level around the connected-component is subtracted to give a better estimation of the real brightness. The magnitude can be defined as follow: \( M = \displaystyle\sum_{p=0} ^{P} i_p - \big((\displaystyle\sum_{n=0} ^{N} i_n) / N\big) \times P\), where \(P\) is the the number of pixels in the current CC, \(i_x\) is the brightness of the pixel \(x\) and \(N\) is the number of noisy pixels considered. In addition, this function can also compute the saturation counter for each RoI (e. g. the number of pixels that have an intensity \(I_p = 255\)).

See also

RoIs_basic_t for more explanations about the basic features.

See also

RoIs_misc_t for more explanations about the miscellaneous features.

Parameters
  • img – Image in grayscale ( \([\texttt{img\_height}][\texttt{img\_width}]\), the values of the pixel range are \( [ 0;255 ] \)).

  • img_width – Image width.

  • img_height – Image height.

  • labels – 2D array of labels ( \([\texttt{img\_height}][\texttt{img\_width}]\)).

  • RoIs_xmin – Array of minimum \(x\) coordinates of the bounding box.

  • RoIs_xmax – Array of maximum \(x\) coordinates of the bounding box.

  • RoIs_ymin – Array of minimum \(y\) coordinates of the bounding box.

  • RoIs_ymax – Array of maximum \(y\) coordinates of the bounding box.

  • RoIs_S – Array of RoI surfaces.

  • RoIs_magnitude – Array of RoI magnitudes.

  • RoIs_sat_count – Array of RoI saturation counters (if NULL, the saturation counter is not computed).

  • n_RoIs – Number of connected-components (= number of RoIs).