Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ project.ext.args4j_version = '2.33'
project.ext.junit_version = '5.11.4'
project.ext.errorprone_version = '2.41.0'
project.ext.nullaway_version = '0.12.10'
project.ext.auto64to32_version = '3.3.0-SNAPSHOT'
project.ext.auto64to32_version = '3.3.0'
project.ext.snakeyaml_version = '2.3'
project.ext.jmh_version = '1.36'
project.ext.jetnull_version = '23.0.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
* Copyright (c) 2026, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -19,7 +19,7 @@
package boofcv.struct.calib;

import lombok.Getter;
import org.ejml.FancyPrint;
import org.ejml.MapPrintFormat;

import java.io.Serializable;

Expand Down Expand Up @@ -81,18 +81,12 @@ public boolean isDistorted() {
System.out.printf("radial=%6.2e%n\n", radial);
}

@Override public String toString() {
FancyPrint fp = new FancyPrint();
String txt = "CameraDivision{" +
"fx=" + fx +
", fy=" + fy +
", skew=" + skew +
", cx=" + cx +
", cy=" + cy +
", width=" + width +
", height=" + height +
", radial="+fp.s(radial);
txt += '}';
return txt;
@Override public String formatMap( MapPrintFormat format ) {
var builder = new StringBuilder();
builder.append(format.itemPrefix);
formatPinhole(format, builder, true);
format.pair(builder, "radial", radial, true);
builder.append(format.itemSuffix);
return builder.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
* Copyright (c) 2026, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -21,9 +21,7 @@
import boofcv.misc.BoofMiscOps;
import lombok.Getter;
import lombok.Setter;
import org.ejml.FancyPrint;

import static boofcv.struct.calib.CameraPinholeBrown.toStringArray;
import org.ejml.MapPrintFormat;

/**
* A camera model for pinhole, wide angle, and fisheye cameras. The full camera model
Expand Down Expand Up @@ -75,7 +73,7 @@ public class CameraKannalaBrandt extends CameraPinhole {
* Constructor which allows the order of all distortion coefficients to be specified
*
* @param numSymmetric Number of radially symmetric terms. Standard is 5.
* @param numAsymmetric Number of non symmetric terms. If not zero then trig coefficients will be 4.
* @param numAsymmetric Number of non-symmetric terms. If not zero then trig coefficients will be 4.
* Standard is 4
*/
public CameraKannalaBrandt( int numSymmetric, int numAsymmetric ) {
Expand All @@ -100,7 +98,7 @@ public CameraKannalaBrandt() {
* Configures the number of coefficients for each distortion term.
*
* @param numSymmetric Number of radially symmetric terms. Standard is 5.
* @param numAsymmetric Number of non symmetric terms. If not zero then trig coefficients will be 4.
* @param numAsymmetric Number of non-symmetric terms. If not zero then trig coefficients will be 4.
* Standard is 4
*/
public void configureCoefficients( int numSymmetric, int numAsymmetric ) {
Expand All @@ -114,8 +112,8 @@ public void configureCoefficients( int numSymmetric, int numAsymmetric ) {
}

@Override public CameraKannalaBrandt fsetK( double fx, double fy,
double skew,
double cx, double cy ) {
double skew,
double cx, double cy ) {
super.fsetK(fx, fy, skew, cx, cy);
return this;
}
Expand Down Expand Up @@ -241,24 +239,17 @@ public <T extends CameraModel> T createLike() {
return (T)new CameraKannalaBrandt(symmetric.length, radial.length);
}

@Override
public String toString() {
FancyPrint fp = new FancyPrint();
String txt = "CameraKannalaBrandt{" +
"fx=" + fx +
", fy=" + fy +
", skew=" + skew +
", cx=" + cx +
", cy=" + cy +
", width=" + width +
", height=" + height;
txt += toStringArray(fp, "s", symmetric);
txt += toStringArray(fp, "r", radial);
txt += toStringArray(fp, "rt", radialTrig);
txt += toStringArray(fp, "t", tangent);
txt += toStringArray(fp, "tt", tangentTrig);
txt += '}';
return txt;
@Override public String formatMap( MapPrintFormat format ) {
var builder = new StringBuilder();
builder.append(format.itemPrefix);
formatPinhole(format, builder, true);
format.pair(builder, "symmetric", symmetric, true);
format.pair(builder, "radial", radial, true);
format.pair(builder, "radialTrig", radialTrig, true);
format.pair(builder, "tangent", tangent, true);
format.pair(builder, "tangentTrig", tangentTrig, false);
builder.append(format.itemSuffix);
return builder.toString();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
* Copyright (c) 2026, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.image.ImageBase;
import boofcv.struct.image.ImageDimension;
import org.ejml.MapFormattable;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;
Expand All @@ -29,7 +30,7 @@
*
* @author Peter Abeles
*/
public abstract class CameraModel implements Serializable {
public abstract class CameraModel implements Serializable, MapFormattable {
/** image shape (units: pixels) */
public int width, height;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
* Copyright (c) 2026, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -21,6 +21,7 @@
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.ejml.MapPrintFormat;
import org.ejml.data.DMatrixRMaj;

/**
Expand Down Expand Up @@ -161,19 +162,27 @@ public <T extends CameraModel> T createLike() {
return (T)new CameraPinhole();
}

@Override
public String toString() {
return "CameraPinhole{" +
"fx=" + fx +
", fy=" + fy +
", skew=" + skew +
", cx=" + cx +
", cy=" + cy +
", width=" + width +
", height=" + height +
'}';
@Override public String formatMap( MapPrintFormat format ) {
var builder = new StringBuilder();
builder.append(format.itemPrefix);
formatPinhole(format, builder, false);
builder.append(format.itemSuffix);
return builder.toString();
}

/// Adds parameters which define a pinhole camera to the serialization
protected void formatPinhole( MapPrintFormat format, StringBuilder builder, boolean isMore ) {
format.pair(builder, "fx", fx, true);
format.pair(builder, "fy", fy, true);
format.pair(builder, "skew", skew, true);
format.pair(builder, "cx", cx, true);
format.pair(builder, "cy", cy, true);
format.pair(builder, "width", width, true);
format.pair(builder, "height", height, isMore);
}

@Override public String toString() {return MapPrintFormat.DEFAULT.toString(this);}

public boolean isEquals( CameraPinhole param, double tol ) {
if (Math.abs(fx - param.fx) > tol)
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Peter Abeles. All Rights Reserved.
* Copyright (c) 2026, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -21,6 +21,7 @@
import lombok.Getter;
import lombok.Setter;
import org.ejml.FancyPrint;
import org.ejml.MapPrintFormat;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;
Expand Down Expand Up @@ -182,24 +183,15 @@ public void print() {
}
}

@Override
public String toString() {
var fp = new FancyPrint();
String txt = "CameraPinholeRadial{" +
"fx=" + fx +
", fy=" + fy +
", skew=" + skew +
", cx=" + cx +
", cy=" + cy +
", width=" + width +
", height=" + height;
txt += toStringArray(fp, "r", radial);

if (t1 != 0 || t2 != 0) {
txt += ", t1=" + fp.s(t1) + " t2=" + fp.s(t2);
}
txt += '}';
return txt;
@Override public String formatMap( MapPrintFormat format ) {
var builder = new StringBuilder();
builder.append(format.itemPrefix);
formatPinhole(format, builder, true);
format.pair(builder, "radial", radial, true);
format.pair(builder, "t1", t1, true);
format.pair(builder, "t2", t2, false);
builder.append(format.itemSuffix);
return builder.toString();
}

public static String toStringArray( FancyPrint fp, String name, @Nullable double[] param ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
* Copyright (c) 2026, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -18,9 +18,7 @@

package boofcv.struct.calib;

import org.ejml.FancyPrint;

import static boofcv.struct.calib.CameraPinholeBrown.toStringArray;
import org.ejml.MapPrintFormat;

/**
* <p>Camera model for omnidirectional single viewpoint sensors [1]. Designed to work with parabolic,
Expand Down Expand Up @@ -165,23 +163,16 @@ public void setMirrorOffset( double mirrorOffset ) {
this.mirrorOffset = mirrorOffset;
}

@Override public String toString() {
FancyPrint fp = new FancyPrint();
String txt = "CameraUniversalOmni{" +
"width=" + width +
", height=" + height +
", fx=" + fx +
", fy=" + fy +
", skew=" + skew +
", cx=" + cx +
", cy=" + cy +
", mirrorOffset=" + fp.s(mirrorOffset);
txt += toStringArray(fp, "r", radial);
if (t1 != 0 || t2 != 0) {
txt += ", t1=" + fp.s(t1) + " t2=" + fp.s(t2);
}
txt += '}';
return txt;
@Override public String formatMap( MapPrintFormat format ) {
var builder = new StringBuilder();
builder.append(format.itemPrefix);
formatPinhole(format, builder, true);
format.pair(builder, "radial", radial, true);
format.pair(builder, "t1", t1, true);
format.pair(builder, "t2", t2, true);
format.pair(builder, "mirrorOffset", mirrorOffset, false);
builder.append(format.itemSuffix);
return builder.toString();
}

@Override
Expand Down
Loading