- /**
- * 删除二维码白边.
- */
- private BitMatrix deleteWhite(BitMatrix matrix) {
- int[] rec = matrix.getEnclosingRectangle();
- int resWidth = rec[2];
- int resHeight = rec[3];
- BitMatrix resMatrix = new BitMatrix(resWidth, resHeight);
- resMatrix.clear();
- for (int i = 0; i < resWidth; i++) {
- for (int j = 0; j < resHeight; j++) {
- if (matrix.get(i + rec[0], j + rec[1]))
- resMatrix.set(i, j);
- }
- }
- return resMatrix;
- }