Search in sources :

Example 1 with SimpleStringNumberReader

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) {
    }
}
Also used : ConfigSquareGrid(boofcv.abst.fiducial.calib.ConfigSquareGrid) SimpleStringNumberReader(boofcv.io.SimpleStringNumberReader) Reader(java.io.Reader) ConfigChessboard(boofcv.abst.fiducial.calib.ConfigChessboard) SimpleStringNumberReader(boofcv.io.SimpleStringNumberReader) IOException(java.io.IOException)

Aggregations

ConfigChessboard (boofcv.abst.fiducial.calib.ConfigChessboard)1 ConfigSquareGrid (boofcv.abst.fiducial.calib.ConfigSquareGrid)1 SimpleStringNumberReader (boofcv.io.SimpleStringNumberReader)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1