@Override protected void computeStatistics(GrayU8 input, int innerWidth, int innerHeight) { Arrays.fill(stats.data,0,stats.width*stats.height*256,0); super.computeStatistics(input, innerWidth, innerHeight); }
/** * Converts the gray scale input image into a binary image * @param input Input image * @param output Output binary image */ public void process(T input , GrayU8 output ) { InputSanityCheck.checkSameShape(input,output); int requestedBlockWidth = this.requestedBlockWidth.computeI(Math.min(input.width,input.height)); if( input.width < requestedBlockWidth || input.height < requestedBlockWidth ) { throw new IllegalArgumentException("Image is smaller than block size"); } selectBlockSize(input.width,input.height,requestedBlockWidth); stats.reshape(input.width/blockWidth,input.height/blockHeight); int innerWidth = input.width%blockWidth == 0 ? input.width : input.width-blockWidth-input.width%blockWidth; int innerHeight = input.height%blockHeight == 0 ? input.height : input.height-blockHeight-input.height%blockHeight; computeStatistics(input, innerWidth, innerHeight); applyThreshold(input,output); }