aboutsummaryrefslogtreecommitdiff
path: root/include/libchelleport.h
blob: b69466eb8df6b0b7d4b9aee5cc63f0f881c410a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include <chrono>
#include <iostream>
#include <leptonica/allheaders.h>
#include <memory>
#include <tesseract/baseapi.h>
#include <vector>

#include "./recognizer.h"

#define MEASURE(label, stmts)                                                  \
  auto start = std::chrono::high_resolution_clock::now();                      \
  stmts;                                                                       \
  auto end = std::chrono::high_resolution_clock::now();                        \
  auto duration =                                                              \
      std::chrono::duration_cast<std::chrono::microseconds>(end - start);      \
  std::cout << label << ": " << duration.count() / 1000.0 << " ms" << std::endl;

extern "C" {
OCRMatch *findWordCoordinates(const char *image_path, /* returns */ int *size);
}

std::vector<OCRMatch> extractTextMatches(const char *imagePath);

std::vector<OCRMatch>
runRecognizers(std::vector<std::unique_ptr<Recognizer>> &recognizers,
               Pix *image);