Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
65338490
Commit
65338490
authored
Jun 18, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lwir-distort' of git.elphel.com:Elphel/imagej-elphel into lwir-distort
parents
3fd21c81
0c001dd2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
16 deletions
+48
-16
Aberration_Calibration.java
...com/elphel/imagej/calibration/Aberration_Calibration.java
+30
-7
MatchSimulatedPattern.java
.../com/elphel/imagej/calibration/MatchSimulatedPattern.java
+18
-9
No files found.
src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java
View file @
65338490
...
@@ -10465,6 +10465,7 @@ if (MORE_BUTTONS) {
...
@@ -10465,6 +10465,7 @@ if (MORE_BUTTONS) {
String [][] sourceFilesList=LWIR_PARAMETERS.getSourceFiles(sourceSetList, sel_chn);
String [][] sourceFilesList=LWIR_PARAMETERS.getSourceFiles(sourceSetList, sel_chn);
boolean saveGrids=DISTORTION_PROCESS_CONFIGURATION.saveGridImages;
boolean saveGrids=DISTORTION_PROCESS_CONFIGURATION.saveGridImages;
boolean overwriteGrids=DISTORTION_PROCESS_CONFIGURATION.overwriteResultFiles;
boolean overwriteGrids=DISTORTION_PROCESS_CONFIGURATION.overwriteResultFiles;
int minGridFileSize = PATTERN_DETECT.minGridFileSize;
if (sourceSetList==null) return;
if (sourceSetList==null) return;
showPatternMinMaxPeriodDialog(PATTERN_DETECT, true);
showPatternMinMaxPeriodDialog(PATTERN_DETECT, true);
int saved_file = 0;
int saved_file = 0;
...
@@ -10487,6 +10488,7 @@ if (MORE_BUTTONS) {
...
@@ -10487,6 +10488,7 @@ if (MORE_BUTTONS) {
}
}
}
}
for (int nfile = 0; nfile < sourceFilesList[nset].length; nfile++) if (sourceFilesList[nset][nfile] != null){
for (int nfile = 0; nfile < sourceFilesList[nset].length; nfile++) if (sourceFilesList[nset][nfile] != null){
in_file++;
in_file++;
long startFileTime=System.nanoTime();
long startFileTime=System.nanoTime();
...
@@ -10497,7 +10499,7 @@ if (MORE_BUTTONS) {
...
@@ -10497,7 +10499,7 @@ if (MORE_BUTTONS) {
}
}
String grid_path = null;
String grid_path = null;
/*
/*
if (saveGrids && !overwriteGrids){ // check if result already exists
if (saveGrids && !ov
minGridFileSize
erwriteGrids){ // check if result already exists
i = sourceFilesList[nset][nfile].lastIndexOf('/');
i = sourceFilesList[nset][nfile].lastIndexOf('/');
if (i>0){
if (i>0){
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
...
@@ -10508,6 +10510,7 @@ if (MORE_BUTTONS) {
...
@@ -10508,6 +10510,7 @@ if (MORE_BUTTONS) {
}
}
}
}
}
}
patternDetectParameters.minGridFileSize
*/
*/
if (saveGrids){ // check if result already exists
if (saveGrids){ // check if result already exists
...
@@ -10515,9 +10518,22 @@ if (MORE_BUTTONS) {
...
@@ -10515,9 +10518,22 @@ if (MORE_BUTTONS) {
if (i>0){
if (i>0){
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
grid_path = gridSetPath + Prefs.getFileSeparator() + grid_name;
grid_path = gridSetPath + Prefs.getFileSeparator() + grid_name;
if (!overwriteGrids && ((new File(grid_path)).exists())){ // check if result already exists
File grid_file = new File(grid_path);
if (DEBUG_LEVEL>0) System.out.println("-->>> Skipping existing "+grid_path+" (as requested in \"Configure Process Distortions\")");
if (!overwriteGrids && (grid_file.exists())){ // check if result already exists
if (grid_file.length() >= minGridFileSize) {
if (DEBUG_LEVEL>0) {
System.out.println("-->>> Skipping existing large enough ("+(grid_file.length())+
" bytes >= "+minGridFileSize+" bytes)"+grid_path+" (as requested in \"Configure Process Distortions\")");
}
continue;
continue;
} else {
if (DEBUG_LEVEL>0) {
System.out.println("-->>> Deleting small ("+(grid_file.length())+
" bytes < "+minGridFileSize+" bytes)"+grid_path+" (as requested in \"Configure Process Distortions\")");
grid_file.delete();
}
}
}
}
}
}
}
}
...
@@ -10549,7 +10565,10 @@ if (MORE_BUTTONS) {
...
@@ -10549,7 +10565,10 @@ if (MORE_BUTTONS) {
noMessageBoxes);
noMessageBoxes);
if (DEBUG_LEVEL>1) System.out.println("numAbsolutePoints="+numAbsolutePoints);
if (DEBUG_LEVEL>1) System.out.println("numAbsolutePoints="+numAbsolutePoints);
if ((numAbsolutePoints==DISTORTION.errPatternNotFound) || (numAbsolutePoints==DISTORTION.errTooFewCells)) {
if ((numAbsolutePoints==DISTORTION.errPatternNotFound) ||
(numAbsolutePoints==DISTORTION.errTooFewCells) ||
(numAbsolutePoints==DISTORTION.errRefineFailed)
) {
if (DEBUG_LEVEL>0) System.out.println("Grid "+(in_file)+" not found or too small ("+numAbsolutePoints+"), wasted "+
if (DEBUG_LEVEL>0) System.out.println("Grid "+(in_file)+" not found or too small ("+numAbsolutePoints+"), wasted "+
IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+" seconds )\n");
IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+" seconds )\n");
if (this.SYNC_COMMAND.stopRequested.get()>0) {
if (this.SYNC_COMMAND.stopRequested.get()>0) {
...
@@ -21107,6 +21126,9 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
...
@@ -21107,6 +21126,9 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
gd.addNumericField("Minimal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.minGridPeriodLwir, 2,5,"pix");
gd.addNumericField("Minimal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.minGridPeriodLwir, 2,5,"pix");
gd.addNumericField("Maximal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.maxGridPeriodLwir, 2,5,"pix");
gd.addNumericField("Maximal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.maxGridPeriodLwir, 2,5,"pix");
}
}
gd.addNumericField("Minimal grid file size to overwrite" , patternDetectParameters.minGridFileSize, 0, 8, "bytes");
// public double minGridFileSize = 25000; // Minimal file size (to overwirite)
gd.showDialog();
gd.showDialog();
if (gd.wasCanceled()) return false;
if (gd.wasCanceled()) return false;
patternDetectParameters.minGridPeriod= gd.getNextNumber();
patternDetectParameters.minGridPeriod= gd.getNextNumber();
...
@@ -21115,6 +21137,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
...
@@ -21115,6 +21137,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
patternDetectParameters.minGridPeriodLwir= gd.getNextNumber();
patternDetectParameters.minGridPeriodLwir= gd.getNextNumber();
patternDetectParameters.maxGridPeriodLwir= gd.getNextNumber();
patternDetectParameters.maxGridPeriodLwir= gd.getNextNumber();
}
}
patternDetectParameters.minGridFileSize = (int) gd.getNextNumber();
return true;
return true;
}
}
src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java
View file @
65338490
...
@@ -4372,12 +4372,14 @@ public class MatchSimulatedPattern {
...
@@ -4372,12 +4372,14 @@ public class MatchSimulatedPattern {
continue;
continue;
} else if ((refCell[0] != null) && (refCell[0].length > 3)) {
} else if ((refCell[0] != null) && (refCell[0].length > 3)) {
double dbg_contrast = (refCell[0].length > 2) ? refCell[0][2] : Double.NaN;
double dbg_contrast = (refCell[0].length > 2) ? refCell[0][2] : Double.NaN;
if (debugLevel > debugThreshold) {
System.out.println("**** refCell was deleted **** u=" + iUVRef[0] + " v="
System.out.println("**** refCell was deleted **** u=" + iUVRef[0] + " v="
+ iUVRef[1] + " current=" + iUVdir[0] + "/" + iUVdir[1] + " ncell=" + ncell
+ iUVRef[1] + " current=" + iUVdir[0] + "/" + iUVdir[1] + " ncell=" + ncell
+ " waveFrontList.size()=" + waveFrontList.size() + " ref_x="
+ " waveFrontList.size()=" + waveFrontList.size() + " ref_x="
+ IJ.d2s(refCell[0][0], 3) + " ref_y=" + IJ.d2s(refCell[0][1], 3)
+ IJ.d2s(refCell[0][0], 3) + " ref_y=" + IJ.d2s(refCell[0][1], 3)
+ " contrast=" + IJ.d2s(dbg_contrast, 3));
+ " contrast=" + IJ.d2s(dbg_contrast, 3));
}
}
}
// found reference cell, calculate x/y, make sure it is inside the selection w/o
// found reference cell, calculate x/y, make sure it is inside the selection w/o
// borders
// borders
double[][] wv = new double[2][];
double[][] wv = new double[2][];
...
@@ -6855,7 +6857,7 @@ public class MatchSimulatedPattern {
...
@@ -6855,7 +6857,7 @@ public class MatchSimulatedPattern {
IJ.showMessage("Error", "Pattern not found");
IJ.showMessage("Error", "Pattern not found");
return distortionParameters.errPatternNotFound;
return distortionParameters.errPatternNotFound;
} else {
} else {
if
(
global_debug_level
>
(
debugThreshold
+
1
))
if (global_debug_level >
0) //
(debugThreshold + 1))
System.out.println("Initial pattern cluster has " + patternCells + " cells");
System.out.println("Initial pattern cluster has " + patternCells + " cells");
}
}
if (global_debug_level > (debugThreshold + 1))
if (global_debug_level > (debugThreshold + 1))
...
@@ -6878,7 +6880,7 @@ public class MatchSimulatedPattern {
...
@@ -6878,7 +6880,7 @@ public class MatchSimulatedPattern {
imp_eq = imp;
imp_eq = imp;
if (distortionParameters.refineCorrelations) {
if (distortionParameters.refineCorrelations) {
refineDistortionCorrelation
(
double maxActualCorr =
refineDistortionCorrelation(
lwirReaderParameters, // LwirReaderParameters lwirReaderParameters, // null is OK
lwirReaderParameters, // LwirReaderParameters lwirReaderParameters, // null is OK
distortionParameters, //
distortionParameters, //
patternDetectParameters,
patternDetectParameters,
...
@@ -6889,7 +6891,10 @@ public class MatchSimulatedPattern {
...
@@ -6889,7 +6891,10 @@ public class MatchSimulatedPattern {
threadsMax,
threadsMax,
updateStatus,
updateStatus,
debug_level); // debug level
debug_level); // debug level
System.out.println(".... maxActualCorr="+maxActualCorr);
if (maxActualCorr <= 0.0) {
return distortionParameters.errRefineFailed; // 2021
}
recalculateWaveVectors(
recalculateWaveVectors(
updateStatus,
updateStatus,
debug_level);// debug level used inside loops
debug_level);// debug level used inside loops
...
@@ -10560,6 +10565,7 @@ public class MatchSimulatedPattern {
...
@@ -10560,6 +10565,7 @@ public class MatchSimulatedPattern {
}
}
contrast = contrasts[0];
contrast = contrasts[0];
result[2] = contrast;
result[2] = contrast;
// System.out.println("cobntrasts = "+contrasts[0]+", "+contrasts[1]);
if (Double.isNaN(contrasts[0]) || ((distortionParameters.correlationMinContrast > 0)
if (Double.isNaN(contrasts[0]) || ((distortionParameters.correlationMinContrast > 0)
&& (contrasts[0] < distortionParameters.correlationMinContrast))) {
&& (contrasts[0] < distortionParameters.correlationMinContrast))) {
if ((debug_level > (debug_threshold - 1)))
if ((debug_level > (debug_threshold - 1)))
...
@@ -12400,6 +12406,7 @@ public class MatchSimulatedPattern {
...
@@ -12400,6 +12406,7 @@ public class MatchSimulatedPattern {
public double minGridPeriod;
public double minGridPeriod;
public double maxGridPeriod;
public double maxGridPeriod;
public double minGridPeriodLwir;
public double minGridPeriodLwir;
public int minGridFileSize = 15000; // Minimal file size (to overwrite)
public double maxGridPeriodLwir;
public double maxGridPeriodLwir;
public double debugX;
public double debugX;
public double debugY;
public double debugY;
...
@@ -12625,6 +12632,8 @@ public class MatchSimulatedPattern {
...
@@ -12625,6 +12632,8 @@ public class MatchSimulatedPattern {
// match pointers errors
// match pointers errors
public int errTooFewCells = -10;
public int errTooFewCells = -10;
public int errPatternNotFound = -11;
public int errPatternNotFound = -11;
public int errRefineFailed = -12;
public boolean legacyMode = false; // legacy mode
public boolean legacyMode = false; // legacy mode
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment