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 default() -> Result<HOGDescriptor>
pub fn default() -> Result<HOGDescriptor>
Creates the HOG descriptor and detector with default parameters.
aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )
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.
aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )
§Overloaded 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
- _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
sourcepub fn new_def(
_win_size: Size,
_block_size: Size,
_block_stride: Size,
_cell_size: Size,
_nbins: i32,
) -> Result<HOGDescriptor>
pub fn new_def( _win_size: Size, _block_size: Size, _block_stride: Size, _cell_size: Size, _nbins: i32, ) -> Result<HOGDescriptor>
@overload
§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:
- _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
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.
aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )
§Overloaded parameters
Creates the HOG descriptor and detector and loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.
§Parameters
- 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>
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/tapi/hog.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_vec(&mut self, val: Vector<f32>)
fn set_svm_detector_vec(&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(&mut self, svmdetector: &impl ToInputArray) -> Result<()>
fn set_svm_detector(&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 Freeze for HOGDescriptor
impl RefUnwindSafe for HOGDescriptor
impl !Sync for HOGDescriptor
impl Unpin 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