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

Function ReadVersion

czxing/src/main/cpp/zxing/src/qrcode/QRDetector.cpp:311–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311static const Version* ReadVersion(const BitMatrix& image, int dimension, const PerspectiveTransform& mod2Pix)
312{
313 int bits[2] = {};
314
315 for (bool mirror : {false, true}) {
316 // Read top-right/bottom-left version info: 3 wide by 6 tall (depending on mirrored)
317 int versionBits = 0;
318 for (int y = 5; y >= 0; --y)
319 for (int x = dimension - 9; x >= dimension - 11; --x) {
320 auto mod = mirror ? PointI{y, x} : PointI{x, y};
321 auto pix = mod2Pix(centered(mod));
322 if (!image.isIn(pix))
323 versionBits = -1;
324 else
325 AppendBit(versionBits, image.get(pix));
326 log(pix, 3);
327 }
328 bits[static_cast<int>(mirror)] = versionBits;
329 }
330
331 return Version::DecodeVersionInformation(bits[0], bits[1]);
332}
333
334DetectorResult SampleQR(const BitMatrix& image, const FinderPatternSet& fp)
335{

Callers 2

DecodeFunction · 0.70
SampleQRFunction · 0.70

Calls 4

centeredFunction · 0.85
logFunction · 0.50
isInMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected