Esempio n. 1
0
        //
        // C++:  bool cv::Tracker::init(Mat image, Rect2d boundingBox)
        //

        //javadoc: Tracker::init(image, boundingBox)
        public bool init(Mat image, Rect2d boundingBox)
        {
            ThrowIfDisposed();
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            bool retVal = tracking_Tracker_init_10(nativeObj, image.nativeObj, boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height);

            return(retVal);
#else
            return(false);
#endif
        }
Esempio n. 2
0
        public Rect2d[] toArray()
        {
            int num = (int)total();

            Rect2d[] a = new Rect2d[num];
            if (num == 0)
            {
                return(a);
            }
            double[] buff = new double[num * _channels];
            get(0, 0, buff);  //TODO: check ret val!
            for (int i = 0; i < num; i++)
            {
                a[i] = new Rect2d(buff[i * _channels], buff[i * _channels + 1], buff[i * _channels + 2], buff[i * _channels + 3]);
            }
            return(a);
        }
Esempio n. 3
0
        //
        // C++:  bool cv::Tracker::update(Mat image, Rect2d& boundingBox)
        //

        //javadoc: Tracker::update(image, boundingBox)
        public bool update(Mat image, Rect2d boundingBox)
        {
            ThrowIfDisposed();
            if (image != null)
            {
                image.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            double[] boundingBox_out = new double[4];
            bool     retVal          = tracking_Tracker_update_10(nativeObj, image.nativeObj, boundingBox_out);
            if (boundingBox != null)
            {
                boundingBox.x = boundingBox_out[0]; boundingBox.y = boundingBox_out[1]; boundingBox.width = boundingBox_out[2]; boundingBox.height = boundingBox_out[3];
            }
            return(retVal);
#else
            return(false);
#endif
        }
Esempio n. 4
0
        public void fromArray(params Rect2d[] a)
        {
            if (a == null || a.Length == 0)
            {
                return;
            }
            int num = a.Length;

            alloc(num);
            double[] buff = new double[num * _channels];
            for (int i = 0; i < num; i++)
            {
                Rect2d r = a[i];
                buff[_channels * i + 0] = (double)r.x;
                buff[_channels * i + 1] = (double)r.y;
                buff[_channels * i + 2] = (double)r.width;
                buff[_channels * i + 3] = (double)r.height;
            }
            put(0, 0, buff);  //TODO: check ret val!
        }