Skip to main content

CvError

Enum CvError 

Source
pub enum CvError {
Show 17 variants InvalidDimensions { width: u32, height: u32, }, InvalidRoi { x: u32, y: u32, width: u32, height: u32, }, InvalidKernelSize { size: usize, }, ColorConversion { message: String, }, UnsupportedFormat { format: String, }, DetectionFailed { message: String, }, TransformError { message: String, }, TrackingError { message: String, }, InsufficientData { expected: usize, actual: usize, }, MatrixError { message: String, }, InvalidParameter { name: String, value: String, }, Core(OxiError), OnnxRuntime { message: String, }, ModelLoad { message: String, }, TensorError { message: String, }, ShapeMismatch { expected: Vec<usize>, actual: Vec<usize>, }, Io(Error),
}
Expand description

Error type for computer vision operations.

This enum covers all possible errors that can occur during image processing, detection, and transformation operations.

§Examples

use oximedia_cv::error::{CvError, CvResult};

fn process_image(width: u32, height: u32) -> CvResult<()> {
    if width == 0 || height == 0 {
        return Err(CvError::InvalidDimensions { width, height });
    }
    Ok(())
}

Variants§

§

InvalidDimensions

Invalid image dimensions (width or height is zero).

Fields

§width: u32

Image width.

§height: u32

Image height.

§

InvalidRoi

Invalid region of interest.

Fields

§x: u32

ROI x coordinate.

§y: u32

ROI y coordinate.

§width: u32

ROI width.

§height: u32

ROI height.

§

InvalidKernelSize

Invalid kernel size for filter operations.

Fields

§size: usize

The invalid kernel size.

§

ColorConversion

Color space conversion error.

Fields

§message: String

Description of the error.

§

UnsupportedFormat

Unsupported pixel format.

Fields

§format: String

The unsupported format name.

§

DetectionFailed

Detection failed.

Fields

§message: String

Description of the failure.

§

TransformError

Transform computation failed.

Fields

§message: String

Description of the error.

§

TrackingError

Tracking operation failed.

Fields

§message: String

Description of the error.

§

InsufficientData

Insufficient data for operation.

Fields

§expected: usize

Expected number of bytes.

§actual: usize

Actual number of bytes.

§

MatrixError

Matrix operation error.

Fields

§message: String

Description of the error.

§

InvalidParameter

Invalid parameter value.

Fields

§name: String

Parameter name.

§value: String

Invalid value description.

§

Core(OxiError)

Core error from oximedia-core.

§

OnnxRuntime

ONNX Runtime error.

Fields

§message: String

Description of the error.

§

ModelLoad

Model loading error.

Fields

§message: String

Description of the error.

§

TensorError

Tensor operation error.

Fields

§message: String

Description of the error.

§

ShapeMismatch

Shape mismatch error.

Fields

§expected: Vec<usize>

Expected shape.

§actual: Vec<usize>

Actual shape.

§

Io(Error)

I/O error.

Implementations§

Source§

impl CvError

Source

pub const fn invalid_dimensions(width: u32, height: u32) -> Self

Creates a new invalid dimensions error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::invalid_dimensions(0, 100);
assert!(matches!(err, CvError::InvalidDimensions { width: 0, height: 100 }));
Source

pub const fn invalid_roi(x: u32, y: u32, width: u32, height: u32) -> Self

Creates a new invalid ROI error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::invalid_roi(10, 20, 0, 50);
assert!(matches!(err, CvError::InvalidRoi { .. }));
Source

pub const fn invalid_kernel_size(size: usize) -> Self

Creates a new invalid kernel size error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::invalid_kernel_size(4);
assert!(matches!(err, CvError::InvalidKernelSize { size: 4 }));
Source

pub fn color_conversion(message: impl Into<String>) -> Self

Creates a new color conversion error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::color_conversion("Invalid color values");
assert!(matches!(err, CvError::ColorConversion { .. }));
Source

pub fn unsupported_format(format: impl Into<String>) -> Self

Creates a new unsupported format error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::unsupported_format("YUV444");
assert!(matches!(err, CvError::UnsupportedFormat { .. }));
Source

pub fn detection_failed(message: impl Into<String>) -> Self

Creates a new detection failed error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::detection_failed("No faces found");
assert!(matches!(err, CvError::DetectionFailed { .. }));
Source

pub fn transform_error(message: impl Into<String>) -> Self

Creates a new transform error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::transform_error("Matrix is singular");
assert!(matches!(err, CvError::TransformError { .. }));
Source

pub fn tracking_error(message: impl Into<String>) -> Self

Creates a new tracking error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::tracking_error("Tracker not initialized");
assert!(matches!(err, CvError::TrackingError { .. }));
Source

pub const fn insufficient_data(expected: usize, actual: usize) -> Self

Creates a new insufficient data error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::insufficient_data(1024, 512);
assert!(matches!(err, CvError::InsufficientData { expected: 1024, actual: 512 }));
Source

pub fn matrix_error(message: impl Into<String>) -> Self

Creates a new matrix error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::matrix_error("Matrix dimensions mismatch");
assert!(matches!(err, CvError::MatrixError { .. }));
Source

pub fn invalid_parameter( name: impl Into<String>, value: impl Into<String>, ) -> Self

Creates a new invalid parameter error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::invalid_parameter("sigma", "-1.0");
assert!(matches!(err, CvError::InvalidParameter { .. }));
Source

pub fn onnx_runtime(message: impl Into<String>) -> Self

Creates a new ONNX Runtime error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::onnx_runtime("Session initialization failed");
assert!(matches!(err, CvError::OnnxRuntime { .. }));
Source

pub fn model_load(message: impl Into<String>) -> Self

Creates a new model load error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::model_load("File not found");
assert!(matches!(err, CvError::ModelLoad { .. }));
Source

pub fn tensor_error(message: impl Into<String>) -> Self

Creates a new tensor error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::tensor_error("Invalid data type");
assert!(matches!(err, CvError::TensorError { .. }));
Source

pub fn shape_mismatch(expected: Vec<usize>, actual: Vec<usize>) -> Self

Creates a new shape mismatch error.

§Examples
use oximedia_cv::error::CvError;

let err = CvError::shape_mismatch(vec![1, 3, 224, 224], vec![1, 3, 256, 256]);
assert!(matches!(err, CvError::ShapeMismatch { .. }));

Trait Implementations§

Source§

impl Debug for CvError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CvError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for CvError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for CvError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<OxiError> for CvError

Source§

fn from(source: OxiError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<E> OxiErrorExt for E
where E: Error,

Source§

fn with_oxi_context(self, frame: ErrorFrame) -> OxiError

Wraps self by prepending the frame’s display string as context.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.