Beispiel #1
0
        override public void extructMatches(HomographyMat H, FeaturePairStack matches)
        {
            int l = matches.getLength();

            FeaturePairStack.Item[] b = matches.getArray();
            double threshold2         = this._threshold2;
            //前方詰め
            int pos = 0;
            NyARDoublePoint2d tmp;

            for (int i = 0; i < l; i++)
            {
                tmp = b[i].ref_;
                double w  = H.m20 * tmp.x + H.m21 * tmp.y + H.m22;
                double t1 = ((H.m00 * tmp.x + H.m01 * tmp.y + H.m02) / w); // XP
                double t2 = ((H.m10 * tmp.x + H.m11 * tmp.y + H.m12) / w); // YP
                tmp = b[i].query;
                t1 -= tmp.x;
                t2 -= tmp.y;
                double d2 = (t1 * t1) + (t2 * t2);
                if (d2 <= threshold2)
                {
                    matches.swap(i, pos);
                    pos++;
                }
            }
            matches.setLength(pos);
            return;
        }
        virtual public void extructMatches(HomographyMat H, FeaturePairStack matches)
        {
            double            threshold2 = this._threshold2;
            NyARDoublePoint2d xp         = new NyARDoublePoint2d();// float xp[2];
            //前方詰め

            int pos = 0;

            for (int i = 0; i < matches.getLength(); i++)
            {
                H.multiplyPointHomographyInhomogenous(matches.getItem(i).ref_.x, matches.getItem(i).ref_.y, xp);
                double t1 = xp.x - matches.getItem(i).query.x;
                double t2 = xp.y - matches.getItem(i).query.y;

                double d2 = (t1 * t1) + (t2 * t2);
                if (d2 <= threshold2)
                {
                    matches.swap(i, pos);
                    pos++;
                }
            }
            matches.setLength(pos);
            return;
        }