5.3.4.72. Function threshold

5.3.4.72.1. Function Documentation

void threshold(const uint8_t **img_in, uint8_t **img_out, const int i0, const int i1, const int j0, const int j1, const uint8_t threshold)

Convert an input image ( \(I_{in}\)) in grayscale levels into a binary image ( \(I_{out}\)) depending on a greyscale threshold ( \(T\)). If \( I_{in}^i \geq T\) then \(I_{out}^i = 255 \), else \(I_{out}^i = 0\).

Parameters
  • img_in – Input greyscale image (2D array \([i1 - i0 + 1][j1 - j0 + 1]\), \(\{0,1\}\)).

  • img_out – Output binary image (2D array \([i1 - i0 + 1][j1 - j0 + 1]\), \(\{0,1\}\), \(\{0,1\}\) is coded as \(\{0,255\}\)).

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

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

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

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

  • threshold – Value that define if the pixel is kept in the output binary image or not.