use crate::border_mode::{BorderMode, MorphScalar};
use crate::op::morph_impl;
use crate::op_impl::make_morphology;
use crate::op_type::MorphOp;
use crate::structuring_element::KernelShape;
use crate::{ImageSize, MorphExOp, MorphologyThreadingPolicy};
pub fn dilate_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Dilate as u8 }, 1>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn dilate_rgb_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Dilate as u8 }, 3>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn erode_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Erode as u8 }, 1>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn erode_rgb_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Erode as u8 }, 3>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn erode_rgba_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Erode as u8 }, 4>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn dilate_rgba_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Dilate as u8 }, 4>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn erode_gray_alpha_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Erode as u8 }, 2>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn dilate_gray_alpha_f32(
src: &[f32],
dst: &mut [f32],
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
make_morphology::<f32, { MorphOp::Dilate as u8 }, 2>(
src,
dst,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn morphology_rgba_f32(
src: &[f32],
dst: &mut [f32],
morph_op: MorphExOp,
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
morph_impl::<f32, 4>(
src,
dst,
morph_op,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}
pub fn morphology_rgb_f32(
src: &[f32],
dst: &mut [f32],
morph_op: MorphExOp,
image_size: ImageSize,
structuring_element: &[u8],
structuring_element_size: KernelShape,
border_mode: BorderMode,
border_scalar: MorphScalar,
threading_policy: MorphologyThreadingPolicy,
) -> Result<(), String> {
morph_impl::<f32, 3>(
src,
dst,
morph_op,
image_size,
structuring_element,
structuring_element_size,
border_mode,
border_scalar,
threading_policy,
)
}