aboutsummaryrefslogtreecommitdiff
path: root/include/libchelleport.h
blob: c02297515e29fbfb12908e3070dc03f2edcd0945 (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
#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);