Search in sources :

Example 1 with FiducialImageEngine

use of boofcv.alg.drawing.FiducialImageEngine in project BoofCV by lessthanoptimal.

the class TestECoCheckDetector method createMarker.

private GrayU8 createMarker(ECoCheckUtils utils, int markerID) {
    int squareWidth = 80;
    GridShape shape = utils.markers.get(markerID);
    var engine = new FiducialImageEngine();
    engine.configure(10, squareWidth * (shape.cols - 1), squareWidth * (shape.rows - 1));
    var renderer = new ECoCheckGenerator(utils);
    renderer.render = engine;
    renderer.squareWidth = squareWidth;
    renderer.render(markerID);
    truthCorners = renderer.corners;
    return engine.getGray();
}
Also used : FiducialImageEngine(boofcv.alg.drawing.FiducialImageEngine) GridShape(boofcv.struct.GridShape)

Example 2 with FiducialImageEngine

use of boofcv.alg.drawing.FiducialImageEngine in project BoofCV by lessthanoptimal.

the class TestCalibrationDetectorMultiECoCheck method renderPattern.

@Override
public GrayF32 renderPattern(int marker, List<PointIndex2D_F64> calibrationPoints) {
    GridShape shape = utils.markers.get(marker);
    int squareLength = 60;
    var engine = new FiducialImageEngine();
    engine.configure(20, squareLength * (shape.cols - 1), squareLength * (shape.rows - 1));
    var generator = new ECoCheckGenerator(utils);
    generator.squareWidth = squareLength;
    generator.setRender(engine);
    generator.render(marker);
    BoofMiscOps.forIdx(generator.corners, (idx, c) -> calibrationPoints.add(new PointIndex2D_F64(c.x, c.y, idx)));
    return engine.getGrayF32();
}
Also used : PointIndex2D_F64(boofcv.struct.geo.PointIndex2D_F64) FiducialImageEngine(boofcv.alg.drawing.FiducialImageEngine) ECoCheckGenerator(boofcv.alg.fiducial.calib.ecocheck.ECoCheckGenerator) GridShape(boofcv.struct.GridShape)

Example 3 with FiducialImageEngine

use of boofcv.alg.drawing.FiducialImageEngine in project BoofCV by lessthanoptimal.

the class TestSquareBinary_to_FiducialDetector method renderFiducial.

@Override
public GrayF32 renderFiducial() {
    FiducialImageEngine render = new FiducialImageEngine();
    render.configure(0, 200);
    FiducialSquareGenerator generator = new FiducialSquareGenerator(render);
    generator.setMarkerWidth(200);
    generator.generate(345, 4);
    return render.getGrayF32();
}
Also used : FiducialImageEngine(boofcv.alg.drawing.FiducialImageEngine) FiducialSquareGenerator(boofcv.alg.fiducial.square.FiducialSquareGenerator)

Example 4 with FiducialImageEngine

use of boofcv.alg.drawing.FiducialImageEngine in project BoofCV by lessthanoptimal.

the class TestMicroQrCodeDecoderImage method simple_all_configs.

/**
 * Render then decode images with all possible versions, masks, and error correction levels.
 */
@Test
void simple_all_configs() {
    String message = "01234";
    var engine = new FiducialImageEngine();
    engine.configure(0, 100);
    var generator = new MicroQrCodeGenerator();
    generator.markerWidth = 100;
    generator.setRender(engine);
    var alg = new MicroQrCodeDecoderImage<>(null, "", GrayU8.class);
    var patterns = new DogArray<>(PositionPatternNode::new);
    for (int version = 1; version <= 4; version++) {
        ErrorLevel[] errors = MicroQrCode.allowedErrorCorrection(version);
        for (ErrorLevel error : errors) {
            // Generate the QR code
            var encoder = new MicroQrCodeEncoder();
            // encoder.setVerbose(System.out, null);
            MicroQrCode qr = encoder.setVersion(version).setError(error).setMask(M00).addNumeric(message).fixate();
            generator.render(qr);
            // Set up the "detected" position pattern
            patterns.reset();
            PositionPatternNode pp = patterns.grow();
            pp.square = qr.pp;
            pp.grayThreshold = (double) (engine.getWhite() / 2);
            // ShowImages.showWindow(engine.getGray(), "Title");
            // BoofMiscOps.sleep(10_000);
            // Process the image
            // alg.decoder.setVerbose(System.out, null);
            alg.process(patterns.toList(), engine.getGray());
            // Check results
            assertEquals(1, alg.found.size());
            assertEquals(0, alg.failures.size());
            assertEquals(version, alg.found.get(0).version);
            assertEquals(message, alg.found.get(0).message);
        }
    }
}
Also used : FiducialImageEngine(boofcv.alg.drawing.FiducialImageEngine) ErrorLevel(boofcv.alg.fiducial.microqr.MicroQrCode.ErrorLevel) PositionPatternNode(boofcv.alg.fiducial.qrcode.PositionPatternNode) DogArray(org.ddogleg.struct.DogArray) Test(org.junit.jupiter.api.Test)

Example 5 with FiducialImageEngine

use of boofcv.alg.drawing.FiducialImageEngine in project BoofCV by lessthanoptimal.

the class TestDetectFiducialSquareImage method render.

private GrayF32 render(GrayU8 pattern, int width, double borderFraction) {
    FiducialImageEngine render = new FiducialImageEngine();
    render.configure(0, width);
    FiducialSquareGenerator generator = new FiducialSquareGenerator(render);
    generator.setMarkerWidth(width);
    generator.setBlackBorder(borderFraction);
    generator.generate(pattern);
    return render.getGrayF32();
}
Also used : FiducialImageEngine(boofcv.alg.drawing.FiducialImageEngine)

Aggregations

FiducialImageEngine (boofcv.alg.drawing.FiducialImageEngine)8 FiducialSquareGenerator (boofcv.alg.fiducial.square.FiducialSquareGenerator)2 GridShape (boofcv.struct.GridShape)2 ECoCheckGenerator (boofcv.alg.fiducial.calib.ecocheck.ECoCheckGenerator)1 MicroQrCode (boofcv.alg.fiducial.microqr.MicroQrCode)1 ErrorLevel (boofcv.alg.fiducial.microqr.MicroQrCode.ErrorLevel)1 MicroQrCodeEncoder (boofcv.alg.fiducial.microqr.MicroQrCodeEncoder)1 MicroQrCodeGenerator (boofcv.alg.fiducial.microqr.MicroQrCodeGenerator)1 PositionPatternNode (boofcv.alg.fiducial.qrcode.PositionPatternNode)1 PointIndex2D_F64 (boofcv.struct.geo.PointIndex2D_F64)1 DogArray (org.ddogleg.struct.DogArray)1 Test (org.junit.jupiter.api.Test)1