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
6293946d
Commit
6293946d
authored
Sep 13, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging LY adjustment, tested semi-manual OK
parent
71ac4a10
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
422 additions
and
106 deletions
+422
-106
CLTParameters.java
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
+10
-0
CLTPass3d.java
src/main/java/com/elphel/imagej/tileprocessor/CLTPass3d.java
+3
-1
CorrVector.java
...main/java/com/elphel/imagej/tileprocessor/CorrVector.java
+8
-4
ExtrinsicAdjustment.java
.../com/elphel/imagej/tileprocessor/ExtrinsicAdjustment.java
+167
-34
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+29
-0
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+22
-0
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+150
-44
SymmVector.java
...main/java/com/elphel/imagej/tileprocessor/SymmVector.java
+5
-3
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+28
-20
No files found.
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
View file @
6293946d
...
...
@@ -292,6 +292,8 @@ public class CLTParameters {
public
double
ly_norm_disp
=
5.0
;
// Reduce weight of higher disparity tiles
// Lazy eye multi-step fitting
public
String
lym_dbg_path
=
""
;
// read saved extrinsics_bgnd_combo.tif to bypass long preparation
public
double
lym_overexp
=
0.0001
;
// Any (near) saturated pixels - discard tile (see sat_level also)
public
boolean
lym_update_disp
=
true
;
// Update target disparity after each step
public
int
lym_iter
=
25
;
// Maximal number of iterations
...
...
@@ -1188,6 +1190,9 @@ public class CLTParameters {
properties
.
setProperty
(
prefix
+
"ly_disp_rvar_gt"
,
this
.
ly_disp_rvar_gt
+
""
);
properties
.
setProperty
(
prefix
+
"ly_norm_disp"
,
this
.
ly_norm_disp
+
""
);
properties
.
setProperty
(
prefix
+
"lym_overexp"
,
this
.
lym_overexp
+
""
);
properties
.
setProperty
(
prefix
+
"lym_dbg_path"
,
this
.
lym_dbg_path
+
""
);
properties
.
setProperty
(
prefix
+
"lym_update_disp"
,
this
.
lym_update_disp
+
""
);
properties
.
setProperty
(
prefix
+
"lym_iter"
,
this
.
lym_iter
+
""
);
properties
.
setProperty
(
prefix
+
"lym_change"
,
this
.
lym_change
+
""
);
...
...
@@ -1997,6 +2002,7 @@ public class CLTParameters {
if
(
properties
.
getProperty
(
prefix
+
"ly_disp_rvar_gt"
)!=
null
)
this
.
ly_disp_rvar_gt
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ly_disp_rvar_gt"
));
if
(
properties
.
getProperty
(
prefix
+
"ly_norm_disp"
)!=
null
)
this
.
ly_norm_disp
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ly_norm_disp"
));
if
(
properties
.
getProperty
(
prefix
+
"lym_overexp"
)!=
null
)
this
.
lym_overexp
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lym_overexp"
));
if
(
properties
.
getProperty
(
prefix
+
"lym_dbg_path"
)!=
null
)
this
.
lym_dbg_path
=
(
String
)
properties
.
getProperty
(
prefix
+
"lym_dbg_path"
);
if
(
properties
.
getProperty
(
prefix
+
"lym_update_disp"
)!=
null
)
this
.
lym_update_disp
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lym_update_disp"
));
if
(
properties
.
getProperty
(
prefix
+
"lym_iter"
)!=
null
)
this
.
lym_iter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"lym_iter"
));
if
(
properties
.
getProperty
(
prefix
+
"lym_change"
)!=
null
)
this
.
lym_change
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lym_change"
));
...
...
@@ -2895,6 +2901,8 @@ public class CLTParameters {
"Full allowed mismatch is a sum of absolute and disparity times relative (relaxed when ground truth is available)"
);
gd
.
addNumericField
(
"Reduce weight of higher disparity tiles"
,
this
.
ly_norm_disp
,
5
,
8
,
""
);
gd
.
addMessage
(
"--- Lazy eye multi-step fitting ---"
);
gd
.
addStringField
(
"Read extrinsics_bgnd_combo instead of building it"
,
this
.
lym_dbg_path
,
80
);
gd
.
addNumericField
(
"Any (near) saturated pixels - discard tile (see sat_level also)"
,
this
.
lym_overexp
,
10
,
12
,
""
);
gd
.
addCheckbox
(
"Update target disparity after each step"
,
this
.
lym_update_disp
);
gd
.
addNumericField
(
"Maximal number of iterations"
,
this
.
lym_iter
,
0
);
...
...
@@ -3833,6 +3841,8 @@ public class CLTParameters {
this
.
ly_disp_var_gt
=
gd
.
getNextNumber
();
this
.
ly_disp_rvar_gt
=
gd
.
getNextNumber
();
this
.
ly_norm_disp
=
gd
.
getNextNumber
();
this
.
lym_dbg_path
=
gd
.
getNextString
();
this
.
lym_overexp
=
gd
.
getNextNumber
();
this
.
lym_update_disp
=
gd
.
getNextBoolean
();
this
.
lym_iter
=
(
int
)
gd
.
getNextNumber
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/CLTPass3d.java
View file @
6293946d
...
...
@@ -902,7 +902,9 @@ public class CLTPass3d{
*/
public
void
updateDisparity
()
{
setTileOpDisparity
(
null
,
getDisparity
(
0
));
if
(
disparity_map
!=
null
)
{
setTileOpDisparity
(
null
,
getDisparity
(
0
));
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/CorrVector.java
View file @
6293946d
...
...
@@ -1101,8 +1101,12 @@ matrix([[-0.125, -0.125, 0.125, 0.125, -0.125, 0.125, -0. , -0. , -0.
}
}
if
(
par_list
.
size
()
<
par_mask
.
length
)
{
int
[]
sub_pars
=
par_list
.
stream
().
mapToInt
(
i
->
i
).
toArray
();
// Java8
from_sym
=
from_sym
.
getMatrix
(
0
,
par_mask
.
length
,
sub_pars
);
// remove masked columns
int
[]
sub_pars
=
new
int
[
par_list
.
size
()];
for
(
int
i
=
0
;
i
<
sub_pars
.
length
;
i
++)
{
sub_pars
[
i
]
=
par_list
.
get
(
i
);
}
// int[] sub_pars = par_list.stream().mapToInt(i -> i).toArray(); // Java8
from_sym
=
from_sym
.
getMatrix
(
0
,
par_mask
.
length
-
1
,
sub_pars
);
// remove masked columns
}
}
Matrix
pcd
=
new
Matrix
(
port_coord_deriv
);
// rows: px0,py0,... px[n-1], py[n-1], columns: tar
...
...
@@ -1187,7 +1191,7 @@ matrix([[-0.125, -0.125, 0.125, 0.125, -0.125, 0.125, -0. , -0. , -0.
}
if
(
par_list
.
size
()
<
par_mask
.
length
)
{
int
[]
sub_pars
=
par_list
.
stream
().
mapToInt
(
i
->
i
).
toArray
();
// Java8
to_sym
=
to_sym
.
getMatrix
(
sub_pars
,
0
,
par_mask
.
length
);
// remove masked rows
to_sym
=
to_sym
.
getMatrix
(
sub_pars
,
0
,
par_mask
.
length
-
1
);
// remove masked rows
}
}
Matrix
tar
=
new
Matrix
(
tar_array
,
tar_array
.
length
);
...
...
@@ -1209,7 +1213,7 @@ matrix([[-0.125, -0.125, 0.125, 0.125, -0.125, 0.125, -0. , -0. , -0.
}
if
(
par_list
.
size
()
<
par_mask
.
length
)
{
int
[]
sub_pars
=
par_list
.
stream
().
mapToInt
(
i
->
i
).
toArray
();
// Java8
from_sym
=
from_sym
.
getMatrix
(
0
,
par_mask
.
length
,
sub_pars
);
// remove masked columns
from_sym
=
from_sym
.
getMatrix
(
0
,
par_mask
.
length
-
1
,
sub_pars
);
// remove masked columns
}
}
Matrix
sym
=
new
Matrix
(
sym_array
,
sym_array
.
length
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/ExtrinsicAdjustment.java
View file @
6293946d
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
6293946d
...
...
@@ -2806,7 +2806,36 @@ public class GeometryCorrection {
return
jt
;
}
public
double
[][]
getPortsXYDerivativesNew
(
// USED in lwir
GeometryCorrection
gc_main
,
boolean
use_rig_offsets
,
Matrix
[]
rots
,
Matrix
[][]
deriv_rots
,
double
[]
py_offset
,
// array of per-port average pY offset from the center (to correct ERS) or null (for no ERS)
double
[]
imu
,
// may be null
double
[]
xyz
,
// world XYZ for ERS correction
double
px
,
double
py
,
double
disparity
)
{
// make sure initPrePostMatrices(true) already ran (in constructor). (true) means that minus sign is already incorporated
double
[][]
pXYNDderiv
=
new
double
[
2
*
numSensors
][];
// CorrVector.LENGTH][];
getPortsNonDistortedCoordinatesAndDerivativesNew
(
// USED in lwir
gc_main
,
use_rig_offsets
,
rots
,
deriv_rots
,
pXYNDderiv
,
// if not null, should be double[8][]
py_offset
,
// // array of per-port average pY offset from the center (to correct ERS) or null (for no ERS)
imu
,
xyz
,
px
,
py
,
disparity
);
return
(
new
Matrix
(
pXYNDderiv
)).
getArray
();
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
6293946d
...
...
@@ -4042,6 +4042,28 @@ public class ImageDttCPU {
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
tIndex
]
=
ds
[
0
][
1
];
if
(
debugTile0
)
{
lma2
.
printStats
(
ds
,
1
);
double
[][]
ddnd
=
lma2
.
getDdNd
();
if
(
ddnd
!=
null
)
{
double
[][]
dxy
=
new
double
[
ddnd
.
length
][
2
];
for
(
int
i
=
0
;
i
<
dxy
.
length
;
i
++)
{
dxy
[
i
][
0
]
=
ddnd
[
i
][
0
]
*
rXY
[
i
][
0
]
-
ddnd
[
i
][
1
]
*
rXY
[
i
][
1
];
dxy
[
i
][
1
]
=
ddnd
[
i
][
0
]
*
rXY
[
i
][
1
]
+
ddnd
[
i
][
1
]
*
rXY
[
i
][
0
];
}
System
.
out
.
print
(
" Port: "
);
for
(
int
i
=
0
;
i
<
dxy
.
length
;
i
++)
System
.
out
.
print
(
String
.
format
(
" %2d "
,
i
));
System
.
out
.
println
();
System
.
out
.
print
(
"Radial_in = ["
);
for
(
int
i
=
0
;
i
<
dxy
.
length
;
i
++)
System
.
out
.
print
(
String
.
format
(
" %6.3f,"
,
ddnd
[
i
][
0
]));
System
.
out
.
println
(
"]"
);
System
.
out
.
print
(
"Tangent_CW = ["
);
for
(
int
i
=
0
;
i
<
dxy
.
length
;
i
++)
System
.
out
.
print
(
String
.
format
(
" %6.3f,"
,
ddnd
[
i
][
1
]));
System
.
out
.
println
(
"]"
);
System
.
out
.
print
(
"X = ["
);
for
(
int
i
=
0
;
i
<
dxy
.
length
;
i
++)
System
.
out
.
print
(
String
.
format
(
" %6.3f,"
,
dxy
[
i
][
0
]));
System
.
out
.
println
(
"]"
);
System
.
out
.
print
(
"Y = ["
);
for
(
int
i
=
0
;
i
<
dxy
.
length
;
i
++)
System
.
out
.
print
(
String
.
format
(
" %6.3f,"
,
dxy
[
i
][
1
]));
System
.
out
.
println
(
"]"
);
System
.
out
.
println
();
}
}
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
6293946d
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/SymmVector.java
View file @
6293946d
...
...
@@ -103,7 +103,7 @@ public class SymmVector {
full_type2
,
debug_level
);
rvs
.
xy
=
sv
.
exportXY
();
rvs
.
rt
=
sv
.
exportRT
();
rvs
.
rt
=
sv
.
exportRT
();
// radius/tangential (out, cw, out, cw
rvs
.
dir_rt
=
sv
.
exportDirRT
();
rvs
.
rots
=
sv
.
exportRZ
(
false
);
// include common roll
rvs
.
zooms
=
sv
.
exportRZ
(
true
);
// no common zoom
...
...
@@ -1152,8 +1152,9 @@ public class SymmVector {
for
(
int
i
=
0
;
i
<
N
-
1
;
i
++)
{
xy2ta
.
set
(
i
,
2
*
i
+
1
,
TILT_SIGN
);
xy2ta
.
set
(
N
-
1
+
i
,
2
*
i
+
0
,
AZIMUTH_SIGN
);
}
return
xy2ta
.
times
(
sym2xy
);
}
Matrix
sym2ta
=
xy2ta
.
times
(
sym2xy
);
return
sym2ta
;
}
/**
...
...
@@ -1195,6 +1196,7 @@ public class SymmVector {
to_sym
.
setMatrix
(
i1
,
i2
-
1
,
i1
,
i2
-
1
,
sym2roll
.
inverse
());
to_sym
.
setMatrix
(
i2
,
i3
-
1
,
i2
,
i3
-
1
,
sym2zoom
.
inverse
());
to_sym
.
setMatrix
(
i3
,
i4
-
1
,
i3
,
i4
-
1
,
sym2ers
.
inverse
());
// Matrix dbg = from_sym.times(to_sym);
return
new
Matrix
[]
{
from_sym
,
to_sym
};
}
//getColumnDimension
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
6293946d
...
...
@@ -9495,41 +9495,49 @@ if (debugLevel > -100) return true; // temporarily !
System
.
out
.
println
(
"Building basic DSI for the AUX camera image set "
+
quadCLT_main
.
image_name
+
" using main camera DSI, pass "
+(
num_adjust_aux
+
1
)+
" of "
+
adjust_aux
);
}
quadCLT_aux
.
preExpandCLTQuad3d
(
// returns ImagePlus, but it already should be saved/shown
imp_srcs_aux
,
// [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp_aux
,
// boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters
,
debayerParameters
,
colorProcParameters_aux
,
rgbParameters
,
threadsMax
,
// maximal number of threads to launch
updateStatus
,
debugLevelInner
);
// adjust extrinsics here
System
.
out
.
println
(
"Adjust AUX extrinsics here"
);
if
(
updateStatus
)
IJ
.
showStatus
(
"Adjusting AUX camera image set for "
+
quadCLT_aux
.
image_name
+
", pass "
+(
num_adjust_aux
+
1
)+
" of "
+
adjust_aux
);
if
(
debugLevel
>
-
5
)
{
System
.
out
.
println
(
"Adjusting AUX camera image set for "
+
quadCLT_aux
.
image_name
+
", pass "
+(
num_adjust_aux
+
1
)+
" of "
+
adjust_aux
);
}
String
dbg_path
=
clt_parameters
.
lym_dbg_path
;
// /home/elphel/lwir16-proc/proc1/results_cuda/25/extrinsics_bgnd_combo.tif
if
(
dbg_path
.
length
()==
0
)
{
dbg_path
=
null
;
}
// dbg_path = "/home/elphel/lwir16-proc/proc1/results_cuda/25/extrinsics_bgnd_combo.tif";
if
(
dbg_path
==
null
)
{
quadCLT_aux
.
preExpandCLTQuad3d
(
// returns ImagePlus, but it already should be saved/shown
imp_srcs_aux
,
// [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp_aux
,
// boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters
,
debayerParameters
,
colorProcParameters_aux
,
rgbParameters
,
threadsMax
,
// maximal number of threads to launch
updateStatus
,
debugLevelInner
);
// adjust extrinsics here
System
.
out
.
println
(
"Adjust AUX extrinsics here"
);
if
(
updateStatus
)
IJ
.
showStatus
(
"Adjusting AUX camera image set for "
+
quadCLT_aux
.
image_name
+
", pass "
+(
num_adjust_aux
+
1
)+
" of "
+
adjust_aux
);
if
(
debugLevel
>
-
5
)
{
System
.
out
.
println
(
"Adjusting AUX camera image set for "
+
quadCLT_aux
.
image_name
+
", pass "
+(
num_adjust_aux
+
1
)+
" of "
+
adjust_aux
);
}
}
if
(
quadCLT_aux
.
ds_from_main
==
null
)
{
System
.
out
.
println
(
"BUG: quadCLT_aux.ds_from_main should be not null here!"
);
double
inf_min
=
-
1.0
;
double
inf_max
=
1.0
;
if
(
num_adjust_aux
>=
(
adjust_aux
/
2
))
{
inf_min
=
-
0.2
;
inf_max
=
0.
05
;
inf_max
=
0.
2
;
// 0.05; Changed for LWIR16
}
// adjust w/o main camera - maybe will be used in the future
boolean
ok
=
quadCLT_aux
.
extrinsicsCLT
(
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
dbg_path
,
false
,
// adjust_poly,
inf_min
,
// double inf_min,
inf_max
,
// double inf_max,
threadsMax
,
//final int threadsMax, // maximal number of threads to launch
updateStatus
,
// final boolean updateStatus,
debugLevelInner
);
// final int debugLevel)
1
);
//
debugLevelInner); // final int debugLevel)
if
(!
ok
)
break
;
}
else
{
boolean
ok
=
quadCLT_aux
.
extrinsicsCLTfromGT
(
...
...
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