5.3.4.56. Function features_merge_CCL_HI_v3

5.3.4.56.1. Function Documentation

uint32_t features_merge_CCL_HI_v3(const uint32_t **in_labels, const uint8_t **img, uint32_t **out_labels, const int i0, const int i1, const int j0, const int j1, RoI_basic_t *RoIs_basic, const size_t n_RoIs, const uint32_t S_min, const uint32_t S_max, const uint8_t threshold_high, const uint8_t no_labels_zeros_init)

Hysteresis re-labeling and morphological thresholding. From a 2D array of labels (in_label) and a grayscale image (img), the function generates a new 2D array of labels (out_labels). The newly produced labels (out_labels) are a sub-set of the “old” labels (in_labels). Labels from in_labels are kept in out_labels only if at least one pixel of the current connected-component exists in the binary image (img). Finally, this function performs a morphological thresholding as follow: if \( S_{min} > S \) or \( S > S_{max}\) then the corresponding RoIs_id is set to 0. Note: this function is optimized to be more efficient than to compute the thresholding and to merge the labels separately.

See also

RoIsbasic_t for more explanations about the features.

Parameters
  • in_labels – Input 2D array of labels ( \([i1 - i0 + 1][j1 - j0 + 1]\)).

  • img – Grayscale image (2D array \([i1 - i0 + 1][j1 - j0 + 1]\), grayscale is in \([0;255]\) range).

  • out_labels – Output 2D array of labels ( \([i1 - i0 + 1][j1 - j0 + 1]\)).

  • i0 – First \(y\) index in the labels (included).

  • i1 – Last \(y\) index in the labels (included).

  • j0 – First \(x\) index in the labels (included).

  • j1 – Last \(x\) index in the labels (included).

  • RoIs_basic – Features.

  • n_RoIs – Number of connected-components (= number of RoIs) in the 2D array of in_labels.

  • S_min – Minimum morphological threshold.

  • S_max – Maximum morphological threshold.

  • threshold_high – Value (between \([0;255]\)). If the pixel intensity is higher than threshold, then the pixel is kept for the re-labeling, else the pixel is ignored. threshold_high should be higher than the threshold value used for in_labels.

  • no_labels_zeros_init – Boolean for optimization purpose. If set to 1, out_labels is not initialized in this function. Thus, it is up to the developer to properly initialize out_labels before calling this routine. If you are not sure, prefer to set this boolean to 0.

Returns

Number of labels.