Closedown
This commit is contained in:
@@ -626,6 +626,37 @@ public class ScreenPanel extends Panel {
|
||||
return (Boolean) camera.get("roi_enable");
|
||||
}
|
||||
}
|
||||
|
||||
public static class CameraPars {
|
||||
|
||||
public HashMap parameter;
|
||||
|
||||
public Boolean getBackgroundSubtraction() {
|
||||
if (parameter.get("background_subtration") == null){
|
||||
return false;
|
||||
}
|
||||
return (Boolean) parameter.get("background_subtration");
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getRoi() {
|
||||
return (ArrayList<Integer>) parameter.get("region_of_interest");
|
||||
}
|
||||
|
||||
public Boolean getRoiEnable() {
|
||||
ArrayList<Integer> roi = getRoi();
|
||||
return ((roi != null) && (roi.size()>=4));
|
||||
}
|
||||
|
||||
public HashMap getGoodRegion() {
|
||||
return (HashMap) parameter.get("good_region");
|
||||
}
|
||||
|
||||
public Double getThresholde() {
|
||||
return (Double) parameter.get("threshold");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Thread devicesInitTask;
|
||||
|
||||
@@ -694,9 +725,27 @@ public class ScreenPanel extends Panel {
|
||||
if ((cameraConfigJson == null) && (buttonDirect.isSelected())) {
|
||||
throw new Exception("Cannot open camera config file: " + configFile.toFile());
|
||||
}
|
||||
|
||||
|
||||
camera = new PsiCamera(CAMERA_DEVICE_NAME, cameraName);
|
||||
config = (CameraConfig) JsonSerializer.decode(cameraConfigJson, CameraConfig.class);
|
||||
|
||||
CameraPars cameraPars = null;
|
||||
try{
|
||||
Path parsFile = Paths.get(CONFIG_FOLDER, cameraName + "_parameters.json");
|
||||
if (parsFile.toFile().exists()){
|
||||
String cameraParsJson = new String(Files.readAllBytes(parsFile));
|
||||
cameraPars = (CameraPars) JsonSerializer.decode(cameraParsJson, CameraPars.class);
|
||||
boolean roi = cameraPars.getRoiEnable();
|
||||
camera.getConfig().roiX = roi ? cameraPars.getRoi().get(0) : 0;
|
||||
camera.getConfig().roiY = roi ? cameraPars.getRoi().get(2) : 0;
|
||||
camera.getConfig().roiWidth = roi ? cameraPars.getRoi().get(1) : -1;
|
||||
camera.getConfig().roiHeight =roi ? cameraPars.getRoi().get(3) : -1;
|
||||
|
||||
}
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
camera.getConfig().flipHorizontally = config.getMirrorX();
|
||||
camera.getConfig().flipVertically = config.getMirrorY();
|
||||
//camera.getConfig().rotation = config.getRotate();
|
||||
@@ -713,10 +762,10 @@ public class ScreenPanel extends Panel {
|
||||
break;
|
||||
}
|
||||
camera.getConfig().rotationCrop = false;
|
||||
camera.getConfig().roiX = config.getRoiEnable() ? config.getRoi().get(0) : 0;
|
||||
camera.getConfig().roiY = config.getRoiEnable() ? config.getRoi().get(1) : 0;
|
||||
camera.getConfig().roiWidth = config.getRoiEnable() ? config.getRoi().get(2) : -1;
|
||||
camera.getConfig().roiHeight = config.getRoiEnable() ? config.getRoi().get(3) : -1;
|
||||
//camera.getConfig().roiX = config.getRoiEnable() ? config.getRoi().get(0) : 0;
|
||||
//camera.getConfig().roiY = config.getRoiEnable() ? config.getRoi().get(1) : 0;
|
||||
//camera.getConfig().roiWidth = config.getRoiEnable() ? config.getRoi().get(2) : -1;
|
||||
//camera.getConfig().roiHeight = config.getRoiEnable() ? config.getRoi().get(3) : -1;
|
||||
try {
|
||||
camera.getConfig().spatialCalOffsetX = config.getCalOffsetX();
|
||||
camera.getConfig().spatialCalOffsetY = config.getCalOffsetY();
|
||||
|
||||
Reference in New Issue
Block a user