1use opencv::{
2 Error,
3 core::{Point, Rect2i, Vector},
4};
5
6#[derive(Clone, Debug)]
7pub enum ReadingIdentificationError {
8 InternalError(&'static str),
9 CouldNotIdentifyReadings,
10 CouldNotIdentityLCDCandidate,
11 UnexpectedNumberOfRows,
12 CouldNotProcessSegments,
13}
14
15#[derive(Clone, Debug)]
16pub struct RejectedLcdScreenCandidate {
17 pub contour: Vector<Point>,
18}
19
20#[derive(Clone, Debug)]
21pub struct LcdScreenCandidate {
22 pub coordinates: Vector<Point>,
23 pub area: f64,
24 pub contour: Vector<Point>,
25}
26
27pub enum LcdScreenCandidateResult {
28 Success(LcdScreenCandidate),
29 Failure(RejectedLcdScreenCandidate),
30}
31
32#[derive(Debug)]
33pub enum ProcessingError {
34 ImageDetectionLibraryError(Error),
35 AppError(ReadingIdentificationError),
36}
37
38impl From<Error> for ProcessingError {
39 fn from(error: Error) -> Self {
40 return Self::ImageDetectionLibraryError(error);
41 }
42}
43
44#[derive(Clone, Debug)]
45pub(crate) struct RectangleCoordinates {
46 pub top_left: Point,
47 pub top_right: Point,
48 pub bottom_left: Point,
49 pub bottom_right: Point,
50}
51
52#[derive(Clone, Debug)]
53pub(crate) struct ReadingLocations {
54 pub systolic_region: Vec<Rect2i>,
55 pub diastolic_region: Vec<Rect2i>,
56 pub pulse_region: Vec<Rect2i>,
57}
58
59#[derive(Clone, Debug, PartialEq)]
60pub struct BloodPressureReading {
61 pub systolic: i32,
62 pub diastolic: i32,
63 pub pulse: i32,
64}