Drop --mask-barcodes feature
This commit is contained in:
@@ -174,10 +174,6 @@ might remove desirable content, especially from poor quality scans.
|
||||
- ``--clean-final`` uses unpaper to clean up pages before OCR and
|
||||
inserts the page into the final output. You will want to review each
|
||||
page to ensure that unpaper did not remove something important.
|
||||
- ``--mask-barcodes`` will suppress any barcodes detected in a page
|
||||
image. Barcodes are known to confuse Tesseract OCR and interfere with
|
||||
the recognition of text on the same baseline as a barcode. The output
|
||||
file will contain the unaltered image of the barcode.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -531,16 +531,9 @@ def create_ocr_image(image, page_context):
|
||||
draw.rectangle(pixcoords, fill=white)
|
||||
# draw.rectangle(pixcoords, outline=pink)
|
||||
|
||||
if options.mask_barcodes or options.threshold:
|
||||
if options.threshold:
|
||||
pix = leptonica.Pix.frompil(im)
|
||||
if options.threshold:
|
||||
pix = pix.masked_threshold_on_background_norm()
|
||||
if options.mask_barcodes:
|
||||
barcodes = pix.locate_barcodes()
|
||||
for barcode in barcodes:
|
||||
decoded, rect = barcode
|
||||
page_context.log.debug('masking barcode %s %r', decoded, rect)
|
||||
draw.rectangle(rect, fill=white)
|
||||
pix = pix.masked_threshold_on_background_norm()
|
||||
im = pix.topil()
|
||||
|
||||
if options.filter_ocr_image:
|
||||
|
||||
@@ -180,7 +180,6 @@ def run( # pylint: disable=unused-argument
|
||||
unpaper_args=None,
|
||||
oversample=None,
|
||||
remove_vectors=None,
|
||||
mask_barcodes=None,
|
||||
threshold=None,
|
||||
force_ocr=None,
|
||||
skip_text=None,
|
||||
|
||||
@@ -267,13 +267,6 @@ preprocessing.add_argument(
|
||||
help="EXPERIMENTAL. Mask out any vector objects in the PDF so that they "
|
||||
"will not be included in OCR. This can eliminate false characters.",
|
||||
)
|
||||
preprocessing.add_argument(
|
||||
'--mask-barcodes',
|
||||
action='store_true',
|
||||
help="EXPERIMENTAL. Mask out any barcodes that appear in the PDF so they are not "
|
||||
"considered during OCR. Barcodes can introduce false characters into "
|
||||
"OCR.",
|
||||
)
|
||||
preprocessing.add_argument(
|
||||
'--threshold',
|
||||
action='store_true',
|
||||
|
||||
Reference in New Issue
Block a user