[][src]Struct opencv::objdetect::HOGDescriptor

pub struct HOGDescriptor { /* fields omitted */ }

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

Methods

impl HOGDescriptor[src]

pub fn as_raw_HOGDescriptor(&self) -> *mut c_void[src]

pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self[src]

impl HOGDescriptor[src]

pub fn win_size(&self) -> Result<Size>[src]

Detection window size. Align to block size and block stride. Default value is Size(64,128).

pub fn block_size(&self) -> Result<Size>[src]

Block size in pixels. Align to cell size. Default value is Size(16,16).

pub fn block_stride(&self) -> Result<Size>[src]

Block stride. It must be a multiple of cell size. Default value is Size(8,8).

pub fn cell_size(&self) -> Result<Size>[src]

Cell size. Default value is Size(8,8).

pub fn nbins(&self) -> Result<i32>[src]

Number of bins used in the calculation of histogram of gradients. Default value is 9.

pub fn deriv_aperture(&self) -> Result<i32>[src]

not documented

pub fn win_sigma(&self) -> Result<f64>[src]

Gaussian smoothing window parameter.

pub fn histogram_norm_type(&self) -> Result<i32>[src]

histogramNormType

pub fn l2_hys_threshold(&self) -> Result<f64>[src]

L2-Hys normalization method shrinkage.

pub fn gamma_correction(&self) -> Result<bool>[src]

Flag to specify whether the gamma correction preprocessing is required or not.

pub fn svm_detector(&mut self) -> Result<VectorOffloat>[src]

coefficients for the linear SVM classifier.

pub fn set_svm_detector_vec(&mut self, val: VectorOffloat) -> Result<()>[src]

coefficients for the linear SVM classifier.

pub fn nlevels(&self) -> Result<i32>[src]

Maximum number of detection window increases. Default value is 64

pub fn signed_gradient(&self) -> Result<bool>[src]

Indicates signed gradient will be used or not

pub fn default() -> Result<HOGDescriptor>[src]

Creates the HOG descriptor and detector with default params.

aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9, 1 )

pub fn new(
    _win_size: Size,
    _block_size: Size,
    _block_stride: Size,
    _cell_size: Size,
    _nbins: i32,
    _deriv_aperture: i32,
    _win_sigma: f64,
    _histogram_norm_type: i32,
    _l2_hys_threshold: f64,
    _gamma_correction: bool,
    _nlevels: i32,
    _signed_gradient: bool
) -> Result<HOGDescriptor>
[src]

Parameters

  • _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.

C++ default parameters

  • _deriv_aperture: 1
  • _win_sigma: -1
  • _histogram_norm_type: HOGDescriptor::L2Hys
  • _l2_hys_threshold: 0.2
  • _gamma_correction: false
  • _nlevels: HOGDescriptor::DEFAULT_NLEVELS
  • _signed_gradient: false

pub fn new_from_file(filename: &str) -> Result<HOGDescriptor>[src]

Parameters

  • filename: the file name containing HOGDescriptor properties and coefficients of the trained classifier

pub fn copy(d: &HOGDescriptor) -> Result<HOGDescriptor>[src]

Parameters

  • d: the HOGDescriptor which cloned to create a new one.

pub fn get_descriptor_size(&self) -> Result<size_t>[src]

Returns the number of coefficients required for the classification.

pub fn check_detector_size(&self) -> Result<bool>[src]

Checks if detector size equal to descriptor size.

pub fn get_win_sigma(&self) -> Result<f64>[src]

Returns winSigma value

pub fn set_svm_detector(
    &mut self,
    _svmdetector: &dyn ToInputArray
) -> Result<()>
[src]

Sets coefficients for the linear SVM classifier.

Parameters

  • _svmdetector: coefficients for the linear SVM classifier.

pub fn read(&mut self, _fn: &mut FileNode) -> Result<bool>[src]

Reads HOGDescriptor parameters from a file node.

Parameters

  • fn: File node

pub fn write(&self, fs: &mut FileStorage, objname: &str) -> Result<()>[src]

Stores HOGDescriptor parameters in a file storage.

Parameters

  • fs: File storage
  • objname: Object name

pub fn load(&mut self, filename: &str, objname: &str) -> Result<bool>[src]

loads coefficients for the linear SVM classifier from a file

Parameters

  • 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).

C++ default parameters

  • objname: String()

pub fn save(&self, filename: &str, objname: &str) -> Result<()>[src]

saves coefficients for the linear SVM classifier to a file

Parameters

  • filename: File name
  • objname: Object name

C++ default parameters

  • objname: String()

pub fn copy_to(&self, c: &mut HOGDescriptor) -> Result<()>[src]

clones the HOGDescriptor

Parameters

  • c: cloned HOGDescriptor

pub fn compute(
    &self,
    img: &dyn ToInputArray,
    descriptors: &mut VectorOffloat,
    win_stride: Size,
    padding: Size,
    locations: &VectorOfPoint
) -> Result<()>
[src]

Computes HOG descriptors of given image.

Parameters

  • img: Matrix of the type CV_8U containing an image where HOG features will be calculated.
  • descriptors: Matrix of the type CV_32F
  • winStride: Window stride. It must be a multiple of block stride.
  • padding: Padding
  • locations: Vector of Point

C++ default parameters

  • win_stride: Size()
  • padding: Size()
  • locations: std::vector()

