Revision 11033 trunk/libraries/libRaster/src/org/gvsig/raster/util/Histogram.java

View differences:

Histogram.java
142 142
	}
143 143
	
144 144
	/**
145
	 * Devuelve el histograma acumulado
145
	 * Devuelve el histograma logaritmico
146 146
	 * @return
147 147
	 */
148 148
	public long[][] getLogaritmicHistogram() {
149
		//TODO: FUNCIONALIDAD: Falta el calculo del histograma logaritmico
150
		return histogram;
149
		if (histogram != null) {
150
			long[][] hist = new long[histogram.length][histogram[0].length];
151
			for (int iBand = 0; iBand < hist.length; iBand++) {
152
				long min = hist[iBand][0];
153
				for (int j = 1; j < hist[iBand].length; j++)
154
					if (min > hist[iBand][j]) min = hist[iBand][j];
155
				for (int j = 0; j < hist[iBand].length; j++)
156
					// Lo multiplico por 1000 para que no se pierdan datos al redondear
157
					hist[iBand][j] = (long) (java.lang.Math.log((double) (histogram[iBand][j] - min + 1))*1000);
158
			}
159
			return hist;
160
		}
161
		return null;
151 162
	}
152 163
	
153 164
	/**

Also available in: Unified diff