mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Merge branch 'tesseract-ocr:main' into 3871-disappearing-word
This commit is contained in:
commit
cef102fdb7
10
.github/workflows/autotools-macos.yml
vendored
10
.github/workflows/autotools-macos.yml
vendored
@ -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
|
||||
|
||||
|
2
.github/workflows/autotools-openmp.yml
vendored
2
.github/workflows/autotools-openmp.yml
vendored
@ -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
|
||||
|
||||
|
2
.github/workflows/autotools.yml
vendored
2
.github/workflows/autotools.yml
vendored
@ -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
|
||||
|
||||
|
2
.github/workflows/cifuzz.yml
vendored
2
.github/workflows/cifuzz.yml
vendored
@ -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
|
||||
|
2
.github/workflows/cmake-win64.yml
vendored
2
.github/workflows/cmake-win64.yml
vendored
@ -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}}
|
||||
|
2
.github/workflows/cmake.yml
vendored
2
.github/workflows/cmake.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
||||
if: runner.os == 'macOS'
|
||||
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -55,7 +55,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
2
.github/workflows/msys2.yml
vendored
2
.github/workflows/msys2.yml
vendored
@ -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
|
||||
|
4
.github/workflows/sw.yml
vendored
4
.github/workflows/sw.yml
vendored
@ -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
|
||||
|
2
.github/workflows/unittest-disablelegacy.yml
vendored
2
.github/workflows/unittest-disablelegacy.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
os: [ ubuntu-20.04 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
2
.github/workflows/unittest-macos.yml
vendored
2
.github/workflows/unittest-macos.yml
vendored
@ -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
|
||||
|
||||
|
2
.github/workflows/unittest.yml
vendored
2
.github/workflows/unittest.yml
vendored
@ -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
|
||||
|
||||
|
2
.github/workflows/vcpkg-4.1.1.yml
vendored
2
.github/workflows/vcpkg-4.1.1.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Tesseract Source (for test images)
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
2
.github/workflows/vcpkg.yml
vendored
2
.github/workflows/vcpkg.yml
vendored
@ -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
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user