
float width = (float)Math.min(targetRectangle.getWidth() + borderWidth * 2,
</BUG>
referenceImage.getMinX() + referenceImage.getWidth() - minX);
<BUG>float height = (float)Math.min(targetRectangle.getHeight() + borderWidth*2 + searchWindowYSize,
</BUG>
referenceImage.getMinY() + referenceImage.getHeight() - minY);
pbCropReference.add(minX);
pbCropReference.add(minY);
pbCropReference.add(width);

List<Point2D.Float> disparitySet = generateDisparitySet(targetRectangle);
RenderedImage referenceImage = referenceBand.getSourceImage();
RenderedImage comparisonImage = comparisonBand.getSourceImage();
ParameterBlock pbCropReference = new ParameterBlock();
pbCropReference.addSource(referenceImage);
float minX = (float)Math.max(targetRectangle.getMinX() - BORDER_WIDTH, referenceImage.getMinX());
float minY = (float)Math.max(targetRectangle.getMinY() - BORDER_WIDTH - Math.abs(searchWindowMinY), referenceImage.getMinY());
float width = (float)Math.min(targetRectangle.getWidth() + BORDER_WIDTH * 2,
referenceImage.getMinX() + referenceImage.getWidth() - minX);
float height = (float)Math.min(targetRectangle.getHeight() + BORDER_WIDTH*2 + searchWindowYSize,
referenceImage.getMinY() + referenceImage.getHeight() - minY);
pbCropReference.add(minX);
pbCropReference.add(minY);
pbCropReference.add(width);
