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 BM3D_STEP1: i32 = 1;
pub const BM3D_STEP2: i32 = 2;
pub const BM3D_STEPALL: i32 = 0;
pub const HAAR: i32 = 0;
pub const INPAINT_SHIFTMAP: i32 = 0;
pub fn apply_channel_gains(src: &dyn core::ToInputArray, dst: &mut dyn core::ToOutputArray, gain_b: f32, gain_g: f32, gain_r: f32) -> Result<()> {
input_array_arg!(src);
output_array_arg!(dst);
unsafe { sys::cv_xphoto_applyChannelGains__InputArray__OutputArray_float_float_float(src.as_raw__InputArray(), dst.as_raw__OutputArray(), gain_b, gain_g, gain_r) }.into_result()
}
pub fn bm3d_denoising(src: &dyn core::ToInputArray, dst_step1: &mut dyn core::ToInputOutputArray, dst_step2: &mut dyn core::ToOutputArray, h: f32, template_window_size: i32, search_window_size: i32, block_matching_step1: i32, block_matching_step2: i32, group_size: i32, sliding_step: i32, beta: f32, norm_type: i32, step: i32, transform_type: i32) -> Result<()> {
input_array_arg!(src);
input_output_array_arg!(dst_step1);
output_array_arg!(dst_step2);
unsafe { sys::cv_xphoto_bm3dDenoising__InputArray__InputOutputArray__OutputArray_float_int_int_int_int_int_int_float_int_int_int(src.as_raw__InputArray(), dst_step1.as_raw__InputOutputArray(), dst_step2.as_raw__OutputArray(), h, template_window_size, search_window_size, block_matching_step1, block_matching_step2, group_size, sliding_step, beta, norm_type, step, transform_type) }.into_result()
}
pub fn bm3d_denoising_1(src: &dyn core::ToInputArray, dst: &mut dyn core::ToOutputArray, h: f32, template_window_size: i32, search_window_size: i32, block_matching_step1: i32, block_matching_step2: i32, group_size: i32, sliding_step: i32, beta: f32, norm_type: i32, step: i32, transform_type: i32) -> Result<()> {
input_array_arg!(src);
output_array_arg!(dst);
unsafe { sys::cv_xphoto_bm3dDenoising__InputArray__OutputArray_float_int_int_int_int_int_int_float_int_int_int(src.as_raw__InputArray(), dst.as_raw__OutputArray(), h, template_window_size, search_window_size, block_matching_step1, block_matching_step2, group_size, sliding_step, beta, norm_type, step, transform_type) }.into_result()
}
pub fn create_grayworld_wb() -> Result<types::PtrOfGrayworldWB> {
unsafe { sys::cv_xphoto_createGrayworldWB() }.into_result().map(|ptr| types::PtrOfGrayworldWB { ptr })
}
pub fn create_learning_based_wb(path_to_model: &str) -> Result<types::PtrOfLearningBasedWB> {
string_arg!(path_to_model);
unsafe { sys::cv_xphoto_createLearningBasedWB_String(path_to_model.as_ptr()) }.into_result().map(|ptr| types::PtrOfLearningBasedWB { ptr })
}
pub fn create_simple_wb() -> Result<types::PtrOfSimpleWB> {
unsafe { sys::cv_xphoto_createSimpleWB() }.into_result().map(|ptr| types::PtrOfSimpleWB { ptr })
}
pub fn dct_denoising(src: &core::Mat, dst: &mut core::Mat, sigma: f64, psize: i32) -> Result<()> {
unsafe { sys::cv_xphoto_dctDenoising_Mat_Mat_double_int(src.as_raw_Mat(), dst.as_raw_Mat(), sigma, psize) }.into_result()
}
pub fn inpaint(src: &core::Mat, mask: &core::Mat, dst: &mut core::Mat, algorithm_type: i32) -> Result<()> {
unsafe { sys::cv_xphoto_inpaint_Mat_Mat_Mat_int(src.as_raw_Mat(), mask.as_raw_Mat(), dst.as_raw_Mat(), algorithm_type) }.into_result()
}
pub trait GrayworldWB: crate::xphoto::WhiteBalancer {
#[inline(always)] fn as_raw_GrayworldWB(&self) -> *mut c_void;
fn get_saturation_threshold(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_GrayworldWB_getSaturationThreshold_const(self.as_raw_GrayworldWB()) }.into_result()
}
fn set_saturation_threshold(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_GrayworldWB_setSaturationThreshold_float(self.as_raw_GrayworldWB(), val) }.into_result()
}
}
pub trait LearningBasedWB: crate::xphoto::WhiteBalancer {
#[inline(always)] fn as_raw_LearningBasedWB(&self) -> *mut c_void;
fn extract_simple_features(&mut self, src: &dyn core::ToInputArray, dst: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(src);
output_array_arg!(dst);
unsafe { sys::cv_xphoto_LearningBasedWB_extractSimpleFeatures__InputArray__OutputArray(self.as_raw_LearningBasedWB(), src.as_raw__InputArray(), dst.as_raw__OutputArray()) }.into_result()
}
fn get_range_max_val(&self) -> Result<i32> {
unsafe { sys::cv_xphoto_LearningBasedWB_getRangeMaxVal_const(self.as_raw_LearningBasedWB()) }.into_result()
}
fn set_range_max_val(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_xphoto_LearningBasedWB_setRangeMaxVal_int(self.as_raw_LearningBasedWB(), val) }.into_result()
}
fn get_saturation_threshold(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_LearningBasedWB_getSaturationThreshold_const(self.as_raw_LearningBasedWB()) }.into_result()
}
fn set_saturation_threshold(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_LearningBasedWB_setSaturationThreshold_float(self.as_raw_LearningBasedWB(), val) }.into_result()
}
fn get_hist_bin_num(&self) -> Result<i32> {
unsafe { sys::cv_xphoto_LearningBasedWB_getHistBinNum_const(self.as_raw_LearningBasedWB()) }.into_result()
}
fn set_hist_bin_num(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_xphoto_LearningBasedWB_setHistBinNum_int(self.as_raw_LearningBasedWB(), val) }.into_result()
}
}
pub trait SimpleWB: crate::xphoto::WhiteBalancer {
#[inline(always)] fn as_raw_SimpleWB(&self) -> *mut c_void;
fn get_input_min(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_SimpleWB_getInputMin_const(self.as_raw_SimpleWB()) }.into_result()
}
fn set_input_min(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_SimpleWB_setInputMin_float(self.as_raw_SimpleWB(), val) }.into_result()
}
fn get_input_max(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_SimpleWB_getInputMax_const(self.as_raw_SimpleWB()) }.into_result()
}
fn set_input_max(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_SimpleWB_setInputMax_float(self.as_raw_SimpleWB(), val) }.into_result()
}
fn get_output_min(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_SimpleWB_getOutputMin_const(self.as_raw_SimpleWB()) }.into_result()
}
fn set_output_min(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_SimpleWB_setOutputMin_float(self.as_raw_SimpleWB(), val) }.into_result()
}
fn get_output_max(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_SimpleWB_getOutputMax_const(self.as_raw_SimpleWB()) }.into_result()
}
fn set_output_max(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_SimpleWB_setOutputMax_float(self.as_raw_SimpleWB(), val) }.into_result()
}
fn get_p(&self) -> Result<f32> {
unsafe { sys::cv_xphoto_SimpleWB_getP_const(self.as_raw_SimpleWB()) }.into_result()
}
fn set_p(&mut self, val: f32) -> Result<()> {
unsafe { sys::cv_xphoto_SimpleWB_setP_float(self.as_raw_SimpleWB(), val) }.into_result()
}
}
pub trait WhiteBalancer: core::Algorithm {
#[inline(always)] fn as_raw_WhiteBalancer(&self) -> *mut c_void;
fn balance_white(&mut self, src: &dyn core::ToInputArray, dst: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(src);
output_array_arg!(dst);
unsafe { sys::cv_xphoto_WhiteBalancer_balanceWhite__InputArray__OutputArray(self.as_raw_WhiteBalancer(), src.as_raw__InputArray(), dst.as_raw__OutputArray()) }.into_result()
}
}