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 ...@@ -109,7 +109,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
private Panel panelGoniometer; private Panel panelGoniometer;
private Panel panelPixelMapping, panelStereo,panelStereo1; private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelLWIR; private Panel panelLWIR;
private Panel panelLWIR16; // private Panel panelLWIR16;
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging? private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
JP46_Reader_camera JP4_INSTANCE; JP46_Reader_camera JP4_INSTANCE;
...@@ -508,6 +508,9 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi ...@@ -508,6 +508,9 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
0.0, 0.0,
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, 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; 2592, // int sensorWidth= 2592;
1936, //int sensorHeight= 1936; 1936, //int sensorHeight= 1936;
2, //int shrinkGridForMask=2; //shrink detected grids by one point for/vert this number of times before calculating masks 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 ...@@ -692,14 +695,15 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
panelRun = new Panel(); panelRun = new Panel();
panelRun.setLayout(new GridLayout(1, 0, 5, 5)); panelRun.setLayout(new GridLayout(1, 0, 5, 5));
addButton("Process Calibration Files",panelRun); addButton("Process Calibration Files",panelRun);
addButton("Save",panelRun); addButton("Save", panelRun);
addButton("Save Selected",panelRun); addButton("Save Selected", panelRun);
addButton("Restore",panelRun,color_restore); addButton("Restore", panelRun,color_restore);
addButton("Restore no autoload",panelRun); addButton("Restore no autoload",panelRun);
addButton("Restore SFE Latest",panelRun,color_restore); addButton("Properties clear", panelRun, color_stop);
addButton("List SFE",panelRun,color_report); addButton("Restore SFE Latest", panelRun, color_restore);
addButton("Stop",panelRun,color_stop); addButton("List SFE", panelRun,color_report);
addButton("Abort",panelRun,color_stop); addButton("Stop", panelRun,color_stop);
addButton("Abort", panelRun,color_stop);
add(panelRun); add(panelRun);
...@@ -1257,6 +1261,10 @@ if (MORE_BUTTONS) { ...@@ -1257,6 +1261,10 @@ if (MORE_BUTTONS) {
} else if (label.equals("Restore") || label.equals("Restore no autoload")) { } else if (label.equals("Restore") || label.equals("Restore no autoload")) {
restore(label.equals("Restore no autoload")); restore(label.equals("Restore no autoload"));
return; return;
/* ======================================================================== */
} else if (label.equals("Properties clear")) {
PROPERTIES=new Properties();
return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Process Calibration Files")) { } else if (label.equals("Process Calibration Files")) {
processCalibrationFiles(); processCalibrationFiles();
...@@ -5977,7 +5985,7 @@ if (MORE_BUTTONS) { ...@@ -5977,7 +5985,7 @@ if (MORE_BUTTONS) {
return; return;
} }
GenericDialog gd=new GenericDialog ("Select list mode"); 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(); gd.showDialog();
if (gd.wasCanceled()) return; if (gd.wasCanceled()) return;
int listMode= (int) gd.getNextNumber(); int listMode= (int) gd.getNextNumber();
...@@ -27,6 +27,7 @@ import java.awt.Point; ...@@ -27,6 +27,7 @@ import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
//import java.util.Arrays; //import java.util.Arrays;
//import java.io.StringWriter; //import java.io.StringWriter;
import java.util.List; import java.util.List;
...@@ -3321,10 +3322,12 @@ For each point in the image ...@@ -3321,10 +3322,12 @@ For each point in the image
int numSuccess=0; int numSuccess=0;
DistortionCalibrationData dcd=fittingStrategy.distortionCalibrationData; DistortionCalibrationData dcd=fittingStrategy.distortionCalibrationData;
for (int numGridImage=0;numGridImage<dcd.gIP.length;numGridImage++) { for (int numGridImage=0;numGridImage<dcd.gIP.length;numGridImage++) {
/*
if (numGridImage >= 1680) { if (numGridImage >= 1680) {
System.out.println("Processing debug image "+numGridImage); System.out.println("Processing debug image "+numGridImage);
System.out.println("Processing debug image "+numGridImage); System.out.println("Processing debug image "+numGridImage);
} }
*/
int set_number = dcd.gIP[numGridImage].getSetNumber(); int set_number = dcd.gIP[numGridImage].getSetNumber();
if ((set_number >= start_set) && if ((set_number >= start_set) &&
(set_number <= end_set) && (set_number <= end_set) &&
...@@ -10747,17 +10750,31 @@ M * V = B ...@@ -10747,17 +10750,31 @@ M * V = B
EyesisCameraParameters eyesisCameraParameters EyesisCameraParameters eyesisCameraParameters
){ ){
boolean resetParametersToZero=false; boolean resetParametersToZero=false;
boolean updateAllSubcameras = false;
boolean [] parameterMask= new boolean[distortionCalibrationData.getNumParameters()]; boolean [] parameterMask= new boolean[distortionCalibrationData.getNumParameters()];
boolean [] channelMask= new boolean[distortionCalibrationData.getNumSubCameras()]; boolean [] channelMask= new boolean[distortionCalibrationData.getNumSubCameras()];
boolean [] stationMask= new boolean[distortionCalibrationData.getNumStations()]; 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<parameterMask.length;i++) parameterMask[i]=false;
for (int i=0;i<channelMask.length;i++) channelMask[i]= true; for (int i=0;i<channelMask.length;i++) channelMask[i]= true;
for (int i=0;i<stationMask.length;i++) stationMask[i]= true; for (int i=0;i<stationMask.length;i++) stationMask[i]= true;
GenericDialog gd=new GenericDialog("Update (new) image settings from known data"); GenericDialog gd=new GenericDialog("Update (new) image settings from known data");
// //
gd.addCheckbox("Reset selected parameters to zero (false - update from camera parameters)", resetParametersToZero); 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)"); 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("----------");
gd.addMessage("Select which channels (sub-cameras) to update"); gd.addMessage("Select which channels (sub-cameras) to update");
for (int i=0;i<channelMask.length;i++) gd.addCheckbox("Subcamera "+i, channelMask[i]); for (int i=0;i<channelMask.length;i++) gd.addCheckbox("Subcamera "+i, channelMask[i]);
...@@ -10776,6 +10793,12 @@ M * V = B ...@@ -10776,6 +10793,12 @@ M * V = B
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return false; if (gd.wasCanceled()) return false;
resetParametersToZero=gd.getNextBoolean(); 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<parameterMask.length;i++) parameterMask[i]= gd.getNextBoolean();
for (int i=0;i<channelMask.length;i++) channelMask[i]= gd.getNextBoolean(); for (int i=0;i<channelMask.length;i++) channelMask[i]= gd.getNextBoolean();
if (stationMask.length>1) { if (stationMask.length>1) {
...@@ -10784,6 +10807,25 @@ M * V = B ...@@ -10784,6 +10807,25 @@ M * V = B
boolean updateFromTimestamps= gd.getNextBoolean(); boolean updateFromTimestamps= gd.getNextBoolean();
boolean allowClosest= gd.getNextBoolean(); boolean allowClosest= gd.getNextBoolean();
boolean reCenterVertically= 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){ if (reCenterVertically){
eyesisCameraParameters.recenterVertically(channelMask, stationMask); eyesisCameraParameters.recenterVertically(channelMask, stationMask);
for (int i=0;i<channelMask.length;i++) channelMask[i]= true; for (int i=0;i<channelMask.length;i++) channelMask[i]= true;
...@@ -10903,6 +10945,38 @@ M * V = B ...@@ -10903,6 +10945,38 @@ M * V = B
return true; 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) * 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 ...@@ -11078,6 +11152,10 @@ M * V = B
int numSeries=allImages?(-1):this.fittingStrategy.currentSeriesNumber; int numSeries=allImages?(-1):this.fittingStrategy.currentSeriesNumber;
boolean [] selectedImages=fittingStrategy.selectedImages(numSeries); // all enabled boolean [] selectedImages=fittingStrategy.selectedImages(numSeries); // all enabled
boolean [] selectedImagesDebug=null; boolean [] selectedImagesDebug=null;
boolean include_disabled = allImages;
if (include_disabled) {
Arrays.fill(selectedImages, true);
}
boolean debugThis=false; boolean debugThis=false;
int maxDebugImages=10; int maxDebugImages=10;
if (this.debugLevel>0) System.out.println("updateCameraParametersFromCalculated("+allImages+")"); if (this.debugLevel>0) System.out.println("updateCameraParametersFromCalculated("+allImages+")");
...@@ -11108,6 +11186,7 @@ M * V = B ...@@ -11108,6 +11186,7 @@ M * V = B
System.out.println(i+": "+fittingStrategy.distortionCalibrationData.getParameterName(i)+" = "+par[i]); 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); 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) // Next line is not needed anymore (will harm as will set orientationEstimated for all unselected sets)
......
...@@ -483,12 +483,19 @@ import ij.io.Opener; ...@@ -483,12 +483,19 @@ import ij.io.Opener;
index++; index++;
} }
for (int n=0;n<getNumGeometricChannels();n++) titles[n]=geometricTitles[n]; 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 nView=0;nView<getNumViews();nView++) {
for (int chn=0;chn<getNumPhotometricChannels();chn++){ for (int chn=0;chn<getNumPhotometricChannels();chn++){
// int pixIndex=getNumGeometricChannels()+chn*this.getNumPhotometricChannels()(); // int pixIndex=getNumGeometricChannels()+chn*this.getNumPhotometricChannels()();
int pixIndex=getNumGeometricChannels()+numZCorr+(nView + numStation*getNumViews()) *getNumPhotometricChannels()+chn; 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; 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