use of boofcv.io.SimpleStringNumberReader in project BoofCV by lessthanoptimal.
the class BaseCalibrationConfig method parseTarget.
protected void parseTarget(String where) throws FileNotFoundException {
Reader input = media.openFile(where);
SimpleStringNumberReader reader = new SimpleStringNumberReader('#');
if (!reader.read(input))
throw new RuntimeException("Parsing configuration failed");
if (reader.remainingTokens() < 7)
throw new RuntimeException("Not enough tokens in config file");
String type = reader.nextString();
numRadial = (int) reader.nextDouble();
includeTangential = Boolean.parseBoolean(reader.nextString());
assumeZeroSkew = Boolean.parseBoolean(reader.nextString());
int numCols = (int) reader.nextDouble();
int numRows = (int) reader.nextDouble();
double width = reader.nextDouble();
if (type.compareToIgnoreCase("square") == 0) {
double space = reader.nextDouble();
detector = FactoryFiducialCalibration.squareGrid(new ConfigSquareGrid(numRows, numCols, width, space));
} else if (type.compareToIgnoreCase("chess") == 0) {
detector = FactoryFiducialCalibration.chessboard(new ConfigChessboard(numRows, numCols, width));
} else {
throw new RuntimeException("Unknown type: " + type);
}
try {
input.close();
} catch (IOException e) {
}
}
Aggregations