public void ExplicitlyDetectMulti() { using var obj = new QRCodeDetector(); using var withQr = Image("qr_multi.png"); using var pointsMat = new Mat(); ShowImagesWhenDebugMode(withQr); bool detected = obj.DetectMulti(withQr, out var points); Assert.True(detected); Assert.Equal(8, points.Length); var expectedPoints = new[] { new Point2f(39, 39), new Point2f(260, 39), new Point2f(260, 260), new Point2f(39, 260), new Point2f(334, 334), new Point2f(565, 334), new Point2f(565, 565), new Point2f(334, 565), }; AreEquivalent(expectedPoints, points); }
public void EmptyDetectMulti() { var lenna = Image("lenna.png"); using var obj = new QRCodeDetector(); bool detected = obj.DetectMulti(lenna, out var points); Assert.False(detected); Assert.Empty(points); }
public void ExplicitlyDecodeMulti() { var expectedDecodedStrings = new[] { "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[]^_`{|}", "Helloこんにちは你好안녕하세요" }; using var obj = new QRCodeDetector(); using var withQr = Image("qr_multi.png"); using var pointsMat = new Mat(); ShowImagesWhenDebugMode(withQr); bool detected = obj.DetectMulti(withQr, out var points); Assert.True(detected); Assert.Equal(8, points.Length); bool decoded = obj.DecodeMulti(withQr, points, out var decodedStrings, out var straightQrCode); Assert.True(decoded); Assert.Equal(2, decodedStrings.Length); AreEquivalent(expectedDecodedStrings, decodedStrings); foreach (var mat in straightQrCode) { ShowImagesWhenDebugMode(mat); } bool decodedWithoutStraightQrCode = obj.DecodeMulti(withQr, points, out decodedStrings); Assert.True(decodedWithoutStraightQrCode); Assert.Equal(2, decodedStrings.Length); AreEquivalent(expectedDecodedStrings, decodedStrings); }