public ScanFHogPyramidDetector(IntPtr detector, ImageScanner.FHogPyramidParameter parameter)
     : base(detector)
 {
     this._FeatureExtractorType = parameter.FeatureExtractorType;
     this._PyramidRate          = parameter.PyramidRate;
     this._PyramidType          = parameter.PyramidType;
 }
Ejemplo n.º 2
0
        public ScanFHogPyramid(uint pyramidRate)
        {
            if (!SupportPyramidType.TryGetValue(typeof(T), out var pyramidType))
            {
                throw new NotSupportedException();
            }
            if (!SupportFeatureExtractorType.TryGetValue(typeof(U), out var featureExtractorType))
            {
                throw new NotSupportedException();
            }

            this._PyramidRate          = pyramidRate;
            this._PyramidType          = pyramidType;
            this._FeatureExtractorType = featureExtractorType;

            var ret = Dlib.Native.scan_fhog_pyramid_new(this._PyramidType,
                                                        this._PyramidRate,
                                                        this._FeatureExtractorType,
                                                        out var pyramid);

            switch (ret)
            {
            case Dlib.Native.ErrorType.PyramidNotSupportType:
            case Dlib.Native.ErrorType.PyramidNotSupportRate:
                throw new NotSupportedException();

            case Dlib.Native.ErrorType.FHogNotSupportExtractor:
                throw new NotSupportedException();
            }

            this.NativePtr = pyramid;
        }
            public ScanFHogPyramidTrainer(ImageScanner scanner)
                : base(scanner)
            {
                var param = scanner.GetFHogPyramidParameter();

                this._FeatureExtractorType = param.FeatureExtractorType;
                this._PyramidRate          = param.PyramidRate;
                this._PyramidType          = param.PyramidType;

                var ret = Dlib.Native.structural_object_detection_trainer_scan_fhog_pyramid_new(this._PyramidType,
                                                                                                this._PyramidRate,
                                                                                                this._FeatureExtractorType,
                                                                                                this.Scanner.NativePtr,
                                                                                                out var trainr);

                this.NativePtr = trainr;
            }
            public ScanFHogPyramidDetector(ImageScanner.FHogPyramidParameter parameter)
                : base(IntPtr.Zero)
            {
                this._FeatureExtractorType = parameter.FeatureExtractorType;
                this._PyramidRate          = parameter.PyramidRate;
                this._PyramidType          = parameter.PyramidType;

                var ret = Dlib.Native.object_detector_scan_fhog_pyramid_new(this._PyramidType,
                                                                            this._PyramidRate,
                                                                            this._FeatureExtractorType,
                                                                            out var detector);

                switch (ret)
                {
                case Dlib.Native.ErrorType.FHogNotSupportExtractor:
                case Dlib.Native.ErrorType.PyramidNotSupportRate:
                case Dlib.Native.ErrorType.PyramidNotSupportType:
                    throw new NotSupportedException();
                }

                this.NativePtr = detector;
            }
Ejemplo n.º 5
0
 internal static bool TryGetSupportPyramidType <T>(out Dlib.Native.PyramidType type)
 {
     return(SupportPyramidType.TryGetValue(typeof(T), out type));
 }
Ejemplo n.º 6
0
 public FHogPyramidParameter(Dlib.Native.PyramidType pyramidType, uint pyramidRate, Dlib.Native.FHogFeatureExtractorType featureExtractorType)
 {
     this.PyramidType          = pyramidType;
     this.PyramidRate          = pyramidRate;
     this.FeatureExtractorType = featureExtractorType;
 }