blackMatrix property

BitMatrix blackMatrix

Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or may not apply sharpening. Therefore, a row from this matrix may not be identical to one fetched using blackRow, so don't mix and match between them.

@return The 2D array of bits for the image (true means black). @throws NotFoundException if image can't be binarized to make a matrix

Implementation

BitMatrix get blackMatrix {
  // The matrix is created on demand the first time it is requested, then cached. There are two
  // reasons for this:
  // 1. This work will never be done if the caller only installs 1D Reader objects, or if a
  //    1D Reader finds a barcode before the 2D Readers run.
  // 2. This work will only be done once even if the caller installs multiple 2D Readers.
  _matrix ??= _binarizer.blackMatrix;
  return _matrix!;
}