@Override public Number get(int x, int y, int band) { return bandWrappers[band].get(x,y); }
public static void checkBorderZero(ImageGray outputImage, int border) { GImageGray img = FactoryGImageGray.wrap(outputImage); for (int y = 0; y < img.getHeight(); y++) { if (y >= border && y < img.getHeight() - border) continue; for (int x = 0; x < img.getWidth(); x++) { if (x >= border && x < img.getWidth() - border) continue; if (img.get(x, y).intValue() != 0) throw new RuntimeException("The border is not zero: "+x+" "+y); } } }
public static void checkBorderZero(ImageGray outputImage, int borderX0 , int borderY0 , int borderX1 , int borderY1 ) { GImageGray img = FactoryGImageGray.wrap(outputImage); for (int y = 0; y < img.getHeight(); y++) { if (y >= borderY0 && y < img.getHeight() - borderY1) continue; for (int x = 0; x < img.getWidth(); x++) { if (x >= borderX0 && x < img.getWidth() - borderX1) continue; if (img.get(x, y).intValue() != 0) throw new RuntimeException("The border is not zero: "+x+" "+y); } } }
@Override public Number get(int x, int y, int band) { if( band != 0 ) throw new IllegalArgumentException("Must be band 0"); return this.sb.get(x,y); }
private static void compareValues(double tol, GImageGray a, GImageGray b, int x, int y) { double normalizer = Math.abs(a.get(x, y).doubleValue()) + Math.abs(b.get(x, y).doubleValue()); if (normalizer < 1.0) normalizer = 1.0; if (Math.abs(a.get(x, y).doubleValue() - b.get(x, y).doubleValue()) / normalizer > tol) throw new RuntimeException("values not equal at (" + x + " " + y + ") " + a.get(x, y) + " " + b.get(x, y)); }
public static void printDiff(ImageGray imgA, ImageGray imgB) { GImageGray a = FactoryGImageGray.wrap(imgA); GImageGray b = FactoryGImageGray.wrap(imgB); System.out.println("------- Difference -----------"); for (int y = 0; y < imgA.getHeight(); y++) { for (int x = 0; x < imgA.getWidth(); x++) { double diff = Math.abs(a.get(x, y).doubleValue() - b.get(x, y).doubleValue()); System.out.printf("%2d ", (int) diff); } System.out.println(); } }