Skip to content

Commit

Permalink
Update action uses versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed May 17, 2024
1 parent 727d26c commit ac03dca
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
include:
- binary: libtesseract.so.aarch64
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4.1.6
- name: Install Dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
cmake --build build --config Release
mv build/libtesseract64.so build/libtesseract.so.aarch64
- uses: actions/upload-artifact@v3.1.0
- uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.binary }}
path: build/${{ matrix.binary }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
include:
- binary: libtesseract64.so
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4.1.6
- name: Install Dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
ldd build/${{ matrix.binary }}
- uses: actions/upload-artifact@v3.1.0
- uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.binary }}
path: build/${{ matrix.binary }}
Expand All @@ -71,8 +71,8 @@ jobs:
https://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.4/fpc-src_3.2.2-210709_amd64.deb
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4.1.6
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.binary }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
include:
- binary: libtesseract.dylib.aarch64
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4.1.6

- name: Install Dependencies
run: |
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
run: |
otool -L build/${{ matrix.binary }}
- uses: actions/upload-artifact@v3.1.0
- uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.binary }}
path: build/${{ matrix.binary }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
include:
- binary: libtesseract64.dylib
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4.1.6

- name: Install Dependencies
run: |
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
otool -L build/${{ matrix.binary }}
- uses: actions/upload-artifact@v3.1.0
- uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.binary }}
path: build/${{ matrix.binary }}
Expand All @@ -71,8 +71,8 @@ jobs:
https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20x86-64/Lazarus%202.2.4/fpc-src-3.2.2-20210709-macosx.dmg
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4.1.6
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.binary }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4.1.6

- uses: msys2/setup-msys2@v2
with:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
run: |
ldd build/${{ matrix.binary }}
- uses: actions/upload-artifact@v3.1.0
- uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.binary }}
path: build/${{ matrix.binary }}
Expand All @@ -97,8 +97,8 @@ jobs:
laz-url: https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Lazarus%202.2.4/lazarus-2.2.4-fpc-3.2.2-win32.exe

steps:
- uses: actions/checkout@v3.1.0
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4.1.6
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.binary }}

Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ Downloads are available here https://github.com/ollydev/libtesseract/releases

