C# Class OpenCvSharp.HOGDescriptor

HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector
Inheritance: OpenCvSharp.DisposableCvObject
ファイルを表示 Open project: shimat/opencvsharp Class Usage Examples

Public Properties

Property Type Description
DaimlerPeopleDetector float[]
DefaultPeopleDetector float[]
SizeOf int

Public Methods

Method Description
CheckDetectorSize ( ) : bool

Compute ( OpenCvSharp.Mat img, Size winStride = null, Size padding = null, System.Point locations = null ) : float[]

ComputeGradient ( OpenCvSharp.Mat img, OpenCvSharp.Mat grad, OpenCvSharp.Mat angleOfs, Size paddingTL = null, Size paddingBR = null ) : void

Detect ( OpenCvSharp.Mat img, double hitThreshold, Size winStride = null, Size padding = null, System.Point searchLocations = null ) : System.Point[]

Performs object detection without a multi-scale window.

Detect ( OpenCvSharp.Mat img, double &weights, double hitThreshold, Size winStride = null, Size padding = null, System.Point searchLocations = null ) : System.Point[]

Performs object detection without a multi-scale window.

DetectMultiScale ( OpenCvSharp.Mat img, double hitThreshold, Size winStride = null, Size padding = null, double scale = 1.05, int groupThreshold = 2 ) : Rect[]

Performs object detection with a multi-scale window.

DetectMultiScale ( OpenCvSharp.Mat img, double &foundWeights, double hitThreshold, Size winStride = null, Size padding = null, double scale = 1.05, int groupThreshold = 2 ) : Rect[]

Performs object detection with a multi-scale window.

DetectMultiScaleROI ( OpenCvSharp.Mat img, Rect &foundLocations, DetectionROI &locations, double hitThreshold, int groupThreshold ) : void

evaluate specified ROI and return confidence value for each location in multiple scales

DetectROI ( OpenCvSharp.Mat img, System.Point locations, System.Point &foundLocations, double &confidences, double hitThreshold, Size winStride = null, Size padding = null ) : void

evaluate specified ROI and return confidence value for each location

GetDaimlerPeopleDetector ( ) : float[]

This method returns 1981 SVM coeffs obtained from daimler's base. To use these coeffs the detection window size should be (48,96)

GetDefaultPeopleDetector ( ) : float[]

Returns coefficients of the classifier trained for people detection (for default window size).

GetDescriptorSize ( ) : int

GetWinSigma ( ) : double

GroupRectangles ( Rect &rectList, double &weights, int groupThreshold, double eps ) : void

HOGDescriptor ( ) : System

Default constructor

HOGDescriptor ( IntPtr ptr ) : System

Initializes from pointer

HOGDescriptor ( Size winSize = null, Size blockSize = null, Size blockStride = null, Size cellSize = null, int nbins = 9, int derivAperture = 1, double winSigma = -1, HistogramNormType histogramNormType = HistogramNormType.L2Hys, double l2HysThreshold = 0.2, bool gammaCorrection = true, int nlevels = DefaultNlevels ) : System

Creates the HOG descriptor and detector.

HOGDescriptor ( string fileName ) : System

Load ( string fileName, string objName = null ) : bool

ReadALTModel ( string modelFile ) : void

read/parse Dalal's alt model file

Save ( string fileName, string objName = null ) : void

