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
2d7ac7b8
Commit
2d7ac7b8
authored
Jan 24, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging "lazy eye". Found residual is due to ERS
parent
30937781
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
156 additions
and
51 deletions
+156
-51
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+1
-1
Corr2dLMA.java
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
+39
-13
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+14
-8
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+42
-14
ImageDttParameters.java
...a/com/elphel/imagej/tileprocessor/ImageDttParameters.java
+24
-9
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+36
-6
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
2d7ac7b8
...
...
@@ -4316,7 +4316,7 @@ private Panel panel1,
}
else
if
(
label
.
equals
(
"CLT 4 images"
)
||
label
.
equals
(
"CLT apply fine corr"
)
||
label
.
equals
(
"CLT infinity corr"
)
||
label
.
equals
(
"CORR TEST"
))
{
label
.
equals
(
"CORR TEST"
))
{
boolean
apply_corr
=
label
.
equals
(
"CLT apply fine corr"
);
boolean
infinity_corr
=
label
.
equals
(
"CLT infinity corr"
);
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
View file @
2d7ac7b8
...
...
@@ -1167,6 +1167,30 @@ public class Corr2dLMA {
}
public
double
[][]
getTileStats
(){
double
[]
rms
=
getRmsTile
();
double
[][]
maxmin_amp
=
getMaxMinAmpTile
();
// double [][] maxmin_val = getMaxMinValTile();
double
[][]
abc
=
getABCTile
();
double
[][]
tileStats
=
new
double
[
numTiles
][];
for
(
int
tile
=
0
;
tile
<
numTiles
;
tile
++)
if
(!
Double
.
isNaN
(
rms
[
tile
])
&&
!
Double
.
isNaN
(
maxmin_amp
[
tile
][
0
])){
tileStats
[
tile
]
=
new
double
[
4
];
double
avg
=
0.5
*(
maxmin_amp
[
tile
][
0
]+
maxmin_amp
[
tile
][
1
]);
double
rrms
=
rms
[
tile
]/
avg
;
double
strength
=
Math
.
sqrt
(
avg
/
rrms
);
double
area
=
Double
.
NaN
;
if
((
abc
[
tile
][
0
]
>
0.0
)
&&
(
abc
[
tile
][
2
]
>
0.0
))
{
area
=
1.0
/
abc
[
tile
][
0
]
+
1.0
/
abc
[
tile
][
2
];
// area of a maximum
}
tileStats
[
tile
][
0
]
=
rrms
;
tileStats
[
tile
][
1
]
=
strength
;
tileStats
[
tile
][
2
]
=
Math
.
max
(
abc
[
tile
][
0
],
abc
[
tile
][
2
]);
tileStats
[
tile
][
3
]
=
area
;
}
return
tileStats
;
}
public
void
printInputDataFx
(
boolean
show_fx
){
// not used in lwir
if
(
show_fx
)
{
...
...
@@ -1435,10 +1459,11 @@ public class Corr2dLMA {
return
rslt
;
}
public
double
[][]
d
isparityStrength
(
public
double
[][]
lmaD
isparityStrength
(
double
lma_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
double
lma_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
double
lma_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
double
lma_max_area
,
// maximal half-area (if > 0.0)
double
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
double
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
){
...
...
@@ -1447,21 +1472,31 @@ public class Corr2dLMA {
double
[][]
maxmin_amp
=
getMaxMinAmpTile
();
double
[][]
abc
=
getABCTile
();
for
(
int
tile
=
0
;
tile
<
numTiles
;
tile
++)
{
ds
[
tile
][
0
]
=
Double
.
NaN
;
if
(
Double
.
isNaN
(
maxmin_amp
[
tile
][
0
]))
{
ds
[
tile
][
0
]
=
Double
.
NaN
;
continue
;
}
double
avg
=
0.5
*(
maxmin_amp
[
tile
][
0
]+
maxmin_amp
[
tile
][
1
]);
double
rrms
=
rms
[
tile
]/
avg
;
if
(((
lma_max_rel_rms
>
0.0
)
&&
(
rrms
>
lma_max_rel_rms
))
||
(
Math
.
max
(
abc
[
tile
][
0
],
abc
[
tile
][
2
])
<
lma_min_ac
))
{
ds
[
tile
][
0
]
=
Double
.
NaN
;
continue
;
}
if
(
lma_max_area
>
0
)
{
if
((
abc
[
tile
][
0
]
>
0.0
)
&&
(
abc
[
tile
][
2
]
>
0.0
))
{
double
area
=
1.0
/
abc
[
tile
][
0
]
+
1.0
/
abc
[
tile
][
2
];
// area of a maximum
if
(
area
>
lma_max_area
)
{
continue
;
// too wide maximum
}
}
else
{
continue
;
// not a maximum
}
}
double
strength
=
Math
.
sqrt
(
avg
/
rrms
);
double
disparity
=
-
all_pars
[
DISP_INDEX
+
tile
*
TILE_PARAMS
];
if
((
strength
<
lma_min_strength
)
||
Double
.
isNaN
(
disparity
))
{
ds
[
tile
][
0
]
=
Double
.
NaN
;
continue
;
}
ds
[
tile
][
0
]
=
disparity
;
...
...
@@ -1716,15 +1751,6 @@ public class Corr2dLMA {
return
rslt
;
}
/*
try {
this.SYNC_COMMAND.wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
if
(
debug_level
>
2
)
{
System
.
out
.
println
(
"(JtJ + lambda*diag(JtJ).inv()"
);
jtjl_inv
.
print
(
18
,
6
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
2d7ac7b8
...
...
@@ -1821,7 +1821,7 @@ public class Correlation2d {
{
// corrs are organized as PAIRS, some are null if not used
// for each enabled and available pair find a maximum, filter convex and create sample list
boolean
debug_graphic
=
imgdtt_params
.
lma_debug_graphic
;
//
(debug_level > -1) ;
boolean
debug_graphic
=
imgdtt_params
.
lma_debug_graphic
&&
(
debug_level
>
-
1
)
;
// boolean debug_graphic = true;
// boolean debug_second_all = false; // true; // alse; // true;
int
clust_height
=
corrs
.
length
/
clust_width
;
...
...
@@ -1831,7 +1831,10 @@ public class Correlation2d {
int
center
=
transform_size
-
1
;
int
corr_size
=
2
*
transform_size
-
1
;
// double [][] blur_max = new double [corrs.length][];
Corr2dLMA
lma
=
new
Corr2dLMA
(
if
(
debug_level
>
-
2
)
{
System
.
out
.
println
(
"Debugging corrLMA2()// multi-tile"
);
}
Corr2dLMA
lma
=
new
Corr2dLMA
(
corrs
.
length
,
transform_size
,
corr_wnd
,
...
...
@@ -2024,10 +2027,11 @@ public class Correlation2d {
}
// double [][] ds = lma.getDisparityStrength();
ds
=
lma
.
d
isparityStrength
(
ds
=
lma
.
lmaD
isparityStrength
(
imgdtt_params
.
lma_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lma_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lma_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
);
...
...
@@ -2121,10 +2125,11 @@ public class Correlation2d {
lma
.
printInputDataFx
(
true
);
}
// double [][] ds = lma.getDisparityStrength();
ds
=
lma
.
d
isparityStrength
(
ds
=
lma
.
lmaD
isparityStrength
(
imgdtt_params
.
lma_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lma_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lma_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
);
...
...
@@ -2217,8 +2222,8 @@ public class Correlation2d {
boolean
need_poly
=
(
disp_str
==
null
);
// true; // find initial disparity by polynomial approximation
boolean
debug_graphic
=
imgdtt_params
.
lma_debug_graphic
&&
(
imgdtt_params
.
lma_debug_level1
>
3
)
&&
(
debug_level
>
0
)
;
String
dbg_title
=
null
;
//
if (debug_graphic) {
if
(
imgdtt_params
.
lma_debug_graphic
)
{
if
(
debug_graphic
)
{
//
if (imgdtt_params.lma_debug_graphic) {
dbg_title
=
String
.
format
(
"tX%d_tY%d"
,
tileX
,
tileY
);
}
DoubleGaussianBlur
gb
=
null
;
...
...
@@ -2350,7 +2355,7 @@ public class Correlation2d {
disp
=
lma
.
polyDisparity
(
corr_wnd_inv_limited
,
transform_size
-
1
-
imgdtt_params
.
lma_soft_marg
,
//double max_offset, // 5?
d
bg_title
);
// double [] rslt = {-approx2d[0], approx2d[2], hwx, hwy};
d
ebug_graphic
?
dbg_title:
null
);
// double [] rslt = {-approx2d[0], approx2d[2], hwx, hwy};
if
(
disp
==
null
)
{
if
(
debug_level
>
0
)
{
...
...
@@ -2414,10 +2419,11 @@ public class Correlation2d {
lma
.
updateFromVector
();
double
[][]
dispStr
=
lma
.
d
isparityStrength
(
double
[][]
dispStr
=
lma
.
lmaD
isparityStrength
(
imgdtt_params
.
lmas_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lmas_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lmas_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lmas_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
2d7ac7b8
...
...
@@ -1867,7 +1867,7 @@ public class ImageDtt {
disparity_array
[
tileY
][
tileX
]
+
disparity_corr
);
}
if
(((
globalDebugLevel
>
0
)
||
debug_distort
)
&&
debugTile
)
{
if
(((
globalDebugLevel
>
0
)
||
debug_distort
)
||
debugTile
)
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
...
...
@@ -1884,7 +1884,7 @@ public class ImageDtt {
centersXY
[
cTile
][
i
][
0
]
+=
debug_offsets_xy
[
i
][
0
];
centersXY
[
cTile
][
i
][
1
]
+=
debug_offsets_xy
[
i
][
1
];
}
if
(
debug_distort
&&
debugCluster
)
{
if
(
(
debug_distort
&&
debugCluster
)
||
debugTile
)
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
System
.
out
.
println
(
String
.
format
(
"%d: {%8.3f, %8.3f}"
,
i
,
debug_offsets_xy
[
i
][
0
],
debug_offsets_xy
[
i
][
1
]));
}
...
...
@@ -2114,12 +2114,13 @@ public class ImageDtt {
disparity_map
[
DISPARITY_INDEX_HOR
][
tIndex
]
=
poly_disp
[
0
];
disparity_map
[
DISPARITY_INDEX_HOR_STRENGTH
][
tIndex
]
=
poly_disp
[
1
];
if
(
lma2
!=
null
)
{
disp_str
[
cTile
]
=
lma2
.
d
isparityStrength
(
disp_str
[
cTile
]
=
lma2
.
lmaD
isparityStrength
(
imgdtt_params
.
lmas_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lmas_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lmas_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lmas_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
)[
0
];
if
(
tile_lma_debug_level
>
0
)
{
double
[][]
ds_dbg
=
{
disp_str
[
cTile
]};
...
...
@@ -2165,12 +2166,14 @@ public class ImageDtt {
if
(
lma2
!=
null
)
{
double
[][]
ddnd
=
lma2
.
getDdNd
();
double
[]
stats
=
lma2
.
getStats
();
double
[][]
lma2_ds
=
lma2
.
d
isparityStrength
(
double
[][]
lma2_ds
=
lma2
.
lmaD
isparityStrength
(
imgdtt_params
.
lma_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lma_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lma_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
);
// convert lma-generated strength to match previous ones - add to result
double
[][]
extra_stats
=
lma2
.
getTileStats
();
for
(
int
cTileY
=
0
;
cTileY
<
tileStep
;
cTileY
++)
{
tileY
=
clustY
*
tileStep
+
cTileY
;
if
(
tileY
<
tilesY
)
{
...
...
@@ -2182,8 +2185,15 @@ public class ImageDtt {
// int nTile = tileY * tilesX + tileX; // how is it different from tIndex?
for
(
int
cam
=
0
;
cam
<
ddnd
.
length
;
cam
++)
{
if
(
ddnd
[
cam
]
!=
null
)
{
clt_mismatch
[
3
*
cam
+
0
][
tIndex
]
=
ddnd
[
cam
][
0
];
clt_mismatch
[
3
*
cam
+
1
][
tIndex
]
=
ddnd
[
cam
][
1
];
if
(
imgdtt_params
.
lma_diff_xy
)
{
clt_mismatch
[
3
*
cam
+
0
][
tIndex
]
=
ddnd
[
cam
][
0
]
*
rXY
[
cam
][
0
]
-
ddnd
[
cam
][
1
]
*
rXY
[
cam
][
1
];
clt_mismatch
[
3
*
cam
+
1
][
tIndex
]
=
ddnd
[
cam
][
0
]
*
rXY
[
cam
][
1
]
+
ddnd
[
cam
][
1
]
*
rXY
[
cam
][
0
];
}
else
{
clt_mismatch
[
3
*
cam
+
0
][
tIndex
]
=
ddnd
[
cam
][
0
];
clt_mismatch
[
3
*
cam
+
1
][
tIndex
]
=
ddnd
[
cam
][
1
];
}
}
if
(
stats
!=
null
)
{
disparity_map
[
IMG_DIFF0_INDEX
+
0
][
tIndex
]
=
stats
[
0
];
...
...
@@ -2194,6 +2204,25 @@ public class ImageDtt {
if
((
lma2_ds
!=
null
)
&&
((
lma2_ds
[
cTile
]
!=
null
)))
{
disparity_map
[
DISPARITY_INDEX_VERT
][
tIndex
]
=
lma2_ds
[
cTile
][
0
];
disparity_map
[
DISPARITY_INDEX_VERT_STRENGTH
][
tIndex
]
=
lma2_ds
[
cTile
][
1
];
clt_mismatch
[
3
*
0
+
2
][
tIndex
]
=
lma2_ds
[
cTile
][
1
];
}
}
if
(
extra_stats
!=
null
)
{
if
(
extra_stats
[
cTile
]
!=
null
)
{
disparity_map
[
DISPARITY_INDEX_CM
+
1
][
tIndex
]
=
extra_stats
[
cTile
][
0
];
disparity_map
[
DISPARITY_VARIATIONS_INDEX
][
tIndex
]
=
extra_stats
[
cTile
][
2
];
disparity_map
[
OVEREXPOSED
][
tIndex
]
=
extra_stats
[
cTile
][
3
];
clt_mismatch
[
3
*
1
+
2
][
tIndex
]
=
extra_stats
[
cTile
][
0
];
clt_mismatch
[
3
*
2
+
2
][
tIndex
]
=
extra_stats
[
cTile
][
2
];
clt_mismatch
[
3
*
3
+
2
][
tIndex
]
=
extra_stats
[
cTile
][
3
];
}
else
{
disparity_map
[
DISPARITY_INDEX_CM
+
1
][
tIndex
]
=
Double
.
NaN
;
disparity_map
[
DISPARITY_VARIATIONS_INDEX
][
tIndex
]
=
Double
.
NaN
;
disparity_map
[
OVEREXPOSED
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
1
+
2
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
2
+
2
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
3
+
2
][
tIndex
]
=
Double
.
NaN
;
}
}
}
...
...
@@ -2202,9 +2231,7 @@ public class ImageDtt {
}
}
}
}
}
};
}
...
...
@@ -3073,10 +3100,11 @@ public class ImageDtt {
tileY
);
// int tileY
double
[][]
ds
=
null
;
if
(
lma2
!=
null
)
{
ds
=
lma2
.
disparityStrength
(
imgdtt_params
.
lma_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lma_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lma_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
ds
=
lma2
.
lmaDisparityStrength
(
imgdtt_params
.
lmas_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lmas_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lmas_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lmas_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttParameters.java
View file @
2d7ac7b8
...
...
@@ -115,6 +115,7 @@ public class ImageDttParameters {
public
double
lmas_max_rel_rms
=
0.2
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lmas_min_strength
=
1.0
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
public
double
lmas_min_ac
=
0.03
;
// minimal of a and C coefficients maximum (measures sharpest point/line)
public
double
lmas_max_area
=
0.0
;
// maximal half-area (if > 0.0)
public
boolean
lma_gaussian
=
false
;
// model correlation maximum as a Gaussian (false - as a parabola)
public
boolean
lma_second
=
false
;
// re-run LMA after removing weak/failed tiles
...
...
@@ -149,9 +150,10 @@ public class ImageDttParameters {
public
double
lma_rms_diff
=
0.001
;
//
public
int
lma_num_iter
=
20
;
//
// Filtering and strength calculation
public
double
lma_max_rel_rms
=
0.2
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lma_min_strength
=
1.0
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
public
double
lma_min_ac
=
0.03
;
// minimal of a and C coefficients maximum (measures sharpest point/line)
public
double
lma_max_rel_rms
=
0.12
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lma_min_strength
=
1.25
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
public
double
lma_min_ac
=
0.15
;
// minimal of a and C coefficients maximum (measures sharpest point/line)
public
double
lma_max_area
=
30.0
;
// maximal half-area (if > 0.0)
public
double
lma_str_scale
=
0.2
;
// convert lma-generated strength to match previous ones - scale
public
double
lma_str_offset
=
0.05
;
// convert lma-generated strength to match previous ones - add to result
...
...
@@ -340,6 +342,8 @@ public class ImageDttParameters {
"Discard tile if composite strength (average amplitude over SQRT of RMS) is below"
);
gd
.
addNumericField
(
"Minimal max (A,C)"
,
this
.
lmas_min_ac
,
6
,
8
,
""
,
"Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"
);
gd
.
addNumericField
(
"Maximal area"
,
this
.
lmas_max_area
,
6
,
8
,
"sq.pix"
,
"Maximal product of maximum half-width by half-height, ignore check if <=0"
);
gd
.
addMessage
(
"Multi-tile (for lazy eye) LMA (some are used for with single-tile mode too)"
);
gd
.
addCheckbox
(
"Correlation maximum as gaussian"
,
this
.
lma_gaussian
,
...
...
@@ -403,6 +407,8 @@ public class ImageDttParameters {
"Discard tile if composite strength (average amplitude over SQRT of RMS) is below"
);
gd
.
addNumericField
(
"Minimal max (A,C)"
,
this
.
lma_min_ac
,
6
,
8
,
""
,
"Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"
);
gd
.
addNumericField
(
"Maximal area"
,
this
.
lma_max_area
,
6
,
8
,
"sq.pix"
,
"Maximal product of maximum half-width by half-height, ignore check if <=0"
);
gd
.
addMessage
(
"Correlation strength calculation (match legacy)"
);
gd
.
addNumericField
(
"Composite correlation strength scale"
,
this
.
lma_str_scale
,
6
,
8
,
""
,
...
...
@@ -541,6 +547,7 @@ public class ImageDttParameters {
this
.
lmas_max_rel_rms
=
gd
.
getNextNumber
();
this
.
lmas_min_strength
=
gd
.
getNextNumber
();
this
.
lmas_min_ac
=
gd
.
getNextNumber
();
this
.
lmas_max_area
=
gd
.
getNextNumber
();
this
.
lma_gaussian
=
gd
.
getNextBoolean
();
this
.
lma_second
=
gd
.
getNextBoolean
();
...
...
@@ -573,6 +580,8 @@ public class ImageDttParameters {
this
.
lma_max_rel_rms
=
gd
.
getNextNumber
();
this
.
lma_min_strength
=
gd
.
getNextNumber
();
this
.
lma_min_ac
=
gd
.
getNextNumber
();
this
.
lma_max_area
=
gd
.
getNextNumber
();
this
.
lma_str_scale
=
gd
.
getNextNumber
();
this
.
lma_str_offset
=
gd
.
getNextNumber
();
...
...
@@ -674,6 +683,7 @@ public class ImageDttParameters {
properties
.
setProperty
(
prefix
+
"lmas_max_rel_rms"
,
this
.
lmas_max_rel_rms
+
""
);
properties
.
setProperty
(
prefix
+
"lmas_min_strength"
,
this
.
lmas_min_strength
+
""
);
properties
.
setProperty
(
prefix
+
"lmas_min_ac"
,
this
.
lmas_min_ac
+
""
);
properties
.
setProperty
(
prefix
+
"lmas_max_area"
,
this
.
lmas_max_area
+
""
);
properties
.
setProperty
(
prefix
+
"lma_gaussian"
,
this
.
lma_gaussian
+
""
);
properties
.
setProperty
(
prefix
+
"lma_second"
,
this
.
lma_second
+
""
);
...
...
@@ -707,6 +717,7 @@ public class ImageDttParameters {
properties
.
setProperty
(
prefix
+
"lma_max_rel_rms"
,
this
.
lma_max_rel_rms
+
""
);
properties
.
setProperty
(
prefix
+
"lma_min_strength"
,
this
.
lma_min_strength
+
""
);
properties
.
setProperty
(
prefix
+
"lma_min_ac"
,
this
.
lma_min_ac
+
""
);
properties
.
setProperty
(
prefix
+
"lma_max_area"
,
this
.
lma_max_area
+
""
);
properties
.
setProperty
(
prefix
+
"lma_str_scale"
,
this
.
lma_str_scale
+
""
);
properties
.
setProperty
(
prefix
+
"lma_str_offset"
,
this
.
lma_str_offset
+
""
);
...
...
@@ -814,6 +825,7 @@ public class ImageDttParameters {
if
(
properties
.
getProperty
(
prefix
+
"lmas_max_rel_rms"
)!=
null
)
this
.
lmas_max_rel_rms
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lmas_max_rel_rms"
));
if
(
properties
.
getProperty
(
prefix
+
"lmas_min_strength"
)!=
null
)
this
.
lmas_min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lmas_min_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"lmas_min_ac"
)!=
null
)
this
.
lmas_min_ac
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lmas_min_ac"
));
if
(
properties
.
getProperty
(
prefix
+
"lmas_max_area"
)!=
null
)
this
.
lmas_max_area
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lmas_max_area"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_gaussian"
)!=
null
)
this
.
lma_gaussian
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lma_gaussian"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_second"
)!=
null
)
this
.
lma_second
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lma_second"
));
...
...
@@ -845,6 +857,7 @@ public class ImageDttParameters {
if
(
properties
.
getProperty
(
prefix
+
"lma_max_rel_rms"
)!=
null
)
this
.
lma_max_rel_rms
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_max_rel_rms"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_min_strength"
)!=
null
)
this
.
lma_min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_min_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_min_ac"
)!=
null
)
this
.
lma_min_ac
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_min_ac"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_max_area"
)!=
null
)
this
.
lma_max_area
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_max_area"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_str_scale"
)!=
null
)
this
.
lma_str_scale
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_str_scale"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_str_offset"
)!=
null
)
this
.
lma_str_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_str_offset"
));
...
...
@@ -943,12 +956,13 @@ public class ImageDttParameters {
idp
.
lmas_poly_str_scale
=
this
.
lmas_poly_str_scale
;
idp
.
lmas_poly_str_min
=
this
.
lmas_poly_str_min
;
idp
.
lmas_lambda_initial
=
this
.
lma_lambda_initial
;
idp
.
lmas_rms_diff
=
this
.
lma_rms_diff
;
idp
.
lmas_num_iter
=
this
.
lma_num_iter
;
idp
.
lmas_max_rel_rms
=
this
.
lma_max_rel_rms
;
idp
.
lmas_min_strength
=
this
.
lma_min_strength
;
idp
.
lmas_min_ac
=
this
.
lma_min_ac
;
idp
.
lmas_lambda_initial
=
this
.
lmas_lambda_initial
;
idp
.
lmas_rms_diff
=
this
.
lmas_rms_diff
;
idp
.
lmas_num_iter
=
this
.
lmas_num_iter
;
idp
.
lmas_max_rel_rms
=
this
.
lmas_max_rel_rms
;
idp
.
lmas_min_strength
=
this
.
lmas_min_strength
;
idp
.
lmas_min_ac
=
this
.
lmas_min_ac
;
idp
.
lmas_max_area
=
this
.
lmas_max_area
;
idp
.
lma_gaussian
=
this
.
lma_gaussian
;
idp
.
lma_second
=
this
.
lma_second
;
...
...
@@ -980,6 +994,7 @@ public class ImageDttParameters {
idp
.
lma_max_rel_rms
=
this
.
lma_max_rel_rms
;
idp
.
lma_min_strength
=
this
.
lma_min_strength
;
idp
.
lma_min_ac
=
this
.
lma_min_ac
;
idp
.
lma_max_area
=
this
.
lma_max_area
;
idp
.
lma_str_scale
=
this
.
lma_str_scale
;
idp
.
lma_str_offset
=
this
.
lma_str_offset
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
2d7ac7b8
...
...
@@ -4593,9 +4593,13 @@ public class QuadCLT {
final
boolean
updateStatus
,
final
int
debugLevel
){
final
boolean
batch_mode
=
clt_parameters
.
batch_run
;
//disable any debug images
boolean
advanced
=
this
.
correctionsParameters
.
zcorrect
||
this
.
correctionsParameters
.
equirectangular
;
boolean
toRGB
=
advanced
?
true
:
this
.
correctionsParameters
.
toRGB
;
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
// boolean advanced= this.correctionsParameters.zcorrect || this.correctionsParameters.equirectangular;
// boolean toRGB= advanced? true: this.correctionsParameters.toRGB;
// if (!batch_mode) return null;
// may use this.StartTime to report intermediate steps execution times
// String aux = isAux()?"-AUX":"";
...
...
@@ -4633,13 +4637,39 @@ public class QuadCLT {
setTiles
(
imp_quad
[
0
],
// set global tp.tilesX, tp.tilesY
clt_parameters
,
threadsMax
);
double
[][]
disparity_array
=
tp
.
setSameDisparity
(
clt_parameters
.
disparity
);
// 0.0); // [tp.tilesY][tp.tilesX] - individual per-tile expected disparity
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ImagePlus
imp_sel
=
WindowManager
.
getCurrentImage
();
if
((
imp_sel
==
null
)
||
(
imp_sel
.
getStackSize
()
!=
3
))
{
System
.
out
.
println
(
"No image / wrong image selected, using infinity"
);
}
else
{
System
.
out
.
println
(
"Image: "
+
imp_sel
.
getTitle
());
int
width
=
imp_sel
.
getWidth
();
int
height
=
imp_sel
.
getHeight
();
if
((
width
!=
tp
.
getTilesX
())
||
(
height
!=
tp
.
getTilesY
()))
{
System
.
out
.
println
(
String
.
format
(
"Image size mismatch: width=%d (%d), height=%d(%d)"
,
width
,
tp
.
getTilesX
(),
height
,
tp
.
getTilesY
()));
return
null
;
}
ImageStack
stack_sel
=
imp_sel
.
getStack
();
float
[]
img_disparity
=
(
float
[])
stack_sel
.
getPixels
(
1
);
// first stack is disparity
int
indx
=
0
;
for
(
int
i
=
0
;
i
<
disparity_array
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
disparity_array
[
0
].
length
;
j
++){
double
d
=
img_disparity
[
indx
++];
if
(!
Double
.
isNaN
(
d
))
{
// treat NaN as 0
disparity_array
[
i
][
j
]
+=
d
;
}
}
}
}
// temporary setting up tile task file (one integer per tile, bitmask
// for testing defined for a window, later the tiles to process will be calculated based on previous passes results
int
[][]
tile_op
=
tp
.
setSameTileOp
(
clt_parameters
,
clt_parameters
.
tile_task_op
,
debugLevel
);
double
[][]
disparity_array
=
tp
.
setSameDisparity
(
clt_parameters
.
disparity
);
// 0.0); // [tp.tilesY][tp.tilesX] - individual per-tile expected disparity
//
double [][] disparity_array = tp.setSameDisparity(clt_parameters.disparity); // 0.0); // [tp.tilesY][tp.tilesX] - individual per-tile expected disparity
//TODO: Add array of default disparity - use for combining images in force disparity mode (no correlation), when disparity is predicted from other tiles
...
...
@@ -4821,8 +4851,8 @@ public class QuadCLT {
clt_mismatch
[
3
*
n
+
0
][
ntile
]
/=
clt_mismatch
[
3
*
n
+
2
][
ntile
];
clt_mismatch
[
3
*
n
+
1
][
ntile
]
/=
clt_mismatch
[
3
*
n
+
2
][
ntile
];
if
(
n
>
0
)
{
double
w
=
disparity_map
[
ImageDtt
.
IMG_DIFF0_INDEX
+
0
][
ntile
];
if
(
w
<
clt_parameters
.
img_dtt
.
lma_diff_minw
)
{
double
w
=
disparity_map
[
ImageDtt
.
IMG_DIFF0_INDEX
+
0
][
ntile
]
-
clt_parameters
.
img_dtt
.
lma_diff_minw
;
if
(
w
<
0.0
)
{
w
=
0.0
;
}
clt_mismatch
[
3
*
n
+
2
][
ntile
]
=
w
;
...
...
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