Ejemplo n.º 1
0
 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 = NativeMethods.scan_fhog_pyramid_new(this._PyramidType,
                                                          this._PyramidRate,
                                                          this._FeatureExtractorType,
                                                          out var pyramid);

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

            case NativeMethods.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 = NativeMethods.structural_object_detection_trainer_scan_fhog_pyramid_new(this._PyramidType,
                                                                                                  this._PyramidRate,
                                                                                                  this._FeatureExtractorType,
                                                                                                  this.Scanner.NativePtr,
                                                                                                  out var trainr);

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

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

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

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