SetSVMDetector ( float svmDetector ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

Method Details

CheckDetectorSize() public method

public CheckDetectorSize ( ) : bool
return bool

Compute() public method

public Compute ( OpenCvSharp.Mat img, Size winStride = null, Size padding = null, System.Point locations = null ) : float[]
img OpenCvSharp.Mat
winStride Size
padding Size
locations System.Point
return float[]

ComputeGradient() public method

public ComputeGradient ( OpenCvSharp.Mat img, OpenCvSharp.Mat grad, OpenCvSharp.Mat angleOfs, Size paddingTL = null, Size paddingBR = null ) : void
img OpenCvSharp.Mat
grad OpenCvSharp.Mat
angleOfs OpenCvSharp.Mat
paddingTL Size
paddingBR Size
return void

Detect() public method

Performs object detection without a multi-scale window.
public Detect ( OpenCvSharp.Mat img, double hitThreshold, Size winStride = null, Size padding = null, System.Point searchLocations = null ) : System.Point[]
img OpenCvSharp.Mat Source image. CV_8UC1 and CV_8UC4 types are supported for now.
hitThreshold double Threshold for the distance between features and SVM classifying plane. /// Usually it is 0 and should be specfied in the detector coefficients (as the last free coefficient). /// But if the free coefficient is omitted (which is allowed), you can specify it manually here.
winStride Size Window stride. It must be a multiple of block stride.
padding Size Mock parameter to keep the CPU interface compatibility. It must be (0,0).
searchLocations System.Point
return System.Point[]

Detect() public method

Performs object detection without a multi-scale window.
public Detect ( OpenCvSharp.Mat img, double &weights, double hitThreshold, Size winStride = null, Size padding = null, System.Point searchLocations = null ) : System.Point[]
img OpenCvSharp.Mat Source image. CV_8UC1 and CV_8UC4 types are supported for now.
weights double
hitThreshold double Threshold for the distance between features and SVM classifying plane. /// Usually it is 0 and should be specfied in the detector coefficients (as the last free coefficient). /// But if the free coefficient is omitted (which is allowed), you can specify it manually here.
winStride Size Window stride. It must be a multiple of block stride.
padding Size Mock parameter to keep the CPU interface compatibility. It must be (0,0).
searchLocations System.Point
return System.Point[]

DetectMultiScale() public method

Performs object detection with a multi-scale window.
public DetectMultiScale ( OpenCvSharp.Mat img, double hitThreshold, Size winStride = null, Size padding = null, double scale = 1.05, int groupThreshold = 2 ) : Rect[]
img OpenCvSharp.Mat Source image. CV_8UC1 and CV_8UC4 types are supported for now.
hitThreshold double Threshold for the distance between features and SVM classifying plane.
winStride Size Window stride. It must be a multiple of block stride.
padding Size Mock parameter to keep the CPU interface compatibility. It must be (0,0).
scale double Coefficient of the detection window increase.
groupThreshold int Coefficient to regulate the similarity threshold. /// When detected, some objects can be covered by many rectangles. 0 means not to perform grouping.
return Rect[]

DetectMultiScale() public method

Performs object detection with a multi-scale window.
public DetectMultiScale ( OpenCvSharp.Mat img, double &foundWeights, double hitThreshold, Size winStride = null, Size padding = null, double scale = 1.05, int groupThreshold = 2 ) : Rect[]
img OpenCvSharp.Mat Source image. CV_8UC1 and CV_8UC4 types are supported for now.
foundWeights double
hitThreshold double Threshold for the distance between features and SVM classifying plane.
winStride Size Window stride. It must be a multiple of block stride.
padding Size Mock parameter to keep the CPU interface compatibility. It must be (0,0).
scale double Coefficient of the detection window increase.
groupThreshold int Coefficient to regulate the similarity threshold. /// When detected, some objects can be covered by many rectangles. 0 means not to perform grouping.
return Rect[]

DetectMultiScaleROI() public method

evaluate specified ROI and return confidence value for each location in multiple scales
public DetectMultiScaleROI ( OpenCvSharp.Mat img, Rect &foundLocations, DetectionROI &locations, double hitThreshold, int groupThreshold ) : void
img OpenCvSharp.Mat
foundLocations Rect
locations DetectionROI
hitThreshold double
groupThreshold int
return void

DetectROI() public method

evaluate specified ROI and return confidence value for each location
public DetectROI ( OpenCvSharp.Mat img, System.Point locations, System.Point &foundLocations, double &confidences, double hitThreshold, Size winStride = null, Size padding = null ) : void
img OpenCvSharp.Mat
locations System.Point
foundLocations System.Point
confidences double
hitThreshold double
winStride Size
padding Size
return void

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. ///
return void

GetDaimlerPeopleDetector() public static method

This method returns 1981 SVM coeffs obtained from daimler's base. To use these coeffs the detection window size should be (48,96)
public static GetDaimlerPeopleDetector ( ) : float[]
return float[]

GetDefaultPeopleDetector() public static method

Returns coefficients of the classifier trained for people detection (for default window size).
public static GetDefaultPeopleDetector ( ) : float[]
return float[]

GetDescriptorSize() public method

public GetDescriptorSize ( ) : int
return int

GetWinSigma() public method

public GetWinSigma ( ) : double
return double

GroupRectangles() public method

public GroupRectangles ( Rect &rectList, double &weights, int groupThreshold, double eps ) : void
rectList Rect
weights double
groupThreshold int
eps double
return void

HOGDescriptor() public method

Default constructor
public HOGDescriptor ( ) : System
return System

HOGDescriptor() public method

Initializes from pointer
public HOGDescriptor ( IntPtr ptr ) : System
ptr System.IntPtr class HOGDescriptor*
return System

HOGDescriptor() public method

Creates the HOG descriptor and detector.
public HOGDescriptor ( Size winSize = null, Size blockSize = null, Size blockStride = null, Size cellSize = null, int nbins = 9, int derivAperture = 1, double winSigma = -1, HistogramNormType histogramNormType = HistogramNormType.L2Hys, double l2HysThreshold = 0.2, bool gammaCorrection = true, int nlevels = DefaultNlevels ) : System
winSize Size Detection window size. Align to block size and block stride.
blockSize Size Block size in pixels. Align to cell size. Only (16,16) is supported for now.
blockStride Size Block stride. It must be a multiple of cell size.
cellSize Size Cell size. Only (8, 8) is supported for now.
nbins int Number of bins. Only 9 bins per cell are supported for now.
derivAperture int
winSigma double Gaussian smoothing window parameter.
histogramNormType HistogramNormType
l2HysThreshold double L2-Hys normalization method shrinkage.
gammaCorrection bool Flag to specify whether the gamma correction preprocessing is required or not.
nlevels int Maximum number of detection window increases.
return System

HOGDescriptor() public method

public HOGDescriptor ( string fileName ) : System
fileName string
return System

Load() public method

public Load ( string fileName, string objName = null ) : bool
fileName string
objName string
return bool

ReadALTModel() public method

read/parse Dalal's alt model file
public ReadALTModel ( string modelFile ) : void
modelFile string
return void

Save() public method

public Save ( string fileName, string objName = null ) : void
fileName string
objName string
return void

SetSVMDetector() public method

public SetSVMDetector ( float svmDetector ) : void
svmDetector float
return void

Property Details

DaimlerPeopleDetector public_oe static_oe property

This field returns 1981 SVM coeffs obtained from daimler's base. To use these coeffs the detection window size should be (48,96)
public static float[] DaimlerPeopleDetector
return float[]

DefaultPeopleDetector public_oe static_oe property

Returns coefficients of the classifier trained for people detection (for default window size).
public static float[] DefaultPeopleDetector
return float[]

SizeOf public_oe static_oe property

sizeof(HOGDescriptor)
public static int SizeOf
return int