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
b5f3d42a
Commit
b5f3d42a
authored
Jul 12, 2018
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using main camera -only DSI in the model where aux camera is occluded
parent
dbd2a71c
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
778 additions
and
139 deletions
+778
-139
BiQuadParameters.java
src/main/java/BiQuadParameters.java
+33
-7
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+83
-3
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+66
-13
GeometryCorrection.java
src/main/java/GeometryCorrection.java
+91
-85
ImageDtt.java
src/main/java/ImageDtt.java
+13
-2
QuadCLT.java
src/main/java/QuadCLT.java
+12
-4
TwoQuadCLT.java
src/main/java/TwoQuadCLT.java
+480
-25
No files found.
src/main/java/BiQuadParameters.java
View file @
b5f3d42a
...
...
@@ -237,9 +237,13 @@ public class BiQuadParameters {
public
double
rf_min_disp
=
0.02
;
// Minimal tile disparity to keep in scan
public
boolean
rf_remove_unselected
=
true
;
// Remove tiles that are not selected
public
boolean
oc_fill_aux_occl
=
true
;
// Fill rig DSI gaps non-zero for the main camera
public
double
oc_min_disparity
=
15
;
// Tile occlusions can only happen for near objects
public
double
oc_min_strength
=
0.1
;
// Minimal main camera strength
public
boolean
ml_generate
=
false
;
// Generate ML data automatically when running ground truth
// public boolean ml_generate = false; // Generate ML data automatically when running ground truth - MOVED to BATCH parameters
public
boolean
ml_poles
=
true
;
// Generate ML data from the DSI that includes extracted poles
public
boolean
ml_copyJP4
=
true
;
// Copy source jp4 files when running "Ground truth" command
...
...
@@ -631,11 +635,17 @@ public class BiQuadParameters {
"Minimal disparity (in master camera pixels) for the tile to be saved for plane extraction"
);
gd
.
addCheckbox
(
"Remove tiles that are not selected"
,
this
.
rf_remove_unselected
,
"Remove (set strength to 0.0, disparity to Double.NaN for all tiles that are not selected"
);
gd
.
addCheckbox
(
"Fill rig gaps by the main camera"
,
this
.
oc_fill_aux_occl
,
"Areas where aux camera image is occluded"
);
gd
.
addNumericField
(
"Minimal main camera disparity to use for rig DSI gaps"
,
this
.
oc_min_disparity
,
3
,
6
,
"pix"
,
"Legitimate full tile occlusions can happen for near objects only"
);
gd
.
addNumericField
(
"Minimal main camera strength to fill rig DSI gaps"
,
this
.
oc_min_strength
,
3
,
6
,
""
,
"Filter out too weak replacements"
);
gd
.
addTab
(
"ML"
,
"Parameters related to the ML files generation for the dual-quad camera rig"
);
gd
.
addCheckbox
(
"Generate ML data automatically"
,
this
.
ml_generate
,
"Generate ML data automatically when running ground truth (may run separately from a command button)"
);
//
gd.addCheckbox ("Generate ML data automatically", this.ml_generate,
//
"Generate ML data automatically when running ground truth (may run separately from a command button)");
gd
.
addCheckbox
(
"Generate ML data from the DSI that includes extracted poles"
,
this
.
ml_poles
,
"If unchecked - use DSI w/o poles data"
);
gd
.
addCheckbox
(
"Copy JP4 source images when generating ML data"
,
this
.
ml_copyJP4
,
...
...
@@ -853,8 +863,12 @@ public class BiQuadParameters {
this
.
rf_min_disp
=
gd
.
getNextNumber
();
this
.
rf_remove_unselected
=
gd
.
getNextBoolean
();
this
.
oc_fill_aux_occl
=
gd
.
getNextBoolean
();
this
.
oc_min_disparity
=
gd
.
getNextNumber
();
this
.
oc_min_strength
=
gd
.
getNextNumber
();
this
.
ml_generate
=
gd
.
getNextBoolean
();
//
this.ml_generate= gd.getNextBoolean();
this
.
ml_poles
=
gd
.
getNextBoolean
();
this
.
ml_copyJP4
=
gd
.
getNextBoolean
();
...
...
@@ -1061,7 +1075,11 @@ public class BiQuadParameters {
properties
.
setProperty
(
prefix
+
"rf_min_disp"
,
this
.
rf_min_disp
+
""
);
properties
.
setProperty
(
prefix
+
"rf_remove_unselected"
,
this
.
rf_remove_unselected
+
""
);
properties
.
setProperty
(
prefix
+
"ml_generate"
,
this
.
ml_generate
+
""
);
properties
.
setProperty
(
prefix
+
"oc_fill_aux_occl"
,
this
.
oc_fill_aux_occl
+
""
);
properties
.
setProperty
(
prefix
+
"oc_min_disparity"
,
this
.
oc_min_disparity
+
""
);
properties
.
setProperty
(
prefix
+
"oc_min_strength"
,
this
.
oc_min_strength
+
""
);
// properties.setProperty(prefix+"ml_generate", this.ml_generate+"");
properties
.
setProperty
(
prefix
+
"ml_poles"
,
this
.
ml_poles
+
""
);
properties
.
setProperty
(
prefix
+
"ml_copyJP4"
,
this
.
ml_copyJP4
+
""
);
properties
.
setProperty
(
prefix
+
"ml_hwidth"
,
this
.
ml_hwidth
+
""
);
...
...
@@ -1264,7 +1282,11 @@ public class BiQuadParameters {
if
(
properties
.
getProperty
(
prefix
+
"rf_min_disp"
)!=
null
)
this
.
rf_min_disp
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"rf_min_disp"
));
if
(
properties
.
getProperty
(
prefix
+
"rf_remove_unselected"
)!=
null
)
this
.
rf_remove_unselected
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"rf_remove_unselected"
));
if
(
properties
.
getProperty
(
prefix
+
"ml_generate"
)!=
null
)
this
.
ml_generate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ml_generate"
));
if
(
properties
.
getProperty
(
prefix
+
"oc_fill_aux_occl"
)!=
null
)
this
.
oc_fill_aux_occl
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"oc_fill_aux_occl"
));
if
(
properties
.
getProperty
(
prefix
+
"oc_min_disparity"
)!=
null
)
this
.
oc_min_disparity
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"oc_min_disparity"
));
if
(
properties
.
getProperty
(
prefix
+
"oc_min_strength"
)!=
null
)
this
.
oc_min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"oc_min_strength"
));
// if (properties.getProperty(prefix+"ml_generate")!=null) this.ml_generate=Boolean.parseBoolean(properties.getProperty(prefix+"ml_generate"));
if
(
properties
.
getProperty
(
prefix
+
"ml_poles"
)!=
null
)
this
.
ml_poles
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ml_poles"
));
if
(
properties
.
getProperty
(
prefix
+
"ml_copyJP4"
)!=
null
)
this
.
ml_copyJP4
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ml_copyJP4"
));
if
(
properties
.
getProperty
(
prefix
+
"ml_hwidth"
)!=
null
)
this
.
ml_hwidth
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ml_hwidth"
));
...
...
@@ -1468,7 +1490,11 @@ public class BiQuadParameters {
bqp
.
rf_min_disp
=
this
.
rf_min_disp
;
bqp
.
rf_remove_unselected
=
this
.
rf_remove_unselected
;
bqp
.
ml_generate
=
this
.
ml_generate
;
bqp
.
oc_fill_aux_occl
=
this
.
oc_fill_aux_occl
;
bqp
.
oc_min_disparity
=
this
.
oc_min_disparity
;
bqp
.
oc_min_strength
=
this
.
oc_min_strength
;
// bqp.ml_generate= this.ml_generate;
bqp
.
ml_poles
=
this
.
ml_poles
;
bqp
.
ml_copyJP4
=
this
.
ml_copyJP4
;
bqp
.
ml_hwidth
=
this
.
ml_hwidth
;
...
...
src/main/java/EyesisCorrectionParameters.java
View file @
b5f3d42a
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
b5f3d42a
...
...
@@ -583,6 +583,8 @@ private Panel panel1,
// addButton("CLT 2*4 images", panelClt4, color_conf_process);
// addButton("CLT 2*4 images - 2", panelClt4, color_conf_process);
// addButton("CLT 2*4 images - 3", panelClt4, color_conf_process);
addButton
(
"Rig offset"
,
panelClt4
,
color_configure
);
addButton
(
"Save offset"
,
panelClt4
,
color_process
);
addButton
(
"SHOW extrinsics"
,
panelClt4
,
color_configure
);
addButton
(
"RIG DSI"
,
panelClt4
,
color_conf_process
);
addButton
(
"MAIN extrinsics"
,
panelClt4
,
color_process
);
...
...
@@ -1171,6 +1173,12 @@ private Panel panel1,
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Save offset"
))
{
saveInfinityOffsets
(
null
,
CORRECTION_PARAMETERS
.
resultsDirectory
);
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Restore"
))
{
String
path
=
loadProperties
(
null
,
CORRECTION_PARAMETERS
.
resultsDirectory
,
true
,
PROPERTIES
);
if
(
path
!=
null
)
{
...
...
@@ -3703,6 +3711,12 @@ private Panel panel1,
if
(!
CLT_PARAMETERS
.
modifyZCorr
(
"Modify infinity per image set disparity corrections"
))
break
;
}
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Rig offset"
))
{
while
(
true
)
{
if
(!
CLT_PARAMETERS
.
modifyInfCorr
(
"Modify infinity offset per image set disparity corrections"
))
break
;
}
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Select CLT image"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
...
...
@@ -5360,19 +5374,6 @@ private Panel panel1,
public
boolean
batchRig
()
{
long
startTime
=
System
.
nanoTime
();
/* if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null) || (QUAD_CLT.tp.clt_3d_passes.size() == 0)) {
boolean OK = clt3d(
false, // boolean adjust_extrinsics,
false); // boolean adjust_poly);
if (! OK) {
String msg = "DSI data is not available and \"CLT 3D\" failed";
IJ.showMessage("Error",msg);
System.out.println(msg);
return false;
}
}
*/
// load needed sensor and kernels files
if
(!
prepareRigImages
())
return
false
;
String
configPath
=
getSaveCongigPath
();
...
...
@@ -6709,7 +6710,59 @@ private Panel panel1,
}
public
void
saveInfinityOffsets
(
String
path
,
// full path or null
String
directory
)
{
// use as default directory if path==null
String
[]
patterns
=
{
".corr-xml"
,
".xml"
};
if
(
path
==
null
)
{
path
=
selectFile
(
true
,
// save
"Save configuration selection"
,
// title
"Select configuration file"
,
// button
new
MultipleExtensionsFileFilter
(
patterns
,
"XML Configuration files (*.corr-xml)"
),
// filter
directory
);
// may be ""
}
else
path
+=
patterns
[
0
];
if
(
path
==
null
)
return
;
Properties
properties
=
new
Properties
();
CLT_PARAMETERS
.
setPropertiesInfinityDistance
(
"CLT_PARAMETERS."
,
properties
);
// setAllProperties(properties);
OutputStream
os
;
try
{
os
=
new
FileOutputStream
(
path
);
}
catch
(
FileNotFoundException
e1
)
{
// missing config directory
File
dir
=
(
new
File
(
path
)).
getParentFile
();
if
(!
dir
.
exists
()){
dir
.
mkdirs
();
try
{
os
=
new
FileOutputStream
(
path
);
}
catch
(
FileNotFoundException
e2
)
{
IJ
.
showMessage
(
"Error"
,
"Failed to create directory "
+
dir
.
getName
()+
" to save configuration file: "
+
path
);
return
;
}
}
else
{
IJ
.
showMessage
(
"Error"
,
"Failed to open configuration file: "
+
path
);
return
;
}
}
try
{
properties
.
storeToXML
(
os
,
"last updated "
+
new
java
.
util
.
Date
(),
"UTF8"
);
}
catch
(
IOException
e
)
{
IJ
.
showMessage
(
"Error"
,
"Failed to write XML configuration file: "
+
path
);
return
;
}
try
{
os
.
close
();
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
if
(
DEBUG_LEVEL
>
-
3
)
System
.
out
.
println
(
"Configuration parameters are saved to "
+
path
);
}
/* ======================================================================== */
...
...
src/main/java/GeometryCorrection.java
View file @
b5f3d42a
...
...
@@ -154,6 +154,7 @@ public class GeometryCorrection {
return
ro
.
getParNorm
(
index
);
}
public
double
[]
getRigCorrection
(
double
infinity_importance
,
// of all measurements
double
dx_max
,
// = 0.3;
...
...
@@ -165,6 +166,7 @@ public class GeometryCorrection {
boolean
adjust_distance
,
boolean
adjust_forward
,
// not used
double
scale_correction
,
double
infinity_disparity
,
ArrayList
<
Integer
>
tile_list
,
QuadCLT
qc_main
,
double
[]
strength
,
...
...
@@ -184,6 +186,7 @@ public class GeometryCorrection {
adjust_distance
,
// boolean adjust_distance,
adjust_forward
,
// boolean adjust_forward, // not used
scale_correction
,
// double scale_correction,
infinity_disparity
,
// double infinity_disparity,
tile_list
,
// ArrayList<Integer> tile_list,
qc_main
,
// QuadCLT qc_main,
strength
,
// double [] strength,
...
...
@@ -192,6 +195,7 @@ public class GeometryCorrection {
target_disparity
,
// double [] target_disparity,
debugLevel
);
// int debugLevel)
}
// correction of cameras mis-alignment
public
CorrVector
getCorrVector
(
double
[]
vector
){
return
new
CorrVector
(
vector
);
...
...
@@ -376,87 +380,6 @@ public class GeometryCorrection {
}
recalcRXY
();
}
public
double
setupYW
(
double
infinity_importance
,
// of all measurements
double
dx_max
,
// = 0.3;
double
dx_pow
,
// = 1.0;
ArrayList
<
Integer
>
tile_list
,
QuadCLT
qc
,
double
[]
strength
,
double
[]
diff_x
,
// used only with target_disparity == 0
double
[]
diff_y
,
double
[]
target_disparity
)
{
y_vector
=
new
double
[
2
*
tile_list
.
size
()];
w_vector
=
new
double
[
2
*
tile_list
.
size
()];
xy_vector
=
new
double
[
2
*
tile_list
.
size
()];
d_vector
=
new
double
[
tile_list
.
size
()];
tile_vector
=
new
int
[
tile_list
.
size
()];
boolean
[]
is_inf
=
new
boolean
[
tile_list
.
size
()];
double
sumw_inf
=
0.0
,
sumw_near
=
0.0
;
double
sum2_inf
=
0.0
,
sum2_near
=
0.0
;
int
tilesX
=
qc
.
tp
.
getTilesX
();
double
tileSize
=
qc
.
tp
.
getTileSize
();
// double dx_max = 0.2;
// double dx_pow = 1.0;
for
(
int
i
=
0
;
i
<
tile_list
.
size
();
i
++)
{
int
nTile
=
tile_list
.
get
(
i
);
int
tileY
=
nTile
/
tilesX
;
int
tileX
=
nTile
%
tilesX
;
double
w
=
strength
[
nTile
];
double
inf_w_corr
=
1.0
;
if
((
dx_max
>
0
)
&&
(
dx_pow
>
0
)){
inf_w_corr
=
(
dx_max
-
diff_x
[
nTile
])/
dx_max
;
if
(
inf_w_corr
<
0.0
)
inf_w_corr
=
0.0
;
// favor negative (more infinity)
if
(
dx_pow
!=
1.0
)
{
inf_w_corr
=
Math
.
pow
(
inf_w_corr
,
dx_pow
);
}
}
if
(
target_disparity
[
nTile
]
==
0.0
)
{
// only for infinity tiles
w
*=
inf_w_corr
;
y_vector
[
2
*
i
+
0
]
=
diff_x
[
nTile
];
w_vector
[
2
*
i
+
0
]
=
w
;
y_vector
[
2
*
i
+
1
]
=
diff_y
[
nTile
];
w_vector
[
2
*
i
+
1
]
=
w
;
sumw_inf
+=
2
*
w
;
sum2_inf
+=
w
*(
diff_x
[
nTile
]*
diff_x
[
nTile
]+
diff_y
[
nTile
]*
diff_y
[
nTile
]);
is_inf
[
i
]
=
true
;
}
else
{
y_vector
[
2
*
i
+
1
]
=
diff_y
[
nTile
];
w_vector
[
2
*
i
+
1
]
=
w
;
sumw_near
+=
w
;
sum2_near
+=
w
*
diff_y
[
nTile
]*
diff_y
[
nTile
];
}
xy_vector
[
2
*
i
+
0
]
=
(
tileX
+
0.5
)
*
tileSize
;
xy_vector
[
2
*
i
+
1
]
=
(
tileY
+
0.5
)
*
tileSize
;
d_vector
[
i
]
=
target_disparity
[
nTile
];
tile_vector
[
i
]
=
nTile
;
}
if
(
infinity_importance
>
1.0
)
infinity_importance
=
1.0
;
else
if
(
infinity_importance
<
0.0
)
infinity_importance
=
0.0
;
double
k_inf
=
0.0
,
k_near
=
0.0
;
if
((
sumw_inf
>
0.0
)
&&
(
sumw_near
>
0.0
)){
k_inf
=
infinity_importance
/
sumw_inf
;
k_near
=
(
1.0
-
infinity_importance
)/
sumw_near
;
}
else
if
(
sumw_inf
>
0.0
){
infinity_importance
=
1.0
;
k_inf
=
infinity_importance
/
sumw_inf
;
}
else
if
(
sumw_near
>
0.0
)
{
infinity_importance
=
0.0
;
k_near
=
(
1.0
-
infinity_importance
)/
sumw_near
;
}
double
sum2
=
k_inf
*
sum2_inf
+
k_near
*
sum2_near
;
for
(
int
i
=
0
;
i
<
is_inf
.
length
;
i
++)
{
if
(
is_inf
[
i
])
{
w_vector
[
2
*
i
+
0
]
*=
k_inf
;
w_vector
[
2
*
i
+
1
]
*=
k_inf
;
}
else
{
w_vector
[
2
*
i
+
1
]
*=
k_near
;
}
}
return
Math
.
sqrt
(
sum2
);
// RMS
}
double
[][]
getJacobianTransposed
(
GeometryCorrection
gc_main
,
...
...
@@ -585,6 +508,7 @@ public class GeometryCorrection {
boolean
adjust_distance
,
boolean
adjust_forward
,
// not used
double
scale_correction
,
double
infinity_disparity
,
ArrayList
<
Integer
>
tile_list
,
QuadCLT
qc_main
,
double
[]
strength
,
...
...
@@ -604,6 +528,7 @@ public class GeometryCorrection {
infinity_importance
,
// of all measurements
dx_max
,
// double dx_max, // = 0.3;
dx_pow
,
// double dx_pow, // = 1.0;
infinity_disparity
,
// double infinity_disparity,
tile_list
,
qc_main
,
strength
,
...
...
@@ -692,10 +617,91 @@ public class GeometryCorrection {
return
vector
;
}
// public double [] getAuxOffset() {
// double [] aux_offset= {baseline * Math.cos(aux_angle)/getDisparityRadius(), baseline * Math.sin(aux_angle)/getDisparityRadius()};
// return aux_offset;
// }
public
double
setupYW
(
double
infinity_importance
,
// of all measurements
double
dx_max
,
// = 0.3;
double
dx_pow
,
// = 1.0;
double
infinity_disparity
,
ArrayList
<
Integer
>
tile_list
,
QuadCLT
qc
,
double
[]
strength
,
double
[]
diff_x
,
// used only with target_disparity == 0
double
[]
diff_y
,
double
[]
target_disparity
)
{
y_vector
=
new
double
[
2
*
tile_list
.
size
()];
w_vector
=
new
double
[
2
*
tile_list
.
size
()];
xy_vector
=
new
double
[
2
*
tile_list
.
size
()];
d_vector
=
new
double
[
tile_list
.
size
()];
tile_vector
=
new
int
[
tile_list
.
size
()];
boolean
[]
is_inf
=
new
boolean
[
tile_list
.
size
()];
double
sumw_inf
=
0.0
,
sumw_near
=
0.0
;
double
sum2_inf
=
0.0
,
sum2_near
=
0.0
;
int
tilesX
=
qc
.
tp
.
getTilesX
();
double
tileSize
=
qc
.
tp
.
getTileSize
();
// double dx_max = 0.2;
// double dx_pow = 1.0;
for
(
int
i
=
0
;
i
<
tile_list
.
size
();
i
++)
{
int
nTile
=
tile_list
.
get
(
i
);
int
tileY
=
nTile
/
tilesX
;
int
tileX
=
nTile
%
tilesX
;
double
w
=
strength
[
nTile
];
double
inf_w_corr
=
1.0
;
if
((
dx_max
>
0
)
&&
(
dx_pow
>
0
)){
inf_w_corr
=
(
dx_max
-
diff_x
[
nTile
])/
dx_max
;
if
(
inf_w_corr
<
0.0
)
inf_w_corr
=
0.0
;
// favor negative (more infinity)
if
(
dx_pow
!=
1.0
)
{
inf_w_corr
=
Math
.
pow
(
inf_w_corr
,
dx_pow
);
}
}
if
(
target_disparity
[
nTile
]
==
infinity_disparity
)
{
// only for infinity tiles
w
*=
inf_w_corr
;
y_vector
[
2
*
i
+
0
]
=
diff_x
[
nTile
];
w_vector
[
2
*
i
+
0
]
=
w
;
y_vector
[
2
*
i
+
1
]
=
diff_y
[
nTile
];
w_vector
[
2
*
i
+
1
]
=
w
;
sumw_inf
+=
2
*
w
;
sum2_inf
+=
w
*(
diff_x
[
nTile
]*
diff_x
[
nTile
]+
diff_y
[
nTile
]*
diff_y
[
nTile
]);
is_inf
[
i
]
=
true
;
}
else
{
y_vector
[
2
*
i
+
1
]
=
diff_y
[
nTile
];
w_vector
[
2
*
i
+
1
]
=
w
;
sumw_near
+=
w
;
sum2_near
+=
w
*
diff_y
[
nTile
]*
diff_y
[
nTile
];
}
xy_vector
[
2
*
i
+
0
]
=
(
tileX
+
0.5
)
*
tileSize
;
xy_vector
[
2
*
i
+
1
]
=
(
tileY
+
0.5
)
*
tileSize
;
d_vector
[
i
]
=
target_disparity
[
nTile
];
tile_vector
[
i
]
=
nTile
;
}
if
(
infinity_importance
>
1.0
)
infinity_importance
=
1.0
;
else
if
(
infinity_importance
<
0.0
)
infinity_importance
=
0.0
;
double
k_inf
=
0.0
,
k_near
=
0.0
;
if
((
sumw_inf
>
0.0
)
&&
(
sumw_near
>
0.0
)){
k_inf
=
infinity_importance
/
sumw_inf
;
k_near
=
(
1.0
-
infinity_importance
)/
sumw_near
;
}
else
if
(
sumw_inf
>
0.0
){
infinity_importance
=
1.0
;
k_inf
=
infinity_importance
/
sumw_inf
;
}
else
if
(
sumw_near
>
0.0
)
{
infinity_importance
=
0.0
;
k_near
=
(
1.0
-
infinity_importance
)/
sumw_near
;
}
System
.
out
.
println
(
"setupYW(): k_inf="
+
k_inf
+
" k_near="
+
k_near
);
double
sum2
=
k_inf
*
sum2_inf
+
k_near
*
sum2_near
;
for
(
int
i
=
0
;
i
<
is_inf
.
length
;
i
++)
{
if
(
is_inf
[
i
])
{
w_vector
[
2
*
i
+
0
]
*=
k_inf
;
w_vector
[
2
*
i
+
1
]
*=
k_inf
;
}
else
{
w_vector
[
2
*
i
+
1
]
*=
k_near
;
}
}
return
Math
.
sqrt
(
sum2
);
// RMS
}
public
void
recalcRXY
()
{
if
(
rXY
!=
null
)
{
// rXY_aux = rXY; // FIXME: put real stuff !!!
...
...
src/main/java/ImageDtt.java
View file @
b5f3d42a
...
...
@@ -7589,6 +7589,8 @@ public class ImageDtt {
final
double
[][][][][][]
clt_kernels_aux
,
// [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
final
double
corr_magic_scale
,
// still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
final
boolean
keep_clt_data
,
final
int
[][]
woi_tops
,
final
double
[][][]
ers_delay
,
// if not null - fill with tile center acquisition delay
final
int
threadsMax
,
// maximal number of threads to launch
final
int
debugLevel
)
{
...
...
@@ -7717,8 +7719,12 @@ public class ImageDtt {
}
}
// final double [] corr_max_weights_poly =(((clt_parameters.max_corr_sigma > 0) && (disparity_bimap != null))?
// setMaxXYWeights(clt_parameters.max_corr_sigma,max_search_radius_poly): null); // here use square anyway
if
(
ers_delay
!=
null
)
{
ers_delay
[
0
]
=
new
double
[
quad_main
][];
for
(
int
i
=
0
;
i
<
quad_main
;
i
++)
ers_delay
[
0
][
i
]
=
new
double
[
tilesX
*
tilesY
];
ers_delay
[
1
]
=
new
double
[
quad_aux
][];
for
(
int
i
=
0
;
i
<
quad_aux
;
i
++)
ers_delay
[
1
][
i
]
=
new
double
[
tilesX
*
tilesY
];
}
dtt
.
set_window
(
clt_parameters
.
clt_window
);
final
double
[]
lt_window
=
dtt
.
getWin2d
();
// [256]
...
...
@@ -7820,6 +7826,11 @@ public class ImageDtt {
centerX
,
centerY
,
disparity_aux
);
// + disparity_corr);
// acquisition time of the tiles centers in scanline times
if
(
ers_delay
!=
null
)
{
for
(
int
i
=
0
;
i
<
quad_main
;
i
++)
ers_delay
[
0
][
i
][
nTile
]
=
centersXY_main
[
i
][
1
]-
woi_tops
[
0
][
i
];
for
(
int
i
=
0
;
i
<
quad_aux
;
i
++)
ers_delay
[
1
][
i
][
nTile
]
=
centersXY_aux
[
i
][
1
]-
woi_tops
[
1
][
i
];
}
if
((
globalDebugLevel
>
0
)
&&
(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
))
{
for
(
int
i
=
0
;
i
<
quad_main
;
i
++)
{
...
...
src/main/java/QuadCLT.java
View file @
b5f3d42a
...
...
@@ -80,6 +80,7 @@ public class QuadCLT {
double
[][][]
image_data
=
null
;
boolean
[][]
saturation_imp
=
null
;
// (near) saturated pixels or null
boolean
is_aux
=
false
;
int
[]
woi_tops
;
// used to calculate scanline timing
// magic scale should be set before using TileProcessor (calculated disparities depend on it)
...
...
@@ -2671,6 +2672,7 @@ public class QuadCLT {
}
ImagePlus
[]
imp_srcs
=
new
ImagePlus
[
channelFiles
.
length
];
this
.
woi_tops
=
new
int
[
channelFiles
.
length
];
double
[]
scaleExposures
=
new
double
[
channelFiles
.
length
];
for
(
int
srcChannel
=
0
;
srcChannel
<
channelFiles
.
length
;
srcChannel
++){
int
nFile
=
channelFiles
[
srcChannel
];
...
...
@@ -2705,6 +2707,7 @@ public class QuadCLT {
imp_srcs
[
srcChannel
],
// ImagePlus imp_src,
eyesisCorrections
.
pixelMapping
.
sensors
[
srcChannel
].
getSensorWH
(),
true
);
// boolean replicate);
woi_tops
[
srcChannel
]
=
Integer
.
parseInt
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"WOI_TOP"
));
scaleExposures
[
srcChannel
]
=
1.0
;
if
(!
Double
.
isNaN
(
referenceExposures
[
nFile
])
&&
(
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
)!=
null
)){
scaleExposures
[
srcChannel
]
=
referenceExposures
[
nFile
]/
Double
.
parseDouble
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
));
...
...
@@ -3364,6 +3367,7 @@ public class QuadCLT {
int
debugLevel
)
{
ImagePlus
[]
imp_srcs
=
new
ImagePlus
[
channelFiles
.
length
];
this
.
woi_tops
=
new
int
[
channelFiles
.
length
];
// double [] scaleExposures = new double[channelFiles.length]; //
double
[][]
dbg_dpixels
=
new
double
[
channelFiles
.
length
][];
// int [] fullWindowWH = geometryCorrection.getSensorWH();
...
...
@@ -3400,10 +3404,12 @@ public class QuadCLT {
}
// imp_srcs[srcChannel].show(); // REMOVE ME!
woi_tops
[
srcChannel
]
=
Integer
.
parseInt
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"WOI_TOP"
));
imp_srcs
[
srcChannel
]
=
padBayerToFullSize
(
imp_srcs
[
srcChannel
],
// ImagePlus imp_src,
eyesisCorrections
.
pixelMapping
.
sensors
[
srcChannel
].
getSensorWH
(),
true
);
// boolean replicate);
scaleExposures
[
srcChannel
]
=
1.0
;
if
(!
Double
.
isNaN
(
referenceExposures
[
nFile
])
&&
(
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
)!=
null
)){
scaleExposures
[
srcChannel
]
=
referenceExposures
[
nFile
]/
Double
.
parseDouble
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
));
...
...
@@ -4863,6 +4869,7 @@ public class QuadCLT {
}
ImagePlus
[]
imp_srcs
=
new
ImagePlus
[
channelFiles
.
length
];
this
.
woi_tops
=
new
int
[
channelFiles
.
length
];
boolean
[][]
saturation_imp
=
(
clt_parameters
.
sat_level
>
0.0
)?
new
boolean
[
channelFiles
.
length
][]
:
null
;
double
[]
scaleExposures
=
new
double
[
channelFiles
.
length
];
for
(
int
srcChannel
=
0
;
srcChannel
<
channelFiles
.
length
;
srcChannel
++){
...
...
@@ -4898,6 +4905,7 @@ public class QuadCLT {
imp_srcs
[
srcChannel
],
// ImagePlus imp_src,
eyesisCorrections
.
pixelMapping
.
sensors
[
srcChannel
].
getSensorWH
(),
true
);
// boolean replicate);
woi_tops
[
srcChannel
]
=
Integer
.
parseInt
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"WOI_TOP"
));
scaleExposures
[
srcChannel
]
=
1.0
;
if
(!
Double
.
isNaN
(
referenceExposures
[
nFile
])
&&
(
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
)!=
null
)){
scaleExposures
[
srcChannel
]
=
referenceExposures
[
nFile
]/
Double
.
parseDouble
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
));
...
...
@@ -6670,7 +6678,7 @@ public class QuadCLT {
}
double
[][][]
new_corr
;
final
double
inf_max_disparity
=
2.0
;
//
final double inf_max_disparity = 2.0;
double
[][][]
gt_disparity_strength
=
{
rig_disp_strength
};
new_corr
=
ac
.
lazyEyeCorrectionFromGT
(
geometryCorrection_main
,
//final GeometryCorrection geometryCorrection_main, // if not null - this is an AUX camera of a rig
...
...
@@ -6700,7 +6708,7 @@ public class QuadCLT {
clt_parameters
.
ih_min_samples
,
// 10, // final int hist_min_samples,
clt_parameters
.
ih_norm_center
,
// true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with
clt_parameters
.
ly_inf_frac
,
// 0.5, // final double inf_fraction, // fraction of the weight for the infinity tiles
inf_max_disparity
,
// final double inf_max_disparity, // use all smaller disparities as inf_fraction
clt_parameters
.
ly_inf_max_disparity
,
//
inf_max_disparity, // final double inf_max_disparity, // use all smaller disparities as inf_fraction
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
scans14
,
// disp_strength, // scans, // double [][] disp_strength,
gt_disparity_strength
,
// double [][][] gt_disparity_strength, // 1 pair for each 14 entries of scans_14 (normally - just 1 scan
...
...
@@ -8706,8 +8714,7 @@ public class QuadCLT {
}
ImagePlus
[]
imp_srcs
=
new
ImagePlus
[
channelFiles
.
length
];
/// boolean [][] saturation_imp = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles.length][] : null;
/// double [] scaleExposures = new double[channelFiles.length]; //
this
.
woi_tops
=
new
int
[
channelFiles
.
length
];
double
[][]
dbg_dpixels
=
batch_mode
?
null
:
(
new
double
[
channelFiles
.
length
][]);
for
(
int
srcChannel
=
0
;
srcChannel
<
channelFiles
.
length
;
srcChannel
++){
...
...
@@ -8743,6 +8750,7 @@ public class QuadCLT {
imp_srcs
[
srcChannel
],
// ImagePlus imp_src,
eyesisCorrections
.
pixelMapping
.
sensors
[
srcChannel
].
getSensorWH
(),
true
);
// boolean replicate);
woi_tops
[
srcChannel
]
=
Integer
.
parseInt
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"WOI_TOP"
));
scaleExposures
[
srcChannel
]
=
1.0
;
if
(!
Double
.
isNaN
(
referenceExposures
[
nFile
])
&&
(
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
)!=
null
)){
scaleExposures
[
srcChannel
]
=
referenceExposures
[
nFile
]/
Double
.
parseDouble
((
String
)
imp_srcs
[
srcChannel
].
getProperty
(
"EXPOSURE"
));
...
...
src/main/java/TwoQuadCLT.java
View file @
b5f3d42a
This diff is collapsed.
Click to expand it.
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