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
0c001dd2
Commit
0c001dd2
authored
Jun 18, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more grids filtering
parent
9c63f90b
Changes
2
Hide 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 @
0c001dd2
...
...
@@ -10352,6 +10352,7 @@ if (MORE_BUTTONS) {
String [][] sourceFilesList=LWIR_PARAMETERS.getSourceFiles(sourceSetList, sel_chn);
boolean saveGrids=DISTORTION_PROCESS_CONFIGURATION.saveGridImages;
boolean overwriteGrids=DISTORTION_PROCESS_CONFIGURATION.overwriteResultFiles;
int minGridFileSize = PATTERN_DETECT.minGridFileSize;
if (sourceSetList==null) return;
showPatternMinMaxPeriodDialog(PATTERN_DETECT, true);
int saved_file = 0;
...
...
@@ -10372,7 +10373,8 @@ if (MORE_BUTTONS) {
if (!set_dir.exists()) {
set_dir.mkdirs(); // including parent
}
}
}
for (int nfile = 0; nfile < sourceFilesList[nset].length; nfile++) if (sourceFilesList[nset][nfile] != null){
in_file++;
...
...
@@ -10384,7 +10386,7 @@ if (MORE_BUTTONS) {
}
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('/');
if (i>0){
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
...
...
@@ -10395,6 +10397,7 @@ if (MORE_BUTTONS) {
}
}
}
patternDetectParameters.minGridFileSize
*/
if (saveGrids){ // check if result already exists
...
...
@@ -10402,10 +10405,23 @@ if (MORE_BUTTONS) {
if (i>0){
String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1);
grid_path = gridSetPath + Prefs.getFileSeparator() + grid_name;
if (!overwriteGrids && ((new File(grid_path)).exists())){ // check if result already exists
if (DEBUG_LEVEL>0) System.out.println("-->>> Skipping existing "+grid_path+" (as requested in \"Configure Process Distortions\")");
continue;
}
File grid_file = new File(grid_path);
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;
} 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();
}
}
}
}
}
imp_sel=new ImagePlus(sourceFilesList[nset][nfile]); // read source file
...
...
@@ -10436,7 +10452,10 @@ if (MORE_BUTTONS) {
noMessageBoxes);
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 "+
IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+" seconds )\n");
if (this.SYNC_COMMAND.stopRequested.get()>0) {
...
...
@@ -20990,6 +21009,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("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();
if (gd.wasCanceled()) return false;
patternDetectParameters.minGridPeriod= gd.getNextNumber();
...
...
@@ -20998,6 +21020,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
patternDetectParameters.minGridPeriodLwir= gd.getNextNumber();
patternDetectParameters.maxGridPeriodLwir= gd.getNextNumber();
}
patternDetectParameters.minGridFileSize = (int) gd.getNextNumber();
return true;
}
src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java
View file @
0c001dd2
...
...
@@ -4372,11 +4372,13 @@ public class MatchSimulatedPattern {
continue
;
}
else
if
((
refCell
[
0
]
!=
null
)
&&
(
refCell
[
0
].
length
>
3
))
{
double
dbg_contrast
=
(
refCell
[
0
].
length
>
2
)
?
refCell
[
0
][
2
]
:
Double
.
NaN
;
System
.
out
.
println
(
"**** refCell was deleted **** u="
+
iUVRef
[
0
]
+
" v="
+
iUVRef
[
1
]
+
" current="
+
iUVdir
[
0
]
+
"/"
+
iUVdir
[
1
]
+
" ncell="
+
ncell
+
" waveFrontList.size()="
+
waveFrontList
.
size
()
+
" ref_x="
+
IJ
.
d2s
(
refCell
[
0
][
0
],
3
)
+
" ref_y="
+
IJ
.
d2s
(
refCell
[
0
][
1
],
3
)
+
" contrast="
+
IJ
.
d2s
(
dbg_contrast
,
3
));
if
(
debugLevel
>
debugThreshold
)
{
System
.
out
.
println
(
"**** refCell was deleted **** u="
+
iUVRef
[
0
]
+
" v="
+
iUVRef
[
1
]
+
" current="
+
iUVdir
[
0
]
+
"/"
+
iUVdir
[
1
]
+
" ncell="
+
ncell
+
" waveFrontList.size()="
+
waveFrontList
.
size
()
+
" ref_x="
+
IJ
.
d2s
(
refCell
[
0
][
0
],
3
)
+
" ref_y="
+
IJ
.
d2s
(
refCell
[
0
][
1
],
3
)
+
" contrast="
+
IJ
.
d2s
(
dbg_contrast
,
3
));
}
}
// found reference cell, calculate x/y, make sure it is inside the selection w/o
// borders
...
...
@@ -6855,7 +6857,7 @@ public class MatchSimulatedPattern {
IJ
.
showMessage
(
"Error"
,
"Pattern not found"
);
return
distortionParameters
.
errPatternNotFound
;
}
else
{
if
(
global_debug_level
>
(
debugThreshold
+
1
))
if
(
global_debug_level
>
0
)
//
(debugThreshold + 1))
System
.
out
.
println
(
"Initial pattern cluster has "
+
patternCells
+
" cells"
);
}
if
(
global_debug_level
>
(
debugThreshold
+
1
))
...
...
@@ -6878,7 +6880,7 @@ public class MatchSimulatedPattern {
imp_eq
=
imp
;
if
(
distortionParameters
.
refineCorrelations
)
{
refineDistortionCorrelation
(
double
maxActualCorr
=
refineDistortionCorrelation
(
lwirReaderParameters
,
// LwirReaderParameters lwirReaderParameters, // null is OK
distortionParameters
,
//
patternDetectParameters
,
...
...
@@ -6889,7 +6891,10 @@ public class MatchSimulatedPattern {
threadsMax
,
updateStatus
,
debug_level
);
// debug level
System
.
out
.
println
(
".... maxActualCorr="
+
maxActualCorr
);
if
(
maxActualCorr
<=
0.0
)
{
return
distortionParameters
.
errRefineFailed
;
// 2021
}
recalculateWaveVectors
(
updateStatus
,
debug_level
);
// debug level used inside loops
...
...
@@ -10560,6 +10565,7 @@ public class MatchSimulatedPattern {
}
contrast
=
contrasts
[
0
];
result
[
2
]
=
contrast
;
// System.out.println("cobntrasts = "+contrasts[0]+", "+contrasts[1]);
if
(
Double
.
isNaN
(
contrasts
[
0
])
||
((
distortionParameters
.
correlationMinContrast
>
0
)
&&
(
contrasts
[
0
]
<
distortionParameters
.
correlationMinContrast
)))
{
if
((
debug_level
>
(
debug_threshold
-
1
)))
...
...
@@ -12400,6 +12406,7 @@ public class MatchSimulatedPattern {
public
double
minGridPeriod
;
public
double
maxGridPeriod
;
public
double
minGridPeriodLwir
;
public
int
minGridFileSize
=
15000
;
// Minimal file size (to overwrite)
public
double
maxGridPeriodLwir
;
public
double
debugX
;
public
double
debugY
;
...
...
@@ -12623,8 +12630,10 @@ public class MatchSimulatedPattern {
// the grig brightness
// match pointers errors
public
int
errTooFewCells
=
-
10
;
public
int
errTooFewCells
=
-
10
;
public
int
errPatternNotFound
=
-
11
;
public
int
errRefineFailed
=
-
12
;
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