Commit f35dc2de authored by Andrey Filippov's avatar Andrey Filippov

removing blanks in the LWIR kernel corners

parent 8f20656c
...@@ -65,7 +65,8 @@ import ij.text.TextWindow; ...@@ -65,7 +65,8 @@ import ij.text.TextWindow;
// 1 - put commons-configuration-1.7.jar under ImageJ plugins directory (I used ImageJ-Elphel) // 1 - put commons-configuration-1.7.jar under ImageJ plugins directory (I used ImageJ-Elphel)
// 2 - in Eclipse project properties -> Build Path -> Libraries -> Add External jar // 2 - in Eclipse project properties -> Build Path -> Libraries -> Add External jar
public class Distortions { public class Distortions {
final public double hintedMaxRelativeRadius=1.2; // make adjustable? // final public double hintedMaxRelativeRadius=1.2; // make adjustable?
final public double hintedMaxRelativeRadiusToDiagonal= 1.1; // 0.96; // make adjustable?
private ShowDoubleFloatArrays SDFA_INSTANCE=new ShowDoubleFloatArrays(); // just for debugging? private ShowDoubleFloatArrays SDFA_INSTANCE=new ShowDoubleFloatArrays(); // just for debugging?
// int numInputs=27; // with A8...// 24; // parameters in subcamera+... // int numInputs=27; // with A8...// 24; // parameters in subcamera+...
// int numOutputs=16; // with A8...//13; // parameters in a single camera // int numOutputs=16; // with A8...//13; // parameters in a single camera
...@@ -3331,7 +3332,7 @@ For each point in the image ...@@ -3331,7 +3332,7 @@ For each point in the image
int global_debug_level, // DEBUG_LEVEL int global_debug_level, // DEBUG_LEVEL
int debug_level // debug level used inside loops int debug_level // debug level used inside loops
){ ){
boolean invert = false;
int debugThreshold0=0; int debugThreshold0=0;
int debugThreshold=2; int debugThreshold=2;
MatchSimulatedPattern matchSimulatedPattern = new MatchSimulatedPattern(64); // new instance, all reset, FFTSize=64 will not be used MatchSimulatedPattern matchSimulatedPattern = new MatchSimulatedPattern(64); // new instance, all reset, FFTSize=64 will not be used
...@@ -3481,11 +3482,12 @@ For each point in the image ...@@ -3481,11 +3482,12 @@ For each point in the image
int rslt= matchSimulatedPattern.combineGridCalibration( int rslt= matchSimulatedPattern.combineGridCalibration(
laserPointer, // LaserPointer object or null laserPointer, // LaserPointer object or null
ignoreLaserPointers?null:dcd.gIP[numGridImage].laserPixelCoordinates, //pointersXY, ignoreLaserPointers?null:dcd.gIP[numGridImage].laserPixelCoordinates, //pointersXY,
removeOutOfGridPointers, // removeOutOfGridPointers, //
hintGrid, // predicted grid array (or null) hintGrid, // predicted grid array (or null)
hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only
global_debug_level, // DEBUG_LEVEL invert,
noMessageBoxes ); global_debug_level, // DEBUG_LEVEL
noMessageBoxes );
if (global_debug_level>0){ if (global_debug_level>0){
System.out.println("applyHintedGrids(): rslt="+rslt); System.out.println("applyHintedGrids(): rslt="+rslt);
} }
...@@ -4040,7 +4042,14 @@ For each point in the image ...@@ -4040,7 +4042,14 @@ For each point in the image
int numImg, int numImg,
int u, // grid signed u,v int u, // grid signed u,v
int v){ int v){
double maxRelativeRadius=this.hintedMaxRelativeRadius; // make adjustable
int subCamera= this.fittingStrategy.distortionCalibrationData.gIP[numImg].channel;
int sensorWidth=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(subCamera);
int sensorHeight=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(subCamera);
// double maxRelativeRadius=this.hintedMaxRelativeRadius; // make adjustable
double maxRelativeRadius=hintedMaxRelativeRadiusToDiagonal * Math.sqrt(sensorWidth * sensorWidth + sensorHeight*sensorHeight)/ sensorWidth;
return reprojectGridNode( return reprojectGridNode(
lensDistortionParameters, lensDistortionParameters,
numImg, numImg,
...@@ -4134,7 +4143,12 @@ For each point in the image ...@@ -4134,7 +4143,12 @@ For each point in the image
double goniometerInterAxis, // interAxisAngle double goniometerInterAxis, // interAxisAngle
int imageSet, int imageSet,
boolean filterBorder){ boolean filterBorder){
double maxRelativeRadius=this.hintedMaxRelativeRadius; // make adjustable int sensorWidth=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(subCamera);
int sensorHeight=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(subCamera);
// double maxRelativeRadius=this.hintedMaxRelativeRadius; // make adjustable
double maxRelativeRadius=hintedMaxRelativeRadiusToDiagonal * Math.sqrt(sensorWidth * sensorWidth + sensorHeight*sensorHeight)/ sensorWidth;
// 1.1 is sufficient
// double maxRelativeRadius= 2.0*Math.sqrt(sensorWidth * sensorWidth + sensorHeight*sensorHeight)/ sensorWidth;
int debugThreshold=2; int debugThreshold=2;
// Get parameter vector (22) for the selected sensor, current Eyesisparameters and specified orientation angles // Get parameter vector (22) for the selected sensor, current Eyesisparameters and specified orientation angles
double [] parVector=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getParametersVector(stationNumber,subCamera); double [] parVector=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getParametersVector(stationNumber,subCamera);
...@@ -4156,8 +4170,6 @@ For each point in the image ...@@ -4156,8 +4170,6 @@ For each point in the image
parVector[goniometerInterAxisAngleIndex]= goniometerInterAxis; parVector[goniometerInterAxisAngleIndex]= goniometerInterAxis;
} }
// /interAxis // /interAxis
int sensorWidth=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(subCamera);
int sensorHeight=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(subCamera);
System.out.println("estimateGridOnSensor(): subCamera="+subCamera+", goniometerHorizontal="+goniometerHorizontal+", goniometerAxial="+goniometerAxial); System.out.println("estimateGridOnSensor(): subCamera="+subCamera+", goniometerHorizontal="+goniometerHorizontal+", goniometerAxial="+goniometerAxial);
this.lensDistortionParameters.lensCalcInterParamers( this.lensDistortionParameters.lensCalcInterParamers(
this.lensDistortionParameters, // 22-long parameter vector for the image this.lensDistortionParameters, // 22-long parameter vector for the image
...@@ -4187,43 +4199,45 @@ For each point in the image ...@@ -4187,43 +4199,45 @@ For each point in the image
// simple fix - remove pixels with too few neighbors (maybe just all border pixels? // simple fix - remove pixels with too few neighbors (maybe just all border pixels?
for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ for (int v=0;v<result.length;v++) {
int [] iUV=this.patternParameters.uvIndicesToUV (u, v); for (int u=0;u<result[v].length;u++){
if (iUV==null) { int [] iUV=this.patternParameters.uvIndicesToUV (u, v);
result[v][u]=null; if (iUV==null) {
} else {
double [] XYZM=this.patternParameters.getXYZM(iUV[0],iUV[1],stationNumber);
// project the target point to this sensor
double [][]pXY= this.lensDistortionParameters.calcPartialDerivatives(
XYZM[0], // target point horizontal, positive - right, mm
XYZM[1], // target point vertical, positive - down, mm
XYZM[2], // target point horizontal, positive - away from camera, mm
maxRelativeRadius,
false); // calculate derivatives, false - values only (NaN for behind points - only when false here)
// verify the grid is inside the sensor area (may use sensor mask later too? probably not needed)
// Now NaN if point is behind the sensor
if (Double.isNaN(pXY[0][0]) || (pXY[0][0]<0) || (pXY[0][0]>=sensorWidth) || (pXY[0][1]<0) || (pXY[0][1]>=sensorHeight)){
if (this.debugLevel>debugThreshold){
System.out.println("--- estimateGridOnSensor():v="+v+" u="+u+" X="+XYZM[0]+" Y="+XYZM[1]+" Z="+XYZM[2]+" M="+XYZM[3]+
" pXY[0][0]="+pXY[0][0]+", pXY[0][1]="+pXY[0][1]+", iUV[0]="+iUV[0]+", iUV[1]="+iUV[1]);
}
result[v][u]=null; result[v][u]=null;
} else { } else {
double [] resultCell={pXY[0][0],pXY[0][1],iUV[0],iUV[1]}; double [] XYZM=this.patternParameters.getXYZM(iUV[0],iUV[1],stationNumber);
result[v][u]=resultCell; // project the target point to this sensor
double [][]pXY= this.lensDistortionParameters.calcPartialDerivatives(
XYZM[0], // target point horizontal, positive - right, mm
XYZM[1], // target point vertical, positive - down, mm
XYZM[2], // target point horizontal, positive - away from camera, mm
maxRelativeRadius,
false); // calculate derivatives, false - values only (NaN for behind points - only when false here)
// verify the grid is inside the sensor area (may use sensor mask later too? probably not needed)
// Now NaN if point is behind the sensor
if (Double.isNaN(pXY[0][0]) || (pXY[0][0]<0) || (pXY[0][0]>=sensorWidth) || (pXY[0][1]<0) || (pXY[0][1]>=sensorHeight)){
if (this.debugLevel>debugThreshold){
System.out.println("--- estimateGridOnSensor():v="+v+" u="+u+" X="+XYZM[0]+" Y="+XYZM[1]+" Z="+XYZM[2]+" M="+XYZM[3]+
" pXY[0][0]="+pXY[0][0]+", pXY[0][1]="+pXY[0][1]+", iUV[0]="+iUV[0]+", iUV[1]="+iUV[1]);
}
result[v][u]=null;
} else {
double [] resultCell={pXY[0][0],pXY[0][1],iUV[0],iUV[1]};
result[v][u]=resultCell;
if (this.debugLevel>debugThreshold){
System.out.println("+++ estimateGridOnSensor():v="+v+" u="+u+" X="+XYZM[0]+" Y="+XYZM[1]+" Z="+XYZM[2]+" M="+XYZM[3]+
" pXY[0][0]="+pXY[0][0]+", pXY[0][1]="+pXY[0][1]+", iUV[0]="+iUV[0]+", iUV[1]="+iUV[1]);
}
visibleCells++;
}
if (this.debugLevel>debugThreshold){ if (this.debugLevel>debugThreshold){
System.out.println("+++ estimateGridOnSensor():v="+v+" u="+u+" X="+XYZM[0]+" Y="+XYZM[1]+" Z="+XYZM[2]+" M="+XYZM[3]+ int uv=u+v*result[v].length;
" pXY[0][0]="+pXY[0][0]+", pXY[0][1]="+pXY[0][1]+", iUV[0]="+iUV[0]+", iUV[1]="+iUV[1]); debugPixels[0][uv]=pXY[0][0];
debugPixels[1][uv]=pXY[0][1];
debugPixels[2][uv]=XYZM[0];
debugPixels[3][uv]=XYZM[1];
debugPixels[4][uv]=XYZM[2];
} }
visibleCells++;
}
if (this.debugLevel>debugThreshold){
int uv=u+v*result[v].length;
debugPixels[0][uv]=pXY[0][0];
debugPixels[1][uv]=pXY[0][1];
debugPixels[2][uv]=XYZM[0];
debugPixels[3][uv]=XYZM[1];
debugPixels[4][uv]=XYZM[2];
} }
} }
} }
......
...@@ -1455,6 +1455,7 @@ public class EyesisAberrations { ...@@ -1455,6 +1455,7 @@ public class EyesisAberrations {
multiFilePSF , // MULTIFILE_PSF = new EyesisAberrations.MultiFilePSF( multiFilePSF , // MULTIFILE_PSF = new EyesisAberrations.MultiFilePSF(
fileList[nChn], fileList[nChn],
resultPaths[nChn], resultPaths[nChn],
nChn, // int sensor_channel, // just for debugging
sdfa_instance, // SDFA_INSTANCE sdfa_instance, // SDFA_INSTANCE
impShow, // just to show in the same window? impShow, // just to show in the same window?
saveResult, saveResult,
...@@ -1478,6 +1479,7 @@ public class EyesisAberrations { ...@@ -1478,6 +1479,7 @@ public class EyesisAberrations {
EyesisAberrations.MultiFilePSF multiFilePSF , // MULTIFILE_PSF = new EyesisAberrations.MultiFilePSF( EyesisAberrations.MultiFilePSF multiFilePSF , // MULTIFILE_PSF = new EyesisAberrations.MultiFilePSF(
String [] filenames, String [] filenames,
String resultPath, String resultPath,
int sensor_channel, // just for debugging
ShowDoubleFloatArrays sdfa_instance, // SDFA_INSTANCE ShowDoubleFloatArrays sdfa_instance, // SDFA_INSTANCE
ImagePlus imp_sel, // just to show in the same window? ImagePlus imp_sel, // just to show in the same window?
boolean saveResult, boolean saveResult,
...@@ -1819,7 +1821,7 @@ public class EyesisAberrations { ...@@ -1819,7 +1821,7 @@ public class EyesisAberrations {
} }
} }
if (multiFilePSF.showWeights) sdfa_instance.showArrays(weights, kWidth, kHeight, true, "weights"); if (multiFilePSF.showWeights) sdfa_instance.showArrays(weights, kWidth, kHeight, true, "weights-"+sensor_channel);
// double [][] weights=new double[nFiles+1][kLength]; // double [][] weights=new double[nFiles+1][kLength];
for (int i=0;i<kLength;i++) weights[0][i]=0.0; for (int i=0;i<kLength;i++) weights[0][i]=0.0;
psfKernelMap=new double [kHeight][kWidth][nChn][]; psfKernelMap=new double [kHeight][kWidth][nChn][];
...@@ -2299,6 +2301,15 @@ public class EyesisAberrations { ...@@ -2299,6 +2301,15 @@ public class EyesisAberrations {
final int full_fft_size = fft_size * PSF_subpixel / (is_mono? 2: 1); // for LWIR - 64, 5MPix: 1024. fft_size = 32/256 final int full_fft_size = fft_size * PSF_subpixel / (is_mono? 2: 1); // for LWIR - 64, 5MPix: 1024. fft_size = 32/256
if (debug_level>3) {
double [] dbg_index = new double [commonMatchSimulatedPattern.UV_INDEX.length];
for (int i = 0; i < dbg_index.length; i++) {
dbg_index[i] = commonMatchSimulatedPattern.UV_INDEX[i];
}
SDFA_INSTANCE.showArrays(dbg_index, imp_sel.getWidth(), dbg_index.length/imp_sel.getWidth(), "UV_INDEX");
}
final boolean debugLateralShifts=(globalDebugLevel>1); final boolean debugLateralShifts=(globalDebugLevel>1);
System.out.println("createPSFMap(): masterDebugLevel="+masterDebugLevel+" globalDebugLevel="+globalDebugLevel+" debug_level="+debug_level); // 2 2 0 System.out.println("createPSFMap(): masterDebugLevel="+masterDebugLevel+" globalDebugLevel="+globalDebugLevel+" debug_level="+debug_level); // 2 2 0
final long startTime = System.nanoTime(); final long startTime = System.nanoTime();
......
...@@ -960,6 +960,7 @@ dPXmmc/dphi= ...@@ -960,6 +960,7 @@ dPXmmc/dphi=
double zp, // target point horizontal, positive - away from camera, mm double zp, // target point horizontal, positive - away from camera, mm
double maxRelativeRadius, // make configurable? double maxRelativeRadius, // make configurable?
boolean calculateAll){ // calculate derivatives, false - values only boolean calculateAll){ // calculate derivatives, false - values only
// maxRelativeRadius *= 1.3; // REMOVE me!
switch (this.lensDistortionModelType){ switch (this.lensDistortionModelType){
case 0: case 0:
case 1: case 1:
......
...@@ -6720,6 +6720,7 @@ public class MatchSimulatedPattern { ...@@ -6720,6 +6720,7 @@ public class MatchSimulatedPattern {
int threadsMax, boolean updateStatus, int global_debug_level, // DEBUG_LEVEL int threadsMax, boolean updateStatus, int global_debug_level, // DEBUG_LEVEL
int debug_level, // debug level used inside loops int debug_level, // debug level used inside loops
boolean noMessageBoxes) { boolean noMessageBoxes) {
if (imp == null) { if (imp == null) {
IJ.showMessage("Error", "There are no images open\nProcess canceled"); IJ.showMessage("Error", "There are no images open\nProcess canceled");
return 0; return 0;
...@@ -6733,6 +6734,8 @@ public class MatchSimulatedPattern { ...@@ -6733,6 +6734,8 @@ public class MatchSimulatedPattern {
int minimal_pattern_cluster = is_lwir ? distortionParameters.minimalPatternClusterLwir int minimal_pattern_cluster = is_lwir ? distortionParameters.minimalPatternClusterLwir
: distortionParameters.minimalPatternCluster; : distortionParameters.minimalPatternCluster;
boolean invert = false; // is_lwir;
int fft_size = is_lwir ? distortionParameters.FFTSize_lwir : distortionParameters.FFTSize; int fft_size = is_lwir ? distortionParameters.FFTSize_lwir : distortionParameters.FFTSize;
long startTime = System.nanoTime(); long startTime = System.nanoTime();
...@@ -6991,6 +6994,7 @@ public class MatchSimulatedPattern { ...@@ -6991,6 +6994,7 @@ public class MatchSimulatedPattern {
pointersXY, removeOutOfGridPointers, // pointersXY, removeOutOfGridPointers, //
hintGrid, // predicted grid array (or null) hintGrid, // predicted grid array (or null)
hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only
invert, // b/w
global_debug_level, // DEBUG_LEVEL global_debug_level, // DEBUG_LEVEL
noMessageBoxes); noMessageBoxes);
} }
...@@ -7738,7 +7742,7 @@ public class MatchSimulatedPattern { ...@@ -7738,7 +7742,7 @@ public class MatchSimulatedPattern {
return flipsToRot(flips[0], flips[1], flips[2]); return flipsToRot(flips[0], flips[1], flips[2]);
} }
public int[][] gridMatrixApproximate(double[][] coeff) { public int[][] gridMatrixApproximate(double[][] coeff, boolean invert) {
int rot = matrixToRot(coeff); int rot = matrixToRot(coeff);
boolean[] flips = rotToFlips(rot); boolean[] flips = rotToFlips(rot);
double[][] aI = { { 1, 0 }, { 0, 1 } }; double[][] aI = { { 1, 0 }, { 0, 1 } };
...@@ -7755,7 +7759,8 @@ public class MatchSimulatedPattern { ...@@ -7755,7 +7759,8 @@ public class MatchSimulatedPattern {
// now M reconstructs coeff // now M reconstructs coeff
double[][] aM = M.getArray(); double[][] aM = M.getArray();
// Black/white cells have to be flipped if flipU XOR flipW, regardless of swapUV // Black/white cells have to be flipped if flipU XOR flipW, regardless of swapUV
int flipForWhite = (flips[1] ^ flips[2]) ? 1 : 0;
int flipForWhite = (invert ^ flips[1] ^ flips[2]) ? 1 : 0;
int[][] shifts = { int[][] shifts = {
{ 2 * ((int) Math.round(0.5 * (coeff[0][2] + 0))), { 2 * ((int) Math.round(0.5 * (coeff[0][2] + 0))),
2 * ((int) Math.round(0.5 * (coeff[1][2] + flipForWhite))) - flipForWhite }, 2 * ((int) Math.round(0.5 * (coeff[1][2] + flipForWhite))) - flipForWhite },
...@@ -7774,10 +7779,6 @@ public class MatchSimulatedPattern { ...@@ -7774,10 +7779,6 @@ public class MatchSimulatedPattern {
+ " d1=" + d1 + " d2=" + d2); + " d1=" + d1 + " d2=" + d2);
} }
int[][] iCoeff = { int[][] iCoeff = {
// {(int) Math.round(aM[0][0]), (int) Math.round(aM[0][1]),(int)
// Math.round(coeff[0][2])},
// {(int) Math.round(aM[1][0]), (int) Math.round(aM[1][1]),(int)
// Math.round(coeff[1][2])}};
{ (int) Math.round(aM[0][0]), (int) Math.round(aM[0][1]), shifts[shiftSelect][0] }, { (int) Math.round(aM[0][0]), (int) Math.round(aM[0][1]), shifts[shiftSelect][0] },
{ (int) Math.round(aM[1][0]), (int) Math.round(aM[1][1]), shifts[shiftSelect][1] } }; { (int) Math.round(aM[1][0]), (int) Math.round(aM[1][1]), shifts[shiftSelect][1] } };
return iCoeff; return iCoeff;
...@@ -7805,8 +7806,17 @@ public class MatchSimulatedPattern { ...@@ -7805,8 +7806,17 @@ public class MatchSimulatedPattern {
return iCoeff; return iCoeff;
} }
public double worstGridMatchRotSkew(double[][] coeff) { public double worstGridMatchRotSkew(
int[][] iCoeff = gridMatrixApproximate(coeff); double[][] coeff) {
return worstGridMatchRotSkew(coeff, false);
}
public double worstGridMatchRotSkew(
double[][] coeff,
boolean invert
) {
int[][] iCoeff = gridMatrixApproximate(coeff, invert);
double worst = 0; double worst = 0;
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
...@@ -7817,8 +7827,15 @@ public class MatchSimulatedPattern { ...@@ -7817,8 +7827,15 @@ public class MatchSimulatedPattern {
return worst; return worst;
} }
public double worstGridMatchTranslate(double[][] coeff) { // in grids half-periods, not pixels! public double worstGridMatchTranslate(
int[][] iCoeff = gridMatrixApproximate(coeff); double[][] coeff) { // in grids half-periods, not pixels!
return worstGridMatchTranslate(coeff, false);
}
public double worstGridMatchTranslate(
double[][] coeff,
boolean invert) { // in grids half-periods, not pixels!
int[][] iCoeff = gridMatrixApproximate(coeff, invert);
double worst = 0; double worst = 0;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
double d = Math.abs(coeff[i][2] - iCoeff[i][2]); double d = Math.abs(coeff[i][2] - iCoeff[i][2]);
...@@ -8246,7 +8263,7 @@ public class MatchSimulatedPattern { ...@@ -8246,7 +8263,7 @@ public class MatchSimulatedPattern {
if (gridMatchCoeff != null) { if (gridMatchCoeff != null) {
gridRotation = matrixToRot(gridMatchCoeff); gridRotation = matrixToRot(gridMatchCoeff);
this.debugLevel = global_debug_level; this.debugLevel = global_debug_level;
int[][] iGridMatchCoeff = gridMatrixApproximate(gridMatchCoeff); int[][] iGridMatchCoeff = gridMatrixApproximate(gridMatchCoeff, false);
if (global_debug_level > 1) { if (global_debug_level > 1) {
System.out.println("gridMatchCoeff[0]={" + IJ.d2s(gridMatchCoeff[0][0], 5) + ", " System.out.println("gridMatchCoeff[0]={" + IJ.d2s(gridMatchCoeff[0][0], 5) + ", "
+ IJ.d2s(gridMatchCoeff[0][1], 5) + ", " + IJ.d2s(gridMatchCoeff[0][2], 5) + "}"); + IJ.d2s(gridMatchCoeff[0][1], 5) + ", " + IJ.d2s(gridMatchCoeff[0][2], 5) + "}");
...@@ -8317,9 +8334,10 @@ public class MatchSimulatedPattern { ...@@ -8317,9 +8334,10 @@ public class MatchSimulatedPattern {
// Modified 06/19 to move laser pointers to files // Modified 06/19 to move laser pointers to files
public int combineGridCalibration(LaserPointer lp, // Only for possible hint on rotations/ flips.LaserPointer object public int combineGridCalibration(LaserPointer lp, // Only for possible hint on rotations/ flips.LaserPointer object
// or null // or null
double[][] pointersXYUV, boolean removeOutOfGridPointers, // double[][] pointersXYUV, boolean removeOutOfGridPointers, //
double[][][] hintGrid, // predicted grid array (or null) double[][][] hintGrid, // predicted grid array (or null)
double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only
boolean invert, // for lwir
int global_debug_level, // DEBUG_LEVEL int global_debug_level, // DEBUG_LEVEL
boolean noMessageBoxes) { boolean noMessageBoxes) {
boolean has_lasers = false; boolean has_lasers = false;
...@@ -8342,7 +8360,7 @@ public class MatchSimulatedPattern { ...@@ -8342,7 +8360,7 @@ public class MatchSimulatedPattern {
if (gridMatchCoeff != null) { if (gridMatchCoeff != null) {
gridRotation = matrixToRot(gridMatchCoeff); gridRotation = matrixToRot(gridMatchCoeff);
this.debugLevel = global_debug_level; this.debugLevel = global_debug_level;
int[][] iGridMatchCoeff = gridMatrixApproximate(gridMatchCoeff); int[][] iGridMatchCoeff = gridMatrixApproximate(gridMatchCoeff, invert);
if (global_debug_level > 0) { if (global_debug_level > 0) {
System.out.println("gridMatchCoeff[0]={" + IJ.d2s(gridMatchCoeff[0][0], 5) + ", " System.out.println("gridMatchCoeff[0]={" + IJ.d2s(gridMatchCoeff[0][0], 5) + ", "
+ IJ.d2s(gridMatchCoeff[0][1], 5) + ", " + IJ.d2s(gridMatchCoeff[0][2], 5) + "}"); + IJ.d2s(gridMatchCoeff[0][1], 5) + ", " + IJ.d2s(gridMatchCoeff[0][2], 5) + "}");
...@@ -8353,9 +8371,8 @@ public class MatchSimulatedPattern { ...@@ -8353,9 +8371,8 @@ public class MatchSimulatedPattern {
+ ", " + iGridMatchCoeff[0][2] + "}"); + ", " + iGridMatchCoeff[0][2] + "}");
System.out.println("iGridMatchCoeff[1]={" + iGridMatchCoeff[1][0] + ", " + iGridMatchCoeff[1][1] System.out.println("iGridMatchCoeff[1]={" + iGridMatchCoeff[1][0] + ", " + iGridMatchCoeff[1][1]
+ ", " + iGridMatchCoeff[1][2] + "}"); + ", " + iGridMatchCoeff[1][2] + "}");
System.out.println("worstGridMatchRotSkew()=" + IJ.d2s(worstGridMatchRotSkew(gridMatchCoeff), 5)); System.out.println("worstGridMatchRotSkew()=" + IJ.d2s(worstGridMatchRotSkew(gridMatchCoeff, invert), 5));
System.out System.out.println("worstGridMatchTranslate()=" + IJ.d2s(worstGridMatchTranslate(gridMatchCoeff, invert), 5));
.println("worstGridMatchTranslate()=" + IJ.d2s(worstGridMatchTranslate(gridMatchCoeff), 5));
} }
// hintGridTolerance==0 - do not try to determine shift from the hint (not // hintGridTolerance==0 - do not try to determine shift from the hint (not
// reliable yet) // reliable yet)
......
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