use std::os::raw::{c_char, c_void};
use libc::{ptrdiff_t, size_t};
use crate::{Error, Result, core, sys, types};
use crate::core::{_InputArray, _OutputArray};
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_DEFAULT: i32 = 0;
pub const DNN_BACKEND_HALIDE: i32 = 1;
pub const DNN_BACKEND_INFERENCE_ENGINE: i32 = 2;
pub const DNN_BACKEND_OPENCV: i32 = 3;
pub const DNN_TARGET_CPU: i32 = 0;
pub const DNN_TARGET_FPGA: i32 = 4;
pub const DNN_TARGET_MYRIAD: i32 = 3;
pub const DNN_TARGET_OPENCL: i32 = 1;
pub const DNN_TARGET_OPENCL_FP16: i32 = 2;
#[repr(C)]
#[derive(Debug)]
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,
}
#[repr(C)]
#[derive(Debug)]
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_FPGA = DNN_TARGET_FPGA 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_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_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 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 crate::dnn::AbsLayer {
fn drop(&mut self) {
unsafe { sys::cv_AbsLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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::Layer {
#[inline(always)] 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 crate::dnn::BNLLLayer {
fn drop(&mut self) {
unsafe { sys::cv_BNLLLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::BackendNode {
fn drop(&mut self) {
unsafe { sys::cv_BackendNode_delete(self.ptr) };
}
}
impl crate::dnn::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 {}
impl BackendNode {
pub fn new(backend_id: i32) -> Result<crate::dnn::BackendNode> {
unsafe { sys::cv_dnn_BackendNode_BackendNode_int(backend_id) }.into_result().map(|ptr| crate::dnn::BackendNode { ptr })
}
}
pub trait BackendWrapper {
#[inline(always)] 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 BaseConvolutionLayer: crate::dnn::Layer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void;
}
pub struct BatchNormLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::BatchNormLayer {
fn drop(&mut self) {
unsafe { sys::cv_BatchNormLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::BlankLayer {
fn drop(&mut self) {
unsafe { sys::cv_BlankLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for BlankLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ChannelsPReLULayer {
fn drop(&mut self) {
unsafe { sys::cv_ChannelsPReLULayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 ConcatLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::ConcatLayer {
fn drop(&mut self) {
unsafe { sys::cv_ConcatLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ConcatLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ConstLayer {
fn drop(&mut self) {
unsafe { sys::cv_ConstLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ConstLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ConvolutionLayer {
fn drop(&mut self) {
unsafe { sys::cv_ConvolutionLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ConvolutionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::BaseConvolutionLayer for ConvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer for ConvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl ConvolutionLayer {
pub fn create(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 crate::dnn::CropAndResizeLayer {
fn drop(&mut self) {
unsafe { sys::cv_CropAndResizeLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for CropAndResizeLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::CropLayer {
fn drop(&mut self) {
unsafe { sys::cv_CropLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for CropLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::DeconvolutionLayer {
fn drop(&mut self) {
unsafe { sys::cv_DeconvolutionLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for DeconvolutionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::BaseConvolutionLayer for DeconvolutionLayer {
#[inline(always)] fn as_raw_BaseConvolutionLayer(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer for DeconvolutionLayer {
#[inline(always)] fn as_raw_Layer(&self) -> *mut c_void { self.ptr }
}
impl DeconvolutionLayer {
pub fn create(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 DetectionOutputLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::DetectionOutputLayer {
fn drop(&mut self) {
unsafe { sys::cv_DetectionOutputLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for DetectionOutputLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 Dict {
#[inline(always)] 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 DictValue {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::DictValue {
fn drop(&mut self) {
unsafe { sys::cv_DictValue_delete(self.ptr) };
}
}
impl crate::dnn::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 crate::dnn::ELULayer {
fn drop(&mut self) {
unsafe { sys::cv_ELULayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::EltwiseLayer {
fn drop(&mut self) {
unsafe { sys::cv_EltwiseLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for EltwiseLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::FlattenLayer {
fn drop(&mut self) {
unsafe { sys::cv_FlattenLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for FlattenLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::InnerProductLayer {
fn drop(&mut self) {
unsafe { sys::cv_InnerProductLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for InnerProductLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::InterpLayer {
fn drop(&mut self) {
unsafe { sys::cv_InterpLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for InterpLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 LRNLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::LRNLayer {
fn drop(&mut self) {
unsafe { sys::cv_LRNLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for LRNLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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::Layer {
#[inline(always)] 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 Layer: core::Algorithm {
#[inline(always)] 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 finalize_to(&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(&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 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 LayerFactory {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::LayerFactory {
fn drop(&mut self) {
unsafe { sys::cv_LayerFactory_delete(self.ptr) };
}
}
impl crate::dnn::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 crate::dnn::LayerParams {
fn drop(&mut self) {
unsafe { sys::cv_LayerParams_delete(self.ptr) };
}
}
impl crate::dnn::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::Dict 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 crate::dnn::MVNLayer {
fn drop(&mut self) {
unsafe { sys::cv_MVNLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for MVNLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::MaxUnpoolLayer {
fn drop(&mut self) {
unsafe { sys::cv_MaxUnpoolLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for MaxUnpoolLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 Net {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::Net {
fn drop(&mut self) {
unsafe { sys::cv_Net_delete(self.ptr) };
}
}
impl crate::dnn::Net {
#[inline(always)] pub fn as_raw_Net(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for Net {}
impl Net {
pub fn default() -> Result<crate::dnn::Net> {
unsafe { sys::cv_dnn_Net_Net() }.into_result().map(|ptr| crate::dnn::Net { ptr })
}
pub fn 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 empty(&self) -> Result<bool> {
unsafe { sys::cv_dnn_Net_empty_const(self.as_raw_Net()) }.into_result()
}
pub fn dump(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_Net_dump(self.as_raw_Net()) }.into_result().map(crate::templ::receive_string_mut)
}
pub 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()
}
pub fn add_layer(&mut self, name: &str, _type: &str, params: &mut crate::dnn::LayerParams) -> Result<i32> {
string_arg!(name);
string_arg!(_type);
unsafe { sys::cv_dnn_Net_addLayer_String_String_LayerParams(self.as_raw_Net(), name.as_ptr(), _type.as_ptr(), params.as_raw_LayerParams()) }.into_result()
}
pub fn add_layer_to_prev(&mut self, name: &str, _type: &str, params: &mut crate::dnn::LayerParams) -> Result<i32> {
string_arg!(name);
string_arg!(_type);
unsafe { sys::cv_dnn_Net_addLayerToPrev_String_String_LayerParams(self.as_raw_Net(), name.as_ptr(), _type.as_ptr(), params.as_raw_LayerParams()) }.into_result()
}
pub fn get_layer_id(&mut self, layer: &str) -> Result<i32> {
string_arg!(layer);
unsafe { sys::cv_dnn_Net_getLayerId_String(self.as_raw_Net(), layer.as_ptr()) }.into_result()
}
pub fn get_layer_names(&self) -> Result<types::VectorOfString> {
unsafe { sys::cv_dnn_Net_getLayerNames_const(self.as_raw_Net()) }.into_result().map(|ptr| types::VectorOfString { ptr })
}
pub fn get_layer(&mut self, layer_id: &crate::dnn::DictValue) -> Result<types::PtrOfLayer> {
unsafe { sys::cv_dnn_Net_getLayer_DictValue(self.as_raw_Net(), layer_id.as_raw_DictValue()) }.into_result().map(|ptr| types::PtrOfLayer { ptr })
}
pub fn 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 })
}
pub fn connect_first_second(&mut self, out_pin: &str, inp_pin: &str) -> Result<()> {
string_arg!(mut out_pin);
string_arg!(mut inp_pin);
unsafe { sys::cv_dnn_Net_connect_String_String(self.as_raw_Net(), out_pin.as_ptr() as _, inp_pin.as_ptr() as _) }.into_result()
}
pub fn connect(&mut self, out_layer_id: i32, out_num: i32, inp_layer_id: i32, inp_num: i32) -> Result<()> {
unsafe { sys::cv_dnn_Net_connect_int_int_int_int(self.as_raw_Net(), out_layer_id, out_num, inp_layer_id, inp_num) }.into_result()
}
pub fn set_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()
}
pub 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 })
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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 })
}
pub 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 })
}
pub 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 })
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub 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()
}
pub fn enable_fusion(&mut self, fusion: bool) -> Result<()> {
unsafe { sys::cv_dnn_Net_enableFusion_bool(self.as_raw_Net(), fusion) }.into_result()
}
pub 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 NormalizeBBoxLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::NormalizeBBoxLayer {
fn drop(&mut self) {
unsafe { sys::cv_NormalizeBBoxLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for NormalizeBBoxLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::PaddingLayer {
fn drop(&mut self) {
unsafe { sys::cv_PaddingLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for PaddingLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::PermuteLayer {
fn drop(&mut self) {
unsafe { sys::cv_PermuteLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for PermuteLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::PoolingLayer {
fn drop(&mut self) {
unsafe { sys::cv_PoolingLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for PoolingLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::PowerLayer {
fn drop(&mut self) {
unsafe { sys::cv_PowerLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::PriorBoxLayer {
fn drop(&mut self) {
unsafe { sys::cv_PriorBoxLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for PriorBoxLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ProposalLayer {
fn drop(&mut self) {
unsafe { sys::cv_ProposalLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ProposalLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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::Layer {
#[inline(always)] 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 crate::dnn::ReLU6Layer {
fn drop(&mut self) {
unsafe { sys::cv_ReLU6Layer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::ReLULayer {
fn drop(&mut self) {
unsafe { sys::cv_ReLULayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::RegionLayer {
fn drop(&mut self) {
unsafe { sys::cv_RegionLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for RegionLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ReorgLayer {
fn drop(&mut self) {
unsafe { sys::cv_ReorgLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ReorgLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ReshapeLayer {
fn drop(&mut self) {
unsafe { sys::cv_ReshapeLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ReshapeLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ResizeLayer {
fn drop(&mut self) {
unsafe { sys::cv_ResizeLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ResizeLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ScaleLayer {
fn drop(&mut self) {
unsafe { sys::cv_ScaleLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ScaleLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 ShiftLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::ShiftLayer {
fn drop(&mut self) {
unsafe { sys::cv_ShiftLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ShiftLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::ShuffleChannelLayer {
fn drop(&mut self) {
unsafe { sys::cv_ShuffleChannelLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for ShuffleChannelLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::SigmoidLayer {
fn drop(&mut self) {
unsafe { sys::cv_SigmoidLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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 crate::dnn::SliceLayer {
fn drop(&mut self) {
unsafe { sys::cv_SliceLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for SliceLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::SoftmaxLayer {
fn drop(&mut self) {
unsafe { sys::cv_SoftmaxLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for SoftmaxLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 crate::dnn::SplitLayer {
fn drop(&mut self) {
unsafe { sys::cv_SplitLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm for SplitLayer {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::dnn::Layer 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 TanHLayer {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::dnn::TanHLayer {
fn drop(&mut self) {
unsafe { sys::cv_TanHLayer_delete(self.ptr) };
}
}
impl crate::dnn::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::Algorithm 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::Layer 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::*;