comparison mupdf-source/thirdparty/zxing-cpp/core/src/HybridBinarizer.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 /*
2 * Copyright 2016 Nu-book Inc.
3 * Copyright 2016 ZXing authors
4 */
5 // SPDX-License-Identifier: Apache-2.0
6
7 #pragma once
8
9 #include "GlobalHistogramBinarizer.h"
10
11 namespace ZXing {
12
13 /**
14 * This class implements a local thresholding algorithm, which while slower than the
15 * GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for
16 * high frequency images of barcodes with black data on white backgrounds. For this application,
17 * it does a much better job than a global blackpoint with severe shadows and gradients.
18 * However it tends to produce artifacts on lower frequency images and is therefore not
19 * a good general purpose binarizer for uses outside ZXing.
20 *
21 * This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers,
22 * and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already
23 * inherently local, and only fails for horizontal gradients. We can revisit that problem later,
24 * but for now it was not a win to use local blocks for 1D.
25 *
26 * This Binarizer is the default for the unit tests and the recommended class for library users.
27 *
28 * @author dswitkin@google.com (Daniel Switkin)
29 */
30 class HybridBinarizer : public GlobalHistogramBinarizer
31 {
32 public:
33 explicit HybridBinarizer(const ImageView& iv);
34 ~HybridBinarizer() override;
35
36 bool getPatternRow(int row, int rotation, PatternRow &res) const override;
37 std::shared_ptr<const BitMatrix> getBlackMatrix() const override;
38 };
39
40 } // ZXing