Esempio n. 1
0
        /// <summary>
        /// Backproject the histogram into a matrix
        /// </summary>
        /// <param name="srcs">Source matrices, all are of the same size and type</param>
        /// <returns>Destination back projection matrix of the sametype as the source matrices</returns>
        /// <typeparam name="TDepth">The type of depth of the matrix</typeparam>
        public Matrix <TDepth> BackProject <TDepth>(Matrix <TDepth>[] srcs) where TDepth : new()
        {
            Debug.Assert(srcs.Length == _binSizes.Length, "Incompatible Dimension");
            using (VectorOfMat vm = new VectorOfMat())
            {
                vm.Push(srcs);

                int[] channels = new int[srcs.Length];
                for (int i = 0; i < channels.Length; i++)
                {
                    channels[i] = i;
                }
                Matrix <TDepth> res = new Matrix <TDepth>(srcs[0].Size);
                CvInvoke.CalcBackProject(vm, channels, this, res.Mat, GetRangeAsFloatVec(), 1.0);

                return(res);
            }
        }
Esempio n. 2
0
        ///<summary>
        /// Backproject the histogram into a matrix
        ///</summary>
        ///<param name="srcs">Source matrices, all are of the same size and type</param>
        ///<returns>Destination back projection matrix of the sametype as the source matrices</returns>
        ///<typeparam name="TDepth">The type of depth of the matrix</typeparam>
        public Matrix <TDepth> BackProject <TDepth>(Matrix <TDepth>[] srcs) where TDepth : new()
        {
#if !(NETFX_CORE || (UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE || UNITY_METRO))
            Debug.Assert(srcs.Length == _binSizes.Length, Properties.StringTable.IncompatibleDimension);
#endif
            using (VectorOfMat vm = new VectorOfMat())
            {
                vm.Push(srcs);

                int[] channels = new int[srcs.Length];
                for (int i = 0; i < channels.Length; i++)
                {
                    channels[i] = i;
                }
                Matrix <TDepth> res = new Matrix <TDepth>(srcs[0].Size);
                CvInvoke.CalcBackProject(vm, channels, this, res.Mat, GetRangeAsFloatVec(), 1.0);

                return(res);
            }
        }