pub fn detect_weights(
    &self,
    img: &Mat,
    found_locations: &mut VectorOfPoint,
    weights: &mut VectorOfdouble,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size,
    search_locations: &VectorOfPoint
) -> Result<()>
[src]

Performs object detection without a multi-scale window.

Parameters

  • img: Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  • foundLocations: Vector of point where each point contains left-top corner point of detected object boundaries.
  • weights: 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.

C++ default parameters

  • hit_threshold: 0
  • win_stride: Size()
  • padding: Size()
  • search_locations: std::vector()

pub fn detect(
    &self,
    img: &Mat,
    found_locations: &mut VectorOfPoint,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size,
    search_locations: &VectorOfPoint
) -> Result<()>
[src]

Performs object detection without a multi-scale window.

Parameters

  • img: Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  • foundLocations: Vector of point where each point contains left-top corner point of detected object boundaries.
  • 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 locations to search.

C++ default parameters

  • hit_threshold: 0
  • win_stride: Size()
  • padding: Size()
  • search_locations: std::vector()

pub fn detect_multi_scale_weights(
    &self,
    img: &dyn ToInputArray,
    found_locations: &mut VectorOfRect,
    found_weights: &mut VectorOfdouble,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size,
    scale: f64,
    final_threshold: f64,
    use_meanshift_grouping: bool
) -> Result<()>
[src]

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.

Parameters

  • img: Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  • foundLocations: Vector of rectangles where each rectangle contains the detected object.
  • foundWeights: 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.
  • finalThreshold: Final threshold
  • useMeanshiftGrouping: indicates grouping algorithm

C++ default parameters

  • hit_threshold: 0
  • win_stride: Size()
  • padding: Size()
  • scale: 1.05
  • final_threshold: 2.0
  • use_meanshift_grouping: false

pub fn detect_multi_scale(
    &self,
    img: &dyn ToInputArray,
    found_locations: &mut VectorOfRect,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size,
    scale: f64,
    final_threshold: f64,
    use_meanshift_grouping: bool
) -> Result<()>
[src]

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.

Parameters

  • img: Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  • foundLocations: Vector of rectangles where each rectangle contains the 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.
  • finalThreshold: Final threshold
  • useMeanshiftGrouping: indicates grouping algorithm

C++ default parameters

  • hit_threshold: 0
  • win_stride: Size()
  • padding: Size()
  • scale: 1.05
  • final_threshold: 2.0
  • use_meanshift_grouping: false

pub fn compute_gradient(
    &self,
    img: &Mat,
    grad: &mut Mat,
    angle_ofs: &mut Mat,
    padding_tl: Size,
    padding_br: Size
) -> Result<()>
[src]

Computes gradients and quantized gradient orientations.

Parameters

  • img: Matrix contains the image to be computed
  • grad: Matrix of type CV_32FC2 contains computed gradients
  • angleOfs: Matrix of type CV_8UC2 contains quantized gradient orientations
  • paddingTL: Padding from top-left
  • paddingBR: Padding from bottom-right

C++ default parameters

  • padding_tl: Size()
  • padding_br: Size()

pub fn get_default_people_detector() -> Result<VectorOffloat>[src]

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

pub fn get_daimler_people_detector() -> Result<VectorOffloat>[src]

Returns coefficients of the classifier trained for people detection (for 48x96 windows).

pub fn detect_roi(
    &self,
    img: &Mat,
    locations: &VectorOfPoint,
    found_locations: &mut VectorOfPoint,
    confidences: &mut VectorOfdouble,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size
) -> Result<()>
[src]

evaluate specified ROI and return confidence value for each location

Parameters

  • img: Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  • locations: Vector of Point
  • foundLocations: Vector of Point where each Point is detected object's top-left point.
  • confidences: confidences
  • 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: winStride
  • padding: padding

C++ default parameters

  • hit_threshold: 0
  • win_stride: Size()
  • padding: Size()

pub fn detect_multi_scale_roi(
    &self,
    img: &Mat,
    found_locations: &mut VectorOfRect,
    locations: &mut VectorOfDetectionROI,
    hit_threshold: f64,
    group_threshold: i32
) -> Result<()>
[src]

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

Parameters

  • img: Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  • foundLocations: Vector of rectangles where each rectangle contains the detected object.
  • locations: Vector of DetectionROI
  • 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.
  • groupThreshold: Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it.

C++ default parameters

  • hit_threshold: 0
  • group_threshold: 0

pub fn read_alt_model(&mut self, modelfile: &str) -> Result<()>[src]

read/parse Dalal's alt model file

Parameters

  • modelfile: Path of Dalal's alt model file.

pub fn group_rectangles(
    &self,
    rect_list: &mut VectorOfRect,
    weights: &mut VectorOfdouble,
    group_threshold: i32,
    eps: f64
) -> Result<()>
[src]

Groups the object candidate rectangles.

Parameters

  • rectList: Input/output vector of rectangles. Output vector includes retained and grouped rectangles. (The Python list is not modified in place.)
  • weights: Input/output vector of weights of rectangles. Output vector includes weights of retained and grouped rectangles. (The Python list is not modified in place.)
  • groupThreshold: Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it.
  • eps: Relative difference between sides of the rectangles to merge them into a group.

Trait Implementations

impl Send for HOGDescriptor[src]

impl Drop for HOGDescriptor[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]