+++ /dev/null
-package jp.nyatla.nyartoolkit.rpf.realitysource.nyartk;\r
-\r
-import java.awt.image.BufferedImage;\r
-\r
-import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.param.NyARCameraDistortionFactor;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.NyARRasterFilter_Rgb2Gs_RgbAve;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARPerspectiveRasterReader;\r
-import jp.nyatla.nyartoolkit.core.types.NyARBufferType;\r
-import jp.nyatla.nyartoolkit.rpf.tracker.nyartk.NyARTrackerSource;\r
-import jp.nyatla.nyartoolkit.rpf.tracker.nyartk.NyARTrackerSource_Reference;\r
-import jp.nyatla.nyartoolkit.utils.j2se.NyARBufferedImageRaster;\r
-\r
-/**\r
- * このクラスは、BufferedImageと互換性のあるNyARRealitySourceです。\r
- * @author nyatla\r
- *\r
- */\r
-public class NyARRealitySource_JavaImage extends NyARRealitySource\r
-{\r
- protected NyARRasterFilter_Rgb2Gs_RgbAve _filter;\r
- /**\r
- * \r
- * @param i_width\r
- * ラスタのサイズを指定します。\r
- * @param i_height\r
- * ラスタのサイズを指定します。\r
- * @param i_ref_raster_distortion\r
- * 歪み矯正の為のオブジェクトを指定します。歪み矯正が必要ない時は、NULLを指定します。\r
- * @param i_depth\r
- * エッジ画像のサイズを1/(2^n)で指定します。(例:QVGA画像で1を指定すると、エッジ検出画像は160x120になります。)\r
- * 数値が大きいほど高速になり、検出精度は低下します。実用的なのは、1<=n<=3の範囲です。標準値は2です。\r
- * @param i_number_of_sample\r
- * サンプリングするターゲット数を指定します。大体100以上をしておけばOKです。具体的な計算式は、{@link NyARTrackerSource_Reference#NyARTrackerSource_Reference}を参考にして下さい。\r
- * @throws NyARException\r
- */\r
- public NyARRealitySource_JavaImage(int i_width,int i_height,NyARCameraDistortionFactor i_ref_raster_distortion,int i_depth,int i_number_of_sample) throws NyARException\r
- {\r
- this._rgb_source=new NyARBufferedImageRaster(i_width,i_height,NyARBufferType.BYTE1D_R8G8B8_24);\r
- this._filter=new NyARRasterFilter_Rgb2Gs_RgbAve(this._rgb_source.getBufferType());\r
- this._source_perspective_reader=new NyARPerspectiveRasterReader(_rgb_source.getBufferType());\r
- this._tracksource=new NyARTrackerSource_Reference(i_number_of_sample,i_ref_raster_distortion,i_width,i_height,i_depth,true);\r
- return;\r
- }\r
- /**\r
- * ビットマップをラップして、RealitySourceを作成します。場合によっては、生成に失敗するかもしれません。\r
- * @param i_bmp\r
- * ラップするBufferedImageを指定します。\r
- * @param i_ref_raster_distortion\r
- * 歪み矯正の為のオブジェクトを指定します。歪み矯正が必要ない時は、NULLを指定します。\r
- * @param i_depth\r
- * エッジ画像のサイズを1/(2^n)で指定します。(例:QVGA画像で1を指定すると、エッジ検出画像は160x120になります。)\r
- * 数値が大きいほど高速になり、検出精度は低下します。実用的なのは、1<=n<=3の範囲です。標準値は2です。\r
- * @param i_number_of_sample\r
- * サンプリングするターゲット数を指定します。大体100以上をしておけばOKです。具体的な計算式は、{@link NyARTrackerSource_Reference#NyARTrackerSource_Reference}を参考にして下さい。\r
- * @throws NyARException\r
- */\r
- public NyARRealitySource_JavaImage(BufferedImage i_bmp,NyARCameraDistortionFactor i_ref_raster_distortion,int i_depth,int i_number_of_sample) throws NyARException\r
- {\r
- this._rgb_source=new NyARBufferedImageRaster(i_bmp);\r
- this._filter=new NyARRasterFilter_Rgb2Gs_RgbAve(this._rgb_source.getBufferType());\r
- this._source_perspective_reader=new NyARPerspectiveRasterReader(_rgb_source.getBufferType());\r
- this._tracksource=new NyARTrackerSource_Reference(i_number_of_sample,i_ref_raster_distortion,i_bmp.getWidth(),i_bmp.getHeight(),i_depth,true);\r
- }\r
- /**\r
- * 入力ラスタとリンクしたBufferedImageを返します。\r
- * @return\r
- */\r
- public BufferedImage getBufferedImage()\r
- {\r
- return ((NyARBufferedImageRaster)this._rgb_source).getBufferedImage();\r
- }\r
-\r
- public final boolean isReady()\r
- {\r
- return this._rgb_source.hasBuffer();\r
- }\r
- public final void syncResource() throws NyARException\r
- {\r
- this._filter.doFilter(this._rgb_source,this._tracksource.refBaseRaster());\r
- super.syncResource();\r
- }\r
- public final NyARTrackerSource makeTrackSource() throws NyARException\r
- {\r
- this._filter.doFilter(this._rgb_source,this._tracksource.refBaseRaster()); \r
- return this._tracksource;\r
- }\r
-\r
-}\r