use crate::{mod_prelude::*, core, sys, types};
use crate::core::{_InputArrayTrait, _OutputArrayTrait};
pub const Blob_ALLOC_MAT: i32 = 1 << 0;
pub const Blob_ALLOC_UMAT: i32 = 1 << 1;
pub const Blob_HEAD_AT_MAT: i32 = 1 << 0;
pub const Blob_HEAD_AT_UMAT: i32 = 1 << 1;
pub const Blob_UNINITIALIZED: i32 = 0;
pub const EltwiseLayer_PROD: i32 = 0;
pub const EltwiseLayer_SUM: i32 = 1;
pub const LRNLayer_CHANNEL_NRM: i32 = 0;
pub const LRNLayer_SPATIAL_NRM: i32 = 1;
pub const PoolingLayer_AVE: i32 = 1;
pub const PoolingLayer_MAX: i32 = 0;
pub const PoolingLayer_STOCHASTIC: i32 = 2;
pub fn compute_shape_by_reshape_mask(src_shape: &crate::dnn::BlobShape, mask_shape: &crate::dnn::BlobShape, src_range: &core::Range) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_computeShapeByReshapeMask_BlobShape_BlobShape_Range(src_shape.as_raw_BlobShape(), mask_shape.as_raw_BlobShape(), src_range.as_raw_Range()) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn create_caffe_importer(prototxt: &str, caffe_model: &str) -> Result<types::PtrOfImporter> {
string_arg!(prototxt);
string_arg!(caffe_model);
unsafe { sys::cv_dnn_createCaffeImporter_String_String(prototxt.as_ptr(), caffe_model.as_ptr()) }.into_result().map(|ptr| types::PtrOfImporter { ptr })
}
pub fn create_tensorflow_importer(model: &str) -> Result<types::PtrOfImporter> {
string_arg!(model);
unsafe { sys::cv_dnn_createTensorflowImporter_String(model.as_ptr()) }.into_result().map(|ptr| types::PtrOfImporter { ptr })
}
pub fn create_torch_importer(filename: &str, is_binary: bool) -> Result<types::PtrOfImporter> {
string_arg!(filename);
unsafe { sys::cv_dnn_createTorchImporter_String_bool(filename.as_ptr(), is_binary) }.into_result().map(|ptr| types::PtrOfImporter { ptr })
}
pub fn init_module() -> Result<()> {
unsafe { sys::cv_dnn_initModule() }.into_result()
}
pub fn read_net_from_caffe(prototxt: &str, caffe_model: &str) -> Result<crate::dnn::Net> {
string_arg!(prototxt);
string_arg!(caffe_model);
unsafe { sys::cv_dnn_readNetFromCaffe_String_String(prototxt.as_ptr(), caffe_model.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_torch_blob(filename: &str, is_binary: bool) -> Result<crate::dnn::Blob> {
string_arg!(filename);
unsafe { sys::cv_dnn_readTorchBlob_String_bool(filename.as_ptr(), is_binary) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub struct AbsLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for AbsLayer {
fn drop(&mut self) {
unsafe { sys::cv_AbsLayer_delete(self.ptr) };
}
}
impl AbsLayer {
#[inline(always)] pub fn as_raw_AbsLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for AbsLayer {}
impl crate::dnn::Layer for AbsLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl AbsLayer {
pub fn create() -> Result<types::PtrOfAbsLayer> {
unsafe { sys::cv_dnn_AbsLayer_create() }.into_result().map(|ptr| types::PtrOfAbsLayer { ptr })
}
}
pub struct BNLLLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BNLLLayer {
fn drop(&mut self) {
unsafe { sys::cv_BNLLLayer_delete(self.ptr) };
}
}
impl BNLLLayer {
#[inline(always)] pub fn as_raw_BNLLLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BNLLLayer {}
impl crate::dnn::Layer for BNLLLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl BNLLLayer {
pub fn create() -> Result<types::PtrOfBNLLLayer> {
unsafe { sys::cv_dnn_BNLLLayer_create() }.into_result().map(|ptr| types::PtrOfBNLLLayer { ptr })
}
}
pub trait BaseConvolutionLayerTrait: crate::dnn::Layer {
fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void;
fn kernel(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_kernel_const(self.as_raw_BaseConvolutionLayer()) }.into_result()
}
fn set_kernel(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_set_kernel_Size(self.as_raw_BaseConvolutionLayer(), val) }.into_result()
}
fn stride(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_stride_const(self.as_raw_BaseConvolutionLayer()) }.into_result()
}
fn set_stride(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_set_stride_Size(self.as_raw_BaseConvolutionLayer(), val) }.into_result()
}
fn pad(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_pad_const(self.as_raw_BaseConvolutionLayer()) }.into_result()
}
fn set_pad(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_set_pad_Size(self.as_raw_BaseConvolutionLayer(), val) }.into_result()
}
fn dilation(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_dilation_const(self.as_raw_BaseConvolutionLayer()) }.into_result()
}
fn set_dilation(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_set_dilation_Size(self.as_raw_BaseConvolutionLayer(), val) }.into_result()
}
fn pad_mode(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_BaseConvolutionLayer_padMode(self.as_raw_BaseConvolutionLayer()) }.into_result().map(crate::templ::receive_string_mut)
}
fn set_pad_mode(&mut self, val: &str) -> Result<()> {
string_arg!(mut val);
unsafe { sys::cv_dnn_BaseConvolutionLayer_set_padMode_String(self.as_raw_BaseConvolutionLayer(), val.as_ptr() as _) }.into_result()
}
}
pub struct BaseConvolutionLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BaseConvolutionLayer {
fn drop(&mut self) {
unsafe { sys::cv_BaseConvolutionLayer_delete(self.ptr) };
}
}
impl BaseConvolutionLayer {
#[inline(always)] pub fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BaseConvolutionLayer {}
impl crate::dnn::BaseConvolutionLayerTrait for BaseConvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer for BaseConvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
pub struct Blob {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for Blob {
fn drop(&mut self) {
unsafe { sys::cv_Blob_delete(self.ptr) };
}
}
impl Blob {
#[inline(always)] pub fn as_raw_Blob(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Blob {}
impl Blob {
pub fn default() -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_Blob_Blob() }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn new(shape: &crate::dnn::BlobShape, _type: i32, alloc_flags: i32) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_Blob_Blob_BlobShape_int_int(shape.as_raw_BlobShape(), _type, alloc_flags) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn new_1(data: &dyn core::ToInputArray) -> Result<crate::dnn::Blob> {
input_array_arg!(data);
unsafe { sys::cv_dnn_Blob_Blob__InputArray(data.as_raw__InputArray()) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn from_images(image: &dyn core::ToInputArray, dst_cn: i32) -> Result<crate::dnn::Blob> {
input_array_arg!(image);
unsafe { sys::cv_dnn_Blob_fromImages__InputArray_int(image.as_raw__InputArray(), dst_cn) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn batch_from_images(&mut self, image: &dyn core::ToInputArray, dst_cn: i32) -> Result<()> {
input_array_arg!(image);
unsafe { sys::cv_dnn_Blob_batchFromImages__InputArray_int(self.as_raw_Blob(), image.as_raw__InputArray(), dst_cn) }.into_result()
}
pub fn create(&mut self, shape: &crate::dnn::BlobShape, _type: i32, alloc_flags: i32) -> Result<()> {
unsafe { sys::cv_dnn_Blob_create_BlobShape_int_int(self.as_raw_Blob(), shape.as_raw_BlobShape(), _type, alloc_flags) }.into_result()
}
pub fn fill(&mut self, _in: &dyn core::ToInputArray) -> Result<()> {
input_array_arg!(_in);
unsafe { sys::cv_dnn_Blob_fill__InputArray(self.as_raw_Blob(), _in.as_raw__InputArray()) }.into_result()
}
pub fn fill_1(&mut self, shape: &crate::dnn::BlobShape, _type: i32, data: &mut c_void, deep_copy: bool) -> Result<()> {
unsafe { sys::cv_dnn_Blob_fill_BlobShape_int_void_X_bool(self.as_raw_Blob(), shape.as_raw_BlobShape(), _type, data, deep_copy) }.into_result()
}
pub fn set_to(&mut self, value: &dyn core::ToInputArray, alloc_flags: i32) -> Result<()> {
input_array_arg!(value);
unsafe { sys::cv_dnn_Blob_setTo__InputArray_int(self.as_raw_Blob(), value.as_raw__InputArray(), alloc_flags) }.into_result()
}
pub fn mat_ref(&mut self, write_only: bool) -> Result<core::Mat> {
unsafe { sys::cv_dnn_Blob_matRef_bool(self.as_raw_Blob(), write_only) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn mat_ref_const(&self) -> Result<core::Mat> {
unsafe { sys::cv_dnn_Blob_matRefConst_const(self.as_raw_Blob()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn umat_ref(&mut self, write_only: bool) -> Result<core::UMat> {
unsafe { sys::cv_dnn_Blob_umatRef_bool(self.as_raw_Blob(), write_only) }.into_result().map(|ptr| core::UMat { ptr })
}
pub fn umat_ref_const(&self) -> Result<core::UMat> {
unsafe { sys::cv_dnn_Blob_umatRefConst_const(self.as_raw_Blob()) }.into_result().map(|ptr| core::UMat { ptr })
}
pub fn update_mat(&self, sync_data: bool) -> Result<()> {
unsafe { sys::cv_dnn_Blob_updateMat_const_bool(self.as_raw_Blob(), sync_data) }.into_result()
}
pub fn update_u_mat(&self, sync_data: bool) -> Result<()> {
unsafe { sys::cv_dnn_Blob_updateUMat_const_bool(self.as_raw_Blob(), sync_data) }.into_result()
}
pub fn sync(&self) -> Result<()> {
unsafe { sys::cv_dnn_Blob_sync_const(self.as_raw_Blob()) }.into_result()
}
pub fn dims(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_dims_const(self.as_raw_Blob()) }.into_result()
}
pub fn size(&self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_size_const_int(self.as_raw_Blob(), axis) }.into_result()
}
pub fn xsize(&self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_xsize_const_int(self.as_raw_Blob(), axis) }.into_result()
}
pub fn total(&self, start_axis: i32, end_axis: i32) -> Result<size_t> {
unsafe { sys::cv_dnn_Blob_total_const_int_int(self.as_raw_Blob(), start_axis, end_axis) }.into_result()
}
pub fn canonical_axis(&self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_canonicalAxis_const_int(self.as_raw_Blob(), axis) }.into_result()
}
pub fn shape(&self) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_Blob_shape_const(self.as_raw_Blob()) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn equal_shape(&self, other: &crate::dnn::Blob) -> Result<bool> {
unsafe { sys::cv_dnn_Blob_equalShape_const_Blob(self.as_raw_Blob(), other.as_raw_Blob()) }.into_result()
}
pub fn get_plane(&mut self, n: i32, cn: i32) -> Result<core::Mat> {
unsafe { sys::cv_dnn_Blob_getPlane_int_int(self.as_raw_Blob(), n, cn) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn get_planes(&mut self, n: i32) -> Result<core::Mat> {
unsafe { sys::cv_dnn_Blob_getPlanes_int(self.as_raw_Blob(), n) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn cols(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_cols_const(self.as_raw_Blob()) }.into_result()
}
pub fn rows(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_rows_const(self.as_raw_Blob()) }.into_result()
}
pub fn channels(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_channels_const(self.as_raw_Blob()) }.into_result()
}
pub fn num(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_num_const(self.as_raw_Blob()) }.into_result()
}
pub fn size2(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_Blob_size2_const(self.as_raw_Blob()) }.into_result()
}
pub fn shape4(&self) -> Result<core::Vec4i> {
unsafe { sys::cv_dnn_Blob_shape4_const(self.as_raw_Blob()) }.into_result()
}
pub fn offset(&self, n: i32, cn: i32, row: i32, col: i32) -> Result<size_t> {
unsafe { sys::cv_dnn_Blob_offset_const_int_int_int_int(self.as_raw_Blob(), n, cn, row, col) }.into_result()
}
pub fn ptr(&mut self, n: i32, cn: i32, row: i32, col: i32) -> Result<&mut u8> {
unsafe { sys::cv_dnn_Blob_ptr_int_int_int_int(self.as_raw_Blob(), n, cn, row, col) }.into_result().and_then(|x| unsafe { x.as_mut() }.ok_or_else(|| Error::new(core::StsNullPtr, "Function returned Null pointer".to_string())))
}
pub fn ptrf(&mut self, n: i32, cn: i32, row: i32, col: i32) -> Result<&mut f32> {
unsafe { sys::cv_dnn_Blob_ptrf_int_int_int_int(self.as_raw_Blob(), n, cn, row, col) }.into_result().and_then(|x| unsafe { x.as_mut() }.ok_or_else(|| Error::new(core::StsNullPtr, "Function returned Null pointer".to_string())))
}
pub fn share_from(&mut self, blob: &crate::dnn::Blob) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_Blob_shareFrom_Blob(self.as_raw_Blob(), blob.as_raw_Blob()) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn reshape(&mut self, shape: &crate::dnn::BlobShape) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_Blob_reshape_BlobShape(self.as_raw_Blob(), shape.as_raw_BlobShape()) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn reshaped(&self, new_shape: &crate::dnn::BlobShape) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_Blob_reshaped_const_BlobShape(self.as_raw_Blob(), new_shape.as_raw_BlobShape()) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn _type(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_type_const(self.as_raw_Blob()) }.into_result()
}
pub fn elem_size(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_elemSize_const(self.as_raw_Blob()) }.into_result()
}
pub fn get_state(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Blob_getState_const(self.as_raw_Blob()) }.into_result()
}
}
pub struct BlobShape {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BlobShape {
fn drop(&mut self) {
unsafe { sys::cv_BlobShape_delete(self.ptr) };
}
}
impl BlobShape {
#[inline(always)] pub fn as_raw_BlobShape(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BlobShape {}
impl BlobShape {
pub fn default() -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape() }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn new(s0: i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape_int(s0) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn new_1(s0: i32, s1: i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape_int_int(s0, s1) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn new_2(s0: i32, s1: i32, s2: i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape_int_int_int(s0, s1, s2) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn new_3(num: i32, cn: i32, rows: i32, cols: i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape_int_int_int_int(num, cn, rows, cols) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn new_4(ndims: i32, sizes: &i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape_int_const_int_X(ndims, sizes) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn new_5(sizes: &types::VectorOfint) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_BlobShape_VectorOfint(sizes.as_raw_VectorOfint()) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn all(ndims: i32, fill: i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_all_int_int(ndims, fill) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn dims(&self) -> Result<i32> {
unsafe { sys::cv_dnn_BlobShape_dims_const(self.as_raw_BlobShape()) }.into_result()
}
pub fn size(&mut self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_BlobShape_size_int(self.as_raw_BlobShape(), axis) }.into_result()
}
pub fn size_1(&self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_BlobShape_size_const_int(self.as_raw_BlobShape(), axis) }.into_result()
}
pub fn xsize(&self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_BlobShape_xsize_const_int(self.as_raw_BlobShape(), axis) }.into_result()
}
pub fn canonical_axis(&self, axis: i32) -> Result<i32> {
unsafe { sys::cv_dnn_BlobShape_canonicalAxis_const_int(self.as_raw_BlobShape(), axis) }.into_result()
}
pub fn total(&self) -> Result<ptrdiff_t> {
unsafe { sys::cv_dnn_BlobShape_total_const(self.as_raw_BlobShape()) }.into_result()
}
pub fn total_1(&self, start_axis: i32, end_axis: i32) -> Result<ptrdiff_t> {
unsafe { sys::cv_dnn_BlobShape_total_const_int_int(self.as_raw_BlobShape(), start_axis, end_axis) }.into_result()
}
pub fn slice(&self, start_axis: i32, end_axis: i32) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_slice_const_int_int(self.as_raw_BlobShape(), start_axis, end_axis) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn ptr(&self) -> Result<&i32> {
unsafe { sys::cv_dnn_BlobShape_ptr_const(self.as_raw_BlobShape()) }.into_result().and_then(|x| unsafe { x.as_ref() }.ok_or_else(|| Error::new(core::StsNullPtr, "Function returned Null pointer".to_string())))
}
pub fn ptr_1(&mut self) -> Result<&mut i32> {
unsafe { sys::cv_dnn_BlobShape_ptr(self.as_raw_BlobShape()) }.into_result().and_then(|x| unsafe { x.as_mut() }.ok_or_else(|| Error::new(core::StsNullPtr, "Function returned Null pointer".to_string())))
}
pub fn equal(&self, other: &crate::dnn::BlobShape) -> Result<bool> {
unsafe { sys::cv_dnn_BlobShape_equal_const_BlobShape(self.as_raw_BlobShape(), other.as_raw_BlobShape()) }.into_result()
}
pub fn like(m: &core::Mat) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_like_Mat(m.as_raw_Mat()) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn like_1(m: &core::UMat) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_like_UMat(m.as_raw_UMat()) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn empty() -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_BlobShape_empty() }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn is_empty(&self) -> Result<bool> {
unsafe { sys::cv_dnn_BlobShape_isEmpty_const(self.as_raw_BlobShape()) }.into_result()
}
}
pub struct ConcatLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ConcatLayer {
fn drop(&mut self) {
unsafe { sys::cv_ConcatLayer_delete(self.ptr) };
}
}
impl ConcatLayer {
#[inline(always)] pub fn as_raw_ConcatLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ConcatLayer {}
impl crate::dnn::Layer for ConcatLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ConcatLayer {
pub fn create(axis: i32) -> Result<types::PtrOfConcatLayer> {
unsafe { sys::cv_dnn_ConcatLayer_create_int(axis) }.into_result().map(|ptr| types::PtrOfConcatLayer { ptr })
}
}
pub struct ConvolutionLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ConvolutionLayer {
fn drop(&mut self) {
unsafe { sys::cv_ConvolutionLayer_delete(self.ptr) };
}
}
impl ConvolutionLayer {
#[inline(always)] pub fn as_raw_ConvolutionLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ConvolutionLayer {}
impl crate::dnn::BaseConvolutionLayerTrait for ConvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer for ConvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ConvolutionLayer {
pub fn create(kernel: core::Size, stride: core::Size, pad: core::Size, dilation: core::Size) -> Result<types::PtrOfBaseConvolutionLayer> {
unsafe { sys::cv_dnn_ConvolutionLayer_create_Size_Size_Size_Size(kernel, stride, pad, dilation) }.into_result().map(|ptr| types::PtrOfBaseConvolutionLayer { ptr })
}
}
pub struct CropLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for CropLayer {
fn drop(&mut self) {
unsafe { sys::cv_CropLayer_delete(self.ptr) };
}
}
impl CropLayer {
#[inline(always)] pub fn as_raw_CropLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for CropLayer {}
impl crate::dnn::Layer for CropLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl CropLayer {
pub fn start_axis(&self) -> Result<i32> {
unsafe { sys::cv_dnn_CropLayer_startAxis_const(self.as_raw_CropLayer()) }.into_result()
}
pub fn set_start_axis(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_CropLayer_set_startAxis_int(self.as_raw_CropLayer(), val) }.into_result()
}
pub fn create(start_axis: i32, offset: &types::VectorOfint) -> Result<types::PtrOfCropLayer> {
unsafe { sys::cv_dnn_CropLayer_create_int_VectorOfint(start_axis, offset.as_raw_VectorOfint()) }.into_result().map(|ptr| types::PtrOfCropLayer { ptr })
}
}
pub struct DeconvolutionLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for DeconvolutionLayer {
fn drop(&mut self) {
unsafe { sys::cv_DeconvolutionLayer_delete(self.ptr) };
}
}
impl DeconvolutionLayer {
#[inline(always)] pub fn as_raw_DeconvolutionLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for DeconvolutionLayer {}
impl crate::dnn::BaseConvolutionLayerTrait for DeconvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer for DeconvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl DeconvolutionLayer {
pub fn create(kernel: core::Size, stride: core::Size, pad: core::Size, dilation: core::Size) -> Result<types::PtrOfBaseConvolutionLayer> {
unsafe { sys::cv_dnn_DeconvolutionLayer_create_Size_Size_Size_Size(kernel, stride, pad, dilation) }.into_result().map(|ptr| types::PtrOfBaseConvolutionLayer { ptr })
}
}
pub trait DictTrait {
fn as_raw_Dict(&self) -> *mut c_void;
fn has(&self, key: &str) -> Result<bool> {
string_arg!(key);
unsafe { sys::cv_dnn_Dict_has_const_String(self.as_raw_Dict(), key.as_ptr()) }.into_result()
}
unsafe fn ptr_mut(&mut self, key: &str) -> Result<crate::dnn::DictValue> {
string_arg!(key);
{ sys::cv_dnn_Dict_ptr_String(self.as_raw_Dict(), key.as_ptr()) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
fn get(&self, key: &str) -> Result<crate::dnn::DictValue> {
string_arg!(key);
unsafe { sys::cv_dnn_Dict_get_const_String(self.as_raw_Dict(), key.as_ptr()) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
fn set(&mut self, key: &str, value: &mut crate::dnn::DictValue) -> Result<crate::dnn::DictValue> {
string_arg!(key);
unsafe { sys::cv_dnn_Dict_set_String_DictValue(self.as_raw_Dict(), key.as_ptr(), value.as_raw_DictValue()) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
}
pub struct Dict {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for Dict {
fn drop(&mut self) {
unsafe { sys::cv_Dict_delete(self.ptr) };
}
}
impl Dict {
#[inline(always)] pub fn as_raw_Dict(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Dict {}
impl crate::dnn::DictTrait for Dict {
#[inline(always)] fn as_raw_Dict(&self) -> *mut c_void { self.ptr }
}
pub struct DictValue {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for DictValue {
fn drop(&mut self) {
unsafe { sys::cv_DictValue_delete(self.ptr) };
}
}
impl DictValue {
#[inline(always)] pub fn as_raw_DictValue(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for DictValue {}
impl DictValue {
pub fn copy(r: &crate::dnn::DictValue) -> Result<crate::dnn::DictValue> {
unsafe { sys::cv_dnn_DictValue_DictValue_DictValue(r.as_raw_DictValue()) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
pub fn from_i64(i: i64) -> Result<crate::dnn::DictValue> {
unsafe { sys::cv_dnn_DictValue_DictValue_int64(i) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
pub fn from_i32(i: i32) -> Result<crate::dnn::DictValue> {
unsafe { sys::cv_dnn_DictValue_DictValue_int(i) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
pub fn from_u32(p: u32) -> Result<crate::dnn::DictValue> {
unsafe { sys::cv_dnn_DictValue_DictValue_unsigned(p) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
pub fn from_f64(p: f64) -> Result<crate::dnn::DictValue> {
unsafe { sys::cv_dnn_DictValue_DictValue_double(p) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
pub fn from_str(s: &str) -> Result<crate::dnn::DictValue> {
string_arg!(s);
unsafe { sys::cv_dnn_DictValue_DictValue_const_char_X(s.as_ptr()) }.into_result().map(|ptr| crate::dnn::DictValue { ptr })
}
pub fn size(&self) -> Result<i32> {
unsafe { sys::cv_dnn_DictValue_size_const(self.as_raw_DictValue()) }.into_result()
}
pub fn is_int(&self) -> Result<bool> {
unsafe { sys::cv_dnn_DictValue_isInt_const(self.as_raw_DictValue()) }.into_result()
}
pub fn is_string(&self) -> Result<bool> {
unsafe { sys::cv_dnn_DictValue_isString_const(self.as_raw_DictValue()) }.into_result()
}
pub fn is_real(&self) -> Result<bool> {
unsafe { sys::cv_dnn_DictValue_isReal_const(self.as_raw_DictValue()) }.into_result()
}
}
pub struct EltwiseLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for EltwiseLayer {
fn drop(&mut self) {
unsafe { sys::cv_EltwiseLayer_delete(self.ptr) };
}
}
impl EltwiseLayer {
#[inline(always)] pub fn as_raw_EltwiseLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for EltwiseLayer {}
impl crate::dnn::Layer for EltwiseLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
pub trait Importer {
fn as_raw_Importer(&self) -> *mut c_void;
fn populate_net(&mut self, net: &crate::dnn::Net) -> Result<()> {
unsafe { sys::cv_dnn_Importer_populateNet_Net(self.as_raw_Importer(), net.as_raw_Net()) }.into_result()
}
}
pub struct InnerProductLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for InnerProductLayer {
fn drop(&mut self) {
unsafe { sys::cv_InnerProductLayer_delete(self.ptr) };
}
}
impl InnerProductLayer {
#[inline(always)] pub fn as_raw_InnerProductLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for InnerProductLayer {}
impl crate::dnn::Layer for InnerProductLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl InnerProductLayer {
pub fn axis(&self) -> Result<i32> {
unsafe { sys::cv_dnn_InnerProductLayer_axis_const(self.as_raw_InnerProductLayer()) }.into_result()
}
pub fn set_axis(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_InnerProductLayer_set_axis_int(self.as_raw_InnerProductLayer(), val) }.into_result()
}
pub fn create(axis: i32) -> Result<types::PtrOfInnerProductLayer> {
unsafe { sys::cv_dnn_InnerProductLayer_create_int(axis) }.into_result().map(|ptr| types::PtrOfInnerProductLayer { ptr })
}
}
pub struct LRNLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for LRNLayer {
fn drop(&mut self) {
unsafe { sys::cv_LRNLayer_delete(self.ptr) };
}
}
impl LRNLayer {
#[inline(always)] pub fn as_raw_LRNLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for LRNLayer {}
impl crate::dnn::Layer for LRNLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl LRNLayer {
pub fn _type(&self) -> Result<i32> {
unsafe { sys::cv_dnn_LRNLayer_type_const(self.as_raw_LRNLayer()) }.into_result()
}
pub fn set_type(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_LRNLayer_set_type_int(self.as_raw_LRNLayer(), val) }.into_result()
}
pub fn size(&self) -> Result<i32> {
unsafe { sys::cv_dnn_LRNLayer_size_const(self.as_raw_LRNLayer()) }.into_result()
}
pub fn set_size(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_LRNLayer_set_size_int(self.as_raw_LRNLayer(), val) }.into_result()
}
pub fn alpha(&self) -> Result<f64> {
unsafe { sys::cv_dnn_LRNLayer_alpha_const(self.as_raw_LRNLayer()) }.into_result()
}
pub fn set_alpha(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_LRNLayer_set_alpha_double(self.as_raw_LRNLayer(), val) }.into_result()
}
pub fn beta(&self) -> Result<f64> {
unsafe { sys::cv_dnn_LRNLayer_beta_const(self.as_raw_LRNLayer()) }.into_result()
}
pub fn set_beta(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_LRNLayer_set_beta_double(self.as_raw_LRNLayer(), val) }.into_result()
}
pub fn bias(&self) -> Result<f64> {
unsafe { sys::cv_dnn_LRNLayer_bias_const(self.as_raw_LRNLayer()) }.into_result()
}
pub fn set_bias(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_LRNLayer_set_bias_double(self.as_raw_LRNLayer(), val) }.into_result()
}
pub fn norm_by_size(&self) -> Result<bool> {
unsafe { sys::cv_dnn_LRNLayer_normBySize_const(self.as_raw_LRNLayer()) }.into_result()
}
pub fn set_norm_by_size(&mut self, val: bool) -> Result<()> {
unsafe { sys::cv_dnn_LRNLayer_set_normBySize_bool(self.as_raw_LRNLayer(), val) }.into_result()
}
pub fn create(_type: i32, size: i32, alpha: f64, beta: f64, bias: f64, norm_by_size: bool) -> Result<types::PtrOfLRNLayer> {
unsafe { sys::cv_dnn_LRNLayer_create_int_int_double_double_double_bool(_type, size, alpha, beta, bias, norm_by_size) }.into_result().map(|ptr| types::PtrOfLRNLayer { ptr })
}
}
pub trait LSTMLayer: crate::dnn::Layer {
fn as_raw_LSTMLayer(&self) -> *mut c_void;
fn set_weights(&mut self, wh: &crate::dnn::Blob, wx: &crate::dnn::Blob, b: &crate::dnn::Blob) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setWeights_Blob_Blob_Blob(self.as_raw_LSTMLayer(), wh.as_raw_Blob(), wx.as_raw_Blob(), b.as_raw_Blob()) }.into_result()
}
fn set_out_shape(&mut self, out_tail_shape: &crate::dnn::BlobShape) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setOutShape_BlobShape(self.as_raw_LSTMLayer(), out_tail_shape.as_raw_BlobShape()) }.into_result()
}
fn set_h(&mut self, h: &crate::dnn::Blob) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setH_Blob(self.as_raw_LSTMLayer(), h.as_raw_Blob()) }.into_result()
}
fn get_h(&self) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_LSTMLayer_getH_const(self.as_raw_LSTMLayer()) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
fn set_c(&mut self, c: &crate::dnn::Blob) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setC_Blob(self.as_raw_LSTMLayer(), c.as_raw_Blob()) }.into_result()
}
fn get_c(&self) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_LSTMLayer_getC_const(self.as_raw_LSTMLayer()) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
fn set_use_timstamps_dim(&mut self, _use: bool) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setUseTimstampsDim_bool(self.as_raw_LSTMLayer(), _use) }.into_result()
}
fn set_produce_cell_output(&mut self, produce: bool) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setProduceCellOutput_bool(self.as_raw_LSTMLayer(), produce) }.into_result()
}
fn input_name_to_index(&mut self, input_name: &str) -> Result<i32> {
string_arg!(mut input_name);
unsafe { sys::cv_dnn_LSTMLayer_inputNameToIndex_String(self.as_raw_LSTMLayer(), input_name.as_ptr() as _) }.into_result()
}
fn output_name_to_index(&mut self, output_name: &str) -> Result<i32> {
string_arg!(mut output_name);
unsafe { sys::cv_dnn_LSTMLayer_outputNameToIndex_String(self.as_raw_LSTMLayer(), output_name.as_ptr() as _) }.into_result()
}
}
impl dyn LSTMLayer + '_ {
pub fn create() -> Result<types::PtrOfLSTMLayer> {
unsafe { sys::cv_dnn_LSTMLayer_create() }.into_result().map(|ptr| types::PtrOfLSTMLayer { ptr })
}
}
pub trait Layer {
fn as_raw_Layer(&self) -> *mut c_void;
fn name(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_Layer_name(self.as_raw_Layer()) }.into_result().map(crate::templ::receive_string_mut)
}
fn set_name(&mut self, val: &str) -> Result<()> {
string_arg!(mut val);
unsafe { sys::cv_dnn_Layer_set_name_String(self.as_raw_Layer(), val.as_ptr() as _) }.into_result()
}
fn _type(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_Layer_type(self.as_raw_Layer()) }.into_result().map(crate::templ::receive_string_mut)
}
fn set_type(&mut self, val: &str) -> Result<()> {
string_arg!(mut val);
unsafe { sys::cv_dnn_Layer_set_type_String(self.as_raw_Layer(), val.as_ptr() as _) }.into_result()
}
fn allocate(&mut self, inputs: &types::VectorOfBlob, outputs: &mut types::VectorOfBlob) -> Result<()> {
unsafe { sys::cv_dnn_Layer_allocate_VectorOfBlob_VectorOfBlob(self.as_raw_Layer(), inputs.as_raw_VectorOfBlob(), outputs.as_raw_VectorOfBlob()) }.into_result()
}
fn allocate_1(&mut self, inputs: &types::VectorOfBlob) -> Result<types::VectorOfBlob> {
unsafe { sys::cv_dnn_Layer_allocate_VectorOfBlob(self.as_raw_Layer(), inputs.as_raw_VectorOfBlob()) }.into_result().map(|ptr| types::VectorOfBlob { ptr })
}
fn forward(&mut self, inputs: &types::VectorOfBlob, outputs: &mut types::VectorOfBlob) -> Result<()> {
unsafe { sys::cv_dnn_Layer_forward_VectorOfBlob_VectorOfBlob(self.as_raw_Layer(), inputs.as_raw_VectorOfBlob(), outputs.as_raw_VectorOfBlob()) }.into_result()
}
fn run(&mut self, inputs: &types::VectorOfBlob, outputs: &mut types::VectorOfBlob) -> Result<()> {
unsafe { sys::cv_dnn_Layer_run_VectorOfBlob_VectorOfBlob(self.as_raw_Layer(), inputs.as_raw_VectorOfBlob(), outputs.as_raw_VectorOfBlob()) }.into_result()
}
fn input_name_to_index(&mut self, input_name: &str) -> Result<i32> {
string_arg!(mut input_name);
unsafe { sys::cv_dnn_Layer_inputNameToIndex_String(self.as_raw_Layer(), input_name.as_ptr() as _) }.into_result()
}
fn output_name_to_index(&mut self, output_name: &str) -> Result<i32> {
string_arg!(mut output_name);
unsafe { sys::cv_dnn_Layer_outputNameToIndex_String(self.as_raw_Layer(), output_name.as_ptr() as _) }.into_result()
}
fn set_params_from(&mut self, params: &crate::dnn::LayerParams) -> Result<()> {
unsafe { sys::cv_dnn_Layer_setParamsFrom_LayerParams(self.as_raw_Layer(), params.as_raw_LayerParams()) }.into_result()
}
}
pub struct LayerFactory {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for LayerFactory {
fn drop(&mut self) {
unsafe { sys::cv_LayerFactory_delete(self.ptr) };
}
}
impl LayerFactory {
#[inline(always)] pub fn as_raw_LayerFactory(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for LayerFactory {}
impl LayerFactory {
pub fn unregister_layer(_type: &str) -> Result<()> {
string_arg!(_type);
unsafe { sys::cv_dnn_LayerFactory_unregisterLayer_String(_type.as_ptr()) }.into_result()
}
pub fn create_layer_instance(_type: &str, params: &mut crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
string_arg!(_type);
unsafe { sys::cv_dnn_LayerFactory_createLayerInstance_String_LayerParams(_type.as_ptr(), params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
}
pub struct LayerParams {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for LayerParams {
fn drop(&mut self) {
unsafe { sys::cv_LayerParams_delete(self.ptr) };
}
}
impl LayerParams {
#[inline(always)] pub fn as_raw_LayerParams(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for LayerParams {}
impl crate::dnn::DictTrait for LayerParams {
#[inline(always)] fn as_raw_Dict(&self) -> *mut c_void { self.ptr }
}
impl LayerParams {
pub fn name(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_LayerParams_name(self.as_raw_LayerParams()) }.into_result().map(crate::templ::receive_string_mut)
}
pub fn set_name(&mut self, val: &str) -> Result<()> {
string_arg!(mut val);
unsafe { sys::cv_dnn_LayerParams_set_name_String(self.as_raw_LayerParams(), val.as_ptr() as _) }.into_result()
}
pub fn _type(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_LayerParams_type(self.as_raw_LayerParams()) }.into_result().map(crate::templ::receive_string_mut)
}
pub fn set_type(&mut self, val: &str) -> Result<()> {
string_arg!(mut val);
unsafe { sys::cv_dnn_LayerParams_set_type_String(self.as_raw_LayerParams(), val.as_ptr() as _) }.into_result()
}
pub fn default() -> Result<crate::dnn::LayerParams> {
unsafe { sys::cv_dnn_LayerParams_LayerParams() }.into_result().map(|ptr| crate::dnn::LayerParams { ptr })
}
}
pub struct MVNLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for MVNLayer {
fn drop(&mut self) {
unsafe { sys::cv_MVNLayer_delete(self.ptr) };
}
}
impl MVNLayer {
#[inline(always)] pub fn as_raw_MVNLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for MVNLayer {}
impl crate::dnn::Layer for MVNLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl MVNLayer {
pub fn eps(&self) -> Result<f64> {
unsafe { sys::cv_dnn_MVNLayer_eps_const(self.as_raw_MVNLayer()) }.into_result()
}
pub fn set_eps(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_MVNLayer_set_eps_double(self.as_raw_MVNLayer(), val) }.into_result()
}
pub fn norm_variance(&self) -> Result<bool> {
unsafe { sys::cv_dnn_MVNLayer_normVariance_const(self.as_raw_MVNLayer()) }.into_result()
}
pub fn set_norm_variance(&mut self, val: bool) -> Result<()> {
unsafe { sys::cv_dnn_MVNLayer_set_normVariance_bool(self.as_raw_MVNLayer(), val) }.into_result()
}
pub fn across_channels(&self) -> Result<bool> {
unsafe { sys::cv_dnn_MVNLayer_acrossChannels_const(self.as_raw_MVNLayer()) }.into_result()
}
pub fn set_across_channels(&mut self, val: bool) -> Result<()> {
unsafe { sys::cv_dnn_MVNLayer_set_acrossChannels_bool(self.as_raw_MVNLayer(), val) }.into_result()
}
pub fn create(norm_variance: bool, across_channels: bool, eps: f64) -> Result<types::PtrOfMVNLayer> {
unsafe { sys::cv_dnn_MVNLayer_create_bool_bool_double(norm_variance, across_channels, eps) }.into_result().map(|ptr| types::PtrOfMVNLayer { ptr })
}
}
pub struct Net {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for Net {
fn drop(&mut self) {
unsafe { sys::cv_Net_delete(self.ptr) };
}
}
impl Net {
#[inline(always)] pub fn as_raw_Net(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Net {}
impl Net {
pub fn default() -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_Net_Net() }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn empty(&self) -> Result<bool> {
unsafe { sys::cv_dnn_Net_empty_const(self.as_raw_Net()) }.into_result()
}
pub fn add_layer(&mut self, name: &str, _type: &str, params: &mut crate::dnn::LayerParams) -> Result<i32> {
string_arg!(name);
string_arg!(_type);
unsafe { sys::cv_dnn_Net_addLayer_String_String_LayerParams(self.as_raw_Net(), name.as_ptr(), _type.as_ptr(), params.as_raw_LayerParams()) }.into_result()
}
pub fn add_layer_to_prev(&mut self, name: &str, _type: &str, params: &mut crate::dnn::LayerParams) -> Result<i32> {
string_arg!(name);
string_arg!(_type);
unsafe { sys::cv_dnn_Net_addLayerToPrev_String_String_LayerParams(self.as_raw_Net(), name.as_ptr(), _type.as_ptr(), params.as_raw_LayerParams()) }.into_result()
}
pub fn get_layer_id(&mut self, layer: &str) -> Result<i32> {
string_arg!(layer);
unsafe { sys::cv_dnn_Net_getLayerId_String(self.as_raw_Net(), layer.as_ptr()) }.into_result()
}
pub fn get_layer_names(&self) -> Result<types::VectorOfString> {
unsafe { sys::cv_dnn_Net_getLayerNames_const(self.as_raw_Net()) }.into_result().map(|ptr| types::VectorOfString { ptr })
}
pub fn get_layer(&mut self, layer_id: &crate::dnn::DictValue) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_Net_getLayer_DictValue(self.as_raw_Net(), layer_id.as_raw_DictValue()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
pub fn delete_layer(&mut self, layer: &crate::dnn::DictValue) -> Result<()> {
unsafe { sys::cv_dnn_Net_deleteLayer_DictValue(self.as_raw_Net(), layer.as_raw_DictValue()) }.into_result()
}
pub fn connect_first_second(&mut self, out_pin: &str, inp_pin: &str) -> Result<()> {
string_arg!(mut out_pin);
string_arg!(mut inp_pin);
unsafe { sys::cv_dnn_Net_connect_String_String(self.as_raw_Net(), out_pin.as_ptr() as _, inp_pin.as_ptr() as _) }.into_result()
}
pub fn connect(&mut self, out_layer_id: i32, out_num: i32, inp_layer_id: i32, inp_num: i32) -> Result<()> {
unsafe { sys::cv_dnn_Net_connect_int_int_int_int(self.as_raw_Net(), out_layer_id, out_num, inp_layer_id, inp_num) }.into_result()
}
pub fn set_net_inputs(&mut self, input_blob_names: &types::VectorOfString) -> Result<()> {
unsafe { sys::cv_dnn_Net_setNetInputs_VectorOfString(self.as_raw_Net(), input_blob_names.as_raw_VectorOfString()) }.into_result()
}
pub fn allocate(&mut self) -> Result<()> {
unsafe { sys::cv_dnn_Net_allocate(self.as_raw_Net()) }.into_result()
}
pub fn forward(&mut self, to_layer: &crate::dnn::DictValue) -> Result<()> {
unsafe { sys::cv_dnn_Net_forward_DictValue(self.as_raw_Net(), to_layer.as_raw_DictValue()) }.into_result()
}
pub fn forward_1(&mut self, start_layer: &crate::dnn::DictValue, to_layer: &crate::dnn::DictValue) -> Result<()> {
unsafe { sys::cv_dnn_Net_forward_DictValue_DictValue(self.as_raw_Net(), start_layer.as_raw_DictValue(), to_layer.as_raw_DictValue()) }.into_result()
}
pub fn forward_2(&mut self, start_layers: &types::VectorOfDictValue, to_layers: &types::VectorOfDictValue) -> Result<()> {
unsafe { sys::cv_dnn_Net_forward_VectorOfDictValue_VectorOfDictValue(self.as_raw_Net(), start_layers.as_raw_VectorOfDictValue(), to_layers.as_raw_VectorOfDictValue()) }.into_result()
}
pub fn forward_opt(&mut self, to_layer: &crate::dnn::DictValue) -> Result<()> {
unsafe { sys::cv_dnn_Net_forwardOpt_DictValue(self.as_raw_Net(), to_layer.as_raw_DictValue()) }.into_result()
}
pub fn forward_opt_1(&mut self, to_layers: &types::VectorOfDictValue) -> Result<()> {
unsafe { sys::cv_dnn_Net_forwardOpt_VectorOfDictValue(self.as_raw_Net(), to_layers.as_raw_VectorOfDictValue()) }.into_result()
}
pub fn set_blob(&mut self, output_name: &str, blob: &crate::dnn::Blob) -> Result<()> {
string_arg!(mut output_name);
unsafe { sys::cv_dnn_Net_setBlob_String_Blob(self.as_raw_Net(), output_name.as_ptr() as _, blob.as_raw_Blob()) }.into_result()
}
pub fn get_blob(&mut self, output_name: &str) -> Result<crate::dnn::Blob> {
string_arg!(mut output_name);
unsafe { sys::cv_dnn_Net_getBlob_String(self.as_raw_Net(), output_name.as_ptr() as _) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
pub fn set_param(&mut self, layer: &crate::dnn::DictValue, num_param: i32, blob: &crate::dnn::Blob) -> Result<()> {
unsafe { sys::cv_dnn_Net_setParam_DictValue_int_Blob(self.as_raw_Net(), layer.as_raw_DictValue(), num_param, blob.as_raw_Blob()) }.into_result()
}
pub fn get_param(&mut self, layer: &crate::dnn::DictValue, num_param: i32) -> Result<crate::dnn::Blob> {
unsafe { sys::cv_dnn_Net_getParam_DictValue_int(self.as_raw_Net(), layer.as_raw_DictValue(), num_param) }.into_result().map(|ptr| crate::dnn::Blob { ptr })
}
}
pub struct PoolingLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for PoolingLayer {
fn drop(&mut self) {
unsafe { sys::cv_PoolingLayer_delete(self.ptr) };
}
}
impl PoolingLayer {
#[inline(always)] pub fn as_raw_PoolingLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for PoolingLayer {}
impl crate::dnn::Layer for PoolingLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PoolingLayer {
pub fn _type(&self) -> Result<i32> {
unsafe { sys::cv_dnn_PoolingLayer_type_const(self.as_raw_PoolingLayer()) }.into_result()
}
pub fn set_type(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_PoolingLayer_set_type_int(self.as_raw_PoolingLayer(), val) }.into_result()
}
pub fn kernel(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_PoolingLayer_kernel_const(self.as_raw_PoolingLayer()) }.into_result()
}
pub fn set_kernel(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_PoolingLayer_set_kernel_Size(self.as_raw_PoolingLayer(), val) }.into_result()
}
pub fn stride(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_PoolingLayer_stride_const(self.as_raw_PoolingLayer()) }.into_result()
}
pub fn set_stride(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_PoolingLayer_set_stride_Size(self.as_raw_PoolingLayer(), val) }.into_result()
}
pub fn pad(&self) -> Result<core::Size> {
unsafe { sys::cv_dnn_PoolingLayer_pad_const(self.as_raw_PoolingLayer()) }.into_result()
}
pub fn set_pad(&mut self, val: core::Size) -> Result<()> {
unsafe { sys::cv_dnn_PoolingLayer_set_pad_Size(self.as_raw_PoolingLayer(), val) }.into_result()
}
pub fn global_pooling(&self) -> Result<bool> {
unsafe { sys::cv_dnn_PoolingLayer_globalPooling_const(self.as_raw_PoolingLayer()) }.into_result()
}
pub fn set_global_pooling(&mut self, val: bool) -> Result<()> {
unsafe { sys::cv_dnn_PoolingLayer_set_globalPooling_bool(self.as_raw_PoolingLayer(), val) }.into_result()
}
pub fn pad_mode(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_PoolingLayer_padMode(self.as_raw_PoolingLayer()) }.into_result().map(crate::templ::receive_string_mut)
}
pub fn set_pad_mode(&mut self, val: &str) -> Result<()> {
string_arg!(mut val);
unsafe { sys::cv_dnn_PoolingLayer_set_padMode_String(self.as_raw_PoolingLayer(), val.as_ptr() as _) }.into_result()
}
pub fn create(_type: i32, kernel: core::Size, stride: core::Size, pad: core::Size, pad_mode: &str) -> Result<types::PtrOfPoolingLayer> {
string_arg!(pad_mode);
unsafe { sys::cv_dnn_PoolingLayer_create_int_Size_Size_Size_String(_type, kernel, stride, pad, pad_mode.as_ptr()) }.into_result().map(|ptr| types::PtrOfPoolingLayer { ptr })
}
pub fn create_global(_type: i32) -> Result<types::PtrOfPoolingLayer> {
unsafe { sys::cv_dnn_PoolingLayer_createGlobal_int(_type) }.into_result().map(|ptr| types::PtrOfPoolingLayer { ptr })
}
}
pub struct PowerLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for PowerLayer {
fn drop(&mut self) {
unsafe { sys::cv_PowerLayer_delete(self.ptr) };
}
}
impl PowerLayer {
#[inline(always)] pub fn as_raw_PowerLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for PowerLayer {}
impl crate::dnn::Layer for PowerLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PowerLayer {
pub fn power(&self) -> Result<f64> {
unsafe { sys::cv_dnn_PowerLayer_power_const(self.as_raw_PowerLayer()) }.into_result()
}
pub fn set_power(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_PowerLayer_set_power_double(self.as_raw_PowerLayer(), val) }.into_result()
}
pub fn scale(&self) -> Result<f64> {
unsafe { sys::cv_dnn_PowerLayer_scale_const(self.as_raw_PowerLayer()) }.into_result()
}
pub fn set_scale(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_PowerLayer_set_scale_double(self.as_raw_PowerLayer(), val) }.into_result()
}
pub fn shift(&self) -> Result<f64> {
unsafe { sys::cv_dnn_PowerLayer_shift_const(self.as_raw_PowerLayer()) }.into_result()
}
pub fn set_shift(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_PowerLayer_set_shift_double(self.as_raw_PowerLayer(), val) }.into_result()
}
pub fn create(power: f64, scale: f64, shift: f64) -> Result<types::PtrOfPowerLayer> {
unsafe { sys::cv_dnn_PowerLayer_create_double_double_double(power, scale, shift) }.into_result().map(|ptr| types::PtrOfPowerLayer { ptr })
}
}
pub trait RNNLayer: crate::dnn::Layer {
fn as_raw_RNNLayer(&self) -> *mut c_void;
fn set_weights(&mut self, wxh: &crate::dnn::Blob, bh: &crate::dnn::Blob, whh: &crate::dnn::Blob, who: &crate::dnn::Blob, bo: &crate::dnn::Blob) -> Result<()> {
unsafe { sys::cv_dnn_RNNLayer_setWeights_Blob_Blob_Blob_Blob_Blob(self.as_raw_RNNLayer(), wxh.as_raw_Blob(), bh.as_raw_Blob(), whh.as_raw_Blob(), who.as_raw_Blob(), bo.as_raw_Blob()) }.into_result()
}
fn set_produce_hidden_output(&mut self, produce: bool) -> Result<()> {
unsafe { sys::cv_dnn_RNNLayer_setProduceHiddenOutput_bool(self.as_raw_RNNLayer(), produce) }.into_result()
}
}
impl dyn RNNLayer + '_ {
pub fn create() -> Result<types::PtrOfRNNLayer> {
unsafe { sys::cv_dnn_RNNLayer_create() }.into_result().map(|ptr| types::PtrOfRNNLayer { ptr })
}
}
pub struct ReLULayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ReLULayer {
fn drop(&mut self) {
unsafe { sys::cv_ReLULayer_delete(self.ptr) };
}
}
impl ReLULayer {
#[inline(always)] pub fn as_raw_ReLULayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ReLULayer {}
impl crate::dnn::Layer for ReLULayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ReLULayer {
pub fn negative_slope(&self) -> Result<f64> {
unsafe { sys::cv_dnn_ReLULayer_negativeSlope_const(self.as_raw_ReLULayer()) }.into_result()
}
pub fn set_negative_slope(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_dnn_ReLULayer_set_negativeSlope_double(self.as_raw_ReLULayer(), val) }.into_result()
}
pub fn create(negative_slope: f64) -> Result<types::PtrOfReLULayer> {
unsafe { sys::cv_dnn_ReLULayer_create_double(negative_slope) }.into_result().map(|ptr| types::PtrOfReLULayer { ptr })
}
}
pub struct ReshapeLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ReshapeLayer {
fn drop(&mut self) {
unsafe { sys::cv_ReshapeLayer_delete(self.ptr) };
}
}
impl ReshapeLayer {
#[inline(always)] pub fn as_raw_ReshapeLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ReshapeLayer {}
impl crate::dnn::Layer for ReshapeLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ReshapeLayer {
pub fn new_shape_desc(&mut self) -> Result<crate::dnn::BlobShape> {
unsafe { sys::cv_dnn_ReshapeLayer_newShapeDesc(self.as_raw_ReshapeLayer()) }.into_result().map(|ptr| crate::dnn::BlobShape { ptr })
}
pub fn set_new_shape_desc(&mut self, val: crate::dnn::BlobShape) -> Result<()> {
unsafe { sys::cv_dnn_ReshapeLayer_set_newShapeDesc_BlobShape(self.as_raw_ReshapeLayer(), val.as_raw_BlobShape()) }.into_result()
}
pub fn new_shape_range(&mut self) -> Result<core::Range> {
unsafe { sys::cv_dnn_ReshapeLayer_newShapeRange(self.as_raw_ReshapeLayer()) }.into_result().map(|ptr| core::Range { ptr })
}
pub fn set_new_shape_range(&mut self, val: core::Range) -> Result<()> {
unsafe { sys::cv_dnn_ReshapeLayer_set_newShapeRange_Range(self.as_raw_ReshapeLayer(), val.as_raw_Range()) }.into_result()
}
pub fn create(new_shape: &crate::dnn::BlobShape, applying_range: &core::Range, enable_reordering: bool) -> Result<types::PtrOfReshapeLayer> {
unsafe { sys::cv_dnn_ReshapeLayer_create_BlobShape_Range_bool(new_shape.as_raw_BlobShape(), applying_range.as_raw_Range(), enable_reordering) }.into_result().map(|ptr| types::PtrOfReshapeLayer { ptr })
}
}
pub struct SigmoidLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SigmoidLayer {
fn drop(&mut self) {
unsafe { sys::cv_SigmoidLayer_delete(self.ptr) };
}
}
impl SigmoidLayer {
#[inline(always)] pub fn as_raw_SigmoidLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SigmoidLayer {}
impl crate::dnn::Layer for SigmoidLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SigmoidLayer {
pub fn create() -> Result<types::PtrOfSigmoidLayer> {
unsafe { sys::cv_dnn_SigmoidLayer_create() }.into_result().map(|ptr| types::PtrOfSigmoidLayer { ptr })
}
}
pub struct SliceLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SliceLayer {
fn drop(&mut self) {
unsafe { sys::cv_SliceLayer_delete(self.ptr) };
}
}
impl SliceLayer {
#[inline(always)] pub fn as_raw_SliceLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SliceLayer {}
impl crate::dnn::Layer for SliceLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SliceLayer {
pub fn axis(&self) -> Result<i32> {
unsafe { sys::cv_dnn_SliceLayer_axis_const(self.as_raw_SliceLayer()) }.into_result()
}
pub fn set_axis(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_SliceLayer_set_axis_int(self.as_raw_SliceLayer(), val) }.into_result()
}
pub fn create(axis: i32) -> Result<types::PtrOfSliceLayer> {
unsafe { sys::cv_dnn_SliceLayer_create_int(axis) }.into_result().map(|ptr| types::PtrOfSliceLayer { ptr })
}
pub fn create_1(axis: i32, slice_indices: &types::VectorOfint) -> Result<types::PtrOfSliceLayer> {
unsafe { sys::cv_dnn_SliceLayer_create_int_VectorOfint(axis, slice_indices.as_raw_VectorOfint()) }.into_result().map(|ptr| types::PtrOfSliceLayer { ptr })
}
}
pub struct SoftmaxLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SoftmaxLayer {
fn drop(&mut self) {
unsafe { sys::cv_SoftmaxLayer_delete(self.ptr) };
}
}
impl SoftmaxLayer {
#[inline(always)] pub fn as_raw_SoftmaxLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SoftmaxLayer {}
impl crate::dnn::Layer for SoftmaxLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SoftmaxLayer {
pub fn create(axis: i32) -> Result<types::PtrOfSoftmaxLayer> {
unsafe { sys::cv_dnn_SoftmaxLayer_create_int(axis) }.into_result().map(|ptr| types::PtrOfSoftmaxLayer { ptr })
}
}
pub struct SplitLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SplitLayer {
fn drop(&mut self) {
unsafe { sys::cv_SplitLayer_delete(self.ptr) };
}
}
impl SplitLayer {
#[inline(always)] pub fn as_raw_SplitLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SplitLayer {}
impl crate::dnn::Layer for SplitLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SplitLayer {
pub fn create(outputs_count: i32) -> Result<types::PtrOfSplitLayer> {
unsafe { sys::cv_dnn_SplitLayer_create_int(outputs_count) }.into_result().map(|ptr| types::PtrOfSplitLayer { ptr })
}
}
pub struct TanHLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for TanHLayer {
fn drop(&mut self) {
unsafe { sys::cv_TanHLayer_delete(self.ptr) };
}
}
impl TanHLayer {
#[inline(always)] pub fn as_raw_TanHLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for TanHLayer {}
impl crate::dnn::Layer for TanHLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl TanHLayer {
pub fn create() -> Result<types::PtrOfTanHLayer> {
unsafe { sys::cv_dnn_TanHLayer_create() }.into_result().map(|ptr| types::PtrOfTanHLayer { ptr })
}
}
pub struct _LayerStaticRegisterer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for _LayerStaticRegisterer {
fn drop(&mut self) {
unsafe { sys::cv__LayerStaticRegisterer_delete(self.ptr) };
}
}
impl _LayerStaticRegisterer {
#[inline(always)] pub fn as_raw__LayerStaticRegisterer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for _LayerStaticRegisterer {}
pub const Blob_ALLOC_BOTH: i32 = 0x3; pub const Blob_SYNCED: i32 = 0x3; pub use crate::manual::dnn::*;