This is a shared library (dll, so, dylib) which exports basic C [Tesseract-OCR](https://github.com/tesseract-ocr/tesseract) functions for basic text recognition. Tesseract and it's dependencies have been statically linked so only a single library is required.

The following methods are exported:
Many optional features are not built to make static linking much easier these are:
```
'--without-libpng' '--without-zlib' '--without-jpeg' '--without-libtiff' '--without-giflib' '--without-libwebp' '--without-libwebpmux' '--without-libopenjpeg'
'--disable-legacy' '--disable-graphics' '--disable-openmp' '--without-curl' '--without-archive'
```
All these exports should be available:

https://github.com/tesseract-ocr/tesseract/blob/main/include/tesseract/capi.h

----

In addition the following "simple" methods are exported for basic text recognition:
```c++
tesseract::TessBaseAPI* Tesseract_Create();
void Tesseract_Delete(tesseract::TessBaseAPI* &tesseract_ptr);
Expand All @@ -27,6 +38,7 @@ Example Pascal header:
```pascal
function Tesseract_Init(ptr: Pointer; datapath, language: PChar): Int32; external 'libtesseract32.dll'
```

----

See the [Github Action](https://github.com/ollydev/libTesseract/blob/master/.github/workflows/build.yml) to see how this is built. Thanks to [SoftwareNetwork](https://github.com/SoftwareNetwork/sw) for making this a lot easier than it used to be.
See the [Github Actions](https://github.com/ollydev/libTesseract/tree/master/.github/workflows) to see how this is built.
17 changes: 8 additions & 9 deletions exports.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,28 @@ static const char* PascalExports[] =
{
(char*)"Tesseract_Create", (char*)"function Tesseract_Create: Pointer;",
(char*)"Tesseract_Delete", (char*)"procedure Tesseract_Delete(var Tess: Pointer);",
(char*)"Tesseract_Init", (char*)"function Tesseract_Init(Tess: Pointer; DataPath, Language: TessTextPtr): Int32;",
(char*)"Tesseract_Init", (char*)"function Tesseract_Init(Tess: Pointer; DataPath, Language: Pointer): Int32;",
(char*)"Tesseract_End", (char*)"procedure Tesseract_End(var Tess: Pointer);",
(char*)"Tesseract_SetPageSegMode", (char*)"procedure Tesseract_SetPageSegMode(Tess: Pointer; Mode: Int32);",
(char*)"Tesseract_GetPageSegMode", (char*)"function Tesseract_GetPageSegMode(Tess: Pointer): Int32;",
(char*)"Tesseract_MeanTextConf", (char*)"function Tesseract_MeanTextConf(Tess: Pointer): Single;",
(char*)"Tesseract_SetImage", (char*)"procedure Tesseract_SetImage(Tess: Pointer; ImageData: Pointer; Width, Height, BytesPerPixel, BytesPerLine: Int32);",
(char*)"Tesseract_GetUTF8Text", (char*)"function Tesseract_GetUTF8Text(Tess: Pointer; var Len: Int32): TessTextPtr;",
(char*)"Tesseract_FreeUTF8Text", (char*)"procedure Tesseract_FreeUTF8Text(var Text: TessTextPtr);",
(char*)"Tesseract_SetVariable", (char*)"function Tesseract_SetVariable(Tess: Pointer; Name, Value: TessTextPtr): Boolean;",
(char*)"Tesseract_GetUTF8Text", (char*)"function Tesseract_GetUTF8Text(Tess: Pointer; var Len: Int32): Pointer;",
(char*)"Tesseract_FreeUTF8Text", (char*)"procedure Tesseract_FreeUTF8Text(var Text: Pointer);",
(char*)"Tesseract_SetVariable", (char*)"function Tesseract_SetVariable(Tess: Pointer; Name, Value: Pointer): Boolean;",
(char*)"Tesseract_Clear", (char*)"procedure Tesseract_Clear(Tess: Pointer);",
(char*)"Tesseract_GetBlockCount", (char*)"function Tesseract_GetBlockCount(Tess: Pointer): Int32;",
(char*)"Tesseract_GetLineCount", (char*)"function Tesseract_GetLineCount(Tess: Pointer): Int32;",
(char*)"Tesseract_GetWordCount", (char*)"function Tesseract_GetWordCount(Tess: Pointer): Int32;",
(char*)"Tesseract_GetCharacterCount", (char*)"function Tesseract_GetCharacterCount(Tess: Pointer): Int32;",
(char*)"Tesseract_GetBlockMatch", (char*)"procedure Tesseract_GetBlockMatch(Tess: Pointer; Index: Int32; var Text: TessTextPtr; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetLineMatch", (char*)"procedure Tesseract_GetLineMatch(Tess: Pointer; Index: Int32; var Text: TessTextPtr; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetWordMatch", (char*)"procedure Tesseract_GetWordMatch(Tess: Pointer; Index: Int32; var Text: TessTextPtr; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetCharacterMatch", (char*)"procedure Tesseract_GetCharacterMatch(Tess: Pointer; Index: Int32; var Text: TessTextPtr; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetBlockMatch", (char*)"procedure Tesseract_GetBlockMatch(Tess: Pointer; Index: Int32; var Text: Pointer; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetLineMatch", (char*)"procedure Tesseract_GetLineMatch(Tess: Pointer; Index: Int32; var Text: Pointer; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetWordMatch", (char*)"procedure Tesseract_GetWordMatch(Tess: Pointer; Index: Int32; var Text: Pointer; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
(char*)"Tesseract_GetCharacterMatch", (char*)"procedure Tesseract_GetCharacterMatch(Tess: Pointer; Index: Int32; var Text: Pointer; var Len: Int32; var Confidence: Single; var X1, Y1, X2, Y2: Int32);",
};

static const char* PascalTypes[] =
{
(char*)"TessTextPtr", (char*)"type PChar",
};

static const long int PascalExportCount = sizeof(PascalExports) / (sizeof(PascalExports[0]) * 2);
Expand Down

0 comments on commit ac03dca

Please sign in to comment.