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) {
parFilter,
""); //String defaultPath
if ((pathname==null) || (pathname=="")) return;
System.out.println("*** Will not work with different size senspors !!!");
DISTORTION_CALIBRATION_DATA.setMaskFromImageStack(pathname);
if (LENS_DISTORTIONS!=null) LENS_DISTORTIONS.updateSensorMasks();
return;
......@@ -3642,8 +3643,8 @@ if (MORE_BUTTONS) {
double threadPitch=0.35; // M1.6
double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.sensorWidth/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX;
double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.sensorHeight/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY;
double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.getSensorWidth(0)/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX;
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
FOCUS_MEASUREMENT_PARAMETERS.result_PX0=camPars.eyesisSubCameras[stationNumber][0].px0;
......@@ -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+"]["+iLens+"].length="+sfeParameters[numSFE][iLens].length);
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][1]=EYESIS_CAMERA_PARAMETERS.sensorHeight;
sensorDimensions[numSFE][0]=EYESIS_CAMERA_PARAMETERS.getSensorWidth(numSFE); // should be the same for all lenses/states
sensorDimensions[numSFE][1]=EYESIS_CAMERA_PARAMETERS.getSensorHeight(numSFE);
iState++;
}
iLens++;
......@@ -5492,12 +5493,12 @@ if (MORE_BUTTONS) {
String path=dFile+Prefs.getFileSeparator()+lensPrefix+CAMERAS.getLastTimestampUnderscored()+
(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);
int sensorWidth=2992,sensorHeight=1936;
int sensorWidth=2592,sensorHeight=1936;
if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)&&
(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData!=null) &&
(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters!=null)){
sensorWidth=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.sensorWidth;
sensorHeight=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.sensorHeight;
sensorWidth=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(0);
sensorHeight=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(0);
}
if (FOCUSING_FIELD!=null){
sensorWidth=FOCUSING_FIELD.sensorWidth;
......@@ -5918,7 +5919,12 @@ if (MORE_BUTTONS) {
IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set");
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;
}
/* ======================================================================== */
......@@ -8986,12 +8992,20 @@ if (MORE_BUTTONS) {
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
masks,
LENS_DISTORTIONS.pixelCorrectionWidth/ LENS_DISTORTIONS.pixelCorrectionDecimation,
LENS_DISTORTIONS.pixelCorrectionHeight/LENS_DISTORTIONS.pixelCorrectionDecimation,
true,
"nonVinetting masks");
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,
LENS_DISTORTIONS.getSensorWidth(0)/ LENS_DISTORTIONS.getDecimateMasks(0),
LENS_DISTORTIONS.getSensorHeight(0)/LENS_DISTORTIONS.getDecimateMasks(0),
true,
"nonVinetting masks");
} else {
System.out.println("**** Can't show sesnor masks for different size sesnors as a stack! ");
}
}
double [][][][] sensorGrids=LENS_DISTORTIONS.calculateGridFlatField(
serNumber,
masks,
......@@ -9556,7 +9570,7 @@ if (MORE_BUTTONS) {
true, // boolean read_grids
MASTER_DEBUG_LEVEL);
if (MASTER_DEBUG_LEVEL <100) return true;
/// if (MASTER_DEBUG_LEVEL <100) return true;
// patterns are not yet read here!
/*
......@@ -9639,6 +9653,11 @@ if (MORE_BUTTONS) {
path,
PROCESS_PARAMETERS.useXML,
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(
properties,
prefix,
......@@ -25,6 +25,9 @@ package com.elphel.imagej.cameras;
import java.util.Properties;
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
public boolean cartesian = false; // cartesian coordinates mode (false - cylindrical)
public int lensDistortionModel=0;
......@@ -80,6 +83,9 @@ import java.util.Properties;
*/
public EyesisSubCameraParameters(
int sensorWidth,
int sensorHeight,
int decimateMasks,
boolean cartesian,
int lensDistortionModel,
boolean enableNoLaser,
......@@ -111,6 +117,9 @@ import java.util.Properties;
int sensor_port,
int subchannel
){
this.decimateMasks = decimateMasks;
this.sensorWidth= sensorWidth;
this.sensorHeight=sensorHeight;
this.cartesian = cartesian;
this.lensDistortionModel=lensDistortionModel;
this.enableNoLaser=enableNoLaser;
......@@ -156,6 +165,9 @@ import java.util.Properties;
@Override
public EyesisSubCameraParameters clone() {
return new EyesisSubCameraParameters(
this.sensorWidth,
this.sensorHeight,
this.decimateMasks,
this.cartesian,
this.lensDistortionModel,
this.enableNoLaser,
......@@ -196,6 +208,9 @@ import java.util.Properties;
}
// TODO: add/restore new 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+"lensDistortionModel", this.lensDistortionModel+"");
properties.setProperty(prefix+"enableNoLaser", this.enableNoLaser+"");
......@@ -239,6 +254,12 @@ import java.util.Properties;
getProperties(prefix,properties, -1);
}
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)
this.cartesian=Boolean.parseBoolean(properties.getProperty(prefix+"cartesian"));
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