コード例 #1
0
 internal static BitMatrix GetLowestPenaltyMatrix(this TriStateMatrix matrix, ErrorCorrectionLevel errorlevel)
 {
     PatternFactory patternFactory = new PatternFactory();
     int score = int.MaxValue;
     int tempScore;
     TriStateMatrix result = new TriStateMatrix(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;
 }
コード例 #2
0
        internal static BitMatrix GetLowestPenaltyMatrix(this TriStateMatrix matrix, ErrorCorrectionLevel errorlevel)
        {
            PatternFactory patternFactory = new PatternFactory();
            int            score          = int.MaxValue;
            int            tempScore;
            TriStateMatrix result = new TriStateMatrix(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);
        }