Commit 6733a12d authored by Andrey Filippov's avatar Andrey Filippov

Implemented LWIR grids calculation

parent 41b1b50e
...@@ -1278,10 +1278,11 @@ public class EyesisAberrations { ...@@ -1278,10 +1278,11 @@ public class EyesisAberrations {
} }
int rslt=matchSimulatedPattern.calculateDistortions( int rslt=matchSimulatedPattern.calculateDistortions(
null, // LwirReaderParameters lwirReaderParameters, // null is OK
distortionParameters, // distortionParameters, //
patternDetectParameters, patternDetectParameters,
patternDetectParameters.minGridPeriod/2, // patternDetectParameters.minGridPeriod/2,
patternDetectParameters.maxGridPeriod/2, // patternDetectParameters.maxGridPeriod/2,
simulParameters, simulParameters,
colorComponents.equalizeGreens, colorComponents.equalizeGreens,
imp, imp,
...@@ -2709,7 +2710,8 @@ public class EyesisAberrations { ...@@ -2709,7 +2710,8 @@ public class EyesisAberrations {
distortedPattern[2], // distortedPattern[2], //
simulParameters.subdiv, simulParameters.subdiv,
fft_size, fft_size,
simulParameters.center_for_g2); simulParameters.center_for_g2,
false);//boolean mono
wVectors[0][0]=2.0*distortedPattern[0][0]/subpixel; wVectors[0][0]=2.0*distortedPattern[0][0]/subpixel;
wVectors[0][1]=2.0*distortedPattern[0][1]/subpixel; wVectors[0][1]=2.0*distortedPattern[0][1]/subpixel;
wVectors[1][0]=2.0*distortedPattern[1][0]/subpixel; wVectors[1][0]=2.0*distortedPattern[1][0]/subpixel;
...@@ -2752,7 +2754,8 @@ public class EyesisAberrations { ...@@ -2752,7 +2754,8 @@ public class EyesisAberrations {
simCorr, // simCorr, //
simulParameters.subdiv, simulParameters.subdiv,
fft_size, fft_size,
simulParameters.center_for_g2); simulParameters.center_for_g2,
false);//boolean mono
} }
// simul_pixels= simulationPattern.extractSimulPatterns ( // simul_pixels= simulationPattern.extractSimulPatterns (
simul_pixels= simulationPattern.extractSimulPatterns ( simul_pixels= simulationPattern.extractSimulPatterns (
......
...@@ -665,11 +665,12 @@ horizontal axis: ...@@ -665,11 +665,12 @@ horizontal axis:
boolean noMessageBoxes=true; boolean noMessageBoxes=true;
int numAbsolutePoints = matchSimulatedPattern.calculateDistortions( int numAbsolutePoints = matchSimulatedPattern.calculateDistortions(
null, // LwirReaderParameters lwirReaderParameters, // null is OK
// allow more of grid around pointers? // allow more of grid around pointers?
distortionParameters, // distortionParameters, //
this.patternDetectParameters, this.patternDetectParameters,
this.patternDetectParameters.minGridPeriod/2, // this.patternDetectParameters.minGridPeriod/2,
this.patternDetectParameters.maxGridPeriod/2, // this.patternDetectParameters.maxGridPeriod/2,
simulParameters, simulParameters,
equalizeGreens, imp_eq, equalizeGreens, imp_eq,
this.laserPointers, // null, //LASER_POINTERS, // this.laserPointers, // null, //LASER_POINTERS, //
...@@ -840,25 +841,26 @@ horizontal axis: ...@@ -840,25 +841,26 @@ horizontal axis:
// matchSimulatedPatterns[numSensor].getChannel(images[numSensor])+" "); // matchSimulatedPatterns[numSensor].getChannel(images[numSensor])+" ");
int numAbsolutePoints = this.matchSimulatedPatterns[numSensor].calculateDistortions( int numAbsolutePoints = this.matchSimulatedPatterns[numSensor].calculateDistortions(
// allow more of grid around pointers? null, // LwirReaderParameters lwirReaderParameters, // null is OK
distortionParameters, // // allow more of grid around pointers?
this.patternDetectParameters, distortionParameters, //
this.patternDetectParameters.minGridPeriod/2, this.patternDetectParameters,
this.patternDetectParameters.maxGridPeriod/2, // this.patternDetectParameters.minGridPeriod/2,
simulParameters, // this.patternDetectParameters.maxGridPeriod/2,
equalizeGreens, imp_eq, simulParameters,
this.laserPointers, // null, //LASER_POINTERS, // equalizeGreens, imp_eq,
// LaserPointer laserPointer, // this.laserPointers, // null, //LASER_POINTERS, //
// LaserPointer object or null // LaserPointer laserPointer, //
true, // don't care -removeOutOfGridPointers // LaserPointer object or null
null, // double [][][] hintGrid, // predicted grid array (or null) true, // don't care -removeOutOfGridPointers
0, // double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only null, // double [][][] hintGrid, // predicted grid array (or null)
0, // double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only
threadsMax,
updateStatus, threadsMax,
debug_level, updateStatus,
distortionParameters.loop_debug_level, // debug level debug_level,
noMessageBoxes); distortionParameters.loop_debug_level, // debug level
noMessageBoxes);
if (numAbsolutePoints <= 0) { // no pointers in this image if (numAbsolutePoints <= 0) { // no pointers in this image
String msg = "*** No laser pointers matched for " + images[numSensor].getTitle() + " - they are needed for absolute grid positioning"; String msg = "*** No laser pointers matched for " + images[numSensor].getTitle() + " - they are needed for absolute grid positioning";
if (debug_level > 0) System.out.println("Warning: " + msg); if (debug_level > 0) System.out.println("Warning: " + msg);
......
...@@ -99,6 +99,7 @@ public class LensAdjustment { ...@@ -99,6 +99,7 @@ public class LensAdjustment {
ImagePlus imp_eq=matchSimulatedPattern.applyFlatField (imp); // will throw if image size mismatch ImagePlus imp_eq=matchSimulatedPattern.applyFlatField (imp); // will throw if image size mismatch
if (updating) { if (updating) {
double maxActualCorr= matchSimulatedPattern.refineDistortionCorrelation ( double maxActualCorr= matchSimulatedPattern.refineDistortionCorrelation (
null, // LwirReaderParameters lwirReaderParameters, // null is OK
distortionParameters, // distortionParameters, //
patternDetectParameters, patternDetectParameters,
simulParameters, simulParameters,
...@@ -132,7 +133,8 @@ public class LensAdjustment { ...@@ -132,7 +133,8 @@ public class LensAdjustment {
System.out.println("updateFocusGrid(), number of already defined grid cells (before distortions()) = "+matchSimulatedPattern.numDefinedCells()); System.out.println("updateFocusGrid(), number of already defined grid cells (before distortions()) = "+matchSimulatedPattern.numDefinedCells());
} }
matchSimulatedPattern.distortions( matchSimulatedPattern.distortions(
null, // is not used in update mode null, //LwirReaderParameters lwirReaderParameters, // null is OK
null, // final boolean [] triedIndices, // is not used in update mode
distortionParameters, // distortionParameters, //
patternDetectParameters, patternDetectParameters,
patternDetectParameters.minGridPeriod/2, patternDetectParameters.minGridPeriod/2,
...@@ -157,10 +159,11 @@ public class LensAdjustment { ...@@ -157,10 +159,11 @@ public class LensAdjustment {
// matchSimulatedPattern.invalidateFlatFieldForGrid(); //Keep these! // matchSimulatedPattern.invalidateFlatFieldForGrid(); //Keep these!
// matchSimulatedPattern.invalidateFocusMask(); // matchSimulatedPattern.invalidateFocusMask();
numAbsolutePoints=matchSimulatedPattern.calculateDistortions( // allow more of grid around pointers? numAbsolutePoints=matchSimulatedPattern.calculateDistortions( // allow more of grid around pointers?
null, // LwirReaderParameters lwirReaderParameters, // null is OK
distortionParameters, // distortionParameters, //
patternDetectParameters, patternDetectParameters,
patternDetectParameters.minGridPeriod/2, // patternDetectParameters.minGridPeriod/2,
patternDetectParameters.maxGridPeriod/2, // patternDetectParameters.maxGridPeriod/2,
simulParameters, simulParameters,
equalizeGreens, equalizeGreens,
imp_eq, imp_eq,
......
...@@ -32,6 +32,7 @@ import java.util.Properties; ...@@ -32,6 +32,7 @@ import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog; import com.elphel.imagej.common.GenericJTabbedDialog;
import ij.ImagePlus;
import ij.Prefs; import ij.Prefs;
public class LwirReaderParameters { public class LwirReaderParameters {
...@@ -54,6 +55,7 @@ public class LwirReaderParameters { ...@@ -54,6 +55,7 @@ public class LwirReaderParameters {
protected double vnir_gain_rg = 0.7705; // 1.116; halogen/fluorescent protected double vnir_gain_rg = 0.7705; // 1.116; halogen/fluorescent
protected double vnir_gain_bg = 2.401; // 1.476; protected double vnir_gain_bg = 2.401; // 1.476;
protected boolean [] selected_channels = {true, true, true, true, true, true, true, true}; protected boolean [] selected_channels = {true, true, true, true, true, true, true, true};
protected int max_lwir_width = 1024; //
/* /*
protected double [] vnir_exp_corr = {1.0, 1.0, 1.0, 1.0}; protected double [] vnir_exp_corr = {1.0, 1.0, 1.0, 1.0};
...@@ -79,9 +81,18 @@ public class LwirReaderParameters { ...@@ -79,9 +81,18 @@ public class LwirReaderParameters {
protected boolean show_images = false; protected boolean show_images = false;
// --- interface methods // --- interface methods
public boolean is_LWIR(int width) {
return width <= max_lwir_width;
}
public boolean is_LWIR(ImagePlus imp){
return is_LWIR(imp.getWidth());
}
public int getDebugLevel() { public int getDebugLevel() {
return this.debug_level; return this.debug_level;
} }
public void setDebugLevel(int level) { public void setDebugLevel(int level) {
this.debug_level = level; this.debug_level = level;
} }
......
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