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;
}
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;
}
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;
}
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();
}
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);
}
Aggregations