Added easier way to set colors + tests

This commit is contained in:
2024-04-15 23:28:10 -05:00
parent 98a96f9f5f
commit 60aff508bd
9 changed files with 148 additions and 20 deletions

View File

@@ -7,8 +7,6 @@ use rten::Model;
use ocrs::{OcrEngine, OcrEngineParams};
use image::{ColorType, ImageFormat};
use crate::Point;
const MATRIX_LEN: usize = 800;
const TEXT_MATRIX_RATIO: f64 = 0.5;
const LINE_WIDTH: f64 = 10.0;
@@ -18,6 +16,13 @@ const TEXT_X_SIZE: f64 = (MATRIX_X_SIZE as f64) * TEXT_MATRIX_RATIO;
const TEXT_X_OFFSET: f64 = (MATRIX_X_SIZE - TEXT_X_SIZE) / 2.0;
const LINE_WIDTH_X_OFFSET: f64 = LINE_WIDTH / 2.0;
#[derive(Debug)]
pub struct Point {
pub x: f64,
pub y: f64,
pub new_line: bool,
}
pub fn print_words(points: &Vec<Point>) -> Result<(), Box<dyn Error>> {
let begin = Instant::now();