WhiteRectangleDetector constructor
@param image barcode image to find a rectangle in
@param initSize initial size of search area around center
@param x x position of search center
@param y y position of search center
@throws NotFoundException if image is too small to accommodate initSize
Implementation
WhiteRectangleDetector(
this._image, [
int initSize = _INIT_SIZE,
int? x,
int? y,
]) : _height = _image.height,
_width = _image.width,
_leftInit = (x ?? _image.width ~/ 2) - initSize ~/ 2,
_rightInit = (x ?? _image.width ~/ 2) + initSize ~/ 2,
_upInit = (y ?? _image.height ~/ 2) - initSize ~/ 2,
_downInit = (y ?? _image.height ~/ 2) + initSize ~/ 2 {
if (_upInit < 0 ||
_leftInit < 0 ||
_downInit >= _height ||
_rightInit >= _width) {
throw NotFoundException.instance;
}
}