enclosures property

int get enclosures

Gets the number of enclosed regions in the matrix.

An enclosed region is a contiguous area of false cells completely surrounded by true cells. This property is useful for character recognition, as different characters have different numbers of enclosed regions (e.g., 'O' has one, 'B' has two).

Returns the number of enclosed regions in the matrix.

Implementation

int get enclosures {
  if (_enclosures < 0) {
    _enclosures = _countEnclosedRegion(this);
  }
  return _enclosures;
}