MuseScore  3.4
Music composition and notation
ocr.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Reader
3 // Music Score Reader
4 //
5 // Copyright (C) 2010 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __OCR_H__
21 #define __OCR_H__
22 
23 
24 namespace tesseract {
25  class TessBaseAPI;
26  };
27 
28 namespace Ms {
29 
30 
31 //---------------------------------------------------------
32 // OcrImage
33 //---------------------------------------------------------
34 
35 struct OcrImage {
36  uint* image;
37  QRect r;
38  int stride; // uint* stride
39 
40  OcrImage() {}
41  OcrImage(const uchar* p, const QRect& _r, int _s) : image((uint*)p), r(_r), stride(_s) {}
42  OcrImage crop() const;
43  bool dot(int x, int y) const {
44  return (*(image + (y * stride) + (x / 32))) & (0x1 << (x % 32));
45  }
46  };
47 
48 //---------------------------------------------------------
49 // Ocr
50 //---------------------------------------------------------
51 
52 class Ocr {
53  tesseract::TessBaseAPI* tess;
54 
55  public:
56  Ocr();
57  void init();
58  QString readLine(const OcrImage&);
59  };
60 }
61 
62 #endif
63 
OcrImage(const uchar *p, const QRect &_r, int _s)
Definition: ocr.h:41
Definition: ocr.h:35
uint * image
Definition: ocr.h:36
Definition: ocr.h:24
Definition: ocr.h:52
QRect r
Definition: ocr.h:37
Definition: aeolus.cpp:26
bool dot(int x, int y) const
Definition: ocr.h:43
int stride
Definition: ocr.h:38
tesseract::TessBaseAPI * tess
Definition: ocr.h:53
OcrImage()
Definition: ocr.h:40