/** * GS画像をセットします。 * この関数を使ってセットした画像は、インスタンスから参照されます。 * @param i_ref_source * @throws NyARException */ public void wrapBuffer(NyARGrayscaleRaster i_ref_source) { //バッファのスイッチ this._base_raster.WrapBuffer(i_ref_source.getBuffer()); }
/** * @param i_number_of_sample * サンプラが検出する最大数。 * 通常100~200以上を指定します。(QVGA画像あたり、100個を基準にします。) * 数が少なすぎると、検出率が低下します。最低でも、NyARTrackerに設定するターゲット数の合計*2以上を指定してください。 * @param i_ref_raster_distortion * 歪み矯正の為のオブジェクトを指定します。歪み矯正が必要ない時は、NULLを指定します。 * @param i_width * ソース画像のサイズ * @param i_height * ソース画像のサイズ * @param i_depth * 解像度の深さ(1/(2^n))倍の画像として処理する。 * @param i_is_alloc * ベースラスタのバッファを内部確保外部参照にするかのフラグです。 * trueの場合、バッファは内部に確保され、{@link #wrapBuffer}関数が使用できなくなります。 * @throws NyARException */ public NyARTrackerSource_Reference(int i_number_of_sample, INyARCameraDistortionFactor i_ref_raster_distortion, int i_width, int i_height, int i_depth, bool i_is_alloc) : base((int)Math.Pow(2, i_depth)) { Debug.Assert(i_depth>0); int div=this._rob_resolution; //主GSラスタ this._base_raster=new NyARGrayscaleRaster(i_width,i_height,NyARBufferType.INT1D_GRAY_8,i_is_alloc); this._gs_graphics = NyARGsRasterGraphicsFactory.CreateDriver(this._base_raster); //Roberts変換ラスタ this._rb_source=new NyARGrayscaleRaster(i_width/div,i_height/div,NyARBufferType.INT1D_GRAY_8, true); //Robertsラスタは最も解像度の低いラスタと同じ this._rbraster=new NyARGrayscaleRaster(i_width/div,i_height/div,NyARBufferType.INT1D_GRAY_8, true); this._vec_reader=new NyARVectorReader_INT1D_GRAY_8(this._base_raster,i_ref_raster_distortion,this._rbraster); //samplerとsampleout this._sampler=new LowResolutionLabelingSampler(i_width, i_height,(int)Math.Pow(2,i_depth)); this._sample_out=new LowResolutionLabelingSamplerOut(i_number_of_sample); }
/** * この関数は、インスタンスを初期化します。 * 継承先のクラスから呼び出してください。 * @param i_param * カメラパラメータオブジェクト。このサイズは、{@link #detectMarker}に入力する画像と同じサイズである必要があります。 * @ */ protected void initInstance(NyARParam i_param) { //初期化済? Debug.Assert(this._initialized == false); NyARIntSize scr_size = i_param.getScreenSize(); // 解析オブジェクトを作る this._transmat = new NyARTransMat(i_param); this._thdetect = new NyARHistogramAnalyzer_SlidePTile(15); // 2値画像バッファを作る this._gs_raster = new NyARGrayscaleRaster(scr_size.w, scr_size.h); this._initialized = true; //コールバックハンドラ this._detectmarker = new DetectSquare(i_param); this._offset = new NyARRectOffset(); return; }
/** * この関数は、インスタンスを初期化します。 * 継承先のクラスから呼び出してください。 * @param i_param * カメラパラメータオブジェクト。このサイズは、{@link #detectMarker}に入力する画像と同じサイズである必要があります。 * @param i_encoder * IDマーカの値エンコーダを指定します。 * @param i_marker_width * マーカの物理縦横サイズをmm単位で指定します。 * @ */ protected void InitInstance(NyARParam i_param, INyIdMarkerDataEncoder i_encoder, double i_marker_width) { //初期化済? Debug.Assert(this._initialized == false); NyARIntSize scr_size = i_param.getScreenSize(); // 解析オブジェクトを作る this._square_detect = new RleDetector( i_param, i_encoder, new NyIdMarkerPickup()); this._transmat = new NyARTransMat(i_param); // 2値画像バッファを作る this._gs_raster = new NyARGrayscaleRaster(scr_size.w, scr_size.h); this._histmaker = (INyARHistogramFromRaster)this._gs_raster.createInterface(typeof(INyARHistogramFromRaster)); //ワーク用のデータオブジェクトを2個作る this._data_current = i_encoder.CreateDataInstance(); this._threshold_detect = new NyARHistogramAnalyzer_SlidePTile(15); this._initialized = true; this._is_active = false; this._offset = new NyARRectOffset(); this._offset.setSquare(i_marker_width); return; }
/** * i_inのデータをサンプリングして、o_outにサンプル値を作成します。 * この関数は、o_outにi_inのサンプリング結果を出力します。既にo_outにあるデータは初期化されます。 * @param i_in * 入力元のデータです。 * @param i_th * ラべリングの敷居値です。 * @param o_out * 出力先のデータです。 * @throws NyARException */ public void Sampling(NyARGrayscaleRaster i_in, int i_th, LowResolutionLabelingSamplerOut o_out) { //クラスのパラメータ初期化 Main_Labeling lb = this._main_labeling; lb.current_output = o_out; lb.current_th = i_th; //パラメータの設定 o_out.initializeParams(); //ラべリング lb.setAreaRange(10000, 3); lb.labeling(i_in, i_th); }
/** * * @param i_ref_raster * 基本画像 * @param i_ref_raster_distortion * 歪み解除オブジェクト(nullの場合歪み解除を省略) * @param i_ref_rob_raster * エッジ探索用のROB画像 * @param */ public NyARVectorReader_INT1D_GRAY_8(NyARGrayscaleRaster i_ref_raster,INyARCameraDistortionFactor i_ref_raster_distortion,NyARGrayscaleRaster i_ref_rob_raster) : base() { Debug.Assert (i_ref_raster.getBufferType() == NyARBufferType.INT1D_GRAY_8); Debug.Assert (i_ref_rob_raster.getBufferType() == NyARBufferType.INT1D_GRAY_8); this.initInstance(i_ref_raster, i_ref_raster_distortion, i_ref_rob_raster,new NyARContourPickup()); }
/** * 継承クラスのコンストラクタから呼び出す。 * @param i_ref_raster * 基本画像 * @param i_ref_raster_distortion * 歪み解除オブジェクト(nullの場合歪み解除を省略) * @param i_ref_rob_raster * エッジ探索用のROB画像 * @param i_contour_pickup * 輪郭線取得クラス * @param */ public void initInstance(NyARGrayscaleRaster i_ref_raster,INyARCameraDistortionFactor i_ref_raster_distortion,NyARGrayscaleRaster i_ref_rob_raster,NyARContourPickup i_contour_pickup) { this._rob_resolution=i_ref_raster.getWidth()/i_ref_rob_raster.getWidth(); this._ref_rob_raster=i_ref_rob_raster; this._ref_base_raster=i_ref_raster; this._coord_buf = new NyARIntCoordinates((i_ref_raster.getWidth() + i_ref_raster.getHeight()) * 4); this._factor=i_ref_raster_distortion; this._tmp_coord_pos = VecLinearCoordinates.VecLinearCoordinatePoint.createArray(this._coord_buf.items.Length); this._cpickup = i_contour_pickup; return; }