在tesseract中查找字形的边界框

时间:2015-11-13 06:56:35

标签: c++ ocr tesseract python-tesseract

我正在浏览tesseract的c ++ API部分,并找到了这段代码,用于从文本中获取每个符号。

struct Node {
    value: i32,
    next: Option<Box<Node>>
}

impl Node {
    pub fn swap_with_next(&mut self) {
        use std::mem::swap;

        match self.next.take() {
            Some(mut next_node) => {
                let next_next = next_node.next.take();
                swap(self, &mut next_node);
                next_node.next = next_next;
                self.next = Some(next_node);
            },
            None => {
                // Uh-oh, there's nothing to swap *with*!
                panic!("cannot swap with nothing");
            }
        }
    }

    pub fn show(&self) {
        print!("{:?}", self.value);
        if let Some(next) = self.next.as_ref() {
            print!(" -> ");
            next.show();
        }
    }
}

fn main() {
    let mut w = Box::new(Node { value: 0, next: None });
    let mut x = Box::new(Node { value: 1, next: Some(w) });
    let mut y = Box::new(Node { value: 2, next: Some(x) });

    y.show();
    println!("");

    y.swap_with_next();
    y.show();
    println!("");
}

现在,如果我们为此边界框({​​{1}})提供了错误的尺寸,它就不会为您提供所需的文字。那么有没有办法在tesseract中估计这些尺寸。 链接到来源https://code.google.com/p/tesseract-ocr/wiki/APIExample#Example_of_iterator_over_the_classifier_choices_for_a_single_sym

0 个答案:

没有答案
相关问题