use crate::{mod_prelude::*, core, sys, types};
use crate::core::{_InputArrayTrait, _OutputArrayTrait};
pub struct DnnSuperResImpl {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for DnnSuperResImpl {
fn drop(&mut self) {
unsafe { sys::cv_DnnSuperResImpl_delete(self.ptr) };
}
}
impl DnnSuperResImpl {
#[inline(always)] pub fn as_raw_DnnSuperResImpl(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for DnnSuperResImpl {}
impl DnnSuperResImpl {
pub fn default() -> Result<crate::dnn_superres::DnnSuperResImpl> {
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_DnnSuperResImpl() }.into_result().map(|ptr| crate::dnn_superres::DnnSuperResImpl { ptr })
}
pub fn new(algo: &str, scale: i32) -> Result<crate::dnn_superres::DnnSuperResImpl> {
string_arg!(algo);
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_DnnSuperResImpl_std_string_int(algo.as_ptr(), scale) }.into_result().map(|ptr| crate::dnn_superres::DnnSuperResImpl { ptr })
}
pub fn read_model(&mut self, path: &str) -> Result<()> {
string_arg!(path);
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_readModel_std_string(self.as_raw_DnnSuperResImpl(), path.as_ptr()) }.into_result()
}
pub fn read_model_1(&mut self, weights: &str, definition: &str) -> Result<()> {
string_arg!(weights);
string_arg!(definition);
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_readModel_std_string_std_string(self.as_raw_DnnSuperResImpl(), weights.as_ptr(), definition.as_ptr()) }.into_result()
}
pub fn set_model(&mut self, algo: &str, scale: i32) -> Result<()> {
string_arg!(algo);
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_setModel_std_string_int(self.as_raw_DnnSuperResImpl(), algo.as_ptr(), scale) }.into_result()
}
pub fn upsample(&mut self, img: &dyn core::ToInputArray, result: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(img);
output_array_arg!(result);
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_upsample__InputArray__OutputArray(self.as_raw_DnnSuperResImpl(), img.as_raw__InputArray(), result.as_raw__OutputArray()) }.into_result()
}
pub fn upsample_multioutput(&mut self, img: &dyn core::ToInputArray, imgs_new: &mut types::VectorOfMat, scale_factors: &types::VectorOfint, node_names: &types::VectorOfString) -> Result<()> {
input_array_arg!(img);
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_upsampleMultioutput__InputArray_VectorOfMat_VectorOfint_VectorOfString(self.as_raw_DnnSuperResImpl(), img.as_raw__InputArray(), imgs_new.as_raw_VectorOfMat(), scale_factors.as_raw_VectorOfint(), node_names.as_raw_VectorOfString()) }.into_result()
}
pub fn get_scale(&mut self) -> Result<i32> {
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_getScale(self.as_raw_DnnSuperResImpl()) }.into_result()
}
pub fn get_algorithm(&mut self) -> Result<String> {
unsafe { sys::cv_dnn_superres_DnnSuperResImpl_getAlgorithm(self.as_raw_DnnSuperResImpl()) }.into_result().map(crate::templ::receive_string_mut)
}
}