Skip to content

Commit

Permalink
Swap to PNG and serialize insolution
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Dec 31, 2023
1 parent 75a580b commit da48930
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions photon-client/src/types/SettingTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export interface BoardObservation {
locationInImageSpace: CvPoint[];
reprojectionErrors: CvPoint[];
optimisedCameraToObject: Pose3d;
includeObservationInCalibration: boolean;
}

export interface CameraCalibrationResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,20 @@ public final class BoardObservation {
// Solver optimized board poses
public Pose3d optimisedCameraToObject;

// If we should use this observation when re-calculating camera calibration
public boolean includeObservationInCalibration;

@JsonCreator
public BoardObservation(
@JsonProperty("locationInObjectSpace") List<Point3> locationInObjectSpace,
@JsonProperty("locationInImageSpace") List<Point> locationInImageSpace,
@JsonProperty("reprojectionErrors") List<Point> reprojectionErrors,
@JsonProperty("optimisedCameraToObject") Pose3d optimisedCameraToObject) {
@JsonProperty("optimisedCameraToObject") Pose3d optimisedCameraToObject,
@JsonProperty("includeObservationInCalibration") boolean includeObservationInCalibration) {
this.locationInObjectSpace = locationInObjectSpace;
this.locationInImageSpace = locationInImageSpace;
this.reprojectionErrors = reprojectionErrors;
this.optimisedCameraToObject = optimisedCameraToObject;
this.includeObservationInCalibration = includeObservationInCalibration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected CameraCalibrationCoefficients process(List<Triple<Size, Mat, Mat>> in)

var camToBoard = MathUtils.opencvRTtoPose3d(rvecs.get(i), tvecs.get(i));

observations.add(new BoardObservation(i_objPts, i_imgPts, reprojectionError, camToBoard));
observations.add(new BoardObservation(i_objPts, i_imgPts, reprojectionError, camToBoard, true));
}
jac_temp.release();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void saveCalImage(Mat img) {
logger.error("Could not create save folder! " + folder);
}
Imgcodecs.imwrite(
Path.of(folder.toAbsolutePath().toString(), "img" + foundCornersList.size() + ".jpg")
Path.of(folder.toAbsolutePath().toString(), "img" + foundCornersList.size() + ".png")
.toString(),
img);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ public static void onCameraCalibImagesRequest(Context ctx) {

var bufferedImage = ImageIO.read(calibImg);
var buffer = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", buffer);
ImageIO.write(bufferedImage, "png", buffer);
byte[] data = buffer.toByteArray();

snapshotData.put("snapshotData", data);
Expand Down

0 comments on commit da48930

Please sign in to comment.