public Letter getIntersection() { try { // int xx = this.imgOffset[0]; // int yy = this.imgOffset[1]; int left = offset[0]; int top = offset[1]; int tmpIntersectionWidth = intersectionDimension[0]; int tmpIntersectionHeight = intersectionDimension[1]; // long starter=Utilities.getTimer(); int[][] g = new int[tmpIntersectionWidth][tmpIntersectionHeight]; for (int x = 0; x < tmpIntersectionWidth; x++) { for (int y = 0; y < tmpIntersectionHeight; y++) { g[x][y] = a.getPixelValue(x + left, y + top); } } Letter ret = getA().createLetter(); int[] l = getA().getLocation(); ret.setLocation(new int[] {l[0] + left, l[1] + top}); ret.setGrid(g); ret.clean(); return ret; } catch (Exception e) { JDLogger.exception(e); return getA(); } }
public Letter getDifference() { try { int xx = imgOffset[0]; int yy = imgOffset[1]; int left = offset[0]; int top = offset[1]; int tmpIntersectionWidth = intersectionDimension[0]; int tmpIntersectionHeight = intersectionDimension[1]; // long starter=Utilities.getTimer(); int[][] g = new int[tmpIntersectionWidth][tmpIntersectionHeight]; for (int x = 0; x < tmpIntersectionWidth; x++) { for (int y = 0; y < tmpIntersectionHeight; y++) { g[x][y] = getA().getMaxPixelValue(); int pixelType = getPixelType(x, y, xx, yy, left, top); switch (pixelType) { case 0: // g[x][y] = 0xcccccc; break; case 1: if (hasNeighbour(x, y, xx, yy, left, top, pixelType) > overlayNoiseSize) { // g[x][y] = 0xff0000; } else { // g[x][y] = 0xff0000; } g[x][y] = 0; break; case 2: if (hasNeighbour(x, y, xx, yy, left, top, pixelType) > overlayNoiseSize) { g[x][y] = 0; } // else { // g[x][y] = 0; // g[x][y] = 0x00ff00; // } break; default: } } } Letter ret = getA().createLetter(); int[] l = getA().getLocation(); ret.setLocation(new int[] {l[0] + left, l[1] + top}); ret.setGrid(g); ret.clean(); return ret; } catch (Exception e) { return getA(); } }