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 BLOCK_MEAN_HASH_MODE_0: i32 = 0;
pub const BLOCK_MEAN_HASH_MODE_1: i32 = 1;
pub struct AverageHash {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::img_hash::AverageHash {
fn drop(&mut self) {
unsafe { sys::cv_AverageHash_delete(self.ptr) };
}
}
impl crate::img_hash::AverageHash {
#[inline(always)] pub fn as_raw_AverageHash(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for AverageHash {}
impl core::Algorithm for AverageHash {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::img_hash::ImgHashBase for AverageHash {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void { self.ptr }
}
impl AverageHash {
pub fn create() -> Result<types::PtrOfAverageHash> {
unsafe { sys::cv_img_hash_AverageHash_create() }.into_result().map(|ptr| types::PtrOfAverageHash { ptr })
}
}
pub struct BlockMeanHash {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::img_hash::BlockMeanHash {
fn drop(&mut self) {
unsafe { sys::cv_BlockMeanHash_delete(self.ptr) };
}
}
impl crate::img_hash::BlockMeanHash {
#[inline(always)] pub fn as_raw_BlockMeanHash(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for BlockMeanHash {}
impl core::Algorithm for BlockMeanHash {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::img_hash::ImgHashBase for BlockMeanHash {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void { self.ptr }
}
impl BlockMeanHash {
pub fn set_mode(&mut self, mode: i32) -> Result<()> {
unsafe { sys::cv_img_hash_BlockMeanHash_setMode_int(self.as_raw_BlockMeanHash(), mode) }.into_result()
}
pub fn get_mean(&self) -> Result<types::VectorOfdouble> {
unsafe { sys::cv_img_hash_BlockMeanHash_getMean_const(self.as_raw_BlockMeanHash()) }.into_result().map(|ptr| types::VectorOfdouble { ptr })
}
pub fn create(mode: i32) -> Result<types::PtrOfBlockMeanHash> {
unsafe { sys::cv_img_hash_BlockMeanHash_create_int(mode) }.into_result().map(|ptr| types::PtrOfBlockMeanHash { ptr })
}
}
pub struct ColorMomentHash {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::img_hash::ColorMomentHash {
fn drop(&mut self) {
unsafe { sys::cv_ColorMomentHash_delete(self.ptr) };
}
}
impl crate::img_hash::ColorMomentHash {
#[inline(always)] pub fn as_raw_ColorMomentHash(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for ColorMomentHash {}
impl core::Algorithm for ColorMomentHash {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::img_hash::ImgHashBase for ColorMomentHash {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void { self.ptr }
}
impl ColorMomentHash {
pub fn create() -> Result<types::PtrOfColorMomentHash> {
unsafe { sys::cv_img_hash_ColorMomentHash_create() }.into_result().map(|ptr| types::PtrOfColorMomentHash { ptr })
}
}
pub trait ImgHashBase: core::Algorithm {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void;
}
pub struct MarrHildrethHash {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::img_hash::MarrHildrethHash {
fn drop(&mut self) {
unsafe { sys::cv_MarrHildrethHash_delete(self.ptr) };
}
}
impl crate::img_hash::MarrHildrethHash {
#[inline(always)] pub fn as_raw_MarrHildrethHash(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for MarrHildrethHash {}
impl core::Algorithm for MarrHildrethHash {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::img_hash::ImgHashBase for MarrHildrethHash {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void { self.ptr }
}
impl MarrHildrethHash {
pub fn get_alpha(&self) -> Result<f32> {
unsafe { sys::cv_img_hash_MarrHildrethHash_getAlpha_const(self.as_raw_MarrHildrethHash()) }.into_result()
}
pub fn get_scale(&self) -> Result<f32> {
unsafe { sys::cv_img_hash_MarrHildrethHash_getScale_const(self.as_raw_MarrHildrethHash()) }.into_result()
}
pub fn set_kernel_param(&mut self, alpha: f32, scale: f32) -> Result<()> {
unsafe { sys::cv_img_hash_MarrHildrethHash_setKernelParam_float_float(self.as_raw_MarrHildrethHash(), alpha, scale) }.into_result()
}
pub fn create(alpha: f32, scale: f32) -> Result<types::PtrOfMarrHildrethHash> {
unsafe { sys::cv_img_hash_MarrHildrethHash_create_float_float(alpha, scale) }.into_result().map(|ptr| types::PtrOfMarrHildrethHash { ptr })
}
}
pub struct PHash {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::img_hash::PHash {
fn drop(&mut self) {
unsafe { sys::cv_PHash_delete(self.ptr) };
}
}
impl crate::img_hash::PHash {
#[inline(always)] pub fn as_raw_PHash(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for PHash {}
impl core::Algorithm for PHash {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::img_hash::ImgHashBase for PHash {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void { self.ptr }
}
impl PHash {
pub fn create() -> Result<types::PtrOfPHash> {
unsafe { sys::cv_img_hash_PHash_create() }.into_result().map(|ptr| types::PtrOfPHash { ptr })
}
}
pub struct RadialVarianceHash {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::img_hash::RadialVarianceHash {
fn drop(&mut self) {
unsafe { sys::cv_RadialVarianceHash_delete(self.ptr) };
}
}
impl crate::img_hash::RadialVarianceHash {
#[inline(always)] pub fn as_raw_RadialVarianceHash(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for RadialVarianceHash {}
impl core::Algorithm for RadialVarianceHash {
#[inline(always)] fn as_raw_Algorithm(&self) -> *mut c_void { self.ptr }
}
impl crate::img_hash::ImgHashBase for RadialVarianceHash {
#[inline(always)] fn as_raw_ImgHashBase(&self) -> *mut c_void { self.ptr }
}
impl RadialVarianceHash {
pub fn create(sigma: f64, num_of_angle_line: i32) -> Result<types::PtrOfRadialVarianceHash> {
unsafe { sys::cv_img_hash_RadialVarianceHash_create_double_int(sigma, num_of_angle_line) }.into_result().map(|ptr| types::PtrOfRadialVarianceHash { ptr })
}
pub fn get_num_of_angle_line(&self) -> Result<i32> {
unsafe { sys::cv_img_hash_RadialVarianceHash_getNumOfAngleLine_const(self.as_raw_RadialVarianceHash()) }.into_result()
}
pub fn get_sigma(&self) -> Result<f64> {
unsafe { sys::cv_img_hash_RadialVarianceHash_getSigma_const(self.as_raw_RadialVarianceHash()) }.into_result()
}
pub fn set_num_of_angle_line(&mut self, value: i32) -> Result<()> {
unsafe { sys::cv_img_hash_RadialVarianceHash_setNumOfAngleLine_int(self.as_raw_RadialVarianceHash(), value) }.into_result()
}
pub fn set_sigma(&mut self, value: f64) -> Result<()> {
unsafe { sys::cv_img_hash_RadialVarianceHash_setSigma_double(self.as_raw_RadialVarianceHash(), value) }.into_result()
}
pub fn get_features(&mut self) -> Result<types::VectorOfdouble> {
unsafe { sys::cv_img_hash_RadialVarianceHash_getFeatures(self.as_raw_RadialVarianceHash()) }.into_result().map(|ptr| types::VectorOfdouble { ptr })
}
pub fn get_hash(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_img_hash_RadialVarianceHash_getHash(self.as_raw_RadialVarianceHash()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn get_projection(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_img_hash_RadialVarianceHash_getProjection(self.as_raw_RadialVarianceHash()) }.into_result().map(|ptr| core::Mat { ptr })
}
}