Search in sources :

Example 6 with CalibrationObservation

use of boofcv.alg.geo.calibration.CalibrationObservation in project BoofCV by lessthanoptimal.

the class CalibrationDetectorCircleHexagonalGrid method process.

@Override
public boolean process(GrayF32 input) {
    results = new CalibrationObservation(input.width, input.height);
    detector.process(input);
    List<Grid> grids = detector.getGrids();
    if (grids.size() != 1)
        return false;
    if (!keypoint.process(grids.get(0)))
        return false;
    FastQueue<Point2D_F64> foundPixels = keypoint.getKeyPoints();
    for (int i = 0; i < foundPixels.size; i++) {
        results.add(foundPixels.get(i), i);
    }
    return true;
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) KeyPointsCircleHexagonalGrid(boofcv.alg.fiducial.calib.circle.KeyPointsCircleHexagonalGrid) DetectCircleHexagonalGrid(boofcv.alg.fiducial.calib.circle.DetectCircleHexagonalGrid) Grid(boofcv.alg.fiducial.calib.circle.EllipseClustersIntoGrid.Grid) CalibrationObservation(boofcv.alg.geo.calibration.CalibrationObservation)

Example 7 with CalibrationObservation

use of boofcv.alg.geo.calibration.CalibrationObservation in project BoofCV by lessthanoptimal.

the class CalibrationDetectorCircleRegularGrid method process.

@Override
public boolean process(GrayF32 input) {
    results = new CalibrationObservation(input.width, input.height);
    detector.process(input);
    List<Grid> grids = detector.getGrids();
    if (grids.size() != 1)
        return false;
    if (!keypoint.process(grids.get(0)))
        return false;
    FastQueue<Point2D_F64> foundPixels = keypoint.getKeyPoints();
    for (int i = 0; i < foundPixels.size; i++) {
        results.add(foundPixels.get(i), i);
    }
    return true;
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) KeyPointsCircleRegularGrid(boofcv.alg.fiducial.calib.circle.KeyPointsCircleRegularGrid) DetectCircleRegularGrid(boofcv.alg.fiducial.calib.circle.DetectCircleRegularGrid) Grid(boofcv.alg.fiducial.calib.circle.EllipseClustersIntoGrid.Grid) CalibrationObservation(boofcv.alg.geo.calibration.CalibrationObservation)

Example 8 with CalibrationObservation

use of boofcv.alg.geo.calibration.CalibrationObservation in project BoofCV by lessthanoptimal.

the class CalibrationDetectorSquareFiducialGrid method process.

@Override
public boolean process(GrayF32 input) {
    observations = new CalibrationObservation(input.width, input.height);
    if (!detector.detect(input)) {
        return false;
    }
    List<DetectFiducialSquareGrid.Detection> detections = detector.getDetections();
    for (int i = 0; i < detections.size(); i++) {
        DetectFiducialSquareGrid.Detection d = detections.get(i);
        int row = d.gridIndex / numCols;
        int col = d.gridIndex % numCols;
        int pointRow = row * 2;
        int pointCol = col * 2;
        observations.add(d.location.a, getPointIndex(pointRow, pointCol));
        observations.add(d.location.b, getPointIndex(pointRow, pointCol + 1));
        observations.add(d.location.c, getPointIndex(pointRow + 1, pointCol + 1));
        observations.add(d.location.d, getPointIndex(pointRow + 1, pointCol));
    }
    observations.sort();
    return true;
}
Also used : DetectFiducialSquareGrid(boofcv.alg.fiducial.calib.DetectFiducialSquareGrid) CalibrationObservation(boofcv.alg.geo.calibration.CalibrationObservation)

Example 9 with CalibrationObservation

use of boofcv.alg.geo.calibration.CalibrationObservation in project BoofCV by lessthanoptimal.

the class CalibrationFiducialDetector method getCenter.

/**
 * Returns the detection point average location.  This will NOT be the same as the geometric center.
 *
 * @param which Fiducial's index
 * @param location (output) Storage for the transform. modified.
 */
@Override
public void getCenter(int which, Point2D_F64 location) {
    CalibrationObservation view = detector.getDetectedPoints();
    location.set(0, 0);
    for (int i = 0; i < view.size(); i++) {
        PointIndex2D_F64 p = view.get(i);
        location.x += p.x;
        location.y += p.y;
    }
    location.x /= view.size();
    location.y /= view.size();
}
Also used : PointIndex2D_F64(boofcv.struct.geo.PointIndex2D_F64) CalibrationObservation(boofcv.alg.geo.calibration.CalibrationObservation)

