/** * * @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, NyARCameraDistortionFactor 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_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, NyARCameraDistortionFactor 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, NyARCameraDistortionFactor 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 = new NyARRasterFilter_Rgb2Gs_RgbAve192(this._rgb_source.getBufferType()); this._source_perspective_reader = new NyARPerspectiveRasterReader(_rgb_source.getBufferType()); this._tracksource = new NyARTrackerSource_Reference(i_number_of_sample, i_ref_raster_distortion, i_width, i_height, i_depth, true); return; }
/** * 継承クラスのコンストラクタから呼び出す。 * @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, NyARCameraDistortionFactor 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; }
public NyARTransMat_ARToolKit(NyARParam i_param) { NyARCameraDistortionFactor dist = i_param.getDistortionFactor(); NyARPerspectiveProjectionMatrix pmat = i_param.getPerspectiveProjectionMatrix(); this._transsolver = new NyARTransportVectorSolver_ARToolKit(pmat); //互換性が重要な時は、NyARRotMatrix_ARToolKitを使うこと。 //理屈はNyARRotMatrix_NyARToolKitもNyARRotMatrix_ARToolKitも同じだけど、少しだけ値がずれる。 this._rotmatrix = new NyARRotMatrix_ARToolKit_O2(pmat); this._mat_optimize = new NyARRotMatrixOptimize_O2(pmat); this._ref_dist_factor = dist; }
public NyARTransMat_ARToolKit(NyARParam i_param) { NyARCameraDistortionFactor dist = i_param.getDistortionFactor(); NyARPerspectiveProjectionMatrix pmat = i_param.getPerspectiveProjectionMatrix(); this._transsolver = new NyARTransportVectorSolver_ARToolKit(pmat); //互換性が重要な時は、NyARRotMatrix_ARToolKitを使うこと。 //理屈はNyARRotMatrix_NyARToolKitもNyARRotMatrix_ARToolKitも同じだけど、少しだけ値がずれる。 this._rotmatrix = new NyARRotMatrix_ARToolKit_O2(pmat); this._mat_optimize = new NyARRotMatrixOptimize_O2(pmat); this._ref_dist_factor = dist; }
private void initInstance(NyARCameraDistortionFactor i_ref_distfactor, NyARPerspectiveProjectionMatrix i_ref_projmat) { NyARCameraDistortionFactor dist = i_ref_distfactor; NyARPerspectiveProjectionMatrix pmat = i_ref_projmat; this._transsolver = new NyARTransportVectorSolver_ARToolKit(pmat); //互換性が重要な時は、NyARRotMatrix_ARToolKitを使うこと。 //理屈はNyARRotMatrix_NyARToolKitもNyARRotMatrix_ARToolKitも同じだけど、少しだけ値がずれる。 this._rotmatrix = new NyARRotMatrix_ARToolKit_O2(pmat); this._mat_optimize = new NyARRotMatrixOptimize_O2(pmat); this._ref_dist_factor = dist; }
/** * コンストラクタです。 * 輪郭取得元画像の歪み矯正オブジェクトとサイズを指定して、インスタンスを生成します。 * @param i_size * 入力画像のサイズ * @param i_distfactor * 樽型歪みを補正する場合に、オブジェクトを指定します。 * nullの場合、補正を行いません。 */ public NyARCoord2Linear(NyARIntSize i_size, NyARCameraDistortionFactor i_distfactor) { if (i_distfactor != null) { this._dist_factor = new NyARObserv2IdealMap(i_distfactor, i_size); } else { this._dist_factor = null; } // 輪郭バッファ this._pca = new NyARPca2d_MatrixPCA_O2(); this._xpos = new double[i_size.w + i_size.h];//最大辺長はthis._width+this._height this._ypos = new double[i_size.w + i_size.h];//最大辺長はthis._width+this._height return; }
/** * コンストラクタです。 * 輪郭取得元画像の歪み矯正オブジェクトとサイズを指定して、インスタンスを生成します。 * @param i_size * 入力画像のサイズ * @param i_distfactor * 樽型歪みを補正する場合に、オブジェクトを指定します。 * nullの場合、補正を行いません。 */ public NyARCoord2Linear(NyARIntSize i_size, NyARCameraDistortionFactor i_distfactor) { if (i_distfactor != null) { this._dist_factor = new NyARObserv2IdealMap(i_distfactor, i_size); } else { this._dist_factor = null; } // 輪郭バッファ this._pca = new NyARPca2d_MatrixPCA_O2(); this._xpos = new double[i_size.w + i_size.h]; //最大辺長はthis._width+this._height this._ypos = new double[i_size.w + i_size.h]; //最大辺長はthis._width+this._height return; }
/** * @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, NyARCameraDistortionFactor 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); //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); }
/** * コンストラクタです。 * 入力した{@link NyARCameraDistortionFactor}とそのサイズから、テーブルを作成します。 * 2つのパラメータは整合性が取れていなければなりません。 * (通常は、{@link NyARParam}の{@link NyARParam#getDistortionFactor()},{@link NyARParam#getScreenSize()}から得られた * パラメータを入力します。) * @param i_distfactor * 樽型歪みパラメータのオブジェクト。 * @param i_screen_size * スクリーンサイズ */ public NyARObserv2IdealMap(NyARCameraDistortionFactor i_distfactor, NyARIntSize i_screen_size) { NyARDoublePoint2d opoint = new NyARDoublePoint2d(); this._mapx = new double[i_screen_size.w * i_screen_size.h]; this._mapy = new double[i_screen_size.w * i_screen_size.h]; this._stride = i_screen_size.w; int ptr = i_screen_size.h * i_screen_size.w - 1; //歪みマップを構築 for (int i = i_screen_size.h - 1; i >= 0; i--) { for (int i2 = i_screen_size.w - 1; i2 >= 0; i2--) { i_distfactor.observ2Ideal(i2, i, opoint); this._mapx[ptr] = opoint.x; this._mapy[ptr] = opoint.y; ptr--; } } return; }
/** * コンストラクタです。 * 入力した{@link NyARCameraDistortionFactor}とそのサイズから、テーブルを作成します。 * 2つのパラメータは整合性が取れていなければなりません。 * (通常は、{@link NyARParam}の{@link NyARParam#getDistortionFactor()},{@link NyARParam#getScreenSize()}から得られた * パラメータを入力します。) * @param i_distfactor * 樽型歪みパラメータのオブジェクト。 * @param i_screen_size * スクリーンサイズ */ public NyARObserv2IdealMap(NyARCameraDistortionFactor i_distfactor, NyARIntSize i_screen_size) { NyARDoublePoint2d opoint = new NyARDoublePoint2d(); this._mapx = new double[i_screen_size.w * i_screen_size.h]; this._mapy = new double[i_screen_size.w * i_screen_size.h]; this._stride = i_screen_size.w; int ptr = i_screen_size.h * i_screen_size.w - 1; //歪みマップを構築 for (int i = i_screen_size.h - 1; i >= 0; i--) { for (int i2 = i_screen_size.w - 1; i2 >= 0; i2--) { i_distfactor.observ2Ideal(i2, i, opoint); this._mapx[ptr] = opoint.x; this._mapy[ptr] = opoint.y; ptr--; } } return; }
public NyARFixedFloatObserv2IdealMap(NyARCameraDistortionFactor i_distfactor, NyARIntSize i_screen_size) { NyARDoublePoint2d opoint = new NyARDoublePoint2d(); this._mapx = new int[i_screen_size.w * i_screen_size.h]; this._mapy = new int[i_screen_size.w * i_screen_size.h]; this._stride = i_screen_size.w; int ptr = i_screen_size.h * i_screen_size.w - 1; //歪みマップを構築 for (int i = i_screen_size.h - 1; i >= 0; i--) { for (int i2 = i_screen_size.w - 1; i2 >= 0; i2--) { i_distfactor.observ2Ideal(i2, i, opoint); this._mapx[ptr] = (int)(opoint.x * 65536); this._mapy[ptr] = (int)(opoint.y * 65536); ptr--; } } i_distfactor.getValue(this._factor); return; }
public NyARFixedFloatIdeal2Observ(NyARCameraDistortionFactor i_distfactor) { i_distfactor.getValue(this._factor); return; }
private void initInstance(NyARCameraDistortionFactor i_ref_distfactor, NyARPerspectiveProjectionMatrix i_ref_projmat) { NyARCameraDistortionFactor dist = i_ref_distfactor; NyARPerspectiveProjectionMatrix pmat = i_ref_projmat; this._transsolver = new NyARTransportVectorSolver_ARToolKit(pmat); //互換性が重要な時は、NyARRotMatrix_ARToolKitを使うこと。 //理屈はNyARRotMatrix_NyARToolKitもNyARRotMatrix_ARToolKitも同じだけど、少しだけ値がずれる。 this._rotmatrix = new NyARRotMatrix_ARToolKit_O2(pmat); this._mat_optimize = new NyARRotMatrixOptimize_O2(pmat); this._ref_dist_factor = dist; }
/** * コンストラクタです。 * 座標計算に必要なオブジェクトの参照値を元に、インスタンスを生成します。 * @param i_ref_distfactor * 樽型歪み矯正オブジェクトの参照値です。歪み矯正が不要な時は、nullを指定します。 * @param i_ref_projmat * 射影変換オブジェクトの参照値です。 * @ */ public NyARTransMat_ARToolKit(NyARCameraDistortionFactor i_ref_distfactor, NyARPerspectiveProjectionMatrix i_ref_projmat) { initInstance(i_ref_distfactor, i_ref_projmat); return; }
/** * コンストラクタから呼び出す共通な初期化部分です。 * @param i_dist_factor * @param i_prjmat * @throws NyARException */ protected void initInstance(NyARIntSize i_screen, double i_near, double i_far, NyARPerspectiveProjectionMatrix i_prjmat, NyARCameraDistortionFactor i_dist_factor) { int number_of_reality_target = this.MAX_LIMIT_KNOWN + this.MAX_LIMIT_UNKNOWN; //演算インスタンス this._transmat = new NyARTransMat(i_dist_factor, i_prjmat); //データインスタンス this._pool = new NyARRealityTargetPool(number_of_reality_target, i_prjmat); this.target = new NyARRealityTargetList(number_of_reality_target); //Trackerの特性値 this._tracker = new NyARTracker((this.MAX_LIMIT_KNOWN + this.MAX_LIMIT_UNKNOWN) * 2, 1, this.MAX_LIMIT_KNOWN * 2); //フラスタムの計算とスクリーンサイズの保存 this._ref_prjmat = i_prjmat; this._frustum = new NyARFrustum(i_prjmat, i_screen.w, i_screen.h, i_near, i_far); //初期化 this._number_of_dead = this._number_of_unknown = this._number_of_known = 0; return; }
/** * コンストラクタ。 * @param i_screen * スクリーン(入力画像)のサイズを指定します。 * @param i_near * {@link #NyARReality(NyARParam i_param,double i_near,double i_far,int i_max_known_target,int i_max_unknown_target)}を参照 * @param i_far * {@link #NyARReality(NyARParam i_param,double i_near,double i_far,int i_max_known_target,int i_max_unknown_target)}を参照 * @param i_prjmat * ARToolKit形式の射影変換パラメータを指定します。 * @param i_dist_factor * カメラ歪み矯正オブジェクトを指定します。歪み矯正が不要な時は、nullを指定します。 * @param i_max_known_target * {@link #NyARReality(NyARParam i_param,double i_near,double i_far,int i_max_known_target,int i_max_unknown_target)}を参照 * @param i_max_unknown_target * {@link #NyARReality(NyARParam i_param,double i_near,double i_far,int i_max_known_target,int i_max_unknown_target)}を参照 * @throws NyARException */ public NyARReality(NyARIntSize i_screen, double i_near, double i_far, NyARPerspectiveProjectionMatrix i_prjmat, NyARCameraDistortionFactor i_dist_factor, int i_max_known_target, int i_max_unknown_target) { this.MAX_LIMIT_KNOWN = i_max_known_target; this.MAX_LIMIT_UNKNOWN = i_max_unknown_target; this.initInstance(i_screen, i_near, i_far, i_prjmat, i_dist_factor); }
public NyARTransMat_ARToolKit(NyARCameraDistortionFactor i_ref_distfactor, NyARPerspectiveProjectionMatrix i_ref_projmat) { initInstance(i_ref_distfactor, i_ref_projmat); return; }