2 * Copyright 2009 (c) Florian Frankenberger (darkblue.de)
4 * This file is part of LEA.
6 * LEA is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU Lesser General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option) any
11 * LEA is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with LEA. If not, see <http://www.gnu.org/licenses/>.
21 * No description given.
23 * @author Florian Frankenberger
27 public class IntegralImageData {
30 private long[][] integral;
36 // private Dimension dimension;
38 public IntegralImageData(Image bufferedImage) {
39 this.integral = new long[bufferedImage.getWidth()][bufferedImage.getHeight()];
40 this.width = bufferedImage.getWidth();
41 this.hegith = bufferedImage.getHeight();
43 long[][] s = new long[bufferedImage.getWidth()][bufferedImage.getHeight()];
44 for (int y = 0; y < bufferedImage.getHeight(); ++y) {
45 for (int x = 0; x < bufferedImage.getWidth(); ++x) {
46 s[x][y] = (y - 1 < 0 ? 0 : s[x][y - 1]) + (bufferedImage.getBlue(x, y) & 0xff);
47 this.integral[x][y] = (x - 1 < 0 ? 0 : this.integral[x - 1][y]) + s[x][y];
48 // System.out.println("integral ("+x+","+y+")="+integral[x][y]);
54 public long getIntegralAt( int x, int y) {
55 return this.integral[x][y];
58 public int getWidth() {
62 public int getHeight() {