Example 10 with CalibrationObservation

use of boofcv.alg.geo.calibration.CalibrationObservation in project BoofCV by lessthanoptimal.

the class AssistedCalibration method handleClearDots.

private void handleClearDots(boolean detected) {
    String message = "Clear the dots!";
    if (detected) {
        gui.getInfoPanel().updateView(saver.getCurrentView());
        gui.getInfoPanel().updateFocusScore(saver.getFocusScore());
        double stationaryTime = actions.getStationaryTime();
        CalibrationObservation points = detector.getDetectedPoints();
        view.getSidesCollision(points, sidesCollision);
        view.getQuadFocus(points, focusQuad);
        boolean closeToMagnet = false;
        for (int i = 0; i < magnets.size(); i++) {
            closeToMagnet |= magnets.get(i).handleDetection();
        }
        boolean resetImageSelector = true;
        if (pictureTaken) {
            if (stationaryTime >= STILL_THRESHOLD) {
                message = "Move somewhere else";
            } else {
                pictureTaken = false;
            }
        } else if (stationaryTime >= STILL_THRESHOLD) {
            if (checkMagnetCapturePicture()) {
                saver.save();
                pictureTaken = true;
                message = "Move somewhere else";
                captureFiducialPoints();
                gui.getInfoPanel().updateEdgeFill(1.0 - (magnets.size() / (double) totalMagnets));
                if (magnets.isEmpty()) {
                    state = State.FILL_SCREEN;
                }
            }
        } else if (stationaryTime > DISPLAY_TIME) {
            if (closeToMagnet) {
                message = String.format("Hold still:  %6.1f", stationaryTime);
                resetImageSelector = false;
            } else {
                message = "Move closer to a dot";
            }
        }
        // save the images if the fiducial is being held still prior to capture
        if (resetImageSelector) {
            saver.clearHistory();
            saver.updateScore(input, focusQuad);
        } else {
            saver.process(input, focusQuad);
        }
        drawPadding();
        renderMagnets();
        renderArrows();
        renderCalibrationPoints(stationaryTime, points.points);
    } else {
        drawPadding();
        saver.clearHistory();
        for (int i = 0; i < magnets.size(); i++) {
            magnets.get(i).handleNoDetection();
        }
        renderMagnets();
    }
    renderFillPolygons();
    gui.setMessage(message);
}
Also used : CalibrationObservation(boofcv.alg.geo.calibration.CalibrationObservation)

Aggregations

CalibrationObservation (boofcv.alg.geo.calibration.CalibrationObservation)16 Point2D_F64 (georegression.struct.point.Point2D_F64)6 PointIndex2D_F64 (boofcv.struct.geo.PointIndex2D_F64)5 GrayF32 (boofcv.struct.image.GrayF32)5 DetectorFiducialCalibration (boofcv.abst.geo.calibration.DetectorFiducialCalibration)3 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 BufferedImage (java.awt.image.BufferedImage)3 Grid (boofcv.alg.fiducial.calib.circle.EllipseClustersIntoGrid.Grid)2 StereoParameters (boofcv.struct.calib.StereoParameters)2 Point2D_F32 (georegression.struct.point.Point2D_F32)2 Point3D_F64 (georegression.struct.point.Point3D_F64)2 Se3_F64 (georegression.struct.se.Se3_F64)2 Test (org.junit.Test)2 ConfigChessboard (boofcv.abst.fiducial.calib.ConfigChessboard)1 CalibrateStereoPlanar (boofcv.abst.geo.calibration.CalibrateStereoPlanar)1 DetectFiducialSquareGrid (boofcv.alg.fiducial.calib.DetectFiducialSquareGrid)1 DetectCircleHexagonalGrid (boofcv.alg.fiducial.calib.circle.DetectCircleHexagonalGrid)1 DetectCircleRegularGrid (boofcv.alg.fiducial.calib.circle.DetectCircleRegularGrid)1 KeyPointsCircleHexagonalGrid (boofcv.alg.fiducial.calib.circle.KeyPointsCircleHexagonalGrid)1 KeyPointsCircleRegularGrid (boofcv.alg.fiducial.calib.circle.KeyPointsCircleRegularGrid)1