1 package jp.nyatla.nyartoolkit.core.analyzer.raster.threshold;
\r
3 import jp.nyatla.nyartoolkit.NyARException;
\r
4 import jp.nyatla.nyartoolkit.core.analyzer.histogram.*;
\r
5 import jp.nyatla.nyartoolkit.core.analyzer.raster.*;
\r
6 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;
\r
7 import jp.nyatla.nyartoolkit.core.types.NyARHistogram;
\r
9 * 明点と暗点をPタイル法で検出して、その中央値を閾値とする。
\r
13 public class NyARRasterThresholdAnalyzer_SlidePTile implements INyARRasterThresholdAnalyzer
\r
15 protected NyARRasterAnalyzer_Histogram _raster_analyzer;
\r
16 private NyARHistogramAnalyzer_SlidePTile _sptile;
\r
17 private NyARHistogram _histogram;
\r
18 public void setVerticalInterval(int i_step)
\r
20 this._raster_analyzer.setVerticalInterval(i_step);
\r
23 public NyARRasterThresholdAnalyzer_SlidePTile(int i_persentage,int i_raster_format,int i_vertical_interval) throws NyARException
\r
25 assert (0 <= i_persentage && i_persentage <= 50);
\r
27 if(!initInstance(i_raster_format,i_vertical_interval)){
\r
28 throw new NyARException();
\r
30 this._sptile=new NyARHistogramAnalyzer_SlidePTile(i_persentage);
\r
31 this._histogram=new NyARHistogram(256);
\r
33 protected boolean initInstance(int i_raster_format,int i_vertical_interval) throws NyARException
\r
35 this._raster_analyzer=new NyARRasterAnalyzer_Histogram(i_raster_format,i_vertical_interval);
\r
38 public int analyzeRaster(INyARRaster i_input) throws NyARException
\r
40 this._raster_analyzer.analyzeRaster(i_input, this._histogram);
\r
41 return this._sptile.getThreshold(this._histogram);
\r