HOGDescriptor
import { HOGDescriptor } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods.
Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.
the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs [Dalal2005] .
useful links:
https://hal.inria.fr/inria-00548512/document/
https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients
https://software.intel.com/en-us/ipp-dev-reference-histogram-of-oriented-gradients-hog-descriptor
http://www.learnopencv.com/histogram-of-oriented-gradients
http://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial
Constructors and members
static new
Creates the HOG descriptor and detector and loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.
new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number, _histogramNormType: HOGDescriptor_HistogramNormType, _L2HysThreshold: number, _gammaCorrection: boolean, _nlevels: number, _signedGradient: boolean): HOGDescriptor;13 available overloads
new(): HOGDescriptor;new(filename: Size): HOGDescriptor;new(filename: Size, _1: Size): HOGDescriptor;new(filename: Size, _1: Size, _2: Size): HOGDescriptor;new(filename: Size, _1: Size, _2: Size, _3: Size): HOGDescriptor;new(filename: Size, _1: Size, _2: Size, _3: Size, _4: number): HOGDescriptor;new(filename: Size, _1: Size, _2: Size, _3: Size, _4: number, _5: number): HOGDescriptor;new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number): HOGDescriptor;new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number, _histogramNormType: HOGDescriptor_HistogramNormType): HOGDescriptor;new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number, _histogramNormType: HOGDescriptor_HistogramNormType, _L2HysThreshold: number): HOGDescriptor;new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number, _histogramNormType: HOGDescriptor_HistogramNormType, _L2HysThreshold: number, _gammaCorrection: boolean): HOGDescriptor;new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number, _histogramNormType: HOGDescriptor_HistogramNormType, _L2HysThreshold: number, _gammaCorrection: boolean, _nlevels: number): HOGDescriptor;new(_winSize: Size, _blockSize: Size, _blockStride: Size, _cellSize: Size, _nbins: number, _derivAperture: number, _winSigma: number, _histogramNormType: HOGDescriptor_HistogramNormType, _L2HysThreshold: number, _gammaCorrection: boolean, _nlevels: number, _signedGradient: boolean): HOGDescriptor;filenameThe file name containing HOGDescriptor properties and coefficients for the linear SVM classifier.
_11 argument (Size).
_22 argument (Size).
_33 argument (Size).
_44 argument (number).
_55 argument (number).
_winSizesets winSize with given value.
_blockSizesets blockSize with given value.
_blockStridesets blockStride with given value.
_cellSizesets cellSize with given value.
_nbinssets nbins with given value.
_derivAperturesets derivAperture with given value.
_winSigmasets winSigma with given value.
_histogramNormTypesets histogramNormType with given value.
_L2HysThresholdsets L2HysThreshold with given value.
_gammaCorrectionsets gammaCorrection with given value.
_nlevelssets nlevels with given value.
_signedGradientsets signedGradient with given value.
The HOGDescriptor result.
static from1
Create an owned HOGDescriptor instance with the supplied configuration.
Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.
from1(_0: EmbindString): HOGDescriptor | null;_00 argument (EmbindString).
The HOGDescriptor | null result.
static getDefaultPeopleDetector
Returns coefficients of the classifier trained for people detection (for 64x128 windows).
getDefaultPeopleDetector(): FloatVector;The FloatVector result. Release returned native handles with using or delete(), including handles nested in results.
static getDaimlerPeopleDetector
example: samples/hog_tapi.cpp Returns coefficients of the classifier trained for people detection (for 48x96 windows).
getDaimlerPeopleDetector(): FloatVector;The FloatVector result. Release returned native handles with using or delete(), including handles nested in results.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
winSize
Detection window size. Align to block size and block stride. Default value is Size(64,128).
winSize: Size;blockSize
Block size in pixels. Align to cell size. Default value is Size(16,16).
blockSize: Size;blockStride
Block stride. It must be a multiple of cell size. Default value is Size(8,8).
blockStride: Size;cellSize
Cell size. Default value is Size(8,8).
cellSize: Size;nbins
Number of bins used in the calculation of histogram of gradients. Default value is 9.
nbins: number;derivAperture
HOGDescriptor.derivAperture: not documented
derivAperture: number;winSigma
Gaussian smoothing window parameter.
winSigma: number;histogramNormType
histogramNormType
readonly histogramNormType: number;L2HysThreshold
L2-Hys normalization method shrinkage.
L2HysThreshold: number;gammaCorrection
Flag to specify whether the gamma correction preprocessing is required or not.
gammaCorrection: boolean;svmDetector
coefficients for the linear SVM classifier.
svmDetector: FloatVector;nlevels
Maximum number of detection window increases. Default value is 64
nlevels: number;signedGradient
Indicates signed gradient will be used or not
signedGradient: boolean;getDescriptorSize
Returns the number of coefficients required for the classification.
getDescriptorSize(): number;The number result.
checkDetectorSize
Checks if detector size equal to descriptor size.
checkDetectorSize(): boolean;The boolean result.
getWinSigma
Returns winSigma value
getWinSigma(): number;The number result.
setSVMDetector
example: samples/peopledetect.cpp Sets coefficients for the linear SVM classifier.
setSVMDetector(svmdetector: Mat): void;svmdetectorcoefficients for the linear SVM classifier.
load
loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file
load(filename: EmbindString, objname: EmbindString): boolean;2 available overloads
load(filename: EmbindString): boolean;load(filename: EmbindString, objname: EmbindString): boolean;filenameName of the file to read.
objnameThe optional name of the node to read (if empty, the first top-level node will be used).
The boolean result.
save
saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file
save(filename: EmbindString, objname: EmbindString): void;2 available overloads
save(filename: EmbindString): void;save(filename: EmbindString, objname: EmbindString): void;filenameFile name
objnameObject name
compute
Computes HOG descriptors of given image.
compute(img: Mat, descriptors: FloatVector, winStride: Size, padding: Size, locations: PointVector): void;4 available overloads
compute(img: Mat, descriptors: FloatVector): void;compute(img: Mat, descriptors: FloatVector, winStride: Size): void;compute(img: Mat, descriptors: FloatVector, winStride: Size, padding: Size): void;compute(img: Mat, descriptors: FloatVector, winStride: Size, padding: Size, locations: PointVector): void;imgMatrix of the type CV_8U containing an image where HOG features will be calculated.
descriptorsOutput destination, filled by the native operation. Matrix of the type CV_32F
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
locationsVector of Point
detect
Performs object detection without a multi-scale window.
detect(img: Mat, foundLocations: PointVector, weights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size, searchLocations: PointVector): void;5 available overloads
detect(img: Mat, foundLocations: PointVector, weights: DoubleVector): void;detect(img: Mat, foundLocations: PointVector, weights: DoubleVector, hitThreshold: number): void;detect(img: Mat, foundLocations: PointVector, weights: DoubleVector, hitThreshold: number, winStride: Size): void;detect(img: Mat, foundLocations: PointVector, weights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size): void;detect(img: Mat, foundLocations: PointVector, weights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size, searchLocations: PointVector): void;imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsOutput destination, filled by the native operation. Vector of point where each point contains left-top corner point of detected object boundaries.
weightsOutput destination, filled by the native operation. Vector that will contain confidence values for each detected object.
hitThresholdThreshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specified 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.
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
searchLocationsVector of Point includes set of requested locations to be evaluated.
detectMultiScale
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size, scale: number, groupThreshold: number, useMeanshiftGrouping: boolean): void;7 available overloads
detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector): void;detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number): void;detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number, winStride: Size): void;detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size): void;detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size, scale: number): void;detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size, scale: number, groupThreshold: number): void;detectMultiScale(img: Mat, foundLocations: RectVector, foundWeights: DoubleVector, hitThreshold: number, winStride: Size, padding: Size, scale: number, groupThreshold: number, useMeanshiftGrouping: boolean): void;imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsOutput destination, filled by the native operation. Vector of rectangles where each rectangle contains the detected object.
foundWeightsOutput destination, filled by the native operation. Vector that will contain confidence values for each detected object.
hitThresholdThreshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specified 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.
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
scaleCoefficient of the detection window increase.
groupThresholdCoefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping.
useMeanshiftGroupingindicates grouping algorithm
computeGradient
Computes gradients and quantized gradient orientations.
computeGradient(img: Mat, grad: Mat, angleOfs: Mat, paddingTL: Size, paddingBR: Size): void;3 available overloads
computeGradient(img: Mat, grad: Mat, angleOfs: Mat): void;computeGradient(img: Mat, grad: Mat, angleOfs: Mat, paddingTL: Size): void;computeGradient(img: Mat, grad: Mat, angleOfs: Mat, paddingTL: Size, paddingBR: Size): void;imgMatrix contains the image to be computed
gradInput/output value, modified by the native operation. Matrix of type CV_32FC2 contains computed gradients
angleOfsInput/output value, modified by the native operation. Matrix of type CV_8UC2 contains quantized gradient orientations
paddingTLPadding from top-left
paddingBRPadding from bottom-right
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.