Commit 96c4558f authored by Andrey Filippov's avatar Andrey Filippov

Debugging fitting strategies, initial image parameter setup

parent f1c19f00
...@@ -2634,6 +2634,7 @@ if (MORE_BUTTONS) { ...@@ -2634,6 +2634,7 @@ if (MORE_BUTTONS) {
parFilter, parFilter,
""); //String defaultPath ""); //String defaultPath
if ((pathname==null) || (pathname=="")) return; if ((pathname==null) || (pathname=="")) return;
System.out.println("*** Will not work with different size senspors !!!");
DISTORTION_CALIBRATION_DATA.setMaskFromImageStack(pathname); DISTORTION_CALIBRATION_DATA.setMaskFromImageStack(pathname);
if (LENS_DISTORTIONS!=null) LENS_DISTORTIONS.updateSensorMasks(); if (LENS_DISTORTIONS!=null) LENS_DISTORTIONS.updateSensorMasks();
return; return;
...@@ -3642,8 +3643,8 @@ if (MORE_BUTTONS) { ...@@ -3642,8 +3643,8 @@ if (MORE_BUTTONS) {
double threadPitch=0.35; // M1.6 double threadPitch=0.35; // M1.6
double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.sensorWidth/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX; double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.getSensorWidth(0)/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX;
double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.sensorHeight/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY; double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.getSensorHeight(0)/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY;
double psi=camPars.eyesisSubCameras[stationNumber][0].psi; // degrees, rotation (of the sensor) around the optical axis. Positive if camera is rotated clockwise looking to the target double psi=camPars.eyesisSubCameras[stationNumber][0].psi; // degrees, rotation (of the sensor) around the optical axis. Positive if camera is rotated clockwise looking to the target
FOCUS_MEASUREMENT_PARAMETERS.result_PX0=camPars.eyesisSubCameras[stationNumber][0].px0; FOCUS_MEASUREMENT_PARAMETERS.result_PX0=camPars.eyesisSubCameras[stationNumber][0].px0;
...@@ -5026,8 +5027,8 @@ if (MORE_BUTTONS) { ...@@ -5026,8 +5027,8 @@ if (MORE_BUTTONS) {
if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"].length="+sfeParameters[numSFE].length); if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"].length="+sfeParameters[numSFE].length);
if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"]["+iLens+"].length="+sfeParameters[numSFE][iLens].length); if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"]["+iLens+"].length="+sfeParameters[numSFE][iLens].length);
sfeParameters[numSFE][iLens][iState]=FOCUS_MEASUREMENT_PARAMETERS.clone(); sfeParameters[numSFE][iLens][iState]=FOCUS_MEASUREMENT_PARAMETERS.clone();
sensorDimensions[numSFE][0]=EYESIS_CAMERA_PARAMETERS.sensorWidth; // should be the same for all lenses/states sensorDimensions[numSFE][0]=EYESIS_CAMERA_PARAMETERS.getSensorWidth(numSFE); // should be the same for all lenses/states
sensorDimensions[numSFE][1]=EYESIS_CAMERA_PARAMETERS.sensorHeight; sensorDimensions[numSFE][1]=EYESIS_CAMERA_PARAMETERS.getSensorHeight(numSFE);
iState++; iState++;
} }
iLens++; iLens++;
...@@ -5492,12 +5493,12 @@ if (MORE_BUTTONS) { ...@@ -5492,12 +5493,12 @@ if (MORE_BUTTONS) {
String path=dFile+Prefs.getFileSeparator()+lensPrefix+CAMERAS.getLastTimestampUnderscored()+ String path=dFile+Prefs.getFileSeparator()+lensPrefix+CAMERAS.getLastTimestampUnderscored()+
(modeAverage?"-summary.csv":"-tempscan.csv"); (modeAverage?"-summary.csv":"-tempscan.csv");
if (MASTER_DEBUG_LEVEL>0) System.out.println ((modeAverage?"Saving averaged measurements to ":"Saving temperature measurement log data to ")+path); if (MASTER_DEBUG_LEVEL>0) System.out.println ((modeAverage?"Saving averaged measurements to ":"Saving temperature measurement log data to ")+path);
int sensorWidth=2992,sensorHeight=1936; int sensorWidth=2592,sensorHeight=1936;
if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)&& if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)&&
(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData!=null) && (LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData!=null) &&
(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters!=null)){ (LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters!=null)){
sensorWidth=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.sensorWidth; sensorWidth=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(0);
sensorHeight=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.sensorHeight; sensorHeight=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(0);
} }
if (FOCUSING_FIELD!=null){ if (FOCUSING_FIELD!=null){
sensorWidth=FOCUSING_FIELD.sensorWidth; sensorWidth=FOCUSING_FIELD.sensorWidth;
...@@ -5918,7 +5919,12 @@ if (MORE_BUTTONS) { ...@@ -5918,7 +5919,12 @@ if (MORE_BUTTONS) {
IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set"); IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set");
return; return;
} }
LENS_DISTORTIONS.listImageSets(); GenericDialog gd=new GenericDialog ("Select list mode");
gd.addNumericField("Mode 0 - old, 1 - shift/Rots", 0, 0);
gd.showDialog();
if (gd.wasCanceled()) return;
int listMode= (int) gd.getNextNumber();
LENS_DISTORTIONS.listImageSets(listMode);
return; return;
} }
/* ======================================================================== */ /* ======================================================================== */
...@@ -8986,12 +8992,20 @@ if (MORE_BUTTONS) { ...@@ -8986,12 +8992,20 @@ if (MORE_BUTTONS) {
for (int nChn=0;nChn<masks.length;nChn++) if ((nChn<selectedChannels.length)&&!selectedChannels[nChn]) masks[nChn]=null; for (int nChn=0;nChn<masks.length;nChn++) if ((nChn<selectedChannels.length)&&!selectedChannels[nChn]) masks[nChn]=null;
} }
if (showSensorMasks) this.SDFA_INSTANCE.showArrays( //java.lang.ArrayIndexOutOfBoundsException: 313632 if (showSensorMasks) {
boolean same_size = true;
for (int i = 1; i < masks.length; i++) same_size &= (masks[i].length == masks[0].length);
if (same_size) {
this.SDFA_INSTANCE.showArrays( //java.lang.ArrayIndexOutOfBoundsException: 313632
masks, masks,
LENS_DISTORTIONS.pixelCorrectionWidth/ LENS_DISTORTIONS.pixelCorrectionDecimation, LENS_DISTORTIONS.getSensorWidth(0)/ LENS_DISTORTIONS.getDecimateMasks(0),
LENS_DISTORTIONS.pixelCorrectionHeight/LENS_DISTORTIONS.pixelCorrectionDecimation, LENS_DISTORTIONS.getSensorHeight(0)/LENS_DISTORTIONS.getDecimateMasks(0),
true, true,
"nonVinetting masks"); "nonVinetting masks");
} else {
System.out.println("**** Can't show sesnor masks for different size sesnors as a stack! ");
}
}
double [][][][] sensorGrids=LENS_DISTORTIONS.calculateGridFlatField( double [][][][] sensorGrids=LENS_DISTORTIONS.calculateGridFlatField(
serNumber, serNumber,
masks, masks,
...@@ -9556,7 +9570,7 @@ if (MORE_BUTTONS) { ...@@ -9556,7 +9570,7 @@ if (MORE_BUTTONS) {
true, // boolean read_grids true, // boolean read_grids
MASTER_DEBUG_LEVEL); MASTER_DEBUG_LEVEL);
if (MASTER_DEBUG_LEVEL <100) return true; /// if (MASTER_DEBUG_LEVEL <100) return true;
// patterns are not yet read here! // patterns are not yet read here!
/* /*
...@@ -9639,6 +9653,11 @@ if (MORE_BUTTONS) { ...@@ -9639,6 +9653,11 @@ if (MORE_BUTTONS) {
path, path,
PROCESS_PARAMETERS.useXML, PROCESS_PARAMETERS.useXML,
null); // Properties properties null); // Properties properties
if (LENS_DISTORTIONS==null) {
System.out.println("Creating new LENS_DISTORTIONS");
LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested);
}
// ABERRATIONS_PARAMETERS.selectCalibrationDirectory(true, ABERRATIONS_PARAMETERS.calibrationDirectory, true);
return EYESIS_CAMERA_PARAMETERS.importSystem( return EYESIS_CAMERA_PARAMETERS.importSystem(
properties, properties,
prefix, prefix,
package com.elphel.imagej.calibration; package com.elphel.imagej.calibration;
import java.awt.Rectangle;
import java.util.Properties;
import com.elphel.imagej.jp4.JP46_Reader_camera;
/* /*
** **
** PatternParameters.java ** PatternParameters.java
...@@ -28,12 +33,6 @@ import ij.ImageStack; ...@@ -28,12 +33,6 @@ import ij.ImageStack;
import ij.gui.GenericDialog; import ij.gui.GenericDialog;
import ij.io.FileSaver; import ij.io.FileSaver;
import ij.io.Opener; import ij.io.Opener;
import java.awt.Rectangle;
import java.util.Properties;
import com.elphel.imagej.calibration.CalibrationFileManagement.MultipleExtensionsFileFilter;
import com.elphel.imagej.jp4.JP46_Reader_camera;
/* gridGeometry: /* gridGeometry:
* [v][u][0] - x(mm) of the node(u,v), right (looking to the wall) - positive * [v][u][0] - x(mm) of the node(u,v), right (looking to the wall) - positive
* [v][u][1] - y(mm) of the node(u,v), down - positive * [v][u][1] - y(mm) of the node(u,v), down - positive
...@@ -260,6 +259,7 @@ import com.elphel.imagej.jp4.JP46_Reader_camera; ...@@ -260,6 +259,7 @@ import com.elphel.imagej.jp4.JP46_Reader_camera;
setPhotometric(viewMap); setPhotometric(viewMap);
calculateGridGeometryAndPhotometric(true); calculateGridGeometryAndPhotometric(true);
} }
@Override
public PatternParameters clone() { public PatternParameters clone() {
PatternParameters patternParameters= new PatternParameters( PatternParameters patternParameters= new PatternParameters(
this.viewMap, this.viewMap,
...@@ -609,13 +609,15 @@ import com.elphel.imagej.jp4.JP46_Reader_camera; ...@@ -609,13 +609,15 @@ import com.elphel.imagej.jp4.JP46_Reader_camera;
GenericDialog gd = new GenericDialog("Initial Wall pattern parameters"); GenericDialog gd = new GenericDialog("Initial Wall pattern parameters");
gd.addNumericField("Pattern full width", this.patternWidth, 1,6,"mm"); // pattern full width in mm gd.addNumericField("Pattern full width", this.patternWidth, 1,6,"mm"); // pattern full width in mm
gd.addNumericField("Pattern full height", this.patternHeight, 1,6,"mm"); // pattern full width in mm gd.addNumericField("Pattern full height", this.patternHeight, 1,6,"mm"); // pattern full width in mm
gd.addNumericField("Distance between opposite sign nodes",this.patternHalfPeriod, 4,8,"mm"); // istance between opposite sign nodes in mm gd.addNumericField("Distance between opposite sign nodes",this.patternHalfPeriod, 4,8,"mm"); // distance between opposite sign nodes in mm
gd.addNumericField("Pattern tilt (clockwise)", this.patternTilt, 1,5,"degrees"); // pattern tilt (degrees) - U clockwise from X-right (V clockwise from Y-down) gd.addNumericField("Pattern tilt (clockwise)", this.patternTilt, 3,8,"degrees"); // pattern tilt (degrees) - U clockwise from X-right (V clockwise from Y-down)
gd.addNumericField("Average grid RED (1.0 for white)", this.averageRGB[0], 3,5,"x"); // gd.addNumericField("Average grid RED (1.0 for white)", this.averageRGB[0], 3,5,"x"); //
gd.addNumericField("Average grid GREEN (1.0 for white)", this.averageRGB[1], 3,5,"x"); // gd.addNumericField("Average grid GREEN (1.0 for white)", this.averageRGB[1], 3,5,"x"); //
gd.addNumericField("Average grid BLUE (1.0 for white)", this.averageRGB[2], 3,5,"x"); // gd.addNumericField("Average grid BLUE (1.0 for white)", this.averageRGB[2], 3,5,"x"); //
gd.addNumericField("Number of sensors (>24 - two groups, 0 - do not change)",this.defaultNumberOfChannels,0); // gd.addNumericField("Number of sensors (>24 - two groups, 0 - do not change)",this.defaultNumberOfChannels,0); //
gd.addCheckbox("Reset to standard fine pitch pattern" , false);
gd.addCheckbox("Reset to standard LWIR pattern" , false);
gd.addMessage("Pressing OK will recalculate grid and clear current grid calibration"); gd.addMessage("Pressing OK will recalculate grid and clear current grid calibration");
gd.showDialog(); gd.showDialog();
...@@ -628,6 +630,27 @@ import com.elphel.imagej.jp4.JP46_Reader_camera; ...@@ -628,6 +630,27 @@ import com.elphel.imagej.jp4.JP46_Reader_camera;
this.averageRGB[1]= gd.getNextNumber(); this.averageRGB[1]= gd.getNextNumber();
this.averageRGB[2]= gd.getNextNumber(); this.averageRGB[2]= gd.getNextNumber();
int numberOfChannels= (int)gd.getNextNumber(); int numberOfChannels= (int)gd.getNextNumber();
boolean use_fine_pattern = gd.getNextBoolean();
boolean use_lwir_pattern = gd.getNextBoolean();
if (use_fine_pattern) {
this.patternWidth= 7010.0;
this.patternHeight= 3073.0;
this.patternHalfPeriod= 41.57;
this.patternTilt= 5.0;
this.averageRGB[0]= 1.0;
this.averageRGB[1]= 1.0;
this.averageRGB[2]= 1.0;
} else if (use_lwir_pattern) {
this.patternWidth= 7010.0; // 7192.0
this.patternHeight= 2997.2;
this.patternHalfPeriod= 178.65;
this.patternTilt= 14.036;
this.averageRGB[0]= 1.0;
this.averageRGB[1]= 1.0;
this.averageRGB[2]= 1.0;
}
if (numberOfChannels>0){ if (numberOfChannels>0){
initDefaultChannels(numberOfChannels); initDefaultChannels(numberOfChannels);
......
...@@ -25,6 +25,9 @@ package com.elphel.imagej.cameras; ...@@ -25,6 +25,9 @@ package com.elphel.imagej.cameras;
import java.util.Properties; import java.util.Properties;
public class EyesisSubCameraParameters{ public class EyesisSubCameraParameters{
public int sensorWidth= 2592; // moving here from the camera as a whole
public int sensorHeight= 1936;
public int decimateMasks= 1;
// origin is on the rotation axis of the tube body closest to the goniometer horizontal axis // origin is on the rotation axis of the tube body closest to the goniometer horizontal axis
public boolean cartesian = false; // cartesian coordinates mode (false - cylindrical) public boolean cartesian = false; // cartesian coordinates mode (false - cylindrical)
public int lensDistortionModel=0; public int lensDistortionModel=0;
...@@ -80,6 +83,9 @@ import java.util.Properties; ...@@ -80,6 +83,9 @@ import java.util.Properties;
*/ */
public EyesisSubCameraParameters( public EyesisSubCameraParameters(
int sensorWidth,
int sensorHeight,
int decimateMasks,
boolean cartesian, boolean cartesian,
int lensDistortionModel, int lensDistortionModel,
boolean enableNoLaser, boolean enableNoLaser,
...@@ -111,6 +117,9 @@ import java.util.Properties; ...@@ -111,6 +117,9 @@ import java.util.Properties;
int sensor_port, int sensor_port,
int subchannel int subchannel
){ ){
this.decimateMasks = decimateMasks;
this.sensorWidth= sensorWidth;
this.sensorHeight=sensorHeight;
this.cartesian = cartesian; this.cartesian = cartesian;
this.lensDistortionModel=lensDistortionModel; this.lensDistortionModel=lensDistortionModel;
this.enableNoLaser=enableNoLaser; this.enableNoLaser=enableNoLaser;
...@@ -156,6 +165,9 @@ import java.util.Properties; ...@@ -156,6 +165,9 @@ import java.util.Properties;
@Override @Override
public EyesisSubCameraParameters clone() { public EyesisSubCameraParameters clone() {
return new EyesisSubCameraParameters( return new EyesisSubCameraParameters(
this.sensorWidth,
this.sensorHeight,
this.decimateMasks,
this.cartesian, this.cartesian,
this.lensDistortionModel, this.lensDistortionModel,
this.enableNoLaser, this.enableNoLaser,
...@@ -196,6 +208,9 @@ import java.util.Properties; ...@@ -196,6 +208,9 @@ import java.util.Properties;
} }
// TODO: add/restore new properties // TODO: add/restore new properties
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"sensorWidth", this.sensorWidth+"");
properties.setProperty(prefix+"sensorHeight", this.sensorHeight+"");
properties.setProperty(prefix+"decimateMasks", this.decimateMasks+"");
properties.setProperty(prefix+"cartesian", this.cartesian+""); properties.setProperty(prefix+"cartesian", this.cartesian+"");
properties.setProperty(prefix+"lensDistortionModel", this.lensDistortionModel+""); properties.setProperty(prefix+"lensDistortionModel", this.lensDistortionModel+"");
properties.setProperty(prefix+"enableNoLaser", this.enableNoLaser+""); properties.setProperty(prefix+"enableNoLaser", this.enableNoLaser+"");
...@@ -239,6 +254,12 @@ import java.util.Properties; ...@@ -239,6 +254,12 @@ import java.util.Properties;
getProperties(prefix,properties, -1); getProperties(prefix,properties, -1);
} }
public void getProperties(String prefix,Properties properties, int channel){ public void getProperties(String prefix,Properties properties, int channel){
if (properties.getProperty(prefix+"sensorWidth")!=null)
this.sensorWidth=Integer.parseInt(properties.getProperty(prefix+"sensorWidth"));
if (properties.getProperty(prefix+"sensorHeight")!=null)
this.sensorHeight=Integer.parseInt(properties.getProperty(prefix+"sensorHeight"));
if (properties.getProperty(prefix+"decimateMasks")!=null)
this.decimateMasks=Integer.parseInt(properties.getProperty(prefix+"decimateMasks"));
if (properties.getProperty(prefix+"cartesian")!=null) if (properties.getProperty(prefix+"cartesian")!=null)
this.cartesian=Boolean.parseBoolean(properties.getProperty(prefix+"cartesian")); this.cartesian=Boolean.parseBoolean(properties.getProperty(prefix+"cartesian"));
if (properties.getProperty(prefix+"lensDistortionModel")!=null) if (properties.getProperty(prefix+"lensDistortionModel")!=null)
......
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