[][src]Trait opencv::objdetect::HOGDescriptorTrait

pub trait HOGDescriptorTrait {
    fn as_raw_HOGDescriptor(&self) -> *mut c_void;

    fn win_size(&self) -> Size { ... }
fn set_win_size(&mut self, val: Size) { ... }
fn block_size(&self) -> Size { ... }
fn set_block_size(&mut self, val: Size) { ... }
fn block_stride(&self) -> Size { ... }
fn set_block_stride(&mut self, val: Size) { ... }
fn cell_size(&self) -> Size { ... }
fn set_cell_size(&mut self, val: Size) { ... }
fn nbins(&self) -> i32 { ... }
fn set_nbins(&mut self, val: i32) { ... }
fn deriv_aperture(&self) -> i32 { ... }
fn set_deriv_aperture(&mut self, val: i32) { ... }
fn win_sigma(&self) -> f64 { ... }
fn set_win_sigma(&mut self, val: f64) { ... }
fn histogram_norm_type(&self) -> HOGDescriptor_HistogramNormType { ... }
fn set_histogram_norm_type(&mut self, val: HOGDescriptor_HistogramNormType) { ... }
fn l2_hys_threshold(&self) -> f64 { ... }
fn set_l2_hys_threshold(&mut self, val: f64) { ... }
fn gamma_correction(&self) -> bool { ... }
fn set_gamma_correction(&mut self, val: bool) { ... }
fn svm_detector(&mut self) -> VectorOff32 { ... }
fn set_svm_detector_vec(&mut self, val: VectorOff32) { ... }
fn ocl_svm_detector(&mut self) -> UMat { ... }
fn set_ocl_svm_detector(&mut self, val: UMat) { ... }
fn free_coef(&self) -> f32 { ... }
fn set_free_coef(&mut self, val: f32) { ... }
fn nlevels(&self) -> i32 { ... }
fn set_nlevels(&mut self, val: i32) { ... }
fn signed_gradient(&self) -> bool { ... }
fn set_signed_gradient(&mut self, val: bool) { ... }
fn get_descriptor_size(&self) -> Result<size_t> { ... }
fn check_detector_size(&self) -> Result<bool> { ... }
fn get_win_sigma(&self) -> Result<f64> { ... }
fn set_svm_detector(&mut self, svmdetector: &dyn ToInputArray) -> Result<()> { ... }
fn read(&mut self, fn_: &mut FileNode) -> Result<bool> { ... }
fn write(&self, fs: &mut FileStorage, objname: &str) -> Result<()> { ... }
fn load(&mut self, filename: &str, objname: &str) -> Result<bool> { ... }
fn save(&self, filename: &str, objname: &str) -> Result<()> { ... }
fn copy_to(&self, c: &mut HOGDescriptor) -> Result<()> { ... }
fn compute(
        &self,
        img: &dyn ToInputArray,
        descriptors: &mut VectorOff32,
        win_stride: Size,
        padding: Size,
        locations: &VectorOfPoint
    ) -> Result<()> { ... }
fn detect_weights(
        &self,
        img: &dyn ToInputArray,
        found_locations: &mut VectorOfPoint,
        weights: &mut VectorOff64,
        hit_threshold: f64,
        win_stride: Size,
        padding: Size,
        search_locations: &VectorOfPoint
    ) -> Result<()> { ... }
fn detect(
        &self,
        img: &dyn ToInputArray,
        found_locations: &mut VectorOfPoint,
        hit_threshold: f64,
        win_stride: Size,
        padding: Size,
        search_locations: &VectorOfPoint
    ) -> Result<()> { ... }
fn detect_multi_scale_weights(
        &self,
        img: &dyn ToInputArray,
        found_locations: &mut VectorOfRect,
        found_weights: &mut VectorOff64,
        hit_threshold: f64,
        win_stride: Size,
        padding: Size,
        scale: f64,
        final_threshold: f64,
        use_meanshift_grouping: bool
    ) -> Result<()> { ... }
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<()> { ... }
fn compute_gradient(
        &self,
        img: &dyn ToInputArray,
        grad: &mut dyn ToInputOutputArray,
        angle_ofs: &mut dyn ToInputOutputArray,
        padding_tl: Size,
        padding_br: Size
    ) -> Result<()> { ... }
fn detect_roi(
        &self,
        img: &dyn ToInputArray,
        locations: &VectorOfPoint,
        found_locations: &mut VectorOfPoint,
        confidences: &mut VectorOff64,
        hit_threshold: f64,
        win_stride: Size,
        padding: Size
    ) -> Result<()> { ... }
fn detect_multi_scale_roi(
        &self,
        img: &dyn ToInputArray,
        found_locations: &mut VectorOfRect,
        locations: &mut VectorOfDetectionROI,
        hit_threshold: f64,
        group_threshold: i32
    ) -> Result<()> { ... }
fn group_rectangles(
        &self,
        rect_list: &mut VectorOfRect,
        weights: &mut VectorOff64,
        group_threshold: i32,
        eps: f64
    ) -> Result<()> { ... } }

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

Required methods

Loading content...

Provided methods

fn win_size(&self) -> Size

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

