#![allow(
unused_parens,
clippy::excessive_precision,
clippy::missing_safety_doc,
clippy::should_implement_trait,
clippy::too_many_arguments,
clippy::unused_unit,
clippy::let_unit_value,
clippy::derive_partial_eq_without_eq,
)]
use crate::{mod_prelude::*, core, sys, types};
pub mod prelude {
pub use { super::DPMDetector_ObjectDetectionTraitConst, super::DPMDetector_ObjectDetectionTrait, super::DPMDetectorConst, super::DPMDetector };
}
pub trait DPMDetectorConst {
fn as_raw_DPMDetector(&self) -> *const c_void;
#[inline]
fn is_empty(&self) -> Result<bool> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_isEmpty_const(self.as_raw_DPMDetector(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
#[inline]
fn get_class_names(&self) -> Result<core::Vector<String>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_getClassNames_const(self.as_raw_DPMDetector(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Vector::<String>::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
fn get_class_count(&self) -> Result<size_t> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_getClassCount_const(self.as_raw_DPMDetector(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
pub trait DPMDetector: crate::dpm::DPMDetectorConst {
fn as_raw_mut_DPMDetector(&mut self) -> *mut c_void;
#[inline]
fn detect(&mut self, image: &mut core::Mat, objects: &mut core::Vector<crate::dpm::DPMDetector_ObjectDetection>) -> Result<()> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_detect_MatR_vectorLObjectDetectionGR(self.as_raw_mut_DPMDetector(), image.as_raw_mut_Mat(), objects.as_raw_mut_VectorOfDPMDetector_ObjectDetection(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
Ok(ret)
}
}
impl dyn DPMDetector + '_ {
#[inline]
pub fn create(filenames: &core::Vector<String>, class_names: &core::Vector<String>) -> Result<core::Ptr<dyn crate::dpm::DPMDetector>> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_create_const_vectorLstringGR_const_vectorLstringGR(filenames.as_raw_VectorOfString(), class_names.as_raw_VectorOfString(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { core::Ptr::<dyn crate::dpm::DPMDetector>::opencv_from_extern(ret) };
Ok(ret)
}
}
pub trait DPMDetector_ObjectDetectionTraitConst {
fn as_raw_DPMDetector_ObjectDetection(&self) -> *const c_void;
#[inline]
fn rect(&self) -> core::Rect {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_getPropRect_const(self.as_raw_DPMDetector_ObjectDetection(), ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
ret
}
#[inline]
fn score(&self) -> f32 {
let ret = unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_getPropScore_const(self.as_raw_DPMDetector_ObjectDetection()) };
ret
}
#[inline]
fn class_id(&self) -> i32 {
let ret = unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_getPropClassID_const(self.as_raw_DPMDetector_ObjectDetection()) };
ret
}
}
pub trait DPMDetector_ObjectDetectionTrait: crate::dpm::DPMDetector_ObjectDetectionTraitConst {
fn as_raw_mut_DPMDetector_ObjectDetection(&mut self) -> *mut c_void;
#[inline]
fn set_rect(&mut self, val: core::Rect) {
let ret = unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_setPropRect_Rect(self.as_raw_mut_DPMDetector_ObjectDetection(), val.opencv_as_extern()) };
ret
}
#[inline]
fn set_score(&mut self, val: f32) {
let ret = unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_setPropScore_float(self.as_raw_mut_DPMDetector_ObjectDetection(), val) };
ret
}
#[inline]
fn set_class_id(&mut self, val: i32) {
let ret = unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_setPropClassID_int(self.as_raw_mut_DPMDetector_ObjectDetection(), val) };
ret
}
}
pub struct DPMDetector_ObjectDetection {
ptr: *mut c_void
}
opencv_type_boxed! { DPMDetector_ObjectDetection }
impl Drop for DPMDetector_ObjectDetection {
fn drop(&mut self) {
extern "C" { fn cv_DPMDetector_ObjectDetection_delete(instance: *mut c_void); }
unsafe { cv_DPMDetector_ObjectDetection_delete(self.as_raw_mut_DPMDetector_ObjectDetection()) };
}
}
unsafe impl Send for DPMDetector_ObjectDetection {}
impl crate::dpm::DPMDetector_ObjectDetectionTraitConst for DPMDetector_ObjectDetection {
#[inline] fn as_raw_DPMDetector_ObjectDetection(&self) -> *const c_void { self.as_raw() }
}
impl crate::dpm::DPMDetector_ObjectDetectionTrait for DPMDetector_ObjectDetection {
#[inline] fn as_raw_mut_DPMDetector_ObjectDetection(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl DPMDetector_ObjectDetection {
#[inline]
pub fn default() -> Result<crate::dpm::DPMDetector_ObjectDetection> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_ObjectDetection(ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::dpm::DPMDetector_ObjectDetection::opencv_from_extern(ret) };
Ok(ret)
}
#[inline]
pub fn new(rect: core::Rect, score: f32, class_id: i32) -> Result<crate::dpm::DPMDetector_ObjectDetection> {
return_send!(via ocvrs_return);
unsafe { sys::cv_dpm_DPMDetector_ObjectDetection_ObjectDetection_const_RectR_float_int(&rect, score, class_id, ocvrs_return.as_mut_ptr()) };
return_receive!(unsafe ocvrs_return => ret);
let ret = ret.into_result()?;
let ret = unsafe { crate::dpm::DPMDetector_ObjectDetection::opencv_from_extern(ret) };
Ok(ret)
}
}