Beispiel #1
0
        public void Test_against_DataSet(TriStateMatrix input, MaskPatternType patternType, BitMatrix expected)
        {
            Pattern pattern = new PatternFactory().CreateByType(patternType);

            BitMatrix result = input.Apply(pattern, ErrorCorrectionLevel.H);

            expected.AssertEquals(result);
        }
Beispiel #2
0
        public void Test_against_DataSet(TriStateMatrix input, MaskPatternType patternType, BitMatrix expected)
        {
            Pattern pattern = new PatternFactory().CreateByType(patternType);

            BitMatrix result = input.Apply(pattern, ErrorCorrectionLevel.H);

            expected.AssertEquals(result);
        }
Beispiel #3
0
        internal static BitMatrix GetLowestPenaltyMatrix(this TriStateMatrix matrix, ErrorCorrectionLevel errorLevel)
        {
            PatternFactory patternFactory = new();
            int            score          = int.MaxValue;
            int            tempScore;
            TriStateMatrix result = new(matrix.Width);
            TriStateMatrix triMatrix;

            foreach (Pattern pattern in patternFactory.AllPatterns())
            {
                triMatrix = matrix.Apply(pattern, errorLevel);
                tempScore = triMatrix.PenaltyScore();
                if (tempScore < score)
                {
                    score  = tempScore;
                    result = triMatrix;
                }
            }

            return(result);
        }