Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Jan 4, 2024
1 parent 06e044e commit d5624e8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
4 changes: 1 addition & 3 deletions devTools/calibrationUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def main():
parser = argparse.ArgumentParser(
description="Convert Photon calibration JSON for use with mrcal"
)
parser.add_argument(
"input", type=str, help="Path to Photon calibration JSON file"
)
parser.add_argument("input", type=str, help="Path to Photon calibration JSON file")
parser.add_argument(
"output_folder", type=str, help="Output folder for mrcal VNL file + images"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
rounded
color="red"
text-color="white"
style="margin: 10px 0"
class="mt-3"
icon="mdi-alert-circle-outline"
>
MrCal JNI could not be loaded! Consult journalctl logs for additional details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.photonvision.common.hardware.Platform;
import org.photonvision.common.networking.NetworkUtils;
import org.photonvision.common.util.SerializationUtils;
import org.photonvision.mrcal.MrCal;
import org.photonvision.mrcal.MrCalJNILoader;
import org.photonvision.raspi.LibCameraJNILoader;
import org.photonvision.vision.calibration.CameraCalibrationCoefficients;
import org.photonvision.vision.processes.VisionModule;
Expand Down Expand Up @@ -141,7 +141,7 @@ public Map<String, Object> toHashMap() {
LibCameraJNILoader.isSupported()
? "Zerocopy Libcamera Working"
: ""); // TODO add support for other types of GPU accel
generalSubmap.put("mrCalWorking", MrCal.isWorking());
generalSubmap.put("mrCalWorking", MrCalJNILoader.isWorking());
generalSubmap.put("hardwareModel", hardwareConfig.deviceName);
generalSubmap.put("hardwarePlatform", Platform.getPlatformName());
settingsSubmap.put("general", generalSubmap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.photonvision.common.util.TestUtils;
import org.photonvision.jni.PhotonJniCommon;

public class MrCal extends PhotonJniCommon {
public class MrCalJNILoader extends PhotonJniCommon {
public static synchronized void forceLoad() throws IOException {
// Force load opencv
TestUtils.loadLibraries();
Expand All @@ -32,7 +32,7 @@ public static synchronized void forceLoad() throws IOException {
if (Platform.isWindows()) {
// Order is correct to match dependencies of libraries
forceLoad(
MrCal.class,
MrCalJNILoader.class,
List.of(
"libamd",
"libcamd",
Expand All @@ -46,10 +46,10 @@ public static synchronized void forceLoad() throws IOException {
"mrcal_jni"));
} else {
// Nothing else to do on linux
forceLoad(MrCal.class, List.of("mrcal_jni"));
forceLoad(MrCalJNILoader.class, List.of("mrcal_jni"));
}

if (!MrCal.isWorking()) {
if (!MrCalJNILoader.isWorking()) {
throw new IOException("Can't load mrcal?");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import org.photonvision.common.logging.LogGroup;
import org.photonvision.common.logging.Logger;
import org.photonvision.common.util.math.MathUtils;
import org.photonvision.mrcal.MrCal;
import org.photonvision.mrcal.MrCalJNI;
import org.photonvision.mrcal.MrCalJNI.MrCalResult;
import org.photonvision.mrcal.MrCalJNILoader;
import org.photonvision.vision.calibration.BoardObservation;
import org.photonvision.vision.calibration.CameraCalibrationCoefficients;
import org.photonvision.vision.calibration.JsonImageMat;
Expand Down Expand Up @@ -79,7 +79,7 @@ protected CameraCalibrationCoefficients process(
&& it.size != null)
.collect(Collectors.toList());

if (MrCal.isWorking() && params.useMrCal) {
if (MrCalJNILoader.isWorking() && params.useMrCal) {
logger.debug("Calibrating with mrcal!");
return process_mrcal(in);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.photonvision.common.logging.LogLevel;
import org.photonvision.common.logging.Logger;
import org.photonvision.common.util.TestUtils;
import org.photonvision.mrcal.MrCal;
import org.photonvision.mrcal.MrCalJNILoader;
import org.photonvision.vision.calibration.CameraCalibrationCoefficients;
import org.photonvision.vision.camera.QuirkyCamera;
import org.photonvision.vision.frame.Frame;
Expand All @@ -49,7 +49,7 @@ public class Calibrate3dPipeTest {
@BeforeAll
public static void init() throws IOException {
TestUtils.loadLibraries();
MrCal.forceLoad();
MrCalJNILoader.forceLoad();

var logLevel = LogLevel.DEBUG;
Logger.setLevel(LogGroup.Camera, logLevel);
Expand Down
4 changes: 2 additions & 2 deletions photon-server/src/main/java/org/photonvision/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.photonvision.common.networking.NetworkManager;
import org.photonvision.common.util.TestUtils;
import org.photonvision.common.util.numbers.IntegerCouple;
import org.photonvision.mrcal.MrCal;
import org.photonvision.mrcal.MrCalJNILoader;
import org.photonvision.raspi.LibCameraJNILoader;
import org.photonvision.server.Server;
import org.photonvision.vision.camera.FileVisionSource;
Expand Down Expand Up @@ -319,7 +319,7 @@ public static void main(String[] args) {
}

try {
MrCal.forceLoad();
MrCalJNILoader.forceLoad();
} catch (IOException e) {
logger.error("Failed to load mrcal-JNI! Camera calibration will fall back to opencv", e);
}
Expand Down

0 comments on commit d5624e8

Please sign in to comment.