/** * * @param i_width * ラスタのサイズを指定します。 * @param i_height * ラスタのサイズを指定します。 * @param i_ref_raster_distortion * 歪み矯正の為のオブジェクトを指定します。歪み矯正が必要ない時は、NULLを指定します。 * @param i_depth * エッジ画像のサイズを1/(2^n)で指定します。(例:QVGA画像で1を指定すると、エッジ検出画像は160x120になります。) * 数値が大きいほど高速になり、検出精度は低下します。実用的なのは、1<=n<=3の範囲です。標準値は2です。 * @param i_number_of_sample * サンプリングするターゲット数を指定します。大体100以上をしておけばOKです。具体的な計算式は、{@link NyARTrackerSource_Reference#NyARTrackerSource_Reference}を参考にして下さい。 * @param i_raster_type * ラスタタイプ * @throws NyARException */ public NyARRealitySource_Reference(int i_width, int i_height, INyARCameraDistortionFactor i_ref_raster_distortion, int i_depth, int i_number_of_sample, int i_raster_type) { this._rgb_source = new NyARRgbRaster(i_width, i_height, i_raster_type); this._filter = (INyARRgb2GsFilter)this._rgb_source.createInterface(typeof(INyARRgb2GsFilter)); this._source_perspective_reader = (INyARPerspectiveCopy)this._rgb_source.createInterface(typeof(INyARPerspectiveCopy)); this._tracksource = new NyARTrackerSource_Reference(i_number_of_sample, i_ref_raster_distortion, i_width, i_height, i_depth, true); return; }
/** * * @param i_width * ラスタのサイズを指定します。 * @param i_height * ラスタのサイズを指定します。 * @param i_ref_raster_distortion * 歪み矯正の為のオブジェクトを指定します。歪み矯正が必要ない時は、NULLを指定します。 * @param i_depth * エッジ画像のサイズを1/(2^n)で指定します。(例:QVGA画像で1を指定すると、エッジ検出画像は160x120になります。) * 数値が大きいほど高速になり、検出精度は低下します。実用的なのは、1<=n<=3の範囲です。標準値は2です。 * @param i_number_of_sample * サンプリングするターゲット数を指定します。大体100以上をしておけばOKです。具体的な計算式は、{@link NyARTrackerSource_Reference#NyARTrackerSource_Reference}を参考にして下さい。 * @param i_raster_type * ラスタタイプ * @throws NyARException */ public NyARRealitySource_Reference(int i_width,int i_height,INyARCameraDistortionFactor i_ref_raster_distortion,int i_depth,int i_number_of_sample,int i_raster_type) { this._rgb_source=new NyARRgbRaster(i_width,i_height,i_raster_type); this._filter=(INyARRgb2GsFilter) this._rgb_source.createInterface(typeof(INyARRgb2GsFilter)); this._source_perspective_reader=(INyARPerspectiveCopy)this._rgb_source.createInterface(typeof(INyARPerspectiveCopy)); this._tracksource=new NyARTrackerSource_Reference(i_number_of_sample,i_ref_raster_distortion,i_width,i_height,i_depth,true); return; }
/** * この関数は、入力画像を元に、インスタンスの状態を更新します。 * この関数は、タイムスタンプをインクリメントします。 * @param i_input * @ */ public virtual void update(INyARRgbRaster i_input) { //ラスタドライバの準備 if (this._ref_raster != i_input) { this._rgb2gs = (INyARRgb2GsFilter)i_input.createInterface(typeof(INyARRgb2GsFilter)); this._pcopy = (INyARPerspectiveCopy)i_input.createInterface(typeof(INyARPerspectiveCopy)); this._ref_raster = i_input; } //ソースidのインクリメント this._src_ts++; }
/** * Based on the input image, this function updates the status of the instance. * This function increments the time stamp. * @param i_input * @ */ public virtual void update(INyARRgbRaster i_input) { //Preparation of raster driver if (this._ref_raster != i_input) { this._rgb2gs = (INyARRgb2GsFilter)i_input.createInterface(typeof(INyARRgb2GsFilter)); this._pcopy = (INyARPerspectiveCopy)i_input.createInterface(typeof(INyARPerspectiveCopy)); this._ref_raster = i_input; } //Increment of the source id this._src_ts++; }
public bool InitializeApplication(Form1 topLevelForm, CaptureDevice i_cap_device) { this._top_form = topLevelForm; topLevelForm.ClientSize = new Size(SCREEN_WIDTH, SCREEN_HEIGHT); //キャプチャを作る(QVGAでフレームレートは30) i_cap_device.SetCaptureListener(this); i_cap_device.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30); this._cap = i_cap_device; //ARの設定 //ARラスタを作る(DirectShowキャプチャ仕様)。 this._raster = new DsRgbRaster(i_cap_device.video_width, i_cap_device.video_height, NyARBufferType.OBJECT_CS_Bitmap); this.gs = new NyARGrayscaleRaster(i_cap_device.video_width, i_cap_device.video_height); this.filter = NyARRgb2GsFilterFactory.createRgbAveDriver(this._raster); this.tracker = new NyARTracker(100, 1, 10); this.tracksource = new NyARTrackerSource_Reference(100, null, i_cap_device.video_width, i_cap_device.video_height, 2, false); return(true); }
/** * この関数は、画像を処理して、適切なマーカ検出イベントハンドラを呼び出します。 * イベントハンドラの呼び出しは、この関数を呼び出したスレッドが、この関数が終了するまでに行います。 * @param i_raster * 検出処理をする画像を指定します。 * @ */ public void DetectMarker(INyARRgbRaster i_raster) { // サイズチェック if (!this._gs_raster.getSize().isEqualSize(i_raster.getSize().w, i_raster.getSize().h)) { throw new NyARException(); } // ラスタをGSへ変換する。 if (this._last_input_raster != i_raster) { this._togs_filter = (INyARRgb2GsFilter)i_raster.createInterface(typeof(INyARRgb2GsFilter)); this._last_input_raster = i_raster; } this._togs_filter.convert(this._gs_raster); // スクエアコードを探す(第二引数に指定したマーカ、もしくは新しいマーカを探す。) this._square_detect.init(this._gs_raster, this._is_active ? this._data_current : null); this._square_detect.detectMarker(this._gs_raster, this._current_threshold, this._square_detect); // 認識状態を更新(マーカを発見したなら、current_dataを渡すかんじ) bool is_id_found = UpdateStatus(this._square_detect.square, this._square_detect.marker_data); //閾値フィードバック(detectExistMarkerにもあるよ) if (is_id_found) { //マーカがあれば、マーカの周辺閾値を反映 this._current_threshold = (this._current_threshold + this._square_detect.threshold) / 2; } else { //マーカがなければ、探索+DualPTailで基準輝度検索 this._histmaker.createHistogram(4, this._hist); int th = this._threshold_detect.getThreshold(this._hist); this._current_threshold = (this._current_threshold + th) / 2; } return; }
/** * この関数は、画像を処理して、適切なマーカ検出イベントハンドラを呼び出します。 * イベントハンドラの呼び出しは、この関数を呼び出したスレッドが、この関数が終了するまでに行います。 * @param i_raster * 検出処理をする画像を指定します。 * @ */ public void detectMarker(INyARRgbRaster i_raster) { // サイズチェック Debug.Assert(this._gs_raster.getSize().isEqualSize(i_raster.getSize().w, i_raster.getSize().h)); if (this._last_input_raster != i_raster) { this._histmaker = (INyARHistogramFromRaster)this._gs_raster.createInterface(typeof(INyARHistogramFromRaster)); this._togs_filter = (INyARRgb2GsFilter)i_raster.createInterface(typeof(INyARRgb2GsFilter)); this._last_input_raster = i_raster; } //GSイメージへの変換とヒストグラムの生成 this._togs_filter.convert(this._gs_raster); this._histmaker.createHistogram(4, this._hist); // スクエアコードを探す this._detectmarker.init(i_raster, this._current_arcode_index); this._detectmarker.detectMarker(this._gs_raster, this._thdetect.getThreshold(this._hist), this._detectmarker); // 認識状態を更新 this.updateStatus(this._detectmarker.square, this._detectmarker.code_index); return; }
/** * この関数は、画像を処理して、適切なマーカ検出イベントハンドラを呼び出します。 * イベントハンドラの呼び出しは、この関数を呼び出したスレッドが、この関数が終了するまでに行います。 * @param i_raster * 検出処理をする画像を指定します。 * @ */ public void detectMarker(INyARRgbRaster i_raster) { // サイズチェック Debug.Assert(this._gs_raster.getSize().isEqualSize(i_raster.getSize().w, i_raster.getSize().h)); if (this._last_input_raster != i_raster) { this._histmaker = (INyARHistogramFromRaster)this._gs_raster.createInterface(typeof(INyARHistogramFromRaster)); this._togs_filter = (INyARRgb2GsFilter)i_raster.createInterface(typeof(INyARRgb2GsFilter)); this._last_input_raster = i_raster; } //GSイメージへの変換とヒストグラムの生成 this._togs_filter.convert(this._gs_raster); this._histmaker.createHistogram(4, this._hist); // スクエアコードを探す this._detectmarker.init(i_raster, this._current_arcode_index); this._detectmarker.detectMarker(this._gs_raster, this._thdetect.getThreshold(this._hist),this._detectmarker); // 認識状態を更新 this.updateStatus(this._detectmarker.square, this._detectmarker.code_index); return; }
/** * この関数は、画像を処理して、適切なマーカ検出イベントハンドラを呼び出します。 * イベントハンドラの呼び出しは、この関数を呼び出したスレッドが、この関数が終了するまでに行います。 * @param i_raster * 検出処理をする画像を指定します。 * @ */ public void detectMarker(INyARRgbRaster i_raster) { // サイズチェック if (!this._gs_raster.getSize().isEqualSize(i_raster.getSize().w, i_raster.getSize().h)) { throw new NyARException(); } // ラスタをGSへ変換する。 if (this._last_input_raster != i_raster) { this._togs_filter = (INyARRgb2GsFilter)i_raster.createInterface(typeof(INyARRgb2GsFilter)); this._last_input_raster = i_raster; } this._togs_filter.convert(this._gs_raster); // スクエアコードを探す(第二引数に指定したマーカ、もしくは新しいマーカを探す。) this._square_detect.init(this._gs_raster, this._is_active ? this._data_current : null); this._square_detect.detectMarker(this._gs_raster, this._current_threshold, this._square_detect); // 認識状態を更新(マーカを発見したなら、current_dataを渡すかんじ) bool is_id_found = updateStatus(this._square_detect.square, this._square_detect.marker_data); //閾値フィードバック(detectExistMarkerにもあるよ) if (is_id_found) { //マーカがあれば、マーカの周辺閾値を反映 this._current_threshold = (this._current_threshold + this._square_detect.threshold) / 2; } else { //マーカがなければ、探索+DualPTailで基準輝度検索 this._histmaker.createHistogram(4, this._hist); int th = this._threshold_detect.getThreshold(this._hist); this._current_threshold = (this._current_threshold + th) / 2; } return; }
/** * この関数は、入力画像を元に、インスタンスの状態を更新します。 * この関数は、タイムスタンプをインクリメントします。 * @param i_input * @ */ public virtual void update(INyARRgbRaster i_input) { //ラスタドライバの準備 if (this._ref_raster != i_input) { this._rgb2gs = (INyARRgb2GsFilter)i_input.createInterface(typeof(INyARRgb2GsFilter)); this._pcopy = (INyARPerspectiveCopy)i_input.createInterface(typeof(INyARPerspectiveCopy)); this._ref_raster = i_input; } //ソースidのインクリメント this._src_ts++; }
public bool InitializeApplication(Form1 topLevelForm, CaptureDevice i_cap_device) { this._top_form = topLevelForm; topLevelForm.ClientSize=new Size(SCREEN_WIDTH,SCREEN_HEIGHT); //キャプチャを作る(QVGAでフレームレートは30) i_cap_device.SetCaptureListener(this); i_cap_device.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30); this._cap = i_cap_device; //ARの設定 //ARラスタを作る(DirectShowキャプチャ仕様)。 this._raster = new DsRgbRaster(i_cap_device.video_width, i_cap_device.video_height,NyARBufferType.OBJECT_CS_Bitmap); this.gs = new NyARGrayscaleRaster(i_cap_device.video_width, i_cap_device.video_height); this.filter = NyARRgb2GsFilterFactory.createRgbAveDriver(this._raster); this.tracker = new NyARTracker(100, 1, 10); this.tracksource = new NyARTrackerSource_Reference(100, null, i_cap_device.video_width, i_cap_device.video_height,2, false); return true; }
/** * Based on the input image, this function updates the status of the instance. * This function increments the time stamp. * @param i_input * @ */ public virtual void update(INyARRgbRaster i_input) { //Preparation of raster driver if (this._ref_raster != i_input) { this._rgb2gs = (INyARRgb2GsFilter)i_input.createInterface(typeof(INyARRgb2GsFilter)); this._pcopy = (INyARPerspectiveCopy)i_input.createInterface(typeof(INyARPerspectiveCopy)); this._ref_raster = i_input; } //Increment of the source id this._src_ts++; }