Ejemplo n.º 1
0
        public bool update(INyARGrayscaleRaster i_raster, SquareStack.Item i_sq)
        {
            if (!this._pickup.getARPlayCardId(i_raster.getGsPixelDriver(), i_sq.ob_vertex, this._id_param))
            {
                return(false);
            }
            //IDを検出
            int s = this._id_param.id;

            for (int i = this.Count - 1; i >= 0; i--)
            {
                Item target = this[i];
                if (target.nyid_range_s > s || s > target.nyid_range_e)
                {
                    continue;
                }
                //既に認識済なら無視
                if (target.lost_count == 0)
                {
                    continue;
                }
                //一致したよー。
                target.id  = s;
                target.dir = this._id_param.direction;
                target.sq  = i_sq;
                return(true);
            }
            return(false);
        }
        public bool update(INyARGrayscaleRaster i_raster, SquareStack.Item i_sq)
        {
            if (!this._id_pickup.pickFromRaster(i_raster, i_sq.ob_vertex, this._id_patt, this._id_param))
            {
                return(false);
            }
            if (!this._id_encoder.encode(this._id_patt, this._id_data))
            {
                return(false);
            }
            //IDを検出
            long s = this._id_data.marker_id;

            for (int i = this.Count - 1; i >= 0; i--)
            {
                Item target = this[i];
                if (target.nyid_range_s > s || s > target.nyid_range_e)
                {
                    continue;
                }
                //既に認識済なら無視
                if (target.lost_count == 0)
                {
                    continue;
                }
                //一致したよー。
                target.nyid = s;
                target.dir  = this._id_param.direction;
                target.sq   = i_sq;
                return(true);
            }
            return(false);
        }
        public bool update(SquareStack.Item i_new_sq)
        {
            int[] ret      = this.__ret;
            int   new_area = i_new_sq.rect_area;
            //頂点の対角距離
            int  new_sq_dist   = i_new_sq.vertex_area.getDiagonalSqDist();
            bool is_dispatched = false;

            for (int i = this.Count - 1; i >= 0; i--)
            {
                TMarkerData target = this[i];
                if (target.lost_count > 1)
                {
                    continue;
                }
                //面積比が急激0.8-1.2倍以外の変動なら無視
                int a_rate = new_area * 100 / target.tl_rect_area;
                if (a_rate < 50 || 150 < a_rate)
                {
                    continue;
                }
                //移動距離^2の二乗が対角線距離^2の4倍以上なら無視
                long sq_move = target.tl_center.sqDist(i_new_sq.center2d);
                if (sq_move * 4 / new_sq_dist > 0)
                {
                    continue;
                }
                compareVertexSet(i_new_sq.ob_vertex, target.tl_vertex, ret);
                int sqdist = ret[1];
                int shift  = ret[0];
                //頂点移動距離の合計が、(中心点移動距離+8)の10倍を超えてたらNG <-
                if (sqdist > (sq_move + 8) * 10)
                {
                    continue;
                }
                //登録可能か確認
                VertexSortTable.Item item = this._tracking_list.getInsertPoint(sqdist);
                if (item == null)
                {
                    continue;
                }
                //登録
                item          = this._tracking_list.insertFromTailBefore(item);
                item.marker   = target;
                item.shift    = shift;
                item.sq_dist  = sqdist;
                item.ref_sq   = i_new_sq;
                is_dispatched = true;
            }
            return(is_dispatched);
        }
Ejemplo n.º 4
0
        /**
         * リスト中の、i_itemと同じマーカIDか、同じ矩形情報を参照しているものを無効に(ptr.idを-1)する。
         */
        public void disableMatchItem(Item i_item)
        {
            //削除対象のオブジェクトのポインタ保存
            ARMarkerList.Item match_mk = i_item.marker;
            SquareStack.Item  match_sq = i_item.ref_sq;
            //リストを走査して該当アイテムを削除
            Item ptr = this._head_item;

            for (int i = this._num_of_item - 1; i >= 0; i--)
            {
                if (ptr.marker != null)
                {
                    if ((ptr.marker == match_mk) || (ptr.ref_sq == match_sq))
                    {
                        ptr.marker = null;
                    }
                }
                ptr = (Item)ptr.next;
            }
        }
Ejemplo n.º 5
0
        /**
         * o_targetsに、敷居値を越えたターゲットリストを返却する。
         * @param i_pix_drv
         * @param i_vertex
         * @param o_targets
         * @return
         * @
         */
        public bool update(INyARPerspectiveCopy i_pix_drv, SquareStack.Item i_sq)
        {
            //sq_tmpに値を生成したかのフラグ
            bool is_ganalated_sq = false;

            for (int i = this.Count - 1; i >= 0; i--)
            {
                ARMarkerList.Item target = this[i];
                //解像度に一致する画像を取得
                NyARMatchPattDeviationColorData diff = this._mpickup.getDeviationColorData(target, i_pix_drv, i_sq.ob_vertex);
                //マーカのパターン解像度に一致したサンプリング画像と比較する。
                if (!target.matchpatt.evaluate(diff, this._patt_result))
                {
                    continue;
                }
                //敷居値をチェック
                if (this._patt_result.confidence < this._configense_th)
                {
                    continue;
                }
                //マーカマップへの追加対象か調べる。
                ARMarkerSortList.Item ip = this._mkmap.getInsertPoint(this._patt_result.confidence);
                if (ip == null)
                {
                    continue;
                }
                //マーカマップアイテムの矩形に参照値を設定する。
                ip              = this._mkmap.insertFromTailBefore(ip);
                ip.cf           = this._patt_result.confidence;
                ip.dir          = this._patt_result.direction;
                ip.marker       = target;
                ip.ref_sq       = i_sq;
                is_ganalated_sq = true;
            }
            return(is_ganalated_sq);
        }