X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=tags%2F2.5.1%2Fsrc%2Fjp%2Fnyatla%2Fnyartoolkit%2Fcore%2Fanalyzer%2Fraster%2Fthreshold%2FNyARRasterThresholdAnalyzer_SlidePTile.java;fp=tags%2F2.5.1%2Fsrc%2Fjp%2Fnyatla%2Fnyartoolkit%2Fcore%2Fanalyzer%2Fraster%2Fthreshold%2FNyARRasterThresholdAnalyzer_SlidePTile.java;h=3c7fb9db11b547fdf49b6fe5b3611cdce9de9439;hb=8a6d71531b0deed00e8150f9d3d1a74ceb1546b0;hp=0000000000000000000000000000000000000000;hpb=3851dd8ad116a1478202b57cd20971d7a77b6f25;p=nyartoolkit-and%2Fnyartoolkit-and.git diff --git a/tags/2.5.1/src/jp/nyatla/nyartoolkit/core/analyzer/raster/threshold/NyARRasterThresholdAnalyzer_SlidePTile.java b/tags/2.5.1/src/jp/nyatla/nyartoolkit/core/analyzer/raster/threshold/NyARRasterThresholdAnalyzer_SlidePTile.java new file mode 100644 index 0000000..3c7fb9d --- /dev/null +++ b/tags/2.5.1/src/jp/nyatla/nyartoolkit/core/analyzer/raster/threshold/NyARRasterThresholdAnalyzer_SlidePTile.java @@ -0,0 +1,43 @@ +package jp.nyatla.nyartoolkit.core.analyzer.raster.threshold; + +import jp.nyatla.nyartoolkit.NyARException; +import jp.nyatla.nyartoolkit.core.analyzer.histogram.*; +import jp.nyatla.nyartoolkit.core.analyzer.raster.*; +import jp.nyatla.nyartoolkit.core.raster.INyARRaster; +import jp.nyatla.nyartoolkit.core.types.NyARHistogram; +/** + * 明点と暗点をPタイル法で検出して、その中央値を閾値とする。 + * + * + */ +public class NyARRasterThresholdAnalyzer_SlidePTile implements INyARRasterThresholdAnalyzer +{ + protected NyARRasterAnalyzer_Histogram _raster_analyzer; + private NyARHistogramAnalyzer_SlidePTile _sptile; + private NyARHistogram _histogram; + public void setVerticalInterval(int i_step) + { + this._raster_analyzer.setVerticalInterval(i_step); + return; + } + public NyARRasterThresholdAnalyzer_SlidePTile(int i_persentage,int i_raster_format,int i_vertical_interval) throws NyARException + { + assert (0 <= i_persentage && i_persentage <= 50); + //初期化 + if(!initInstance(i_raster_format,i_vertical_interval)){ + throw new NyARException(); + } + this._sptile=new NyARHistogramAnalyzer_SlidePTile(i_persentage); + this._histogram=new NyARHistogram(256); + } + protected boolean initInstance(int i_raster_format,int i_vertical_interval) throws NyARException + { + this._raster_analyzer=new NyARRasterAnalyzer_Histogram(i_raster_format,i_vertical_interval); + return true; + } + public int analyzeRaster(INyARRaster i_input) throws NyARException + { + this._raster_analyzer.analyzeRaster(i_input, this._histogram); + return this._sptile.getThreshold(this._histogram); + } +}