2 * PROJECT: NyARToolkit(Extension)
\r
3 * --------------------------------------------------------------------------------
\r
4 * The NyARToolkit is Java edition ARToolKit class library.
\r
5 * Copyright (C)2008-2009 Ryo Iizuka
\r
7 * This program is free software: you can redistribute it and/or modify
\r
8 * it under the terms of the GNU General Public License as published by
\r
9 * the Free Software Foundation, either version 3 of the License, or
\r
10 * (at your option) any later version.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
20 * For further information please contact.
\r
21 * http://nyatla.jp/nyatoolkit/
\r
22 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
\r
25 package jp.nyatla.nyartoolkit.core.rasterfilter;
\r
27 import jp.nyatla.nyartoolkit.NyARException;
\r
28 import jp.nyatla.nyartoolkit.core.analyzer.raster.NyARRasterAnalyzer_Histogram;
\r
29 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;
\r
30 import jp.nyatla.nyartoolkit.core.types.NyARHistogram;
\r
35 public class NyARRasterFilter_EqualizeHist extends NyARRasterFilter_CustomToneTable
\r
37 private NyARRasterAnalyzer_Histogram _hist_analyzer;
\r
38 private NyARHistogram _histogram=new NyARHistogram(256);
\r
39 public NyARRasterFilter_EqualizeHist(int i_raster_type,int i_sample_interval) throws NyARException
\r
41 super(i_raster_type);
\r
42 this._hist_analyzer=new NyARRasterAnalyzer_Histogram(i_raster_type,i_sample_interval);
\r
44 public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException
\r
47 NyARHistogram hist=this._histogram;
\r
48 this._hist_analyzer.analyzeRaster(i_input,hist);
\r
50 int hist_total=this._histogram.total_of_data;
\r
51 int min=hist.getMinData();
\r
52 int hist_size=this._histogram.length;
\r
54 for(int i=0;i<hist_size;i++){
\r
56 this.table[i]=(int)((sum-min)*(hist_size-1)/((hist_total-min)));
\r
59 super.doFilter(i_input, i_output);
\r