Commit cde73fef authored by Andrey Filippov's avatar Andrey Filippov

implemented 'neck' parameters (rotating/shifting camera as a whole), old bug fixes

parent 782eb01a
......@@ -109,7 +109,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
private Panel panelGoniometer;
private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelLWIR;
private Panel panelLWIR16;
// private Panel panelLWIR16;
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
JP46_Reader_camera JP4_INSTANCE;
......@@ -508,6 +508,9 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
0.0,
0.0,
0.0, 0.0, 2360, //double [] GXYZ // coordinates (in mm) of the goniometer horizontal axis closest to the moving one in target system
0.0,
0.0,
0.0, 0.0,
2592, // int sensorWidth= 2592;
1936, //int sensorHeight= 1936;
2, //int shrinkGridForMask=2; //shrink detected grids by one point for/vert this number of times before calculating masks
......@@ -692,14 +695,15 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
panelRun = new Panel();
panelRun.setLayout(new GridLayout(1, 0, 5, 5));
addButton("Process Calibration Files",panelRun);
addButton("Save",panelRun);
addButton("Save Selected",panelRun);
addButton("Restore",panelRun,color_restore);
addButton("Save", panelRun);
addButton("Save Selected", panelRun);
addButton("Restore", panelRun,color_restore);
addButton("Restore no autoload",panelRun);
addButton("Restore SFE Latest",panelRun,color_restore);
addButton("List SFE",panelRun,color_report);
addButton("Stop",panelRun,color_stop);
addButton("Abort",panelRun,color_stop);
addButton("Properties clear", panelRun, color_stop);
addButton("Restore SFE Latest", panelRun, color_restore);
addButton("List SFE", panelRun,color_report);
addButton("Stop", panelRun,color_stop);
addButton("Abort", panelRun,color_stop);
add(panelRun);
......@@ -1257,6 +1261,10 @@ if (MORE_BUTTONS) {
} else if (label.equals("Restore") || label.equals("Restore no autoload")) {
restore(label.equals("Restore no autoload"));
return;
/* ======================================================================== */
} else if (label.equals("Properties clear")) {
PROPERTIES=new Properties();
return;
/* ======================================================================== */
} else if (label.equals("Process Calibration Files")) {
processCalibrationFiles();
......@@ -5977,7 +5985,7 @@ if (MORE_BUTTONS) {
return;
}
GenericDialog gd=new GenericDialog ("Select list mode");
gd.addNumericField("Mode 0 - pointers, 1 - shift/Rots, 2 - points/extra, 3 - rms", 3, 0);
gd.addNumericField("Mode 0 - pointers, 1 - shift/Rots, 2 - points/extra, 3 - rms, 4 - image numbers", 3, 0);
gd.showDialog();
if (gd.wasCanceled()) return;
int listMode= (int) gd.getNextNumber();
......@@ -27,6 +27,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Arrays;
//import java.util.Arrays;
//import java.io.StringWriter;
import java.util.List;
......@@ -3321,10 +3322,12 @@ For each point in the image
int numSuccess=0;
DistortionCalibrationData dcd=fittingStrategy.distortionCalibrationData;
for (int numGridImage=0;numGridImage<dcd.gIP.length;numGridImage++) {
/*
if (numGridImage >= 1680) {
System.out.println("Processing debug image "+numGridImage);
System.out.println("Processing debug image "+numGridImage);
}
*/
int set_number = dcd.gIP[numGridImage].getSetNumber();
if ((set_number >= start_set) &&
(set_number <= end_set) &&
......@@ -10747,17 +10750,31 @@ M * V = B
EyesisCameraParameters eyesisCameraParameters
){
boolean resetParametersToZero=false;
boolean updateAllSubcameras = false;
boolean [] parameterMask= new boolean[distortionCalibrationData.getNumParameters()];
boolean [] channelMask= new boolean[distortionCalibrationData.getNumSubCameras()];
boolean [] stationMask= new boolean[distortionCalibrationData.getNumStations()];
String [] source_stations = new String[stationMask.length+1];
source_stations[0] = "---";
for (int i = 0; i < stationMask.length; i++) {
source_stations[i+1]=""+i;
}
for (int i=0;i<parameterMask.length;i++) parameterMask[i]=false;
for (int i=0;i<channelMask.length;i++) channelMask[i]= true;
for (int i=0;i<stationMask.length;i++) stationMask[i]= true;
GenericDialog gd=new GenericDialog("Update (new) image settings from known data");
//
gd.addCheckbox("Reset selected parameters to zero (false - update from camera parameters)", resetParametersToZero);
if (stationMask.length > 1) {
gd.addChoice("Copy selected parameters from tis station to all other stations" , source_stations, source_stations[0]);
}
gd.addMessage("Select which individual image parameters to be updated from the camera parameters (or reset to 0)");
for (int i=0;i<parameterMask.length;i++) gd.addCheckbox(i+": "+distortionCalibrationData.getParameterName(i), parameterMask[i]);
gd.addCheckbox("Update all subcamera parameters", updateAllSubcameras);
for (int i=0;i<parameterMask.length;i++) {
gd.addCheckbox(i+": "+distortionCalibrationData.getParameterName(i), parameterMask[i]);
}
gd.addMessage("----------");
gd.addMessage("Select which channels (sub-cameras) to update");
for (int i=0;i<channelMask.length;i++) gd.addCheckbox("Subcamera "+i, channelMask[i]);
......@@ -10776,6 +10793,12 @@ M * V = B
gd.showDialog();
if (gd.wasCanceled()) return false;
resetParametersToZero=gd.getNextBoolean();
int source_station = -1;
if (stationMask.length > 1) {
source_station = gd.getNextChoiceIndex() - 1;
}
updateAllSubcameras = gd.getNextBoolean();
for (int i=0;i<parameterMask.length;i++) parameterMask[i]= gd.getNextBoolean();
for (int i=0;i<channelMask.length;i++) channelMask[i]= gd.getNextBoolean();
if (stationMask.length>1) {
......@@ -10784,6 +10807,25 @@ M * V = B
boolean updateFromTimestamps= gd.getNextBoolean();
boolean allowClosest= gd.getNextBoolean();
boolean reCenterVertically= gd.getNextBoolean();
if (updateAllSubcameras) {
resetParametersToZero = false; // just for safety
for (int i=0;i<parameterMask.length;i++) {
parameterMask[i] |= distortionCalibrationData.isSubcameraParameter(i);
}
}
if (source_station >= 0) {
updateOtherStations(
eyesisCameraParameters,
source_station,
parameterMask,
channelMask,
stationMask);
}
if (reCenterVertically){
eyesisCameraParameters.recenterVertically(channelMask, stationMask);
for (int i=0;i<channelMask.length;i++) channelMask[i]= true;
......@@ -10903,6 +10945,38 @@ M * V = B
return true;
}
/**
* Update selected parameters from sourceStation to selected (stationMask) stations, filtered by channelMask
* @param eyesisCameraParameters
* @param sourceStation
* @param parameterMask
* @param channelMask
* @param stationMask
*/
public void updateOtherStations(
EyesisCameraParameters eyesisCameraParameters,
int sourceStation,
boolean [] parameterMask,
boolean [] channelMask,
boolean [] stationMask
) {
for (int stationNumber = 0; stationNumber < stationMask.length; stationNumber++) if (stationMask[stationNumber]) {
for (int subCam=0; subCam < channelMask.length; subCam++) if (channelMask[subCam]) {
double [] oldVector=eyesisCameraParameters.getParametersVector(stationNumber,subCam);
double [] newVector=eyesisCameraParameters.getParametersVector(sourceStation,subCam);
for (int j=0;j<oldVector.length;j++) if (parameterMask[j]){
oldVector[j]=newVector[j];
}
eyesisCameraParameters.setParametersVector(
newVector,
parameterMask,
stationNumber,
subCam);
}
}
}
/**
* Copies selected parameters from the camera parameters to per-image parameters (i.e. for new/previously disabled images)
......@@ -11078,6 +11152,10 @@ M * V = B
int numSeries=allImages?(-1):this.fittingStrategy.currentSeriesNumber;
boolean [] selectedImages=fittingStrategy.selectedImages(numSeries); // all enabled
boolean [] selectedImagesDebug=null;
boolean include_disabled = allImages;
if (include_disabled) {
Arrays.fill(selectedImages, true);
}
boolean debugThis=false;
int maxDebugImages=10;
if (this.debugLevel>0) System.out.println("updateCameraParametersFromCalculated("+allImages+")");
......@@ -11108,6 +11186,7 @@ M * V = B
System.out.println(i+": "+fittingStrategy.distortionCalibrationData.getParameterName(i)+" = "+par[i]);
}
}
// System.out.println(numImg+"[21]: "+fittingStrategy.distortionCalibrationData.getParameterName(21)+" = "+par[21]);
}
if (this.debugLevel>1) System.out.println("updateCameraParametersFromCalculated("+allImages+") for series="+numSeries);
// Next line is not needed anymore (will harm as will set orientationEstimated for all unselected sets)
......
......@@ -483,12 +483,19 @@ import ij.io.Opener;
index++;
}
for (int n=0;n<getNumGeometricChannels();n++) titles[n]=geometricTitles[n];
for (int numStation=0;numStation<this.numStations;numStation++) {
for (int numStation = 0; numStation < this.numStations; numStation++) {
int numStationSrc = numStation;
if (numStationSrc >= this.photometricByView.length) {
System.out.println("Station"+numStationSrc+" >= this.photometricByView.length, saving from the last known station");
numStationSrc = this.photometricByView.length-1;
}
for (int nView=0;nView<getNumViews();nView++) {
for (int chn=0;chn<getNumPhotometricChannels();chn++){
// int pixIndex=getNumGeometricChannels()+chn*this.getNumPhotometricChannels()();
int pixIndex=getNumGeometricChannels()+numZCorr+(nView + numStation*getNumViews()) *getNumPhotometricChannels()+chn;
for (int i=0;i<length;i++) pixels[pixIndex][i]= (float) this.photometricByView[numStation][nView][chn][i]; //OOB 8 //oob 12
for (int i=0;i<length;i++) {
pixels[pixIndex][i]= (float) this.photometricByView[numStationSrc][nView][chn][i]; //OOB 8 //oob 12
}
titles[pixIndex]=photometricTitles[chn]+nView;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment