int j = startX;\r
// Burn off leading white pixels before anything else; if we start in the middle of\r
// a white run, it doesn't make sense to count its length, since we don't know if the\r
// white run continued to the left of the start point\r
int j = startX;\r
// Burn off leading white pixels before anything else; if we start in the middle of\r
// a white run, it doesn't make sense to count its length, since we don't know if the\r
// white run continued to the left of the start point\r
/**\r
* @param stateCount count of black/white/black pixels just read\r
* @return true iff the proportions of the counts is close enough to the 1/1/1 ratios\r
/**\r
* @param stateCount count of black/white/black pixels just read\r
* @return true iff the proportions of the counts is close enough to the 1/1/1 ratios\r
* @param startI row where an alignment pattern was detected\r
* @param centerJ center of the section that appears to cross an alignment pattern\r
* @param maxCount maximum reasonable number of modules that should be\r
* @param startI row where an alignment pattern was detected\r
* @param centerJ center of the section that appears to cross an alignment pattern\r
* @param maxCount maximum reasonable number of modules that should be\r
- private float crossCheckVertical(int startI, int centerJ, int maxCount) {\r
+ private float crossCheckVertical(int startI, int centerJ, int maxCount, int originalStateCountTotal) {\r
* @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not\r
*/\r
private AlignmentPattern handlePossibleCenter(int[] stateCount, int i, int j) {\r
* @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not\r
*/\r
private AlignmentPattern handlePossibleCenter(int[] stateCount, int i, int j) {\r
- float centerI = crossCheckVertical(i, (int) centerJ, 2 * stateCount[1]);\r
+ float centerI = crossCheckVertical(i, (int) centerJ, 2 * stateCount[1], stateCountTotal);\r
if (!Float.isNaN(centerI)) {\r
float estimatedModuleSize = (float) (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;\r
int max = possibleCenters.size();\r
if (!Float.isNaN(centerI)) {\r
float estimatedModuleSize = (float) (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;\r
int max = possibleCenters.size();\r