Commit 05f8b7db authored by Andrey Filippov's avatar Andrey Filippov

updating correction

parent f580e71e
......@@ -2081,7 +2081,7 @@ if (MORE_BUTTONS) {
if (label.equals("List Eyesis4pi") || label.equals("List X-cam")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
DistortionCalibrationData dcd=(DISTORTION_CALIBRATION_DATA!=null)?DISTORTION_CALIBRATION_DATA:
new DistortionCalibrationData(EYESIS_CAMERA_PARAMETERS);
new DistortionCalibrationData(EYESIS_CAMERA_PARAMETERS,GONIOMETER_PARAMETERS);
dcd.listCameraParameters(label.equals("List X-cam"));
return;
}
......@@ -2137,11 +2137,27 @@ if (MORE_BUTTONS) {
PATTERN_PARAMETERS.debugLevel=MASTER_DEBUG_LEVEL;
EYESIS_CAMERA_PARAMETERS.updateNumstations (numStations);
//if (MASTER_DEBUG_LEVEL==0) return; //TODO: Remove - just debugging
if (GONIOMETER==null) {
GONIOMETER= new Goniometer(
CAMERAS, // CalibrationHardwareInterface.CamerasInterface cameras,
DISTORTION, //MatchSimulatedPattern.DistortionParameters distortion,
PATTERN_DETECT, //MatchSimulatedPattern.PatternDetectParameters patternDetectParameters,
EYESIS_CAMERA_PARAMETERS, //EyesisCameraParameters eyesisCameraParameters,
LASER_POINTERS, // MatchSimulatedPattern.LaserPointer laserPointers
SIMUL, //SimulationPattern.SimulParameters simulParametersDefault,
GONIOMETER_PARAMETERS, //LensAdjustment.FocusMeasurementParameters focusMeasurementParameters,
DISTORTION_PROCESS_CONFIGURATION
);
}
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData(
gridFiles,
PATTERN_PARAMETERS,
EYESIS_CAMERA_PARAMETERS,
LASER_POINTERS,
GONIOMETER_PARAMETERS,
MASTER_DEBUG_LEVEL);
LENS_DISTORTIONS.initImageSet(
DISTORTION_CALIBRATION_DATA,
......@@ -2178,7 +2194,6 @@ if (MORE_BUTTONS) {
if (label.equals("Restore Calibration")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
String defaultPath= (DISTORTION_CALIBRATION_DATA!=null)?DISTORTION_CALIBRATION_DATA.pathName:"";
// public static DistortionCalibrationData DISTORTION_CALIBRATION_DATA=null;
DistortionCalibrationData oldDISTORTION_CALIBRATION_DATA=DISTORTION_CALIBRATION_DATA;
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData(
false,
......@@ -2187,6 +2202,7 @@ if (MORE_BUTTONS) {
EYESIS_CAMERA_PARAMETERS,
ABERRATIONS_PARAMETERS,
LASER_POINTERS,
GONIOMETER_PARAMETERS,
null); // gridImages null - use specified files
if (DISTORTION_CALIBRATION_DATA.pathName== null){ // failed to select/open the file
DISTORTION_CALIBRATION_DATA=oldDISTORTION_CALIBRATION_DATA;
......@@ -3563,6 +3579,7 @@ if (MORE_BUTTONS) {
EYESIS_CAMERA_PARAMETERS, // is it null or 1?
ABERRATIONS_PARAMETERS,
LASER_POINTERS,
GONIOMETER_PARAMETERS,
imp_calibrated); // gridImages null - use specified files - single image
if (DISTORTION_CALIBRATION_DATA.pathName== null){ // failed to select/open the file
DISTORTION_CALIBRATION_DATA=null;
......@@ -6262,7 +6279,8 @@ if (MORE_BUTTONS) {
}
// initialize needed classes
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData( // images are not setup yet
EYESIS_CAMERA_PARAMETERS); //EyesisCameraParameters eyesisCameraParameters
EYESIS_CAMERA_PARAMETERS, //EyesisCameraParameters eyesisCameraParameters
GONIOMETER_PARAMETERS);
if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)) {
LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData=DISTORTION_CALIBRATION_DATA;
}
......@@ -9860,7 +9878,8 @@ if (MORE_BUTTONS) {
sourceFilter,
PATTERN_PARAMETERS,
EYESIS_CAMERA_PARAMETERS,
LASER_POINTERS, //LaserPointer laserPointers
LASER_POINTERS, //LaserPointer laserPointers
GONIOMETER_PARAMETERS, //
true, // boolean read_grids
MASTER_DEBUG_LEVEL);
......@@ -9868,7 +9887,7 @@ if (MORE_BUTTONS) {
DISTORTION_CALIBRATION_DATA,
EYESIS_CAMERA_PARAMETERS
);
// set initial orientation of the cameras from the sensors that see mpst of the matching pointers
// set initial orientation of the cameras from the sensors that see most of the matching pointers
// just for the LMA to start
DISTORTION_CALIBRATION_DATA.setInitialOrientation(true);
return true;
......@@ -9899,6 +9918,7 @@ if (MORE_BUTTONS) {
null,
LENS_DISTORTIONS,
DISTORTION_CALIBRATION_DATA, // may be null, then it will not be updated, obviously (sensor masks)
GONIOMETER_PARAMETERS, // for motor sensitivity
ABERRATIONS_PARAMETERS.calibrationDirectory);//String calibration_directory
//getProperties(String prefix,Properties properties)
//EyesisCameraParameters
......@@ -9951,6 +9971,7 @@ if (MORE_BUTTONS) {
" (of "+ sourceFilesList[nset].length+"), file "+in_file+" (of "+ numFiles+ ") success in "+saved_file+" - "+sourceFilesList[nset][nfile]);
}
String grid_path = null;
/*
if (saveGrids && !overwriteGrids){ // check if result already exists
i = sourceFilesList[nset][nfile].lastIndexOf('/');
if (i>0){
......@@ -9961,6 +9982,19 @@ if (MORE_BUTTONS) {
continue;
}
}
}
*/
if (saveGrids){ // check if result already exists
i = sourceFilesList[nset][nfile].lastIndexOf('/');
if (i>0){
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
grid_path = gridSetPath + Prefs.getFileSeparator() + grid_name;
if (!overwriteGrids && ((new File(grid_path)).exists())){ // check if result already exists
if (DEBUG_LEVEL>0) System.out.println("-->>> Skipping existing "+grid_path+" (as requested in \"Configure Process Distortions\")");
continue;
}
}
}
imp_sel=new ImagePlus(sourceFilesList[nset][nfile]); // read source file
EyesisTiff.decodeProperiesFromInfo(imp_sel);
......@@ -11260,6 +11294,7 @@ if (MORE_BUTTONS) {
eyesisCameraParameters,
aberrationParameters,
laserPointers,
GONIOMETER_PARAMETERS,
null); // gridImages null - use specified files
if (distortions.fittingStrategy!=null) {
distortions.fittingStrategy.distortionCalibrationData=dcd;
......@@ -11291,7 +11326,7 @@ if (MORE_BUTTONS) {
if (configPaths[2] !=null){ // load grid file
patternParameters.debugLevel=debugLevel;
patternParameters.updateStatus=updateStstus;
if (DEBUG_LEVEL>0) System.out.println("Autolading grid file "+configPaths[2]);
if (DEBUG_LEVEL>0) System.out.println("Autoloading grid file "+configPaths[2]);
patternParameters.selectAndRestore(true,configPaths[2],dcd.eyesisCameraParameters.numStations); // returns path or null on failure
} else {
System.out.println("No pattern grid file (ground gtruth) is provided");
......@@ -70,6 +70,7 @@ import ij.text.TextWindow;
public static final int INDEX_B = 7;
public static final double SMALL_FRACTION = 0.8; // consider sensor to be a "small" if average grid period < this fraction of the large
Goniometer.GoniometerParameters goniometerParameters = null;
public String pathName=null;
public EyesisCameraParameters eyesisCameraParameters; // has "cartesian"
public int numSubCameras=1;
......@@ -631,14 +632,16 @@ import ij.text.TextWindow;
String [] filenames,
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers
LaserPointer laserPointers,
Goniometer.GoniometerParameters goniometerParameters
) {
String [][] stationFilenames={filenames};
setupDistortionCalibrationData(
stationFilenames,
patternParameters,
eyesisCameraParameters, // debugLevel
laserPointers
laserPointers,
goniometerParameters
);
}
public DistortionCalibrationData (
......@@ -646,6 +649,7 @@ import ij.text.TextWindow;
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers,
Goniometer.GoniometerParameters goniometerParameters,
int debugLevel
) {
this.debugLevel=debugLevel;
......@@ -654,7 +658,8 @@ import ij.text.TextWindow;
stationFilenames,
patternParameters,
eyesisCameraParameters, // debugLevel
laserPointers
laserPointers,
goniometerParameters
);
}
......@@ -663,6 +668,7 @@ import ij.text.TextWindow;
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers,
Goniometer.GoniometerParameters goniometerParameters,
int debugLevel
) {
this.debugLevel=debugLevel;
......@@ -670,7 +676,8 @@ import ij.text.TextWindow;
stationFilenames,
patternParameters,
eyesisCameraParameters, // debugLevel
laserPointers
laserPointers,
goniometerParameters
);
}
......@@ -682,6 +689,7 @@ import ij.text.TextWindow;
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers, // as a backup if data is not available in the file
Goniometer.GoniometerParameters goniometerParameters,
boolean read_grids,
int debugLevel
) {
......@@ -694,6 +702,7 @@ import ij.text.TextWindow;
patternParameters,
eyesisCameraParameters, // debugLevel
laserPointers, // as a backup if data is not available in the file
goniometerParameters,
read_grids
);
}
......@@ -703,8 +712,10 @@ import ij.text.TextWindow;
String [][] stationFilenames,
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers // as a backup if data is not available in the file
LaserPointer laserPointers, // as a backup if data is not available in the file
Goniometer.GoniometerParameters goniometerParameters
) {
this.goniometerParameters = goniometerParameters;
setupIndices();
this.eyesisCameraParameters=eyesisCameraParameters;
int numSubCameras=(eyesisCameraParameters==null)?1:eyesisCameraParameters.eyesisSubCameras[0].length;
......@@ -772,6 +783,7 @@ import ij.text.TextWindow;
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers, // as a backup if data is not available in the file
Goniometer.GoniometerParameters goniometerParameters,
boolean read_grids
) {
class DirTs{
......@@ -836,6 +848,7 @@ import ij.text.TextWindow;
}
}
}
this.goniometerParameters = goniometerParameters;
boolean ignore_LWIR_pointers = true; // skip LWIR absolute marks, use them later
int max_lwir_width = 1023; // use LWIR class
setupIndices();
......@@ -1548,9 +1561,11 @@ import ij.text.TextWindow;
public DistortionCalibrationData (
EyesisCameraParameters eyesisCameraParameters
EyesisCameraParameters eyesisCameraParameters,
Goniometer.GoniometerParameters goniometerParameters
) {
setupIndices();
this.goniometerParameters = goniometerParameters;
int numSubCameras=(eyesisCameraParameters==null)?1:eyesisCameraParameters.eyesisSubCameras[0].length;
this.numSubCameras=numSubCameras;
......@@ -1562,9 +1577,11 @@ import ij.text.TextWindow;
ImagePlus [] images, // images in the memory
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers
LaserPointer laserPointers,
Goniometer.GoniometerParameters goniometerParameters
) {
setupIndices();
this.goniometerParameters = goniometerParameters;
int numSubCameras=(eyesisCameraParameters==null)?1:eyesisCameraParameters.eyesisSubCameras[0].length;
this.numSubCameras=numSubCameras;
this.eyesisCameraParameters=eyesisCameraParameters;
......@@ -2690,9 +2707,11 @@ import ij.text.TextWindow;
if (this.debugLevel>0) System.out.println("Failed to find any known orientation");
return null;
}
if (late_set <0) iBest= early_set;
else if (early_set <0) iBest= late_set;
else {
if (late_set <0) {
iBest= early_set;
} else if (early_set <0) {
iBest= late_set;
} else {
// interpolate
double axialEarly=this.gIS[early_set].goniometerAxial;
double axialLate= this.gIS[late_set].goniometerAxial;
......@@ -2745,9 +2764,12 @@ import ij.text.TextWindow;
}
this.gIS[i].orientationEstimated=true;
double [] result = {
this.gIS[iBest].goniometerTilt,
this.gIS[iBest].goniometerAxial,
this.gIS[iBest].interAxisAngle
// this.gIS[iBest].goniometerTilt,
// this.gIS[iBest].goniometerAxial,
/// this.gIS[iBest].interAxisAngle
this.gIS[i].goniometerTilt,
this.gIS[i].goniometerAxial,
this.gIS[i].interAxisAngle
};
return result;
}
......@@ -2768,14 +2790,17 @@ import ij.text.TextWindow;
if ( // (j!=i) && // not needed - this set does not have orientation
(this.gIS[j].getStationNumber()==stationNumber) &&
(this.gIS[j].motors[mHorizontal]==thisMotorHorizontal) &&
!this.gIS[j].orientationEstimated && // new
!Double.isNaN(this.gIS[j].goniometerTilt) &&
!Double.isNaN(this.gIS[j].goniometerAxial) &&
!Double.isNaN(this.gIS[j].interAxisAngle)){
System.out.println("Found image set "+j+" with timestamp "+ timeStamp + " with known attitude to estimate this attitude");
setList.add(new Integer(j));
}
}
if (setList.size()>=2){
if (this.debugLevel>2) System.out.println("getImagesetTiltAxial("+timeStamp+"): estimating orientation for set # "+i+": this.debugLevel="+this.debugLevel);
// if (this.debugLevel>2) System.out.println("getImagesetTiltAxial("+timeStamp+"): estimating orientation for set # "+i+": this.debugLevel="+this.debugLevel);
if (this.debugLevel > -1) System.out.println("getImagesetTiltAxial("+timeStamp+"): estimating orientation for set # "+i+": this.debugLevel="+this.debugLevel);
// find the closest one
int indexClosest=setList.get(0);
double dClosest=Math.abs(this.gIS[indexClosest].motors[mAxial]-thisMotorAxial);
......@@ -2849,10 +2874,22 @@ import ij.text.TextWindow;
") is not defined, using interpolated between sets # "+indexClosest+" (timestamp "+IJ.d2s(this.gIS[indexClosest].timeStamp,6)+") "+
"and # "+indexSecond+" (timestamp "+IJ.d2s(this.gIS[indexSecond].timeStamp,6)+")");
}
// } else if (setList.size() >= 1){
// if (this.debugLevel > -1) System.out.println("getImagesetTiltAxial("+timeStamp+
// "): estimating orientation for set # "+i+" from a single set "+setList.get(0)+": this.debugLevel="+this.debugLevel);
} else { // old way
// first try for the same station number only:
iBest = -1;
double d2Min=-1;
for (int j=0;j<this.gIS.length;j++) if ((j!=i) && (this.gIS[j].motors!=null) &&
!Double.isNaN(this.gIS[j].goniometerTilt) && !Double.isNaN(this.gIS[j].goniometerAxial ) && !Double.isNaN(this.gIS[j].interAxisAngle)) {
int station_number = this.gIS[i].getStationNumber();
for (int j=0;j<this.gIS.length;j++) if ((j!=i) &&
(this.gIS[j].getStationNumber() == station_number) &&
!this.gIS[j].orientationEstimated &&
(this.gIS[j].motors!=null) &&
!Double.isNaN(this.gIS[j].goniometerTilt) &&
!Double.isNaN(this.gIS[j].goniometerAxial ) &&
!Double.isNaN(this.gIS[j].interAxisAngle)) {
double d2=0;
for (int k=0;k<this.gIS[j].motors.length;k++){
d2+=1.0*(this.gIS[j].motors[k]-this.gIS[i].motors[k])*
......@@ -2863,21 +2900,84 @@ import ij.text.TextWindow;
iBest=j;
}
}
if (iBest < 0) {
d2Min=-1;
for (int j=0;j<this.gIS.length;j++) if ((j!=i) &&
(this.gIS[j].motors!=null) &&
!this.gIS[j].orientationEstimated &&
!Double.isNaN(this.gIS[j].goniometerTilt) &&
!Double.isNaN(this.gIS[j].goniometerAxial ) &&
!Double.isNaN(this.gIS[j].interAxisAngle)) {
double d2=0;
for (int k=0;k<this.gIS[j].motors.length;k++){
d2+=1.0*(this.gIS[j].motors[k]-this.gIS[i].motors[k])*
(this.gIS[j].motors[k]-this.gIS[i].motors[k]);
}
if ((d2Min<0) || (d2Min>d2)) {
d2Min=d2;
iBest=j;
}
}
if (iBest < 0) {
d2Min=-1;
for (int j=0;j<this.gIS.length;j++) if ((j!=i) &&
(this.gIS[j].motors!=null) &&
!Double.isNaN(this.gIS[j].goniometerTilt) &&
!Double.isNaN(this.gIS[j].goniometerAxial ) &&
!Double.isNaN(this.gIS[j].interAxisAngle)) {
double d2=0;
for (int k=0;k<this.gIS[j].motors.length;k++){
d2+=1.0*(this.gIS[j].motors[k]-this.gIS[i].motors[k])*
(this.gIS[j].motors[k]-this.gIS[i].motors[k]);
}
if ((d2Min<0) || (d2Min>d2)) {
d2Min=d2;
iBest=j;
}
}
System.out.println("Used any station numer with even estimated orientation, iBest = "+iBest);
} else {
System.out.println("Used different station numer, iBest = "+iBest);
}
} else {
System.out.println("Used the same station number, iBest = "+iBest);
}
}
}
double [] result = {
this.gIS[iBest].goniometerTilt,
this.gIS[iBest].goniometerAxial,
this.gIS[iBest].interAxisAngle
};
// double [] result = {
// this.gIS[iBest].goniometerTilt,
// this.gIS[iBest].goniometerAxial,
// this.gIS[iBest].interAxisAngle
// };
if (iBest!=i){
boolean usable_tilt = (this.gIS[i].motors != null);
boolean usable_axial = usable_tilt && (this.gIS[i].getStationNumber() == this.gIS[iBest].getStationNumber());
double diff_axial = usable_axial? (this.gIS[i].motors[mAxial]-this.gIS[iBest].motors[mAxial])/
goniometerParameters.goniometerMotors.stepsPerDegreeAxial : 0.0;
double diff_horizontal = usable_tilt? (this.gIS[i].motors[mHorizontal]-this.gIS[iBest].motors[mHorizontal])/
goniometerParameters.goniometerMotors.stepsPerDegreeTilt: 0.0;
this.gIS[i].goniometerTilt = this.gIS[iBest].goniometerTilt + diff_horizontal;
this.gIS[i].goniometerAxial = this.gIS[iBest].goniometerAxial + diff_axial;
this.gIS[i].goniometerTilt-=360.0*Math.floor((this.gIS[i].goniometerTilt+180.0)/360.0);
this.gIS[i].goniometerAxial-=360.0*Math.floor((this.gIS[i].goniometerAxial+180.0)/360.0);
if (this.debugLevel>0) System.out.println("Orientation for set # "+i+" timestamp "+IJ.d2s(this.gIS[i].timeStamp,6)+
") is not defined, using # "+iBest+" (timestamp "+IJ.d2s(this.gIS[iBest].timeStamp,6)+")" );
") is not defined, estimating from # "+iBest+" (timestamp "+IJ.d2s(this.gIS[iBest].timeStamp,6)+")" );
this.gIS[i].orientationEstimated=true;
this.gIS[i].goniometerTilt= this.gIS[iBest].goniometerTilt;
this.gIS[i].goniometerAxial=this.gIS[iBest].goniometerAxial;
// this.gIS[i].goniometerTilt= this.gIS[iBest].goniometerTilt;
// this.gIS[i].goniometerAxial=this.gIS[iBest].goniometerAxial;
this.gIS[i].interAxisAngle=this.gIS[iBest].interAxisAngle;
}
double [] result = {
this.gIS[i].goniometerTilt,
this.gIS[i].goniometerAxial,
this.gIS[i].interAxisAngle
};
return result; // may have Double.NaN
}
return null;
......@@ -2942,7 +3042,9 @@ import ij.text.TextWindow;
EyesisCameraParameters eyesisCameraParameters,
EyesisAberrations.AberrationParameters aberrationParameters,
LaserPointer laserPointers,
Goniometer.GoniometerParameters goniometerParameters,
ImagePlus[] gridImages ){ // null - use specified files
this.goniometerParameters = goniometerParameters;
setupIndices();
String [] extensions={".dcal-xml","-distcal.xml"};
MultipleExtensionsFileFilter parFilter = new MultipleExtensionsFileFilter("",extensions,"Distortion calibration *.dcal-xml files");
......
......@@ -3026,6 +3026,7 @@ For each point in the image
if (imp.getRoi() instanceof PointRoi) {
pointRoi = (PointRoi) imp.getRoi();
} else {
System.out.println("This image does not have point marks - please mark it in "+source_path);
IJ.showMessage("This image does not have point marks - please mark it in "+source_path);
return null;
}
......@@ -3123,7 +3124,7 @@ For each point in the image
xyuv[i][3]=0.5;
}
GenericDialog gd=new GenericDialog("Specify U,V coordinates of the marker(s)");
gd.addMessage("Center white cell U=0.5, V=0.5");
gd.addMessage("Center white (LWIR black) cell U=0.5, V=0.5");
for (int n = 0; n < markers.length; n++) {
String label = "Marker "+(n+1)+" (x="+markers[n][0]+", y="+markers[n][1];
gd.addNumericField(label+" U", xyuv[n][2], 1, 5, "");
......
......@@ -24,6 +24,7 @@ package com.elphel.imagej.calibration;
**
*/
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -49,6 +50,7 @@ import Jama.Matrix; // Download here: http://math.nist.gov/javanumerics/jama/
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.gui.PointRoi;
import ij.gui.Roi;
import ij.process.FHT; // get rid, change to double
import ij.process.FloatProcessor;
......@@ -3133,7 +3135,7 @@ public class MatchSimulatedPattern {
if (roi==null){
selection=new Rectangle(0, 0, imp.getWidth(), imp.getHeight());
} else {
selection=roi.getBounds();
selection= (roi instanceof PointRoi) ? (new Rectangle(0, 0, imp.getWidth(), imp.getHeight())) : roi.getBounds();
}
MatchSimulatedPattern matchSimulatedPattern=new MatchSimulatedPattern(distortionParameters.FFTSize);
matchSimulatedPattern.debugLevel=debugLevel;
......@@ -3299,7 +3301,7 @@ public class MatchSimulatedPattern {
if (roi==null){
selection=new Rectangle(0, 0, imp.getWidth(), imp.getHeight());
} else {
selection=roi.getBounds();
selection= (roi instanceof PointRoi) ? (new Rectangle(0, 0, imp.getWidth(), imp.getHeight())) : roi.getBounds();
}
Rectangle initialPatternCell=new Rectangle(xc-fft_size,
yc-fft_size,
......@@ -3626,7 +3628,7 @@ public class MatchSimulatedPattern {
if (roi==null){
selection=new Rectangle(0, 0, imp.getWidth(), imp.getHeight());
} else {
selection=roi.getBounds();
selection= (roi instanceof PointRoi) ? (new Rectangle(0, 0, imp.getWidth(), imp.getHeight())) : roi.getBounds();
}
} else {
if ((getImageHeight()!=imp.getHeight()) || (getImageWidth()!=imp.getWidth())){
......@@ -6193,8 +6195,32 @@ public class MatchSimulatedPattern {
setWOI(0, 0, imp.getWidth(), imp.getHeight());
selection=new Rectangle(0, 0, imp.getWidth(), imp.getHeight());
} else {
setWOI(roi.getBounds());
selection=roi.getBounds();
if (roi instanceof PointRoi) {
PointRoi pointRoi = (PointRoi) roi;
Point [] points = pointRoi.getContainedPoints();
int [][] ipoints = new int [points.length][2];
for (int n = 0; n < ipoints.length; n++) {
ipoints[n][0] = points[n].x;
ipoints[n][1] = points[n].y;
}
// as if they a laser pointers
double [][] xyuv = new double [points.length][4];
for (int i =0; i < ipoints.length; i++) {
xyuv[i][0]=ipoints[i][0];
xyuv[i][1]=ipoints[i][1];
xyuv[i][2]=0.5;
xyuv[i][3]=0.5;
}
System.out.println("Setting first marker (of "+ipoints.length+") as pointer 0.5/0.5 - use use multiple?");
System.out.println("**** Not yet implemented, use 'Manual hint' command for each of the annotated files ****");
// setPointersXYUV(imp, xyuv);
setWOI(0, 0, imp.getWidth(), imp.getHeight());
selection=new Rectangle(0, 0, imp.getWidth(), imp.getHeight());
} else {
setWOI(roi.getBounds());
selection=roi.getBounds();
}
}
this.debugLevel=global_debug_level;
int patternCells=0;
......@@ -6377,6 +6403,8 @@ public class MatchSimulatedPattern {
int numPointers=(laserPointer!=null)?laserPointer.laserUVMap.length:0;
double [][] pointersXY=(numPointers>0)?getPointersXYUV(imp, laserPointer):null;
if (global_debug_level > (debugThreshold+1)){
if (pointersXY!=null){
System.out.println("calculateDistortions() numPointers="+numPointers+" pointersXY.length="+pointersXY.length);
......
......@@ -7,6 +7,7 @@ import com.elphel.imagej.calibration.CalibrationFileManagement;
import com.elphel.imagej.calibration.DistortionCalibrationData;
import com.elphel.imagej.calibration.Distortions;
import com.elphel.imagej.calibration.EyesisAberrations;
import com.elphel.imagej.calibration.Goniometer;
import com.elphel.imagej.calibration.LensDistortionParameters;
import com.elphel.imagej.calibration.MultipleExtensionsFileFilter;
import com.elphel.imagej.common.GenericJTabbedDialog;
......@@ -2705,6 +2706,7 @@ import ij.gui.GenericDialog;
SubsystemOffsets subsystemOffsets,
Distortions systemDistortions,
DistortionCalibrationData system_distortionCalibrationData,
Goniometer.GoniometerParameters goniometerParameters,
String calibration_directory) {
EyesisCameraParameters sub_system = new EyesisCameraParameters();
sub_system.getProperties(prefix, properties);
......@@ -2745,7 +2747,8 @@ import ij.gui.GenericDialog;
System.out.println("sensors_path = "+sensors_path);
/// String [][] stationFilenames = new String[sub_system.numStations][0];
sub_distortionCalibrationData = new DistortionCalibrationData(
sub_system // EyesisCameraParameters eyesisCameraParameters
sub_system, // EyesisCameraParameters eyesisCameraParameters
goniometerParameters
);
// now read all sensor files
if ((sensors_path !=null) && (sensors_path != "")){ // load sensor
......@@ -2827,7 +2830,7 @@ import ij.gui.GenericDialog;
for (int i = 0; i < tmpPixelCorrection.length; i++ ) systemDistortions.pixelCorrection[i] = tmpPixelCorrection[i];
}
if (system_distortionCalibrationData == null) {
system_distortionCalibrationData = new DistortionCalibrationData (this);
system_distortionCalibrationData = new DistortionCalibrationData (this, goniometerParameters);
}
if (system_distortionCalibrationData.sensorMasks == null) {
system_distortionCalibrationData.sensorMasks = new double [new_channels][];
......
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