mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
Show Saved Snapshots in UI (#995)
Add Camera Control tab to Cameras for the button to live in
This commit is contained in:
@@ -47,14 +47,16 @@ public class FileSaveFrameConsumer implements Consumer<CVMat> {
|
||||
private final String ntEntryName;
|
||||
private IntegerEntry saveFrameEntry;
|
||||
|
||||
private final String cameraUniqueName;
|
||||
private String cameraNickname;
|
||||
private final String streamType;
|
||||
|
||||
private long savedImagesCount = 0;
|
||||
|
||||
public FileSaveFrameConsumer(String camNickname, String streamPrefix) {
|
||||
public FileSaveFrameConsumer(String camNickname, String cameraUniqueName, String streamPrefix) {
|
||||
this.ntEntryName = streamPrefix + NT_SUFFIX;
|
||||
this.cameraNickname = camNickname;
|
||||
this.cameraUniqueName = cameraUniqueName;
|
||||
this.streamType = streamPrefix;
|
||||
|
||||
this.rootTable = NetworkTablesManager.getInstance().kRootTable;
|
||||
@@ -74,7 +76,15 @@ public class FileSaveFrameConsumer implements Consumer<CVMat> {
|
||||
|
||||
String fileName =
|
||||
cameraNickname + "_" + streamType + "_" + df.format(now) + "T" + tf.format(now);
|
||||
String saveFilePath = FILE_PATH + File.separator + fileName + FILE_EXTENSION;
|
||||
|
||||
// Check if the Unique Camera directory exists and create it if it doesn't
|
||||
String cameraPath = FILE_PATH + File.separator + this.cameraUniqueName;
|
||||
var cameraDir = new File(cameraPath);
|
||||
if (!cameraDir.exists()) {
|
||||
cameraDir.mkdir();
|
||||
}
|
||||
|
||||
String saveFilePath = cameraPath + File.separator + fileName + FILE_EXTENSION;
|
||||
|
||||
Imgcodecs.imwrite(saveFilePath, image.getMat());
|
||||
|
||||
|
||||
@@ -176,10 +176,15 @@ public class VisionModule {
|
||||
this.outputStreamPort = 1181 + (camStreamIdx * 2) + 1;
|
||||
|
||||
inputFrameSaver =
|
||||
new FileSaveFrameConsumer(visionSource.getSettables().getConfiguration().nickname, "input");
|
||||
new FileSaveFrameConsumer(
|
||||
visionSource.getSettables().getConfiguration().nickname,
|
||||
visionSource.getSettables().getConfiguration().uniqueName,
|
||||
"input");
|
||||
outputFrameSaver =
|
||||
new FileSaveFrameConsumer(
|
||||
visionSource.getSettables().getConfiguration().nickname, "output");
|
||||
visionSource.getSettables().getConfiguration().nickname,
|
||||
visionSource.getSettables().getConfiguration().uniqueName,
|
||||
"output");
|
||||
|
||||
String camHostname = CameraServerJNI.getHostname();
|
||||
inputVideoStreamer =
|
||||
|
||||
Reference in New Issue
Block a user