fn set_win_size(&mut self, val: Size)

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

fn block_size(&self) -> Size

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

fn set_block_size(&mut self, val: Size)

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

fn block_stride(&self) -> Size

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

fn set_block_stride(&mut self, val: Size)

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

fn cell_size(&self) -> Size

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

fn set_cell_size(&mut self, val: Size)

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

fn nbins(&self) -> i32

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

fn set_nbins(&mut self, val: i32)

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

fn deriv_aperture(&self) -> i32

not documented

fn set_deriv_aperture(&mut self, val: i32)

not documented

fn win_sigma(&self) -> f64

Gaussian smoothing window parameter.

fn set_win_sigma(&mut self, val: f64)

Gaussian smoothing window parameter.

fn histogram_norm_type(&self) -> HOGDescriptor_HistogramNormType

histogramNormType

fn set_histogram_norm_type(&mut self, val: HOGDescriptor_HistogramNormType)

histogramNormType

fn l2_hys_threshold(&self) -> f64

L2-Hys normalization method shrinkage.

fn set_l2_hys_threshold(&mut self, val: f64)

L2-Hys normalization method shrinkage.

fn gamma_correction(&self) -> bool

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

fn set_gamma_correction(&mut self, val: bool)

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

fn svm_detector(&mut self) -> VectorOff32

coefficients for the linear SVM classifier.

fn set_svm_detector_vec(&mut self, val: VectorOff32)

coefficients for the linear SVM classifier.

fn ocl_svm_detector(&mut self) -> UMat

coefficients for the linear SVM classifier used when OpenCL is enabled

fn set_ocl_svm_detector(&mut self, val: UMat)

coefficients for the linear SVM classifier used when OpenCL is enabled

fn free_coef(&self) -> f32

not documented

fn set_free_coef(&mut self, val: f32)

not documented

fn nlevels(&self) -> i32

Maximum number of detection window increases. Default value is 64

fn set_nlevels(&mut self, val: i32)

Maximum number of detection window increases. Default value is 64

fn signed_gradient(&self) -> bool

Indicates signed gradient will be used or not

fn set_signed_gradient(&mut self, val: bool)

Indicates signed gradient will be used or not

fn get_descriptor_size(&self) -> Result<size_t>

Returns the number of coefficients required for the classification.

fn check_detector_size(&self) -> Result<bool>

Checks if detector size equal to descriptor size.

fn get_win_sigma(&self) -> Result<f64>

Returns winSigma value

fn set_svm_detector(&mut self, svmdetector: &dyn ToInputArray) -> Result<()>

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

Parameters

  • svmdetector: coefficients for the linear SVM classifier.

fn read(&mut self, fn_: &mut FileNode) -> Result<bool>

Reads HOGDescriptor parameters from a cv::FileNode.

Parameters

  • fn: File node

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

Stores HOGDescriptor parameters in a cv::FileStorage.

Parameters

  • fs: File storage
  • objname: Object name

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

loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.

Parameters

  • filename: Path 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()

fn save(&self, filename: &str, objname: &str) -> Result<()>

saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file

Parameters

  • filename: File name
  • objname: Object name

C++ default parameters

  • objname: String()

fn copy_to(&self, c: &mut HOGDescriptor) -> Result<()>

clones the HOGDescriptor

Parameters

  • c: cloned HOGDescriptor

fn compute(
    &self,
    img: &dyn ToInputArray,
    descriptors: &mut VectorOff32,
    win_stride: Size,
    padding: Size,
    locations: &VectorOfPoint
) -> Result<()>

@example samples/cpp/train_HOG.cpp / 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()

fn detect_weights(
    &self,
    img: &dyn ToInputArray,
    found_locations: &mut VectorOfPoint,
    weights: &mut VectorOff64,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size,
    search_locations: &VectorOfPoint
) -> Result<()>

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()

fn detect(
    &self,
    img: &dyn ToInputArray,
    found_locations: &mut VectorOfPoint,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size,
    search_locations: &VectorOfPoint
) -> Result<()>

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()

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

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

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<()>

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

fn compute_gradient(
    &self,
    img: &dyn ToInputArray,
    grad: &mut dyn ToInputOutputArray,
    angle_ofs: &mut dyn ToInputOutputArray,
    padding_tl: Size,
    padding_br: Size
) -> Result<()>

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()

fn detect_roi(
    &self,
    img: &dyn ToInputArray,
    locations: &VectorOfPoint,
    found_locations: &mut VectorOfPoint,
    confidences: &mut VectorOff64,
    hit_threshold: f64,
    win_stride: Size,
    padding: Size
) -> Result<()>

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()

fn detect_multi_scale_roi(
    &self,
    img: &dyn ToInputArray,
    found_locations: &mut VectorOfRect,
    locations: &mut VectorOfDetectionROI,
    hit_threshold: f64,
    group_threshold: i32
) -> Result<()>

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

fn group_rectangles(
    &self,
    rect_list: &mut VectorOfRect,
    weights: &mut VectorOff64,
    group_threshold: i32,
    eps: f64
) -> Result<()>

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.
Loading content...

Implementors

impl HOGDescriptorTrait for HOGDescriptor[src]

Loading content...