Skip to content

HOGDescriptor

xobjdetectclassOpenCV 5.0.0
import { HOGDescriptor } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSHOGDescriptor
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

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;
filename

The file name containing HOGDescriptor properties and coefficients for the linear SVM classifier.

_1

1 argument (Size).

_2

2 argument (Size).

_3

3 argument (Size).

_4

4 argument (number).

_5

5 argument (number).

_winSize

sets winSize with given value.

_blockSize

sets blockSize with given value.

_blockStride

sets blockStride with given value.

_cellSize

sets cellSize with given value.

_nbins

sets nbins with given value.

_derivAperture

sets derivAperture with given value.

_winSigma

sets winSigma with given value.

_histogramNormType

sets histogramNormType with given value.

_L2HysThreshold

sets L2HysThreshold with given value.

_gammaCorrection

sets gammaCorrection with given value.

_nlevels

sets nlevels with given value.

_signedGradient

sets signedGradient with given value.

Returns

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;
_0

0 argument (EmbindString).

Returns

The HOGDescriptor | null result.

static getDefaultPeopleDetector

Returns coefficients of the classifier trained for people detection (for 64x128 windows).

getDefaultPeopleDetector(): FloatVector;
Returns

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;
Returns

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;
Returns

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;
Returns

The number result.

checkDetectorSize

Checks if detector size equal to descriptor size.

checkDetectorSize(): boolean;
Returns

The boolean result.

getWinSigma

Returns winSigma value

getWinSigma(): number;
Returns

The number result.

setSVMDetector

example: samples/peopledetect.cpp Sets coefficients for the linear SVM classifier.

setSVMDetector(svmdetector: Mat): void;
svmdetector

coefficients 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;
filename

Name of the file to read.

objname

The optional name of the node to read (if empty, the first top-level node will be used).

Returns

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;
filename

File name

objname

Object 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;
img

Matrix of the type CV_8U containing an image where HOG features will be calculated.

descriptors

Output destination, filled by the native operation. Matrix of the type CV_32F

winStride

Window stride. It must be a multiple of block stride.

padding

Padding

locations

Vector 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;
img

Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.

foundLocations

Output destination, filled by the native operation. Vector of point where each point contains left-top corner point of detected object boundaries.

weights

Output destination, filled by the native operation. Vector that will contain confidence values for each detected object.

hitThreshold

Threshold 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.

winStride

Window stride. It must be a multiple of block stride.

padding

Padding

searchLocations

Vector 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;
img

Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.

foundLocations

Output destination, filled by the native operation. Vector of rectangles where each rectangle contains the detected object.

foundWeights

Output destination, filled by the native operation. Vector that will contain confidence values for each detected object.

hitThreshold

Threshold 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.

winStride

Window stride. It must be a multiple of block stride.

padding

Padding

scale

Coefficient of the detection window increase.

groupThreshold

Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping.

useMeanshiftGrouping

indicates 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;
img

Matrix contains the image to be computed

grad

Input/output value, modified by the native operation. Matrix of type CV_32FC2 contains computed gradients

angleOfs

Input/output value, modified by the native operation. Matrix of type CV_8UC2 contains quantized gradient orientations

paddingTL

Padding from top-left

paddingBR

Padding 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.