Merge branch 'tesseract-ocr:main' into 3871-disappearing-word

This commit is contained in:
rmast 2022-10-23 08:55:42 +02:00 committed by GitHub
commit cef102fdb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 34 additions and 23 deletions

View File

@ -14,11 +14,11 @@ jobs:
fail-fast: false
matrix:
config:
- { name: macos-12-clang-13-autotools, os: macos-12, cxx: clang++ }
- { name: macos-12-gcc-11-autotools, os: macos-12, cxx: g++-11 }
- { name: macos-12-clang-14-autotools, os: macos-12, cxx: clang++ }
#- { name: macos-12-gcc-11-autotools, os: macos-12, cxx: g++-11 }
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
@ -115,10 +115,10 @@ jobs:
fail-fast: false
matrix:
config:
- { name: macos-10.15-clang-12-autotools, os: macos-10.15, cxx: clang++ }
- { name: macos-12-clang-14-autotools, os: macos-12, cxx: clang++ }
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -17,7 +17,7 @@ jobs:
- { name: 22.04-openmp, os: ubuntu-22.04 }
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -24,7 +24,7 @@ jobs:
- { name: ubuntu-20.04-gcc-10-autotools, os: ubuntu-20.04, cxx: g++-10 } #installed
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -26,7 +26,7 @@ jobs:
fuzz-seconds: 600
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts

View File

@ -151,7 +151,7 @@ jobs:
tesseract test/testing/phototest.tif -
- name: Upload Build Results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: tesseract-${{ steps.get_version.outputs.VERSION }}-VS2019_win64
path: ${{env.ILOC}}

View File

@ -61,7 +61,7 @@ jobs:
if: runner.os == 'macOS'
- name: Checkout Source
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -55,7 +55,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install dependencies
run: |

View File

@ -19,7 +19,7 @@ jobs:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: msys2/setup-msys2@v2

View File

@ -28,7 +28,7 @@ jobs:
os: [windows-2022, windows-2019, ubuntu-22.04, ubuntu-20.04, macos-12]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: egorpugin/sw-action@master
@ -71,7 +71,7 @@ jobs:
- name: Upload Unit Test Results
if: always() && matrix.os != 'windows-2022' && matrix.os != 'windows-2019'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Test Results (${{ matrix.os }})
path: .sw/test/results.xml

View File

@ -17,7 +17,7 @@ jobs:
os: [ ubuntu-20.04 ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -17,7 +17,7 @@ jobs:
- { name: macos-12-gcc-unittest, os: macos-12, cxx: g++ }
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -17,7 +17,7 @@ jobs:
- { name: ubuntu-20.04-gcc-unittest, os: ubuntu-20.04, cxx: g++ }
- { name: ubuntu-22.04-clang-unittest, os: ubuntu-22.04, cxx: clang++ }
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -17,7 +17,7 @@ jobs:
steps:
- name: Checkout Tesseract Source (for test images)
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -16,7 +16,7 @@ jobs:
steps:
- name: Checkout Tesseract Source (--head from main branch)
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

View File

@ -287,15 +287,26 @@ bool ImageThresholder::ThresholdToPix(Image *pix) {
tprintf("Image too large: (%d, %d)\n", image_width_, image_height_);
return false;
}
Image original = GetPixRect();
if (pix_channels_ == 0) {
// We have a binary image, but it still has to be copied, as this API
// allows the caller to modify the output.
Image original = GetPixRect();
*pix = original.copy();
original.destroy();
} else {
OtsuThresholdRectToPix(pix_, pix);
if (pixGetColormap(original)) {
Image without_cmap =
pixRemoveColormap(original, REMOVE_CMAP_BASED_ON_SRC);
int depth = pixGetDepth(without_cmap);
if (depth > 1 && depth < 8) {
original = pixConvertTo8(without_cmap, false);
} else {
original = without_cmap.copy();
}
without_cmap.destroy();
}
OtsuThresholdRectToPix(original, pix);
}
original.destroy();
return true;
}
@ -353,7 +364,7 @@ Image ImageThresholder::GetPixRect() {
Image ImageThresholder::GetPixRectGrey() {
auto pix = GetPixRect(); // May have to be reduced to grey.
int depth = pixGetDepth(pix);
if (depth != 8) {
if (depth != 8 || pixGetColormap(pix)) {
if (depth == 24) {
auto tmp = pixConvert24To32(pix);
pix.destroy();