pub struct HOGDescriptor { /* private fields */ }Expand description
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
Implementations§
Source§impl HOGDescriptor
impl HOGDescriptor
Sourcepub 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: HOGDescriptor_HistogramNormType,
_l2_hys_threshold: f64,
_gamma_correction: bool,
_nlevels: i32,
_signed_gradient: bool,
) -> Result<HOGDescriptor>
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: HOGDescriptor_HistogramNormType, _l2_hys_threshold: f64, _gamma_correction: bool, _nlevels: i32, _signed_gradient: bool, ) -> Result<HOGDescriptor>
Creates the HOG descriptor and detector with default parameters.
§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
- _win_size: Size(64,128)
- _block_size: Size(16,16)
- _block_stride: Size(8,8)
- _cell_size: Size(8,8)
- _nbins: 9
- _deriv_aperture: 1
- _win_sigma: -1
- _histogram_norm_type: HOGDescriptor::L2Hys
- _l2_hys_threshold: 0.2
- _gamma_correction: true
- _nlevels: HOGDescriptor::DEFAULT_NLEVELS
- _signed_gradient: false
Sourcepub fn new_def() -> Result<HOGDescriptor>
pub fn new_def() -> Result<HOGDescriptor>
Creates the HOG descriptor and detector with default parameters.
§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.
§Note
This alternative version of [new] function uses the following default values for its arguments:
- _win_size: Size(64,128)
- _block_size: Size(16,16)
- _block_stride: Size(8,8)
- _cell_size: Size(8,8)
- _nbins: 9
- _deriv_aperture: 1
- _win_sigma: -1
- _histogram_norm_type: HOGDescriptor::L2Hys
- _l2_hys_threshold: 0.2
- _gamma_correction: true
- _nlevels: HOGDescriptor::DEFAULT_NLEVELS
- _signed_gradient: false
Sourcepub fn new_from_file(filename: &str) -> Result<HOGDescriptor>
pub fn new_from_file(filename: &str) -> Result<HOGDescriptor>
Creates the HOG descriptor and detector with default parameters.
§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.
§Overloaded parameters
Creates the HOG descriptor and detector and loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.
- filename: The file name containing HOGDescriptor properties and coefficients for the linear SVM classifier.
Sourcepub fn copy(d: &impl HOGDescriptorTraitConst) -> Result<HOGDescriptor>
pub fn copy(d: &impl HOGDescriptorTraitConst) -> Result<HOGDescriptor>
Creates the HOG descriptor and detector with default parameters.
§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.
§Overloaded parameters
- d: the HOGDescriptor which cloned to create a new one.
Sourcepub fn get_default_people_detector() -> Result<Vector<f32>>
pub fn get_default_people_detector() -> Result<Vector<f32>>
Returns coefficients of the classifier trained for people detection (for 64x128 windows).
Sourcepub fn get_daimler_people_detector() -> Result<Vector<f32>>
pub fn get_daimler_people_detector() -> Result<Vector<f32>>
@example samples/hog_tapi.cpp / Returns coefficients of the classifier trained for people detection (for 48x96 windows).
Trait Implementations§
Source§impl Boxed for HOGDescriptor
impl Boxed for HOGDescriptor
Source§unsafe fn from_raw(
ptr: <HOGDescriptor as OpenCVFromExtern>::ExternReceive,
) -> Self
unsafe fn from_raw( ptr: <HOGDescriptor as OpenCVFromExtern>::ExternReceive, ) -> Self
Source§fn into_raw(self) -> <HOGDescriptor as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <HOGDescriptor as OpenCVTypeExternContainer>::ExternSendMut
Source§fn as_raw(&self) -> <HOGDescriptor as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <HOGDescriptor as OpenCVTypeExternContainer>::ExternSend
Source§fn as_raw_mut(
&mut self,
) -> <HOGDescriptor as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <HOGDescriptor as OpenCVTypeExternContainer>::ExternSendMut
Source§impl Debug for HOGDescriptor
impl Debug for HOGDescriptor
Source§impl Drop for HOGDescriptor
impl Drop for HOGDescriptor
Source§impl HOGDescriptorTrait for HOGDescriptor
impl HOGDescriptorTrait for HOGDescriptor
fn as_raw_mut_HOGDescriptor(&mut self) -> *mut c_void
Source§fn set_win_size(&mut self, val: Size)
fn set_win_size(&mut self, val: Size)
Source§fn set_block_size(&mut self, val: Size)
fn set_block_size(&mut self, val: Size)
Source§fn set_block_stride(&mut self, val: Size)
fn set_block_stride(&mut self, val: Size)
Source§fn set_cell_size(&mut self, val: Size)
fn set_cell_size(&mut self, val: Size)
Source§fn set_nbins(&mut self, val: i32)
fn set_nbins(&mut self, val: i32)
Source§fn set_deriv_aperture(&mut self, val: i32)
fn set_deriv_aperture(&mut self, val: i32)
Source§fn set_win_sigma(&mut self, val: f64)
fn set_win_sigma(&mut self, val: f64)
Source§fn set_histogram_norm_type(&mut self, val: HOGDescriptor_HistogramNormType)
fn set_histogram_norm_type(&mut self, val: HOGDescriptor_HistogramNormType)
Source§fn set_l2_hys_threshold(&mut self, val: f64)
fn set_l2_hys_threshold(&mut self, val: f64)
Source§fn set_gamma_correction(&mut self, val: bool)
fn set_gamma_correction(&mut self, val: bool)
Source§fn set_svm_detector(&mut self, val: Vector<f32>)
fn set_svm_detector(&mut self, val: Vector<f32>)
Source§fn set_ocl_svm_detector(&mut self, val: UMat)
fn set_ocl_svm_detector(&mut self, val: UMat)
Source§fn set_free_coef(&mut self, val: f32)
fn set_free_coef(&mut self, val: f32)
Source§fn set_nlevels(&mut self, val: i32)
fn set_nlevels(&mut self, val: i32)
Source§fn set_signed_gradient(&mut self, val: bool)
fn set_signed_gradient(&mut self, val: bool)
Source§fn set_svm_detector_input_array(
&mut self,
svmdetector: &impl ToInputArray,
) -> Result<()>
fn set_svm_detector_input_array( &mut self, svmdetector: &impl ToInputArray, ) -> Result<()>
Source§fn read(&mut self, fn_: &mut impl FileNodeTrait) -> Result<bool>
fn read(&mut self, fn_: &mut impl FileNodeTrait) -> Result<bool>
Source§impl HOGDescriptorTraitConst for HOGDescriptor
impl HOGDescriptorTraitConst for HOGDescriptor
fn as_raw_HOGDescriptor(&self) -> *const c_void
Source§fn win_size(&self) -> Size
fn win_size(&self) -> Size
Source§fn block_size(&self) -> Size
fn block_size(&self) -> Size
Source§fn block_stride(&self) -> Size
fn block_stride(&self) -> Size
Source§fn nbins(&self) -> i32
fn nbins(&self) -> i32
Source§fn deriv_aperture(&self) -> i32
fn deriv_aperture(&self) -> i32
Source§fn histogram_norm_type(&self) -> HOGDescriptor_HistogramNormType
fn histogram_norm_type(&self) -> HOGDescriptor_HistogramNormType
Source§fn l2_hys_threshold(&self) -> f64
fn l2_hys_threshold(&self) -> f64
Source§fn gamma_correction(&self) -> bool
fn gamma_correction(&self) -> bool
Source§fn svm_detector(&self) -> Vector<f32>
fn svm_detector(&self) -> Vector<f32>
Source§fn ocl_svm_detector(&self) -> UMat
fn ocl_svm_detector(&self) -> UMat
Source§fn signed_gradient(&self) -> bool
fn signed_gradient(&self) -> bool
Source§fn get_descriptor_size(&self) -> Result<size_t>
fn get_descriptor_size(&self) -> Result<size_t>
Source§fn check_detector_size(&self) -> Result<bool>
fn check_detector_size(&self) -> Result<bool>
Source§fn get_win_sigma(&self) -> Result<f64>
fn get_win_sigma(&self) -> Result<f64>
Source§fn write(&self, fs: &mut impl FileStorageTrait, objname: &str) -> Result<()>
fn write(&self, fs: &mut impl FileStorageTrait, objname: &str) -> Result<()>
Source§fn save(&self, filename: &str, objname: &str) -> Result<()>
fn save(&self, filename: &str, objname: &str) -> Result<()>
Source§fn save_def(&self, filename: &str) -> Result<()>
fn save_def(&self, filename: &str) -> Result<()>
Source§fn copy_to(&self, c: &mut impl HOGDescriptorTrait) -> Result<()>
fn copy_to(&self, c: &mut impl HOGDescriptorTrait) -> Result<()>
Source§fn compute(
&self,
img: &impl ToInputArray,
descriptors: &mut Vector<f32>,
win_stride: Size,
padding: Size,
locations: &Vector<Point>,
) -> Result<()>
fn compute( &self, img: &impl ToInputArray, descriptors: &mut Vector<f32>, win_stride: Size, padding: Size, locations: &Vector<Point>, ) -> Result<()>
Source§fn compute_def(
&self,
img: &impl ToInputArray,
descriptors: &mut Vector<f32>,
) -> Result<()>
fn compute_def( &self, img: &impl ToInputArray, descriptors: &mut Vector<f32>, ) -> Result<()>
Source§fn detect_weights(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Point>,
weights: &mut Vector<f64>,
hit_threshold: f64,
win_stride: Size,
padding: Size,
search_locations: &Vector<Point>,
) -> Result<()>
fn detect_weights( &self, img: &impl ToInputArray, found_locations: &mut Vector<Point>, weights: &mut Vector<f64>, hit_threshold: f64, win_stride: Size, padding: Size, search_locations: &Vector<Point>, ) -> Result<()>
Source§fn detect_weights_def(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Point>,
weights: &mut Vector<f64>,
) -> Result<()>
fn detect_weights_def( &self, img: &impl ToInputArray, found_locations: &mut Vector<Point>, weights: &mut Vector<f64>, ) -> Result<()>
Source§fn detect(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Point>,
hit_threshold: f64,
win_stride: Size,
padding: Size,
search_locations: &Vector<Point>,
) -> Result<()>
fn detect( &self, img: &impl ToInputArray, found_locations: &mut Vector<Point>, hit_threshold: f64, win_stride: Size, padding: Size, search_locations: &Vector<Point>, ) -> Result<()>
Source§fn detect_def(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Point>,
) -> Result<()>
fn detect_def( &self, img: &impl ToInputArray, found_locations: &mut Vector<Point>, ) -> Result<()>
Source§fn detect_multi_scale_weights(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Rect>,
found_weights: &mut Vector<f64>,
hit_threshold: f64,
win_stride: Size,
padding: Size,
scale: f64,
group_threshold: f64,
use_meanshift_grouping: bool,
) -> Result<()>
fn detect_multi_scale_weights( &self, img: &impl ToInputArray, found_locations: &mut Vector<Rect>, found_weights: &mut Vector<f64>, hit_threshold: f64, win_stride: Size, padding: Size, scale: f64, group_threshold: f64, use_meanshift_grouping: bool, ) -> Result<()>
Source§fn detect_multi_scale_weights_def(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Rect>,
found_weights: &mut Vector<f64>,
) -> Result<()>
fn detect_multi_scale_weights_def( &self, img: &impl ToInputArray, found_locations: &mut Vector<Rect>, found_weights: &mut Vector<f64>, ) -> Result<()>
Source§fn detect_multi_scale(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Rect>,
hit_threshold: f64,
win_stride: Size,
padding: Size,
scale: f64,
group_threshold: f64,
use_meanshift_grouping: bool,
) -> Result<()>
fn detect_multi_scale( &self, img: &impl ToInputArray, found_locations: &mut Vector<Rect>, hit_threshold: f64, win_stride: Size, padding: Size, scale: f64, group_threshold: f64, use_meanshift_grouping: bool, ) -> Result<()>
Source§fn detect_multi_scale_def(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Rect>,
) -> Result<()>
fn detect_multi_scale_def( &self, img: &impl ToInputArray, found_locations: &mut Vector<Rect>, ) -> Result<()>
Source§fn compute_gradient(
&self,
img: &impl ToInputArray,
grad: &mut impl ToInputOutputArray,
angle_ofs: &mut impl ToInputOutputArray,
padding_tl: Size,
padding_br: Size,
) -> Result<()>
fn compute_gradient( &self, img: &impl ToInputArray, grad: &mut impl ToInputOutputArray, angle_ofs: &mut impl ToInputOutputArray, padding_tl: Size, padding_br: Size, ) -> Result<()>
Source§fn compute_gradient_def(
&self,
img: &impl ToInputArray,
grad: &mut impl ToInputOutputArray,
angle_ofs: &mut impl ToInputOutputArray,
) -> Result<()>
fn compute_gradient_def( &self, img: &impl ToInputArray, grad: &mut impl ToInputOutputArray, angle_ofs: &mut impl ToInputOutputArray, ) -> Result<()>
Source§fn detect_roi(
&self,
img: &impl ToInputArray,
locations: &Vector<Point>,
found_locations: &mut Vector<Point>,
confidences: &mut Vector<f64>,
hit_threshold: f64,
win_stride: Size,
padding: Size,
) -> Result<()>
fn detect_roi( &self, img: &impl ToInputArray, locations: &Vector<Point>, found_locations: &mut Vector<Point>, confidences: &mut Vector<f64>, hit_threshold: f64, win_stride: Size, padding: Size, ) -> Result<()>
Source§fn detect_roi_def(
&self,
img: &impl ToInputArray,
locations: &Vector<Point>,
found_locations: &mut Vector<Point>,
confidences: &mut Vector<f64>,
) -> Result<()>
fn detect_roi_def( &self, img: &impl ToInputArray, locations: &Vector<Point>, found_locations: &mut Vector<Point>, confidences: &mut Vector<f64>, ) -> Result<()>
Source§fn detect_multi_scale_roi(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Rect>,
locations: &mut Vector<DetectionROI>,
hit_threshold: f64,
group_threshold: i32,
) -> Result<()>
fn detect_multi_scale_roi( &self, img: &impl ToInputArray, found_locations: &mut Vector<Rect>, locations: &mut Vector<DetectionROI>, hit_threshold: f64, group_threshold: i32, ) -> Result<()>
Source§fn detect_multi_scale_roi_def(
&self,
img: &impl ToInputArray,
found_locations: &mut Vector<Rect>,
locations: &mut Vector<DetectionROI>,
) -> Result<()>
fn detect_multi_scale_roi_def( &self, img: &impl ToInputArray, found_locations: &mut Vector<Rect>, locations: &mut Vector<DetectionROI>, ) -> Result<()>
impl Send for HOGDescriptor
Auto Trait Implementations§
impl !Sync for HOGDescriptor
impl Freeze for HOGDescriptor
impl RefUnwindSafe for HOGDescriptor
impl Unpin for HOGDescriptor
impl UnsafeUnpin for HOGDescriptor
impl UnwindSafe for HOGDescriptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Mat or another similar object. By passing
a mutable reference to the Mat to this function your closure will get called with the read reference and a write references
to the same Mat. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold. Read more