use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class VisualizeStereoVisualOdometryApp method refreshAll.
@Override
public void refreshAll(Object[] cookies) {
numFaults = 0;
if (cookies != null)
whichAlg = (Integer) cookies[0];
alg = createStereoDepth(whichAlg);
alg.setCalibration(config);
guiInfo.reset();
handleRunningStatus(2);
CameraPinholeRadial right = config.right;
guiCam3D.init();
guiCam3D.setFocalLength(300);
guiCam3D.setStepSize(config.getBaseline());
guiCam3D.setPreferredSize(new Dimension(right.width, right.height));
guiCam3D.setMaximumSize(guiCam3D.getPreferredSize());
startWorkerThread();
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class ExampleCalibrateMonocular method main.
public static void main(String[] args) {
DetectorFiducialCalibration detector;
List<String> images;
// Regular Circle Example
// detector = FactoryFiducialCalibration.circleRegularGrid(new ConfigCircleRegularGrid(8, 10, 1.5, 2.5));
// images = UtilIO.listByPrefix(UtilIO.pathExample("calibration/mono/Sony_DSC-HX5V_CircleRegular"),"image");
// Hexagonal Circle Example
// detector = FactoryFiducialCalibration.circleHexagonalGrid(new ConfigCircleHexagonalGrid(24, 28, 1, 1.2));
// images = UtilIO.listByPrefix(UtilIO.pathExample("calibration/mono/Sony_DSC-HX5V_CircleHexagonal"),"image");
// Square Grid example
// detector = FactoryFiducialCalibration.squareGrid(new ConfigSquareGrid(4, 3, 30, 30));
// images = UtilIO.listByPrefix(UtilIO.pathExample("calibration/stereo/Bumblebee2_Square"),"left");
// Chessboard Example
detector = FactoryFiducialCalibration.chessboard(new ConfigChessboard(7, 5, 30));
images = UtilIO.listByPrefix(UtilIO.pathExample("calibration/stereo/Bumblebee2_Chess"), "left");
// Declare and setup the calibration algorithm
CalibrateMonoPlanar calibrationAlg = new CalibrateMonoPlanar(detector.getLayout());
// tell it type type of target and which parameters to estimate
calibrationAlg.configurePinhole(true, 2, false);
for (String n : images) {
BufferedImage input = UtilImageIO.loadImage(n);
if (input != null) {
GrayF32 image = ConvertBufferedImage.convertFrom(input, (GrayF32) null);
if (detector.process(image)) {
calibrationAlg.addImage(detector.getDetectedPoints().copy());
} else {
System.err.println("Failed to detect target in " + n);
}
}
}
// process and compute intrinsic parameters
CameraPinholeRadial intrinsic = calibrationAlg.process();
// save results to a file and print out
CalibrationIO.save(intrinsic, "intrinsic.yaml");
calibrationAlg.printStatistics();
System.out.println();
System.out.println("--- Intrinsic Parameters ---");
System.out.println();
intrinsic.print();
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class BenchmarkFiducialDetector method perform.
private static void perform(String directory, FiducialDetector detector) {
CameraPinholeRadial intrinsic = CalibrationIO.load(new File(directory, "intrinsic.yaml"));
// intrinsic.radial = null;
// intrinsic.t1 = intrinsic.t2 = 0;
BenchmarkFiducialDetector benchmark = new BenchmarkFiducialDetector(detector);
benchmark.addImage(directory + "image0000.jpg");
benchmark.addImage(directory + "image0001.jpg");
benchmark.addImage(directory + "image0002.jpg");
System.out.println("FPS = " + benchmark.benchmark(600));
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class ImplRectifyImageOps_F32 method allInsideLeft.
public static void allInsideLeft(CameraPinholeRadial paramLeft, FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight, FMatrixRMaj rectifyK) {
// need to take in account the order in which image distort will remove rectification later on
paramLeft = new CameraPinholeRadial(paramLeft);
Point2Transform2_F32 tranLeft = transformPixelToRect(paramLeft, rectifyLeft);
RectangleLength2D_F32 bound = LensDistortionOps.boundBoxInside(paramLeft.width, paramLeft.height, new PointToPixelTransform_F32(tranLeft));
LensDistortionOps.roundInside(bound);
float scaleX = paramLeft.width / (float) bound.width;
float scaleY = paramLeft.height / (float) bound.height;
float scale = (float) Math.max(scaleX, scaleY);
adjustCalibrated(rectifyLeft, rectifyRight, rectifyK, bound, scale);
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class TestAssociateStereo2D method setup.
@Before
public void setup() {
leftToRight = new Se3_F64();
ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.01, -0.001, 0.005, leftToRight.getR());
leftToRight.getT().set(-0.1, 0, 0);
param = new StereoParameters();
param.rightToLeft = leftToRight.invert(null);
param.left = new CameraPinholeRadial(400, 500, 0.1, 160, 120, 320, 240).fsetRadial(0, 0);
param.right = new CameraPinholeRadial(380, 505, 0.05, 165, 115, 320, 240).fsetRadial(0, 0);
descLeft = new FastQueue<TupleDesc_F64>(TupleDesc_F64.class, true) {
@Override
protected TupleDesc_F64 createInstance() {
return new TupleDesc_F64(10);
}
};
descRight = new FastQueue<TupleDesc_F64>(TupleDesc_F64.class, true) {
@Override
protected TupleDesc_F64 createInstance() {
return new TupleDesc_F64(10);
}
};
pointsLeft.reset();
pointsRight.reset();
}
Aggregations