MCPcopy Create free account
hub / github.com/devilsen/CZXing / readMultiple

Method readMultiple

czxing/src/main/cpp/zxing/src/MultiFormatReader.cpp:61–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61Results MultiFormatReader::readMultiple(const BinaryBitmap& image, int maxSymbols) const
62{
63 std::vector<Result> res;
64
65 for (const auto& reader : _readers) {
66 if (image.inverted() && !reader->supportsInversion)
67 continue;
68 auto r = reader->decode(image, maxSymbols);
69 if (!_hints.returnErrors()) {
70 //TODO: C++20 res.erase_if()
71 auto it = std::remove_if(res.begin(), res.end(), [](auto&& r) { return !r.isValid(); });
72 res.erase(it, res.end());
73 }
74 maxSymbols -= Size(r);
75 res.insert(res.end(), std::move_iterator(r.begin()), std::move_iterator(r.end()));
76 if (maxSymbols <= 0)
77 break;
78 }
79
80 // sort results based on their position on the image
81 std::sort(res.begin(), res.end(), [](const Result& l, const Result& r) {
82 auto lp = l.position().topLeft();
83 auto rp = r.position().topLeft();
84 return lp.y < rp.y || (lp.y == rp.y && lp.x < rp.x);
85 });
86
87 return res;
88}
89
90} // ZXing

Callers 1

ReadBarcodesFunction · 0.80

Calls 9

invertedMethod · 0.80
SizeFunction · 0.70
decodeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
isValidMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45
topLeftMethod · 0.45

Tested by

no test coverage detected