mirror of
https://github.com/zxing-cpp/zxing-cpp.git
synced 2025-10-14 02:28:02 +08:00
Compare commits
3 Commits
0f115a80f9
...
c98555164e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c98555164e | ||
![]() |
1ea75e71ab | ||
![]() |
445217e7fd |
@@ -155,7 +155,8 @@ void Result::symbol(BitMatrix&& bits)
|
||||
|
||||
ImageView Result::symbol() const
|
||||
{
|
||||
return _symbol ? ImageView{_symbol->row(0).begin(), _symbol->width(), _symbol->height(), ImageFormat::Lum} : ImageView{};
|
||||
return _symbol && !_symbol->empty() ? ImageView{_symbol->row(0).begin(), _symbol->width(), _symbol->height(), ImageFormat::Lum}
|
||||
: ImageView{};
|
||||
}
|
||||
|
||||
void Result::zint(unique_zint_symbol&& z)
|
||||
|
@@ -63,7 +63,7 @@ void BinaryBitmap::invert()
|
||||
auto matrix = const_cast<BitMatrix*>(_cache->matrix.get());
|
||||
matrix->flipAll();
|
||||
}
|
||||
_inverted = true;
|
||||
_inverted = !_inverted;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
|
@@ -175,8 +175,12 @@ Barcodes ReadBarcodes(const ImageView& _iv, const ReaderOptions& opts)
|
||||
for (auto&& iv : pyramid.layers) {
|
||||
auto bitmap = CreateBitmap(opts.binarizer(), iv);
|
||||
for (int close = 0; close <= (closedReader ? 1 : 0); ++close) {
|
||||
if (close)
|
||||
if (close) {
|
||||
// if we already inverted the image in the first round, we need to undo that first
|
||||
if (bitmap->inverted())
|
||||
bitmap->invert();
|
||||
bitmap->close();
|
||||
}
|
||||
|
||||
// TODO: check if closing after invert would be beneficial
|
||||
for (int invert = 0; invert <= static_cast<int>(opts.tryInvert() && !close); ++invert) {
|
||||
|
@@ -281,6 +281,9 @@ ZX_PROPERTY(bool, tryHarder, TryHarder)
|
||||
ZX_PROPERTY(bool, tryRotate, TryRotate)
|
||||
ZX_PROPERTY(bool, tryInvert, TryInvert)
|
||||
ZX_PROPERTY(bool, tryDownscale, TryDownscale)
|
||||
#ifdef ZXING_EXPERIMENTAL_API
|
||||
ZX_PROPERTY(bool, tryDenoise, TryDenoise)
|
||||
#endif
|
||||
ZX_PROPERTY(bool, isPure, IsPure)
|
||||
ZX_PROPERTY(bool, returnErrors, ReturnErrors)
|
||||
ZX_PROPERTY(int, minLineCount, MinLineCount)
|
||||
|
@@ -233,6 +233,9 @@ void ZXing_ReaderOptions_setTryHarder(ZXing_ReaderOptions* opts, bool tryHarder)
|
||||
void ZXing_ReaderOptions_setTryRotate(ZXing_ReaderOptions* opts, bool tryRotate);
|
||||
void ZXing_ReaderOptions_setTryInvert(ZXing_ReaderOptions* opts, bool tryInvert);
|
||||
void ZXing_ReaderOptions_setTryDownscale(ZXing_ReaderOptions* opts, bool tryDownscale);
|
||||
#ifdef ZXING_EXPERIMENTAL_API
|
||||
void ZXing_ReaderOptions_setTryDenoise(ZXing_ReaderOptions* opts, bool tryDenoise);
|
||||
#endif
|
||||
void ZXing_ReaderOptions_setIsPure(ZXing_ReaderOptions* opts, bool isPure);
|
||||
void ZXing_ReaderOptions_setReturnErrors(ZXing_ReaderOptions* opts, bool returnErrors);
|
||||
void ZXing_ReaderOptions_setFormats(ZXing_ReaderOptions* opts, ZXing_BarcodeFormats formats);
|
||||
@@ -246,6 +249,9 @@ bool ZXing_ReaderOptions_getTryHarder(const ZXing_ReaderOptions* opts);
|
||||
bool ZXing_ReaderOptions_getTryRotate(const ZXing_ReaderOptions* opts);
|
||||
bool ZXing_ReaderOptions_getTryInvert(const ZXing_ReaderOptions* opts);
|
||||
bool ZXing_ReaderOptions_getTryDownscale(const ZXing_ReaderOptions* opts);
|
||||
#ifdef ZXING_EXPERIMENTAL_API
|
||||
bool ZXing_ReaderOptions_getTryDenoise(const ZXing_ReaderOptions* opts);
|
||||
#endif
|
||||
bool ZXing_ReaderOptions_getIsPure(const ZXing_ReaderOptions* opts);
|
||||
bool ZXing_ReaderOptions_getReturnErrors(const ZXing_ReaderOptions* opts);
|
||||
ZXing_BarcodeFormats ZXing_ReaderOptions_getFormats(const ZXing_ReaderOptions* opts);
|
||||
|
Reference in New Issue
Block a user