use crate::{mod_prelude::*, core, sys, types};
use crate::core::{_InputArrayTrait, _OutputArrayTrait};
pub const CV_DNN_BACKEND_INFERENCE_ENGINE_NGRAPH: &'static str = "NGRAPH";
pub const CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API: &'static str = "NN_BUILDER";
pub const CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2: &'static str = "Myriad2";
pub const CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X: &'static str = "MyriadX";
pub const CV_DNN_INFERENCE_ENGINE_VPU_TYPE_UNSPECIFIED: &'static str = "";
pub const DNN_BACKEND_CUDA: i32 = 0+5;
pub const DNN_BACKEND_DEFAULT: i32 = 0;
pub const DNN_BACKEND_HALIDE: i32 = 0+1;
pub const DNN_BACKEND_INFERENCE_ENGINE: i32 = 0+2;
pub const DNN_BACKEND_INFERENCE_ENGINE_NGRAPH: i32 = 1000000;
pub const DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019: i32 = 1000000+1;
pub const DNN_BACKEND_OPENCV: i32 = 0+3;
pub const DNN_BACKEND_VKCOM: i32 = 0+4;
pub const DNN_TARGET_CPU: i32 = 0;
pub const DNN_TARGET_CUDA: i32 = 6;
pub const DNN_TARGET_CUDA_FP16: i32 = 7;
pub const DNN_TARGET_FPGA: i32 = 5;
pub const DNN_TARGET_MYRIAD: i32 = 3;
pub const DNN_TARGET_OPENCL: i32 = 1;
pub const DNN_TARGET_OPENCL_FP16: i32 = 2;
pub const DNN_TARGET_VULKAN: i32 = 4;
pub const OPENCV_DNN_API_VERSION: i32 = 20191202;
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Backend {
DNN_BACKEND_DEFAULT = DNN_BACKEND_DEFAULT as isize,
DNN_BACKEND_HALIDE = DNN_BACKEND_HALIDE as isize,
DNN_BACKEND_INFERENCE_ENGINE = DNN_BACKEND_INFERENCE_ENGINE as isize,
DNN_BACKEND_OPENCV = DNN_BACKEND_OPENCV as isize,
DNN_BACKEND_VKCOM = DNN_BACKEND_VKCOM as isize,
DNN_BACKEND_CUDA = DNN_BACKEND_CUDA as isize,
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH = DNN_BACKEND_INFERENCE_ENGINE_NGRAPH as isize,
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 = DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 as isize,
}
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Target {
DNN_TARGET_CPU = DNN_TARGET_CPU as isize,
DNN_TARGET_OPENCL = DNN_TARGET_OPENCL as isize,
DNN_TARGET_OPENCL_FP16 = DNN_TARGET_OPENCL_FP16 as isize,
DNN_TARGET_MYRIAD = DNN_TARGET_MYRIAD as isize,
DNN_TARGET_VULKAN = DNN_TARGET_VULKAN as isize,
DNN_TARGET_FPGA = DNN_TARGET_FPGA as isize,
DNN_TARGET_CUDA = DNN_TARGET_CUDA as isize,
DNN_TARGET_CUDA_FP16 = DNN_TARGET_CUDA_FP16 as isize,
}
pub fn nms_boxes_f64(bboxes: &types::VectorOfRect2d, scores: &types::VectorOffloat, score_threshold: f32, nms_threshold: f32, indices: &mut types::VectorOfint, eta: f32, top_k: i32) -> Result<()> {
unsafe { sys::cv_dnn_NMSBoxes_VectorOfRect2d_VectorOffloat_float_float_VectorOfint_float_int(bboxes.as_raw_VectorOfRect2d(), scores.as_raw_VectorOffloat(), score_threshold, nms_threshold, indices.as_raw_VectorOfint(), eta, top_k) }.into_result()
}
pub fn nms_boxes(bboxes: &types::VectorOfRect, scores: &types::VectorOffloat, score_threshold: f32, nms_threshold: f32, indices: &mut types::VectorOfint, eta: f32, top_k: i32) -> Result<()> {
unsafe { sys::cv_dnn_NMSBoxes_VectorOfRect_VectorOffloat_float_float_VectorOfint_float_int(bboxes.as_raw_VectorOfRect(), scores.as_raw_VectorOffloat(), score_threshold, nms_threshold, indices.as_raw_VectorOfint(), eta, top_k) }.into_result()
}
pub fn nms_boxes_rotated(bboxes: &types::VectorOfRotatedRect, scores: &types::VectorOffloat, score_threshold: f32, nms_threshold: f32, indices: &mut types::VectorOfint, eta: f32, top_k: i32) -> Result<()> {
unsafe { sys::cv_dnn_NMSBoxes_VectorOfRotatedRect_VectorOffloat_float_float_VectorOfint_float_int(bboxes.as_raw_VectorOfRotatedRect(), scores.as_raw_VectorOffloat(), score_threshold, nms_threshold, indices.as_raw_VectorOfint(), eta, top_k) }.into_result()
}
pub fn blob_from_image_to(image: &dyn core::ToInputArray, blob: &mut dyn core::ToOutputArray, scalefactor: f64, size: core::Size, mean: core::Scalar, swap_rb: bool, crop: bool, ddepth: i32) -> Result<()> {
input_array_arg!(image);
output_array_arg!(blob);
unsafe { sys::cv_dnn_blobFromImage__InputArray__OutputArray_double_Size_Scalar_bool_bool_int(image.as_raw__InputArray(), blob.as_raw__OutputArray(), scalefactor, size, mean, swap_rb, crop, ddepth) }.into_result()
}
pub fn blob_from_image(image: &dyn core::ToInputArray, scalefactor: f64, size: core::Size, mean: core::Scalar, swap_rb: bool, crop: bool, ddepth: i32) -> Result<core::Mat> {
input_array_arg!(image);
unsafe { sys::cv_dnn_blobFromImage__InputArray_double_Size_Scalar_bool_bool_int(image.as_raw__InputArray(), scalefactor, size, mean, swap_rb, crop, ddepth) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn blob_from_images_to(images: &dyn core::ToInputArray, blob: &mut dyn core::ToOutputArray, scalefactor: f64, size: core::Size, mean: core::Scalar, swap_rb: bool, crop: bool, ddepth: i32) -> Result<()> {
input_array_arg!(images);
output_array_arg!(blob);
unsafe { sys::cv_dnn_blobFromImages__InputArray__OutputArray_double_Size_Scalar_bool_bool_int(images.as_raw__InputArray(), blob.as_raw__OutputArray(), scalefactor, size, mean, swap_rb, crop, ddepth) }.into_result()
}
pub fn blob_from_images(images: &dyn core::ToInputArray, scalefactor: f64, size: core::Size, mean: core::Scalar, swap_rb: bool, crop: bool, ddepth: i32) -> Result<core::Mat> {
input_array_arg!(images);
unsafe { sys::cv_dnn_blobFromImages__InputArray_double_Size_Scalar_bool_bool_int(images.as_raw__InputArray(), scalefactor, size, mean, swap_rb, crop, ddepth) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn clamp_range(r: &core::Range, axis_size: i32) -> Result<core::Range> {
unsafe { sys::cv_dnn_clamp_Range_int(r.as_raw_Range(), axis_size) }.into_result().map(|ptr| core::Range { ptr })
}
pub fn clamp(ax: i32, dims: i32) -> Result<i32> {
unsafe { sys::cv_dnn_clamp_int_int(ax, dims) }.into_result()
}
pub fn get_available_targets(be: crate::dnn::Backend) -> Result<types::VectorOfTarget> {
unsafe { sys::cv_dnn_getAvailableTargets_Backend(be) }.into_result().map(|ptr| types::VectorOfTarget { ptr })
}
pub fn get_inference_engine_backend_type() -> Result<String> {
unsafe { sys::cv_dnn_getInferenceEngineBackendType() }.into_result().map(crate::templ::receive_string_mut)
}
pub fn get_inference_engine_vpu_type() -> Result<String> {
unsafe { sys::cv_dnn_getInferenceEngineVPUType() }.into_result().map(crate::templ::receive_string_mut)
}
pub fn get_plane(m: &core::Mat, n: i32, cn: i32) -> Result<core::Mat> {
unsafe { sys::cv_dnn_getPlane_Mat_int_int(m.as_raw_Mat(), n, cn) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn images_from_blob(blob_: &core::Mat, images_: &mut dyn core::ToOutputArray) -> Result<()> {
output_array_arg!(images_);
unsafe { sys::cv_dnn_imagesFromBlob_Mat__OutputArray(blob_.as_raw_Mat(), images_.as_raw__OutputArray()) }.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_net_from_caffe_buffer(buffer_proto: &types::VectorOfuchar, buffer_model: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_readNetFromCaffe_VectorOfuchar_VectorOfuchar(buffer_proto.as_raw_VectorOfuchar(), buffer_model.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_caffe_str(buffer_proto: &str, len_proto: size_t, buffer_model: &str, len_model: size_t) -> Result<crate::dnn::Net> {
string_arg!(buffer_proto);
string_arg!(buffer_model);
unsafe { sys::cv_dnn_readNetFromCaffe_const_char_X_size_t_const_char_X_size_t(buffer_proto.as_ptr(), len_proto, buffer_model.as_ptr(), len_model) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_darknet(cfg_file: &str, darknet_model: &str) -> Result<crate::dnn::Net> {
string_arg!(cfg_file);
string_arg!(darknet_model);
unsafe { sys::cv_dnn_readNetFromDarknet_String_String(cfg_file.as_ptr(), darknet_model.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_darknet_buffer(buffer_cfg: &types::VectorOfuchar, buffer_model: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_readNetFromDarknet_VectorOfuchar_VectorOfuchar(buffer_cfg.as_raw_VectorOfuchar(), buffer_model.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_darknet_str(buffer_cfg: &str, len_cfg: size_t, buffer_model: &str, len_model: size_t) -> Result<crate::dnn::Net> {
string_arg!(buffer_cfg);
string_arg!(buffer_model);
unsafe { sys::cv_dnn_readNetFromDarknet_const_char_X_size_t_const_char_X_size_t(buffer_cfg.as_ptr(), len_cfg, buffer_model.as_ptr(), len_model) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_model_optimizer(xml: &str, bin: &str) -> Result<crate::dnn::Net> {
string_arg!(xml);
string_arg!(bin);
unsafe { sys::cv_dnn_readNetFromModelOptimizer_String_String(xml.as_ptr(), bin.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_model_optimizer_1(buffer_model_config: &types::VectorOfuchar, buffer_weights: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_readNetFromModelOptimizer_VectorOfuchar_VectorOfuchar(buffer_model_config.as_raw_VectorOfuchar(), buffer_weights.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_model_optimizer_2(buffer_model_config_ptr: &u8, buffer_model_config_size: size_t, buffer_weights_ptr: &u8, buffer_weights_size: size_t) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_readNetFromModelOptimizer_const_uchar_X_size_t_const_uchar_X_size_t(buffer_model_config_ptr, buffer_model_config_size, buffer_weights_ptr, buffer_weights_size) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_onnx(onnx_file: &str) -> Result<crate::dnn::Net> {
string_arg!(onnx_file);
unsafe { sys::cv_dnn_readNetFromONNX_String(onnx_file.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_onnx_buffer(buffer: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_readNetFromONNX_VectorOfuchar(buffer.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_onnx_str(buffer: &str, size_buffer: size_t) -> Result<crate::dnn::Net> {
string_arg!(buffer);
unsafe { sys::cv_dnn_readNetFromONNX_const_char_X_size_t(buffer.as_ptr(), size_buffer) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_tensorflow(model: &str, config: &str) -> Result<crate::dnn::Net> {
string_arg!(model);
string_arg!(config);
unsafe { sys::cv_dnn_readNetFromTensorflow_String_String(model.as_ptr(), config.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_tensorflow_buffer(buffer_model: &types::VectorOfuchar, buffer_config: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_readNetFromTensorflow_VectorOfuchar_VectorOfuchar(buffer_model.as_raw_VectorOfuchar(), buffer_config.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_tensorflow_str(buffer_model: &str, len_model: size_t, buffer_config: &str, len_config: size_t) -> Result<crate::dnn::Net> {
string_arg!(buffer_model);
string_arg!(buffer_config);
unsafe { sys::cv_dnn_readNetFromTensorflow_const_char_X_size_t_const_char_X_size_t(buffer_model.as_ptr(), len_model, buffer_config.as_ptr(), len_config) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_from_torch(model: &str, is_binary: bool, evaluate: bool) -> Result<crate::dnn::Net> {
string_arg!(model);
unsafe { sys::cv_dnn_readNetFromTorch_String_bool_bool(model.as_ptr(), is_binary, evaluate) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net(model: &str, config: &str, framework: &str) -> Result<crate::dnn::Net> {
string_arg!(model);
string_arg!(config);
string_arg!(framework);
unsafe { sys::cv_dnn_readNet_String_String_String(model.as_ptr(), config.as_ptr(), framework.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_net_1(framework: &str, buffer_model: &types::VectorOfuchar, buffer_config: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
string_arg!(framework);
unsafe { sys::cv_dnn_readNet_String_VectorOfuchar_VectorOfuchar(framework.as_ptr(), buffer_model.as_raw_VectorOfuchar(), buffer_config.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_tensor_from_onnx(path: &str) -> Result<core::Mat> {
string_arg!(path);
unsafe { sys::cv_dnn_readTensorFromONNX_String(path.as_ptr()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn read_torch_blob(filename: &str, is_binary: bool) -> Result<core::Mat> {
string_arg!(filename);
unsafe { sys::cv_dnn_readTorchBlob_String_bool(filename.as_ptr(), is_binary) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn reset_myriad_device() -> Result<()> {
unsafe { sys::cv_dnn_resetMyriadDevice() }.into_result()
}
pub fn set_inference_engine_backend_type(new_backend_type: &str) -> Result<String> {
string_arg!(new_backend_type);
unsafe { sys::cv_dnn_setInferenceEngineBackendType_String(new_backend_type.as_ptr()) }.into_result().map(crate::templ::receive_string_mut)
}
pub fn shape(mat: &core::Mat) -> Result<types::VectorOfint> {
unsafe { sys::cv_dnn_shape_Mat(mat.as_raw_Mat()) }.into_result().map(|ptr| types::VectorOfint { ptr })
}
pub fn shape_umat(mat: &core::UMat) -> Result<types::VectorOfint> {
unsafe { sys::cv_dnn_shape_UMat(mat.as_raw_UMat()) }.into_result().map(|ptr| types::VectorOfint { ptr })
}
pub fn shape_nd(dims: &i32, n: i32) -> Result<types::VectorOfint> {
unsafe { sys::cv_dnn_shape_const_int_X_int(dims, n) }.into_result().map(|ptr| types::VectorOfint { ptr })
}
pub fn shape_3d(a0: i32, a1: i32, a2: i32, a3: i32) -> Result<types::VectorOfint> {
unsafe { sys::cv_dnn_shape_int_int_int_int(a0, a1, a2, a3) }.into_result().map(|ptr| types::VectorOfint { ptr })
}
pub fn shrink_caffe_model(src: &str, dst: &str, layers_types: &types::VectorOfString) -> Result<()> {
string_arg!(src);
string_arg!(dst);
unsafe { sys::cv_dnn_shrinkCaffeModel_String_String_VectorOfString(src.as_ptr(), dst.as_ptr(), layers_types.as_raw_VectorOfString()) }.into_result()
}
pub fn slice_1d(m: &core::Mat, r0: &core::Range) -> Result<core::Mat> {
unsafe { sys::cv_dnn_slice_Mat_Range(m.as_raw_Mat(), r0.as_raw_Range()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn slice_2d(m: &core::Mat, r0: &core::Range, r1: &core::Range) -> Result<core::Mat> {
unsafe { sys::cv_dnn_slice_Mat_Range_Range(m.as_raw_Mat(), r0.as_raw_Range(), r1.as_raw_Range()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn slice_3d(m: &core::Mat, r0: &core::Range, r1: &core::Range, r2: &core::Range) -> Result<core::Mat> {
unsafe { sys::cv_dnn_slice_Mat_Range_Range_Range(m.as_raw_Mat(), r0.as_raw_Range(), r1.as_raw_Range(), r2.as_raw_Range()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn slice_4d(m: &core::Mat, r0: &core::Range, r1: &core::Range, r2: &core::Range, r3: &core::Range) -> Result<core::Mat> {
unsafe { sys::cv_dnn_slice_Mat_Range_Range_Range_Range(m.as_raw_Mat(), r0.as_raw_Range(), r1.as_raw_Range(), r2.as_raw_Range(), r3.as_raw_Range()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn write_text_graph(model: &str, output: &str) -> Result<()> {
string_arg!(model);
string_arg!(output);
unsafe { sys::cv_dnn_writeTextGraph_String_String(model.as_ptr(), output.as_ptr()) }.into_result()
}
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 core::AlgorithmTrait for AbsLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for AbsLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for AbsLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl AbsLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfAbsLayer> {
unsafe { sys::cv_dnn_AbsLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfAbsLayer { ptr })
}
}
pub trait ActivationLayer: crate::dnn::LayerTrait {
fn as_raw_ActivationLayer(&self) -> *mut c_void;
fn forward_slice(&self, src: &f32, dst: &mut f32, len: i32, out_plane_size: size_t, cn0: i32, cn1: i32) -> Result<()> {
unsafe { sys::cv_dnn_ActivationLayer_forwardSlice_const_const_float_X_float_X_int_size_t_int_int(self.as_raw_ActivationLayer(), src, dst, len, out_plane_size, cn0, cn1) }.into_result()
}
}
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 core::AlgorithmTrait for BNLLLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for BNLLLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for BNLLLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl BNLLLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfBNLLLayer> {
unsafe { sys::cv_dnn_BNLLLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfBNLLLayer { ptr })
}
}
pub struct BackendNode {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BackendNode {
fn drop(&mut self) {
unsafe { sys::cv_BackendNode_delete(self.ptr) };
}
}
impl BackendNode {
#[inline(always)] pub fn as_raw_BackendNode(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BackendNode {}
pub trait BackendWrapper {
fn as_raw_BackendWrapper(&self) -> *mut c_void;
fn copy_to_host(&mut self) -> Result<()> {
unsafe { sys::cv_dnn_BackendWrapper_copyToHost(self.as_raw_BackendWrapper()) }.into_result()
}
fn set_host_dirty(&mut self) -> Result<()> {
unsafe { sys::cv_dnn_BackendWrapper_setHostDirty(self.as_raw_BackendWrapper()) }.into_result()
}
}
pub trait BaseConvolutionLayerTrait: crate::dnn::LayerTrait {
fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void;
}
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 core::AlgorithmTrait for BaseConvolutionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::BaseConvolutionLayerTrait for BaseConvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for BaseConvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
pub struct BatchNormLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BatchNormLayer {
fn drop(&mut self) {
unsafe { sys::cv_BatchNormLayer_delete(self.ptr) };
}
}
impl BatchNormLayer {
#[inline(always)] pub fn as_raw_BatchNormLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BatchNormLayer {}
impl core::AlgorithmTrait for BatchNormLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for BatchNormLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for BatchNormLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl BatchNormLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfBatchNormLayer> {
unsafe { sys::cv_dnn_BatchNormLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfBatchNormLayer { ptr })
}
}
pub struct BlankLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for BlankLayer {
fn drop(&mut self) {
unsafe { sys::cv_BlankLayer_delete(self.ptr) };
}
}
impl BlankLayer {
#[inline(always)] pub fn as_raw_BlankLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BlankLayer {}
impl core::AlgorithmTrait for BlankLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for BlankLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl BlankLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_BlankLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
}
pub struct ChannelsPReLULayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ChannelsPReLULayer {
fn drop(&mut self) {
unsafe { sys::cv_ChannelsPReLULayer_delete(self.ptr) };
}
}
impl ChannelsPReLULayer {
#[inline(always)] pub fn as_raw_ChannelsPReLULayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ChannelsPReLULayer {}
impl core::AlgorithmTrait for ChannelsPReLULayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for ChannelsPReLULayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ChannelsPReLULayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ChannelsPReLULayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_ChannelsPReLULayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
}
pub struct ClassificationModel {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ClassificationModel {
fn drop(&mut self) {
unsafe { sys::cv_ClassificationModel_delete(self.ptr) };
}
}
impl ClassificationModel {
#[inline(always)] pub fn as_raw_ClassificationModel(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ClassificationModel {}
impl crate::dnn::ModelTrait for ClassificationModel {
#[inline(always)] fn as_raw_Model(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::NetTrait for ClassificationModel {
#[inline(always)] fn as_raw_Net(&self) -> *mut c_void { self.ptr }
}
impl ClassificationModel {
pub fn new(model: &str, config: &str) -> Result<crate::dnn::ClassificationModel> {
string_arg!(model);
string_arg!(config);
unsafe { sys::cv_dnn_ClassificationModel_ClassificationModel_String_String(model.as_ptr(), config.as_ptr()) }.into_result().map(|ptr| crate::dnn::ClassificationModel { ptr })
}
pub fn new_1(network: &dyn crate::dnn::NetTrait) -> Result<crate::dnn::ClassificationModel> {
unsafe { sys::cv_dnn_ClassificationModel_ClassificationModel_Net(network.as_raw_Net()) }.into_result().map(|ptr| crate::dnn::ClassificationModel { ptr })
}
pub fn classify(&mut self, frame: &dyn core::ToInputArray, class_id: &mut i32, conf: &mut f32) -> Result<()> {
input_array_arg!(frame);
unsafe { sys::cv_dnn_ClassificationModel_classify__InputArray_int_float(self.as_raw_ClassificationModel(), frame.as_raw__InputArray(), class_id, conf) }.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 core::AlgorithmTrait for ConcatLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ConcatLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ConcatLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfConcatLayer> {
unsafe { sys::cv_dnn_ConcatLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfConcatLayer { ptr })
}
}
pub struct ConstLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ConstLayer {
fn drop(&mut self) {
unsafe { sys::cv_ConstLayer_delete(self.ptr) };
}
}
impl ConstLayer {
#[inline(always)] pub fn as_raw_ConstLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ConstLayer {}
impl core::AlgorithmTrait for ConstLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ConstLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ConstLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_ConstLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { 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 core::AlgorithmTrait for ConvolutionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::BaseConvolutionLayerTrait for ConvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ConvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ConvolutionLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfBaseConvolutionLayer> {
unsafe { sys::cv_dnn_ConvolutionLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfBaseConvolutionLayer { ptr })
}
}
pub struct CropAndResizeLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for CropAndResizeLayer {
fn drop(&mut self) {
unsafe { sys::cv_CropAndResizeLayer_delete(self.ptr) };
}
}
impl CropAndResizeLayer {
#[inline(always)] pub fn as_raw_CropAndResizeLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for CropAndResizeLayer {}
impl core::AlgorithmTrait for CropAndResizeLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for CropAndResizeLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl CropAndResizeLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_CropAndResizeLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { 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 core::AlgorithmTrait for CropLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for CropLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl CropLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_CropLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { 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 core::AlgorithmTrait for DeconvolutionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::BaseConvolutionLayerTrait for DeconvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for DeconvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl DeconvolutionLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfBaseConvolutionLayer> {
unsafe { sys::cv_dnn_DeconvolutionLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfBaseConvolutionLayer { ptr })
}
}
pub struct DetectionModel {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for DetectionModel {
fn drop(&mut self) {
unsafe { sys::cv_DetectionModel_delete(self.ptr) };
}
}
impl DetectionModel {
#[inline(always)] pub fn as_raw_DetectionModel(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for DetectionModel {}
impl crate::dnn::ModelTrait for DetectionModel {
#[inline(always)] fn as_raw_Model(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::NetTrait for DetectionModel {
#[inline(always)] fn as_raw_Net(&self) -> *mut c_void { self.ptr }
}
impl DetectionModel {
pub fn new(model: &str, config: &str) -> Result<crate::dnn::DetectionModel> {
string_arg!(model);
string_arg!(config);
unsafe { sys::cv_dnn_DetectionModel_DetectionModel_String_String(model.as_ptr(), config.as_ptr()) }.into_result().map(|ptr| crate::dnn::DetectionModel { ptr })
}
pub fn new_1(network: &dyn crate::dnn::NetTrait) -> Result<crate::dnn::DetectionModel> {
unsafe { sys::cv_dnn_DetectionModel_DetectionModel_Net(network.as_raw_Net()) }.into_result().map(|ptr| crate::dnn::DetectionModel { ptr })
}
pub fn detect(&mut self, frame: &dyn core::ToInputArray, class_ids: &mut types::VectorOfint, confidences: &mut types::VectorOffloat, boxes: &mut types::VectorOfRect, conf_threshold: f32, nms_threshold: f32) -> Result<()> {
input_array_arg!(frame);
unsafe { sys::cv_dnn_DetectionModel_detect__InputArray_VectorOfint_VectorOffloat_VectorOfRect_float_float(self.as_raw_DetectionModel(), frame.as_raw__InputArray(), class_ids.as_raw_VectorOfint(), confidences.as_raw_VectorOffloat(), boxes.as_raw_VectorOfRect(), conf_threshold, nms_threshold) }.into_result()
}
}
pub struct DetectionOutputLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for DetectionOutputLayer {
fn drop(&mut self) {
unsafe { sys::cv_DetectionOutputLayer_delete(self.ptr) };
}
}
impl DetectionOutputLayer {
#[inline(always)] pub fn as_raw_DetectionOutputLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for DetectionOutputLayer {}
impl core::AlgorithmTrait for DetectionOutputLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for DetectionOutputLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl DetectionOutputLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfDetectionOutputLayer> {
unsafe { sys::cv_dnn_DetectionOutputLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfDetectionOutputLayer { 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 })
}
unsafe fn ptr(&self, key: &str) -> Result<crate::dnn::DictValue> {
string_arg!(key);
{ sys::cv_dnn_Dict_ptr_const_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 })
}
fn erase(&mut self, key: &str) -> Result<()> {
string_arg!(key);
unsafe { sys::cv_dnn_Dict_erase_String(self.as_raw_Dict(), key.as_ptr()) }.into_result()
}
}
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_bool(i: bool) -> Result<crate::dnn::DictValue> {
unsafe { sys::cv_dnn_DictValue_DictValue_bool(i) }.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 fn get_int_value(&self, idx: i32) -> Result<i32> {
unsafe { sys::cv_dnn_DictValue_getIntValue_const_int(self.as_raw_DictValue(), idx) }.into_result()
}
pub fn get_real_value(&self, idx: i32) -> Result<f64> {
unsafe { sys::cv_dnn_DictValue_getRealValue_const_int(self.as_raw_DictValue(), idx) }.into_result()
}
pub fn get_string_value(&self, idx: i32) -> Result<String> {
unsafe { sys::cv_dnn_DictValue_getStringValue_const_int(self.as_raw_DictValue(), idx) }.into_result().map(crate::templ::receive_string_mut)
}
}
pub struct ELULayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ELULayer {
fn drop(&mut self) {
unsafe { sys::cv_ELULayer_delete(self.ptr) };
}
}
impl ELULayer {
#[inline(always)] pub fn as_raw_ELULayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ELULayer {}
impl core::AlgorithmTrait for ELULayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for ELULayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ELULayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ELULayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfELULayer> {
unsafe { sys::cv_dnn_ELULayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfELULayer { ptr })
}
}
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 core::AlgorithmTrait for EltwiseLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for EltwiseLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl EltwiseLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfEltwiseLayer> {
unsafe { sys::cv_dnn_EltwiseLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfEltwiseLayer { ptr })
}
}
pub struct FlattenLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for FlattenLayer {
fn drop(&mut self) {
unsafe { sys::cv_FlattenLayer_delete(self.ptr) };
}
}
impl FlattenLayer {
#[inline(always)] pub fn as_raw_FlattenLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for FlattenLayer {}
impl core::AlgorithmTrait for FlattenLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for FlattenLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl FlattenLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfFlattenLayer> {
unsafe { sys::cv_dnn_FlattenLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfFlattenLayer { ptr })
}
}
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 core::AlgorithmTrait for InnerProductLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for InnerProductLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl InnerProductLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfInnerProductLayer> {
unsafe { sys::cv_dnn_InnerProductLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfInnerProductLayer { ptr })
}
}
pub struct InterpLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for InterpLayer {
fn drop(&mut self) {
unsafe { sys::cv_InterpLayer_delete(self.ptr) };
}
}
impl InterpLayer {
#[inline(always)] pub fn as_raw_InterpLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for InterpLayer {}
impl core::AlgorithmTrait for InterpLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for InterpLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl InterpLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_InterpLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
}
pub struct KeypointsModel {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for KeypointsModel {
fn drop(&mut self) {
unsafe { sys::cv_KeypointsModel_delete(self.ptr) };
}
}
impl KeypointsModel {
#[inline(always)] pub fn as_raw_KeypointsModel(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for KeypointsModel {}
impl crate::dnn::ModelTrait for KeypointsModel {
#[inline(always)] fn as_raw_Model(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::NetTrait for KeypointsModel {
#[inline(always)] fn as_raw_Net(&self) -> *mut c_void { self.ptr }
}
impl KeypointsModel {
pub fn new(model: &str, config: &str) -> Result<crate::dnn::KeypointsModel> {
string_arg!(model);
string_arg!(config);
unsafe { sys::cv_dnn_KeypointsModel_KeypointsModel_String_String(model.as_ptr(), config.as_ptr()) }.into_result().map(|ptr| crate::dnn::KeypointsModel { ptr })
}
pub fn new_1(network: &dyn crate::dnn::NetTrait) -> Result<crate::dnn::KeypointsModel> {
unsafe { sys::cv_dnn_KeypointsModel_KeypointsModel_Net(network.as_raw_Net()) }.into_result().map(|ptr| crate::dnn::KeypointsModel { ptr })
}
pub fn estimate(&mut self, frame: &dyn core::ToInputArray, thresh: f32) -> Result<types::VectorOfPoint2f> {
input_array_arg!(frame);
unsafe { sys::cv_dnn_KeypointsModel_estimate__InputArray_float(self.as_raw_KeypointsModel(), frame.as_raw__InputArray(), thresh) }.into_result().map(|ptr| types::VectorOfPoint2f { 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 core::AlgorithmTrait for LRNLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for LRNLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl LRNLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLRNLayer> {
unsafe { sys::cv_dnn_LRNLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLRNLayer { ptr })
}
}
pub trait LSTMLayer: crate::dnn::LayerTrait {
fn as_raw_LSTMLayer(&self) -> *mut c_void;
#[deprecated = "Use LayerParams::blobs instead."]
fn set_weights(&mut self, wh: &core::Mat, wx: &core::Mat, b: &core::Mat) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setWeights_Mat_Mat_Mat(self.as_raw_LSTMLayer(), wh.as_raw_Mat(), wx.as_raw_Mat(), b.as_raw_Mat()) }.into_result()
}
#[deprecated = "Use flag `produce_cell_output` in LayerParams."]
fn set_use_timstamps_dim(&mut self, _use: bool) -> Result<()> {
unsafe { sys::cv_dnn_LSTMLayer_setUseTimstampsDim_bool(self.as_raw_LSTMLayer(), _use) }.into_result()
}
#[deprecated = "Use flag `use_timestamp_dim` in LayerParams."]
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!(output_name);
unsafe { sys::cv_dnn_LSTMLayer_outputNameToIndex_String(self.as_raw_LSTMLayer(), output_name.as_ptr()) }.into_result()
}
}
impl dyn LSTMLayer + '_ {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLSTMLayer> {
unsafe { sys::cv_dnn_LSTMLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLSTMLayer { ptr })
}
}
pub trait LayerTrait: core::AlgorithmTrait {
fn as_raw_Layer(&self) -> *mut c_void;
fn blobs(&mut self) -> Result<types::VectorOfMat> {
unsafe { sys::cv_dnn_Layer_blobs(self.as_raw_Layer()) }.into_result().map(|ptr| types::VectorOfMat { ptr })
}
fn set_blobs(&mut self, val: types::VectorOfMat) -> Result<()> {
unsafe { sys::cv_dnn_Layer_set_blobs_VectorOfMat(self.as_raw_Layer(), val.as_raw_VectorOfMat()) }.into_result()
}
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 preferable_target(&self) -> Result<i32> {
unsafe { sys::cv_dnn_Layer_preferableTarget_const(self.as_raw_Layer()) }.into_result()
}
fn set_preferable_target(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_dnn_Layer_set_preferableTarget_int(self.as_raw_Layer(), val) }.into_result()
}
fn finalize(&mut self, inputs: &dyn core::ToInputArray, outputs: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(inputs);
output_array_arg!(outputs);
unsafe { sys::cv_dnn_Layer_finalize__InputArray__OutputArray(self.as_raw_Layer(), inputs.as_raw__InputArray(), outputs.as_raw__OutputArray()) }.into_result()
}
fn forward(&mut self, inputs: &dyn core::ToInputArray, outputs: &mut dyn core::ToOutputArray, internals: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(inputs);
output_array_arg!(outputs);
output_array_arg!(internals);
unsafe { sys::cv_dnn_Layer_forward__InputArray__OutputArray__OutputArray(self.as_raw_Layer(), inputs.as_raw__InputArray(), outputs.as_raw__OutputArray(), internals.as_raw__OutputArray()) }.into_result()
}
fn forward_fallback(&mut self, inputs: &dyn core::ToInputArray, outputs: &mut dyn core::ToOutputArray, internals: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(inputs);
output_array_arg!(outputs);
output_array_arg!(internals);
unsafe { sys::cv_dnn_Layer_forward_fallback__InputArray__OutputArray__OutputArray(self.as_raw_Layer(), inputs.as_raw__InputArray(), outputs.as_raw__OutputArray(), internals.as_raw__OutputArray()) }.into_result()
}
#[deprecated = "Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead"]
fn finalize_mat(&mut self, inputs: &types::VectorOfMat) -> Result<types::VectorOfMat> {
unsafe { sys::cv_dnn_Layer_finalize_VectorOfMat(self.as_raw_Layer(), inputs.as_raw_VectorOfMat()) }.into_result().map(|ptr| types::VectorOfMat { ptr })
}
#[deprecated = "This method will be removed in the future release."]
fn run(&mut self, inputs: &types::VectorOfMat, outputs: &mut types::VectorOfMat, internals: &mut types::VectorOfMat) -> Result<()> {
unsafe { sys::cv_dnn_Layer_run_VectorOfMat_VectorOfMat_VectorOfMat(self.as_raw_Layer(), inputs.as_raw_VectorOfMat(), outputs.as_raw_VectorOfMat(), internals.as_raw_VectorOfMat()) }.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!(output_name);
unsafe { sys::cv_dnn_Layer_outputNameToIndex_String(self.as_raw_Layer(), output_name.as_ptr()) }.into_result()
}
fn support_backend(&mut self, backend_id: i32) -> Result<bool> {
unsafe { sys::cv_dnn_Layer_supportBackend_int(self.as_raw_Layer(), backend_id) }.into_result()
}
fn init_halide(&mut self, inputs: &types::VectorOfPtrOfBackendWrapper) -> Result<types::PtrOfBackendNode> {
unsafe { sys::cv_dnn_Layer_initHalide_VectorOfPtrOfBackendWrapper(self.as_raw_Layer(), inputs.as_raw_VectorOfPtrOfBackendWrapper()) }.into_result().map(|ptr| types::PtrOfBackendNode { ptr })
}
fn init_inf_engine(&mut self, inputs: &types::VectorOfPtrOfBackendWrapper) -> Result<types::PtrOfBackendNode> {
unsafe { sys::cv_dnn_Layer_initInfEngine_VectorOfPtrOfBackendWrapper(self.as_raw_Layer(), inputs.as_raw_VectorOfPtrOfBackendWrapper()) }.into_result().map(|ptr| types::PtrOfBackendNode { ptr })
}
fn init_ngraph(&mut self, inputs: &types::VectorOfPtrOfBackendWrapper, nodes: &types::VectorOfPtrOfBackendNode) -> Result<types::PtrOfBackendNode> {
unsafe { sys::cv_dnn_Layer_initNgraph_VectorOfPtrOfBackendWrapper_VectorOfPtrOfBackendNode(self.as_raw_Layer(), inputs.as_raw_VectorOfPtrOfBackendWrapper(), nodes.as_raw_VectorOfPtrOfBackendNode()) }.into_result().map(|ptr| types::PtrOfBackendNode { ptr })
}
fn init_vk_com(&mut self, inputs: &types::VectorOfPtrOfBackendWrapper) -> Result<types::PtrOfBackendNode> {
unsafe { sys::cv_dnn_Layer_initVkCom_VectorOfPtrOfBackendWrapper(self.as_raw_Layer(), inputs.as_raw_VectorOfPtrOfBackendWrapper()) }.into_result().map(|ptr| types::PtrOfBackendNode { ptr })
}
fn init_cuda(&mut self, context: &mut c_void, inputs: &types::VectorOfPtrOfBackendWrapper, outputs: &types::VectorOfPtrOfBackendWrapper) -> Result<types::PtrOfBackendNode> {
unsafe { sys::cv_dnn_Layer_initCUDA_void_X_VectorOfPtrOfBackendWrapper_VectorOfPtrOfBackendWrapper(self.as_raw_Layer(), context, inputs.as_raw_VectorOfPtrOfBackendWrapper(), outputs.as_raw_VectorOfPtrOfBackendWrapper()) }.into_result().map(|ptr| types::PtrOfBackendNode { ptr })
}
fn try_attach(&mut self, node: &types::PtrOfBackendNode) -> Result<types::PtrOfBackendNode> {
unsafe { sys::cv_dnn_Layer_tryAttach_PtrOfBackendNode(self.as_raw_Layer(), node.as_raw_PtrOfBackendNode()) }.into_result().map(|ptr| types::PtrOfBackendNode { ptr })
}
fn set_activation(&mut self, layer: &types::PtrOfActivationLayer) -> Result<bool> {
unsafe { sys::cv_dnn_Layer_setActivation_PtrOfActivationLayer(self.as_raw_Layer(), layer.as_raw_PtrOfActivationLayer()) }.into_result()
}
fn try_fuse(&mut self, top: &mut types::PtrOfLayer) -> Result<bool> {
unsafe { sys::cv_dnn_Layer_tryFuse_PtrOfLayer(self.as_raw_Layer(), top.as_raw_PtrOfLayer()) }.into_result()
}
fn get_scale_shift(&self, scale: &mut core::Mat, shift: &mut core::Mat) -> Result<()> {
unsafe { sys::cv_dnn_Layer_getScaleShift_const_Mat_Mat(self.as_raw_Layer(), scale.as_raw_Mat(), shift.as_raw_Mat()) }.into_result()
}
fn unset_attached(&mut self) -> Result<()> {
unsafe { sys::cv_dnn_Layer_unsetAttached(self.as_raw_Layer()) }.into_result()
}
fn get_memory_shapes(&self, inputs: &types::VectorOfVectorOfint, required_outputs: i32, outputs: &mut types::VectorOfVectorOfint, internals: &mut types::VectorOfVectorOfint) -> Result<bool> {
unsafe { sys::cv_dnn_Layer_getMemoryShapes_const_VectorOfVectorOfint_int_VectorOfVectorOfint_VectorOfVectorOfint(self.as_raw_Layer(), inputs.as_raw_VectorOfVectorOfint(), required_outputs, outputs.as_raw_VectorOfVectorOfint(), internals.as_raw_VectorOfVectorOfint()) }.into_result()
}
fn get_flops(&self, inputs: &types::VectorOfVectorOfint, outputs: &types::VectorOfVectorOfint) -> Result<i64> {
unsafe { sys::cv_dnn_Layer_getFLOPS_const_VectorOfVectorOfint_VectorOfVectorOfint(self.as_raw_Layer(), inputs.as_raw_VectorOfVectorOfint(), outputs.as_raw_VectorOfVectorOfint()) }.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 Layer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for Layer {
fn drop(&mut self) {
unsafe { sys::cv_Layer_delete(self.ptr) };
}
}
impl Layer {
#[inline(always)] pub fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Layer {}
impl core::AlgorithmTrait for Layer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for Layer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl Layer {
pub fn default() -> Result<crate::dnn::Layer> {
unsafe { sys::cv_dnn_Layer_Layer() }.into_result().map(|ptr| crate::dnn::Layer { ptr })
}
pub fn new(params: &crate::dnn::LayerParams) -> Result<crate::dnn::Layer> {
unsafe { sys::cv_dnn_Layer_Layer_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| crate::dnn::Layer { ptr })
}
}
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 blobs(&mut self) -> Result<types::VectorOfMat> {
unsafe { sys::cv_dnn_LayerParams_blobs(self.as_raw_LayerParams()) }.into_result().map(|ptr| types::VectorOfMat { ptr })
}
pub fn set_blobs(&mut self, val: types::VectorOfMat) -> Result<()> {
unsafe { sys::cv_dnn_LayerParams_set_blobs_VectorOfMat(self.as_raw_LayerParams(), val.as_raw_VectorOfMat()) }.into_result()
}
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 core::AlgorithmTrait for MVNLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for MVNLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl MVNLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfMVNLayer> {
unsafe { sys::cv_dnn_MVNLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfMVNLayer { ptr })
}
}
pub struct MaxUnpoolLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for MaxUnpoolLayer {
fn drop(&mut self) {
unsafe { sys::cv_MaxUnpoolLayer_delete(self.ptr) };
}
}
impl MaxUnpoolLayer {
#[inline(always)] pub fn as_raw_MaxUnpoolLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for MaxUnpoolLayer {}
impl core::AlgorithmTrait for MaxUnpoolLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for MaxUnpoolLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl MaxUnpoolLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfMaxUnpoolLayer> {
unsafe { sys::cv_dnn_MaxUnpoolLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfMaxUnpoolLayer { ptr })
}
}
pub struct MishLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for MishLayer {
fn drop(&mut self) {
unsafe { sys::cv_MishLayer_delete(self.ptr) };
}
}
impl MishLayer {
#[inline(always)] pub fn as_raw_MishLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for MishLayer {}
impl core::AlgorithmTrait for MishLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for MishLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for MishLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl MishLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfMishLayer> {
unsafe { sys::cv_dnn_MishLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfMishLayer { ptr })
}
}
pub trait ModelTrait: crate::dnn::NetTrait {
fn as_raw_Model(&self) -> *mut c_void;
fn set_input_size(&mut self, size: core::Size) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_setInputSize_Size(self.as_raw_Model(), size) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_setInputSize_int_int(self.as_raw_Model(), width, height) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
fn set_input_mean(&mut self, mean: core::Scalar) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_setInputMean_Scalar(self.as_raw_Model(), mean) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
fn set_input_scale(&mut self, scale: f64) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_setInputScale_double(self.as_raw_Model(), scale) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
fn set_input_crop(&mut self, crop: bool) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_setInputCrop_bool(self.as_raw_Model(), crop) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_setInputSwapRB_bool(self.as_raw_Model(), swap_rb) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
fn set_input_params(&mut self, scale: f64, size: core::Size, mean: core::Scalar, swap_rb: bool, crop: bool) -> Result<()> {
unsafe { sys::cv_dnn_Model_setInputParams_double_Size_Scalar_bool_bool(self.as_raw_Model(), scale, size, mean, swap_rb, crop) }.into_result()
}
fn predict(&mut self, frame: &dyn core::ToInputArray, outs: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(frame);
output_array_arg!(outs);
unsafe { sys::cv_dnn_Model_predict__InputArray__OutputArray(self.as_raw_Model(), frame.as_raw__InputArray(), outs.as_raw__OutputArray()) }.into_result()
}
}
pub struct Model {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for Model {
fn drop(&mut self) {
unsafe { sys::cv_Model_delete(self.ptr) };
}
}
impl Model {
#[inline(always)] pub fn as_raw_Model(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Model {}
impl crate::dnn::ModelTrait for Model {
#[inline(always)] fn as_raw_Model(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::NetTrait for Model {
#[inline(always)] fn as_raw_Net(&self) -> *mut c_void { self.ptr }
}
impl Model {
pub fn default() -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_Model() }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
pub fn new(model: &str, config: &str) -> Result<crate::dnn::Model> {
string_arg!(model);
string_arg!(config);
unsafe { sys::cv_dnn_Model_Model_String_String(model.as_ptr(), config.as_ptr()) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
pub fn new_1(network: &dyn crate::dnn::NetTrait) -> Result<crate::dnn::Model> {
unsafe { sys::cv_dnn_Model_Model_Net(network.as_raw_Net()) }.into_result().map(|ptr| crate::dnn::Model { ptr })
}
}
pub trait NetTrait {
fn as_raw_Net(&self) -> *mut c_void;
fn empty(&self) -> Result<bool> {
unsafe { sys::cv_dnn_Net_empty_const(self.as_raw_Net()) }.into_result()
}
fn dump(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_Net_dump(self.as_raw_Net()) }.into_result().map(crate::templ::receive_string_mut)
}
fn dump_to_file(&mut self, path: &str) -> Result<()> {
string_arg!(path);
unsafe { sys::cv_dnn_Net_dumpToFile_String(self.as_raw_Net(), path.as_ptr()) }.into_result()
}
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()
}
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()
}
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()
}
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 })
}
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 })
}
fn get_layer_inputs(&mut self, layer_id: &crate::dnn::DictValue) -> Result<types::VectorOfPtrOfLayer> {
unsafe { sys::cv_dnn_Net_getLayerInputs_DictValue(self.as_raw_Net(), layer_id.as_raw_DictValue()) }.into_result().map(|ptr| types::VectorOfPtrOfLayer { ptr })
}
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()
}
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()
}
fn set_inputs_names(&mut self, input_blob_names: &types::VectorOfString) -> Result<()> {
unsafe { sys::cv_dnn_Net_setInputsNames_VectorOfString(self.as_raw_Net(), input_blob_names.as_raw_VectorOfString()) }.into_result()
}
fn forward(&mut self, output_name: &str) -> Result<core::Mat> {
string_arg!(output_name);
unsafe { sys::cv_dnn_Net_forward_String(self.as_raw_Net(), output_name.as_ptr()) }.into_result().map(|ptr| core::Mat { ptr })
}
fn forward_layer(&mut self, output_blobs: &mut dyn core::ToOutputArray, output_name: &str) -> Result<()> {
output_array_arg!(output_blobs);
string_arg!(output_name);
unsafe { sys::cv_dnn_Net_forward__OutputArray_String(self.as_raw_Net(), output_blobs.as_raw__OutputArray(), output_name.as_ptr()) }.into_result()
}
fn forward_first_outputs(&mut self, output_blobs: &mut dyn core::ToOutputArray, out_blob_names: &types::VectorOfString) -> Result<()> {
output_array_arg!(output_blobs);
unsafe { sys::cv_dnn_Net_forward__OutputArray_VectorOfString(self.as_raw_Net(), output_blobs.as_raw__OutputArray(), out_blob_names.as_raw_VectorOfString()) }.into_result()
}
fn forward_all(&mut self, output_blobs: &mut types::VectorOfVectorOfMat, out_blob_names: &types::VectorOfString) -> Result<()> {
unsafe { sys::cv_dnn_Net_forward_VectorOfVectorOfMat_VectorOfString(self.as_raw_Net(), output_blobs.as_raw_VectorOfVectorOfMat(), out_blob_names.as_raw_VectorOfString()) }.into_result()
}
fn set_halide_scheduler(&mut self, scheduler: &str) -> Result<()> {
string_arg!(scheduler);
unsafe { sys::cv_dnn_Net_setHalideScheduler_String(self.as_raw_Net(), scheduler.as_ptr()) }.into_result()
}
fn set_preferable_backend(&mut self, backend_id: i32) -> Result<()> {
unsafe { sys::cv_dnn_Net_setPreferableBackend_int(self.as_raw_Net(), backend_id) }.into_result()
}
fn set_preferable_target(&mut self, target_id: i32) -> Result<()> {
unsafe { sys::cv_dnn_Net_setPreferableTarget_int(self.as_raw_Net(), target_id) }.into_result()
}
fn set_input(&mut self, blob: &dyn core::ToInputArray, name: &str, scalefactor: f64, mean: core::Scalar) -> Result<()> {
input_array_arg!(blob);
string_arg!(name);
unsafe { sys::cv_dnn_Net_setInput__InputArray_String_double_Scalar(self.as_raw_Net(), blob.as_raw__InputArray(), name.as_ptr(), scalefactor, mean) }.into_result()
}
fn set_param(&mut self, layer: &crate::dnn::DictValue, num_param: i32, blob: &core::Mat) -> Result<()> {
unsafe { sys::cv_dnn_Net_setParam_DictValue_int_Mat(self.as_raw_Net(), layer.as_raw_DictValue(), num_param, blob.as_raw_Mat()) }.into_result()
}
fn get_param(&mut self, layer: &crate::dnn::DictValue, num_param: i32) -> Result<core::Mat> {
unsafe { sys::cv_dnn_Net_getParam_DictValue_int(self.as_raw_Net(), layer.as_raw_DictValue(), num_param) }.into_result().map(|ptr| core::Mat { ptr })
}
fn get_unconnected_out_layers(&self) -> Result<types::VectorOfint> {
unsafe { sys::cv_dnn_Net_getUnconnectedOutLayers_const(self.as_raw_Net()) }.into_result().map(|ptr| types::VectorOfint { ptr })
}
fn get_unconnected_out_layers_names(&self) -> Result<types::VectorOfString> {
unsafe { sys::cv_dnn_Net_getUnconnectedOutLayersNames_const(self.as_raw_Net()) }.into_result().map(|ptr| types::VectorOfString { ptr })
}
fn get_layers_shapes(&self, net_input_shapes: &types::VectorOfVectorOfint, layers_ids: &mut types::VectorOfint, in_layers_shapes: &mut types::VectorOfVectorOfVectorOfint, out_layers_shapes: &mut types::VectorOfVectorOfVectorOfint) -> Result<()> {
unsafe { sys::cv_dnn_Net_getLayersShapes_const_VectorOfVectorOfint_VectorOfint_VectorOfVectorOfVectorOfint_VectorOfVectorOfVectorOfint(self.as_raw_Net(), net_input_shapes.as_raw_VectorOfVectorOfint(), layers_ids.as_raw_VectorOfint(), in_layers_shapes.as_raw_VectorOfVectorOfVectorOfint(), out_layers_shapes.as_raw_VectorOfVectorOfVectorOfint()) }.into_result()
}
fn get_layer_shapes(&self, net_input_shapes: &types::VectorOfVectorOfint, layer_id: i32, in_layer_shapes: &mut types::VectorOfVectorOfint, out_layer_shapes: &mut types::VectorOfVectorOfint) -> Result<()> {
unsafe { sys::cv_dnn_Net_getLayerShapes_const_VectorOfVectorOfint_int_VectorOfVectorOfint_VectorOfVectorOfint(self.as_raw_Net(), net_input_shapes.as_raw_VectorOfVectorOfint(), layer_id, in_layer_shapes.as_raw_VectorOfVectorOfint(), out_layer_shapes.as_raw_VectorOfVectorOfint()) }.into_result()
}
fn get_flops(&self, net_input_shapes: &types::VectorOfVectorOfint) -> Result<i64> {
unsafe { sys::cv_dnn_Net_getFLOPS_const_VectorOfVectorOfint(self.as_raw_Net(), net_input_shapes.as_raw_VectorOfVectorOfint()) }.into_result()
}
fn get_flops_1(&self, layer_id: i32, net_input_shapes: &types::VectorOfVectorOfint) -> Result<i64> {
unsafe { sys::cv_dnn_Net_getFLOPS_const_int_VectorOfVectorOfint(self.as_raw_Net(), layer_id, net_input_shapes.as_raw_VectorOfVectorOfint()) }.into_result()
}
fn get_layer_types(&self, layers_types: &mut types::VectorOfString) -> Result<()> {
unsafe { sys::cv_dnn_Net_getLayerTypes_const_VectorOfString(self.as_raw_Net(), layers_types.as_raw_VectorOfString()) }.into_result()
}
fn get_layers_count(&self, layer_type: &str) -> Result<i32> {
string_arg!(layer_type);
unsafe { sys::cv_dnn_Net_getLayersCount_const_String(self.as_raw_Net(), layer_type.as_ptr()) }.into_result()
}
fn get_memory_consumption(&self, net_input_shapes: &types::VectorOfVectorOfint, weights: &mut size_t, blobs: &mut size_t) -> Result<()> {
unsafe { sys::cv_dnn_Net_getMemoryConsumption_const_VectorOfVectorOfint_size_t_size_t(self.as_raw_Net(), net_input_shapes.as_raw_VectorOfVectorOfint(), weights, blobs) }.into_result()
}
fn get_memory_consumption_for_layer(&self, layer_id: i32, net_input_shapes: &types::VectorOfVectorOfint, weights: &mut size_t, blobs: &mut size_t) -> Result<()> {
unsafe { sys::cv_dnn_Net_getMemoryConsumption_const_int_VectorOfVectorOfint_size_t_size_t(self.as_raw_Net(), layer_id, net_input_shapes.as_raw_VectorOfVectorOfint(), weights, blobs) }.into_result()
}
fn get_memory_consumption_for_layers(&self, net_input_shapes: &types::VectorOfVectorOfint, layer_ids: &mut types::VectorOfint, weights: &mut types::VectorOfsize_t, blobs: &mut types::VectorOfsize_t) -> Result<()> {
unsafe { sys::cv_dnn_Net_getMemoryConsumption_const_VectorOfVectorOfint_VectorOfint_VectorOfsize_t_VectorOfsize_t(self.as_raw_Net(), net_input_shapes.as_raw_VectorOfVectorOfint(), layer_ids.as_raw_VectorOfint(), weights.as_raw_VectorOfsize_t(), blobs.as_raw_VectorOfsize_t()) }.into_result()
}
fn enable_fusion(&mut self, fusion: bool) -> Result<()> {
unsafe { sys::cv_dnn_Net_enableFusion_bool(self.as_raw_Net(), fusion) }.into_result()
}
fn get_perf_profile(&mut self, timings: &mut types::VectorOfdouble) -> Result<i64> {
unsafe { sys::cv_dnn_Net_getPerfProfile_VectorOfdouble(self.as_raw_Net(), timings.as_raw_VectorOfdouble()) }.into_result()
}
}
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 crate::dnn::NetTrait for Net {
#[inline(always)] fn as_raw_Net(&self) -> *mut c_void { self.ptr }
}
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 read_from_model_optimizer(xml: &str, bin: &str) -> Result<crate::dnn::Net> {
string_arg!(xml);
string_arg!(bin);
unsafe { sys::cv_dnn_Net_readFromModelOptimizer_String_String(xml.as_ptr(), bin.as_ptr()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_from_model_optimizer_1(buffer_model_config: &types::VectorOfuchar, buffer_weights: &types::VectorOfuchar) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_Net_readFromModelOptimizer_VectorOfuchar_VectorOfuchar(buffer_model_config.as_raw_VectorOfuchar(), buffer_weights.as_raw_VectorOfuchar()) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn read_from_model_optimizer_2(buffer_model_config_ptr: &u8, buffer_model_config_size: size_t, buffer_weights_ptr: &u8, buffer_weights_size: size_t) -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_Net_readFromModelOptimizer_const_uchar_X_size_t_const_uchar_X_size_t(buffer_model_config_ptr, buffer_model_config_size, buffer_weights_ptr, buffer_weights_size) }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
}
pub struct NormalizeBBoxLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for NormalizeBBoxLayer {
fn drop(&mut self) {
unsafe { sys::cv_NormalizeBBoxLayer_delete(self.ptr) };
}
}
impl NormalizeBBoxLayer {
#[inline(always)] pub fn as_raw_NormalizeBBoxLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for NormalizeBBoxLayer {}
impl core::AlgorithmTrait for NormalizeBBoxLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for NormalizeBBoxLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl NormalizeBBoxLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfNormalizeBBoxLayer> {
unsafe { sys::cv_dnn_NormalizeBBoxLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfNormalizeBBoxLayer { ptr })
}
}
pub struct PaddingLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for PaddingLayer {
fn drop(&mut self) {
unsafe { sys::cv_PaddingLayer_delete(self.ptr) };
}
}
impl PaddingLayer {
#[inline(always)] pub fn as_raw_PaddingLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for PaddingLayer {}
impl core::AlgorithmTrait for PaddingLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for PaddingLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PaddingLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfPaddingLayer> {
unsafe { sys::cv_dnn_PaddingLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfPaddingLayer { ptr })
}
}
pub struct PermuteLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for PermuteLayer {
fn drop(&mut self) {
unsafe { sys::cv_PermuteLayer_delete(self.ptr) };
}
}
impl PermuteLayer {
#[inline(always)] pub fn as_raw_PermuteLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for PermuteLayer {}
impl core::AlgorithmTrait for PermuteLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for PermuteLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PermuteLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfPermuteLayer> {
unsafe { sys::cv_dnn_PermuteLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfPermuteLayer { 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 core::AlgorithmTrait for PoolingLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for PoolingLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PoolingLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfPoolingLayer> {
unsafe { sys::cv_dnn_PoolingLayer_create_LayerParams(params.as_raw_LayerParams()) }.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 core::AlgorithmTrait for PowerLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for PowerLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for PowerLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PowerLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfPowerLayer> {
unsafe { sys::cv_dnn_PowerLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfPowerLayer { ptr })
}
}
pub struct PriorBoxLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for PriorBoxLayer {
fn drop(&mut self) {
unsafe { sys::cv_PriorBoxLayer_delete(self.ptr) };
}
}
impl PriorBoxLayer {
#[inline(always)] pub fn as_raw_PriorBoxLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for PriorBoxLayer {}
impl core::AlgorithmTrait for PriorBoxLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for PriorBoxLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl PriorBoxLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfPriorBoxLayer> {
unsafe { sys::cv_dnn_PriorBoxLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfPriorBoxLayer { ptr })
}
}
pub struct ProposalLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ProposalLayer {
fn drop(&mut self) {
unsafe { sys::cv_ProposalLayer_delete(self.ptr) };
}
}
impl ProposalLayer {
#[inline(always)] pub fn as_raw_ProposalLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ProposalLayer {}
impl core::AlgorithmTrait for ProposalLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ProposalLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ProposalLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfProposalLayer> {
unsafe { sys::cv_dnn_ProposalLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfProposalLayer { ptr })
}
}
pub trait RNNLayer: crate::dnn::LayerTrait {
fn as_raw_RNNLayer(&self) -> *mut c_void;
fn set_weights(&mut self, wxh: &core::Mat, bh: &core::Mat, whh: &core::Mat, who: &core::Mat, bo: &core::Mat) -> Result<()> {
unsafe { sys::cv_dnn_RNNLayer_setWeights_Mat_Mat_Mat_Mat_Mat(self.as_raw_RNNLayer(), wxh.as_raw_Mat(), bh.as_raw_Mat(), whh.as_raw_Mat(), who.as_raw_Mat(), bo.as_raw_Mat()) }.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(params: &crate::dnn::LayerParams) -> Result<types::PtrOfRNNLayer> {
unsafe { sys::cv_dnn_RNNLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfRNNLayer { ptr })
}
}
pub struct ReLU6Layer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ReLU6Layer {
fn drop(&mut self) {
unsafe { sys::cv_ReLU6Layer_delete(self.ptr) };
}
}
impl ReLU6Layer {
#[inline(always)] pub fn as_raw_ReLU6Layer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ReLU6Layer {}
impl core::AlgorithmTrait for ReLU6Layer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for ReLU6Layer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ReLU6Layer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ReLU6Layer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfReLU6Layer> {
unsafe { sys::cv_dnn_ReLU6Layer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfReLU6Layer { 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 core::AlgorithmTrait for ReLULayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for ReLULayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ReLULayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ReLULayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfReLULayer> {
unsafe { sys::cv_dnn_ReLULayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfReLULayer { ptr })
}
}
pub struct RegionLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for RegionLayer {
fn drop(&mut self) {
unsafe { sys::cv_RegionLayer_delete(self.ptr) };
}
}
impl RegionLayer {
#[inline(always)] pub fn as_raw_RegionLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for RegionLayer {}
impl core::AlgorithmTrait for RegionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for RegionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl RegionLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfRegionLayer> {
unsafe { sys::cv_dnn_RegionLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfRegionLayer { ptr })
}
}
pub struct ReorgLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ReorgLayer {
fn drop(&mut self) {
unsafe { sys::cv_ReorgLayer_delete(self.ptr) };
}
}
impl ReorgLayer {
#[inline(always)] pub fn as_raw_ReorgLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ReorgLayer {}
impl core::AlgorithmTrait for ReorgLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ReorgLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ReorgLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfReorgLayer> {
unsafe { sys::cv_dnn_ReorgLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfReorgLayer { 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 core::AlgorithmTrait for ReshapeLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ReshapeLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ReshapeLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfReshapeLayer> {
unsafe { sys::cv_dnn_ReshapeLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfReshapeLayer { ptr })
}
}
pub struct ResizeLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ResizeLayer {
fn drop(&mut self) {
unsafe { sys::cv_ResizeLayer_delete(self.ptr) };
}
}
impl ResizeLayer {
#[inline(always)] pub fn as_raw_ResizeLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ResizeLayer {}
impl core::AlgorithmTrait for ResizeLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ResizeLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ResizeLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfResizeLayer> {
unsafe { sys::cv_dnn_ResizeLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfResizeLayer { ptr })
}
}
pub struct ScaleLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ScaleLayer {
fn drop(&mut self) {
unsafe { sys::cv_ScaleLayer_delete(self.ptr) };
}
}
impl ScaleLayer {
#[inline(always)] pub fn as_raw_ScaleLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ScaleLayer {}
impl core::AlgorithmTrait for ScaleLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ScaleLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ScaleLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfScaleLayer> {
unsafe { sys::cv_dnn_ScaleLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfScaleLayer { ptr })
}
}
pub struct SegmentationModel {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SegmentationModel {
fn drop(&mut self) {
unsafe { sys::cv_SegmentationModel_delete(self.ptr) };
}
}
impl SegmentationModel {
#[inline(always)] pub fn as_raw_SegmentationModel(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SegmentationModel {}
impl crate::dnn::ModelTrait for SegmentationModel {
#[inline(always)] fn as_raw_Model(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::NetTrait for SegmentationModel {
#[inline(always)] fn as_raw_Net(&self) -> *mut c_void { self.ptr }
}
impl SegmentationModel {
pub fn new(model: &str, config: &str) -> Result<crate::dnn::SegmentationModel> {
string_arg!(model);
string_arg!(config);
unsafe { sys::cv_dnn_SegmentationModel_SegmentationModel_String_String(model.as_ptr(), config.as_ptr()) }.into_result().map(|ptr| crate::dnn::SegmentationModel { ptr })
}
pub fn new_1(network: &dyn crate::dnn::NetTrait) -> Result<crate::dnn::SegmentationModel> {
unsafe { sys::cv_dnn_SegmentationModel_SegmentationModel_Net(network.as_raw_Net()) }.into_result().map(|ptr| crate::dnn::SegmentationModel { ptr })
}
pub fn segment(&mut self, frame: &dyn core::ToInputArray, mask: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(frame);
output_array_arg!(mask);
unsafe { sys::cv_dnn_SegmentationModel_segment__InputArray__OutputArray(self.as_raw_SegmentationModel(), frame.as_raw__InputArray(), mask.as_raw__OutputArray()) }.into_result()
}
}
pub struct ShiftLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ShiftLayer {
fn drop(&mut self) {
unsafe { sys::cv_ShiftLayer_delete(self.ptr) };
}
}
impl ShiftLayer {
#[inline(always)] pub fn as_raw_ShiftLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ShiftLayer {}
impl core::AlgorithmTrait for ShiftLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ShiftLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ShiftLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_ShiftLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
}
pub struct ShuffleChannelLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for ShuffleChannelLayer {
fn drop(&mut self) {
unsafe { sys::cv_ShuffleChannelLayer_delete(self.ptr) };
}
}
impl ShuffleChannelLayer {
#[inline(always)] pub fn as_raw_ShuffleChannelLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ShuffleChannelLayer {}
impl core::AlgorithmTrait for ShuffleChannelLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for ShuffleChannelLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ShuffleChannelLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_ShuffleChannelLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfLayer { 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 core::AlgorithmTrait for SigmoidLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for SigmoidLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for SigmoidLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SigmoidLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfSigmoidLayer> {
unsafe { sys::cv_dnn_SigmoidLayer_create_LayerParams(params.as_raw_LayerParams()) }.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 core::AlgorithmTrait for SliceLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for SliceLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SliceLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfSliceLayer> {
unsafe { sys::cv_dnn_SliceLayer_create_LayerParams(params.as_raw_LayerParams()) }.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 core::AlgorithmTrait for SoftmaxLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for SoftmaxLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SoftmaxLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfSoftmaxLayer> {
unsafe { sys::cv_dnn_SoftmaxLayer_create_LayerParams(params.as_raw_LayerParams()) }.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 core::AlgorithmTrait for SplitLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for SplitLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SplitLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfSplitLayer> {
unsafe { sys::cv_dnn_SplitLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfSplitLayer { ptr })
}
}
pub struct SwishLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for SwishLayer {
fn drop(&mut self) {
unsafe { sys::cv_SwishLayer_delete(self.ptr) };
}
}
impl SwishLayer {
#[inline(always)] pub fn as_raw_SwishLayer(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for SwishLayer {}
impl core::AlgorithmTrait for SwishLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for SwishLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for SwishLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl SwishLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfSwishLayer> {
unsafe { sys::cv_dnn_SwishLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfSwishLayer { 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 core::AlgorithmTrait for TanHLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::ActivationLayer for TanHLayer {
#[inline(always)] fn as_raw_ActivationLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::LayerTrait for TanHLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl TanHLayer {
pub fn create(params: &crate::dnn::LayerParams) -> Result<types::PtrOfTanHLayer> {
unsafe { sys::cv_dnn_TanHLayer_create_LayerParams(params.as_raw_LayerParams()) }.into_result().map(|ptr| types::PtrOfTanHLayer { ptr })
}
}
pub use crate::manual::dnn::*;