示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="img"></param>
        /// <param name="winStride"></param>
        /// <param name="padding"></param>
        /// <param name="locations"></param>
        /// <returns></returns>
        public virtual float[] Compute(Mat img, CvSize winStride, CvSize padding, CvPoint[] locations)
        {
            if (disposed)
                throw new ObjectDisposedException("HOGDescriptor");
            if (img == null)
                throw new ArgumentNullException("img");

            using (StdVectorFloat flVec = new StdVectorFloat())
            {
                int length = (locations != null) ? locations.Length : 0;
                CppInvoke.HOGDescriptor_compute(ptr, img.CvPtr, flVec.CvPtr, winStride, padding, locations, length);
                // std::vector<float>*からfloat[]に移し替えて返す
                return flVec.ToArray();
            }
        }
示例#2
0
        /// <summary>
        /// 線形SVM分類器に,係数をセットします.
        /// </summary>
        /// <param name="svmdetector"></param>
#else
        /// <summary>
        /// 
        /// </summary>
        /// <param name="svmdetector"></param>
#endif
        public virtual void SetSVMDetector(float[] svmdetector)
        {
            if (disposed)
                throw new ObjectDisposedException("HOGDescriptor");

            if (_svmDetector != null)
                _svmDetector.Dispose();
            _svmDetector = new StdVectorFloat(svmdetector);            
            CppInvoke.HOGDescriptor_setSVMDetector(ptr, _svmDetector.CvPtr);
        }