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
38b6b0d7
Commit
38b6b0d7
authored
Aug 07, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved splitting sequences
parent
f7907c7d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
249 additions
and
32 deletions
+249
-32
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+46
-0
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+197
-29
TexturedModel.java
...n/java/com/elphel/imagej/tileprocessor/TexturedModel.java
+6
-3
No files found.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
38b6b0d7
...
@@ -261,6 +261,12 @@ public class IntersceneMatchParameters {
...
@@ -261,6 +261,12 @@ public class IntersceneMatchParameters {
public
double
fpn_radius
=
0.75
;
// pix - zero around center
public
double
fpn_radius
=
0.75
;
// pix - zero around center
public
boolean
fpn_ignore_border
=
false
;
// only if fpn_mask != null - ignore tile if maximum touches fpn_mask
public
boolean
fpn_ignore_border
=
false
;
// only if fpn_mask != null - ignore tile if maximum touches fpn_mask
public
double
min_offset
=
1.5
;
// pixels - minimal average pixel offset between images to consider interscene matching
public
double
max_rel_offset
=
0.5
;
// maximal interscene offset as a fraction of image width
public
double
max_roll_deg
=
10.0
;
// maximal interscene roll to consider matching
public
boolean
fpn_skip
=
true
;
// skip too close scenes (false - abort, previous behavior)
public
boolean
fpn_rematch
=
true
;
// match fpn-failed scenes to later scenes with larger difference
// Remove moving objects (goal is not to detect slightest movement, but to improve pose matching
// Remove moving objects (goal is not to detect slightest movement, but to improve pose matching
public
boolean
mov_en
=
true
;
// enable detection/removal of the moving objects during pose matching
public
boolean
mov_en
=
true
;
// enable detection/removal of the moving objects during pose matching
public
double
mov_sigma
=
1.5
;
// pix - weighted-blur offsets before detection
public
double
mov_sigma
=
1.5
;
// pix - weighted-blur offsets before detection
...
@@ -793,6 +799,18 @@ public class IntersceneMatchParameters {
...
@@ -793,6 +799,18 @@ public class IntersceneMatchParameters {
gd
.
addCheckbox
(
"Ignore maximums \"touching\" FPN"
,
this
.
fpn_ignore_border
,
gd
.
addCheckbox
(
"Ignore maximums \"touching\" FPN"
,
this
.
fpn_ignore_border
,
"Discard TD integrated tiles where local maximum is a neighbor (including diagonal) to blanked FPN correlation pixels"
);
"Discard TD integrated tiles where local maximum is a neighbor (including diagonal) to blanked FPN correlation pixels"
);
gd
.
addMessage
(
"Limit series, handle FPN-related problems"
);
gd
.
addNumericField
(
"Minimal inter-scene offset"
,
this
.
min_offset
,
6
,
7
,
"pix"
,
"Minimal average pixel offset between images to consider interscene matching"
);
gd
.
addNumericField
(
"Maximal interscene offset fraction of width"
,
this
.
max_rel_offset
,
6
,
7
,
"x width"
,
"Maximal interscene offset as a fraction of image width to handle low overlap"
);
gd
.
addNumericField
(
"Maximal interscene roll"
,
this
.
max_roll_deg
,
6
,
7
,
"degrees"
,
"Maximal interscene roll to consider matching"
);
gd
.
addCheckbox
(
"Skip too close to reference scenes"
,
this
.
fpn_skip
,
"Skip too close to reference scenes (false - abort, previous behavior)"
);
gd
.
addCheckbox
(
"Match FPN-failed with other scenes"
,
this
.
fpn_rematch
,
"Match fpn-failed scenes to later scenes with larger difference"
);
gd
.
addMessage
(
"Detect and remove moving objects from pose matching"
);
gd
.
addMessage
(
"Detect and remove moving objects from pose matching"
);
gd
.
addCheckbox
(
"Enable movement detection/elimination"
,
this
.
mov_en
,
gd
.
addCheckbox
(
"Enable movement detection/elimination"
,
this
.
mov_en
,
"Detect and mask areas with detected movement to improve pose matching"
);
"Detect and mask areas with detected movement to improve pose matching"
);
...
@@ -1167,6 +1185,13 @@ public class IntersceneMatchParameters {
...
@@ -1167,6 +1185,13 @@ public class IntersceneMatchParameters {
this
.
fpn_max_offset
=
gd
.
getNextNumber
();
this
.
fpn_max_offset
=
gd
.
getNextNumber
();
this
.
fpn_radius
=
gd
.
getNextNumber
();
this
.
fpn_radius
=
gd
.
getNextNumber
();
this
.
fpn_ignore_border
=
gd
.
getNextBoolean
();
this
.
fpn_ignore_border
=
gd
.
getNextBoolean
();
this
.
min_offset
=
gd
.
getNextNumber
();
this
.
max_rel_offset
=
gd
.
getNextNumber
();
this
.
max_roll_deg
=
gd
.
getNextNumber
();
this
.
fpn_skip
=
gd
.
getNextBoolean
();
this
.
fpn_rematch
=
gd
.
getNextBoolean
();
this
.
mov_en
=
gd
.
getNextBoolean
();
this
.
mov_en
=
gd
.
getNextBoolean
();
this
.
mov_sigma
=
gd
.
getNextNumber
();
this
.
mov_sigma
=
gd
.
getNextNumber
();
this
.
mov_max_std
=
gd
.
getNextNumber
();
this
.
mov_max_std
=
gd
.
getNextNumber
();
...
@@ -1494,6 +1519,13 @@ public class IntersceneMatchParameters {
...
@@ -1494,6 +1519,13 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"fpn_max_offset"
,
this
.
fpn_max_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"fpn_max_offset"
,
this
.
fpn_max_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"fpn_radius"
,
this
.
fpn_radius
+
""
);
// double
properties
.
setProperty
(
prefix
+
"fpn_radius"
,
this
.
fpn_radius
+
""
);
// double
properties
.
setProperty
(
prefix
+
"fpn_ignore_border"
,
this
.
fpn_ignore_border
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"fpn_ignore_border"
,
this
.
fpn_ignore_border
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"min_offset"
,
this
.
min_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_rel_offset"
,
this
.
max_rel_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_roll_deg"
,
this
.
max_roll_deg
+
""
);
// double
properties
.
setProperty
(
prefix
+
"fpn_skip"
,
this
.
fpn_skip
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"fpn_rematch"
,
this
.
fpn_rematch
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"mov_en"
,
this
.
mov_en
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"mov_en"
,
this
.
mov_en
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"mov_sigma"
,
this
.
mov_sigma
+
""
);
// double
properties
.
setProperty
(
prefix
+
"mov_sigma"
,
this
.
mov_sigma
+
""
);
// double
properties
.
setProperty
(
prefix
+
"mov_max_std"
,
this
.
mov_max_std
+
""
);
// double
properties
.
setProperty
(
prefix
+
"mov_max_std"
,
this
.
mov_max_std
+
""
);
// double
...
@@ -1779,6 +1811,13 @@ public class IntersceneMatchParameters {
...
@@ -1779,6 +1811,13 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"fpn_max_offset"
)!=
null
)
this
.
fpn_max_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"fpn_max_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_max_offset"
)!=
null
)
this
.
fpn_max_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"fpn_max_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_radius"
)!=
null
)
this
.
fpn_radius
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"fpn_radius"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_radius"
)!=
null
)
this
.
fpn_radius
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"fpn_radius"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
)!=
null
)
this
.
fpn_ignore_border
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
)!=
null
)
this
.
fpn_ignore_border
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
));
if
(
properties
.
getProperty
(
prefix
+
"min_offset"
)!=
null
)
this
.
min_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"max_rel_offset"
)!=
null
)
this
.
max_rel_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_rel_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"max_roll_deg"
)!=
null
)
this
.
max_roll_deg
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_roll_deg"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_skip"
)!=
null
)
this
.
fpn_skip
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"fpn_skip"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_rematch"
)!=
null
)
this
.
fpn_rematch
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"fpn_rematch"
));
if
(
properties
.
getProperty
(
prefix
+
"mov_en"
)!=
null
)
this
.
mov_en
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"mov_en"
));
if
(
properties
.
getProperty
(
prefix
+
"mov_en"
)!=
null
)
this
.
mov_en
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"mov_en"
));
if
(
properties
.
getProperty
(
prefix
+
"mov_sigma"
)!=
null
)
this
.
mov_sigma
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"mov_sigma"
));
if
(
properties
.
getProperty
(
prefix
+
"mov_sigma"
)!=
null
)
this
.
mov_sigma
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"mov_sigma"
));
if
(
properties
.
getProperty
(
prefix
+
"mov_max_std"
)!=
null
)
this
.
mov_max_std
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"mov_max_std"
));
if
(
properties
.
getProperty
(
prefix
+
"mov_max_std"
)!=
null
)
this
.
mov_max_std
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"mov_max_std"
));
...
@@ -2074,6 +2113,13 @@ public class IntersceneMatchParameters {
...
@@ -2074,6 +2113,13 @@ public class IntersceneMatchParameters {
imp
.
fpn_max_offset
=
this
.
fpn_max_offset
;
imp
.
fpn_max_offset
=
this
.
fpn_max_offset
;
imp
.
fpn_radius
=
this
.
fpn_radius
;
imp
.
fpn_radius
=
this
.
fpn_radius
;
imp
.
fpn_ignore_border
=
this
.
fpn_ignore_border
;
imp
.
fpn_ignore_border
=
this
.
fpn_ignore_border
;
imp
.
min_offset
=
this
.
min_offset
;
imp
.
max_rel_offset
=
this
.
max_rel_offset
;
imp
.
max_roll_deg
=
this
.
max_roll_deg
;
imp
.
fpn_skip
=
this
.
fpn_skip
;
imp
.
fpn_rematch
=
this
.
fpn_rematch
;
imp
.
mov_en
=
this
.
mov_en
;
imp
.
mov_en
=
this
.
mov_en
;
imp
.
mov_sigma
=
this
.
mov_sigma
;
imp
.
mov_sigma
=
this
.
mov_sigma
;
imp
.
mov_max_std
=
this
.
mov_max_std
;
imp
.
mov_max_std
=
this
.
mov_max_std
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
38b6b0d7
...
@@ -85,6 +85,14 @@ public class OpticalFlow {
...
@@ -85,6 +85,14 @@ public class OpticalFlow {
public
static
int
COMBO_DSN_INDX_DISP_FG
=
9
;
// cumulative disparity (from CM or POLY), FG
public
static
int
COMBO_DSN_INDX_DISP_FG
=
9
;
// cumulative disparity (from CM or POLY), FG
public
static
int
COMBO_DSN_INDX_DISP_BG_ALL
=
10
;
// cumulative BG disparity (Use FG where no BG is available)
public
static
int
COMBO_DSN_INDX_DISP_BG_ALL
=
10
;
// cumulative BG disparity (Use FG where no BG is available)
public
static
int
COMBO_DSN_INDX_BLUE_SKY
=
11
;
// Detected featureless infinity (sky)
public
static
int
COMBO_DSN_INDX_BLUE_SKY
=
11
;
// Detected featureless infinity (sky)
// interscene adjustments failure reasons.
public
static
int
FAIL_REASON_LMA
=
1
;
// LMA failed
public
static
int
FAIL_REASON_INTERSCENE
=
2
;
// clt_process_tl_interscene() returned null
public
static
int
FAIL_REASON_MIN
=
3
;
// average pixel offset is below specified threshold (FPN)
public
static
int
FAIL_REASON_MAX
=
4
;
// average pixel offset is above specified threshold (overlap)
public
static
int
FAIL_REASON_NULL
=
5
;
// null offsets array
public
static
int
FAIL_REASON_EMPTY
=
6
;
// No offset pairs in offsets array
public
static
int
FAIL_REASON_ROLL
=
7
;
// Too high roll between the images
public
static
double
[]
ZERO3
=
{
0.0
,
0.0
,
0.0
};
public
static
double
[]
ZERO3
=
{
0.0
,
0.0
,
0.0
};
public
static
double
LINE_ERR
=
0.1
;
public
static
double
LINE_ERR
=
0.1
;
...
@@ -3531,6 +3539,8 @@ public class OpticalFlow {
...
@@ -3531,6 +3539,8 @@ public class OpticalFlow {
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
...
@@ -4511,6 +4521,19 @@ public class OpticalFlow {
...
@@ -4511,6 +4521,19 @@ public class OpticalFlow {
double
[]
lma_rms
=
new
double
[
2
];
double
[]
lma_rms
=
new
double
[
2
];
double
[]
use_atr
=
null
;
double
[]
use_atr
=
null
;
int
tilesX
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTilesX
();
// int tilesY = quadCLTs[ref_index].getTileProcessor().getTilesY();
int
tile_size
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTileSize
();
double
min_offset
=
0.0
;
// clt_parameters.imp.min_offset;
double
max_offset
=
clt_parameters
.
imp
.
max_rel_offset
*
tilesX
*
tile_size
;
double
max_roll
=
clt_parameters
.
imp
.
max_roll_deg
*
Math
.
PI
/
180.0
;
boolean
fpn_skip
=
clt_parameters
.
imp
.
fpn_skip
;
// if false - fail as before
boolean
fpn_rematch
=
clt_parameters
.
imp
.
fpn_rematch
;
// if false - keep previous
double
[]
min_max
=
{
min_offset
,
max_offset
,
0.0
}
;
// {min, max, actual rms)
int
[]
fail_reason
=
new
int
[
1
];
// null or int[1]: 0 - OK, 2 - LMA, 3 - min, 4 - max
for
(
int
scene_index
=
ref_index
-
1
;
scene_index
>=
0
;
scene_index
--)
{
for
(
int
scene_index
=
ref_index
-
1
;
scene_index
>=
0
;
scene_index
--)
{
// to include ref scene photometric calibration
// to include ref scene photometric calibration
quadCLTs
[
scene_index
]
=
quadCLTs
[
ref_index
].
spawnNoModelQuadCLT
(
quadCLTs
[
scene_index
]
=
quadCLTs
[
ref_index
].
spawnNoModelQuadCLT
(
...
@@ -4561,6 +4584,8 @@ public class OpticalFlow {
...
@@ -4561,6 +4584,8 @@ public class OpticalFlow {
}
}
QuadCLT
scene_QuadClt
=
quadCLTs
[
scene_index
];
QuadCLT
scene_QuadClt
=
quadCLTs
[
scene_index
];
// get initial xyzatr:
// get initial xyzatr:
// TODO:repeat spiralSearchATR if found scene was too close
if
(
scene_index
==
ref_index
-
1
)
{
// search around for the best fit
if
(
scene_index
==
ref_index
-
1
)
{
// search around for the best fit
use_atr
=
spiralSearchATR
(
use_atr
=
spiralSearchATR
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
...
@@ -4613,6 +4638,8 @@ public class OpticalFlow {
...
@@ -4613,6 +4638,8 @@ public class OpticalFlow {
scenes_xyzatr
[
scene_index
]
=
adjustPairsLMAInterscene
(
scenes_xyzatr
[
scene_index
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
quadCLTs
[
ref_index
],
// QuadCLT reference_QuadCLT,
quadCLTs
[
ref_index
],
// QuadCLT reference_QuadCLT,
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// double [] ref_disparity, // null or alternative reference disparity
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
...
@@ -4626,6 +4653,41 @@ public class OpticalFlow {
...
@@ -4626,6 +4653,41 @@ public class OpticalFlow {
lma_rms
,
// double [] rms, // null or double [2]
lma_rms
,
// double [] rms, // null or double [2]
clt_parameters
.
imp
.
max_rms
,
// double max_rms,
clt_parameters
.
imp
.
max_rms
,
// double max_rms,
clt_parameters
.
imp
.
debug_level
);
// 1); // -1); // int debug_level);
clt_parameters
.
imp
.
debug_level
);
// 1); // -1); // int debug_level);
boolean
adjust_OK
=
scenes_xyzatr
[
scene_index
]
!=
null
;
if
(
adjust_OK
&&
(
Math
.
abs
(
scenes_xyzatr
[
scene_index
][
1
][
2
])
>
max_roll
))
{
fail_reason
[
0
]
=
FAIL_REASON_ROLL
;
adjust_OK
=
false
;
}
// FAIL_REASON_ROLL
if
(!
adjust_OK
)
{
boolean
OK
=
false
;
System
.
out
.
println
(
"LMA failed at nscene = "
+
scene_index
+
". Reason = "
+
fail_reason
[
0
]);
if
(
fail_reason
[
0
]==
FAIL_REASON_MIN
)
{
if
(
fpn_skip
)
{
System
.
out
.
println
(
"fpn_skip is set, just skipping this scene"
);
continue
;
// to next scene
}
else
{
System
.
out
.
println
(
"fpn_skip is not set, aborting series and adjusting earliest_scene"
);
// set this and all previous to null
}
}
// all other reasons lead to failure
earliest_scene
=
scene_index
+
1
;
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"Pass multi scene "
+
scene_index
+
" (of "
+
quadCLTs
.
length
+
") "
+
quadCLTs
[
ref_index
].
getImageName
()
+
"/"
+
scene_QuadClt
.
getImageName
()+
" FAILED. Setting earliest_scene to "
+
earliest_scene
+
" Failure reason: "
+
fail_reason
[
0
]);
}
// set this and all previous to null
for
(;
scene_index
>=
0
;
scene_index
--)
{
ers_reference
.
addScene
(
quadCLTs
[
scene_index
].
getImageName
(),
null
);
// quadCLTs[scene_index] = null; // completely remove early scenes?
}
break
;
}
/* old version
if (scenes_xyzatr[scene_index] == null) {
if (scenes_xyzatr[scene_index] == null) {
earliest_scene = scene_index + 1;
earliest_scene = scene_index + 1;
if (debugLevel > -3) {
if (debugLevel > -3) {
...
@@ -4639,7 +4701,7 @@ public class OpticalFlow {
...
@@ -4639,7 +4701,7 @@ public class OpticalFlow {
}
}
break;
break;
}
}
*/
// TODO: Maybe after testing high-ers scenes - restore velocities from before/after scenes
// TODO: Maybe after testing high-ers scenes - restore velocities from before/after scenes
ers_reference
.
addScene
(
scene_QuadClt
.
getImageName
(),
ers_reference
.
addScene
(
scene_QuadClt
.
getImageName
(),
scenes_xyzatr
[
scene_index
][
0
],
scenes_xyzatr
[
scene_index
][
0
],
...
@@ -6563,6 +6625,8 @@ public class OpticalFlow {
...
@@ -6563,6 +6625,8 @@ public class OpticalFlow {
double
[][]
adjusted_xyzatr
=
adjustPairsLMAInterscene
(
double
[][]
adjusted_xyzatr
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
quadCLTs
[
other_ref
[
1
]],
// QuadCLT reference_QuadCLT,
quadCLTs
[
other_ref
[
1
]],
// QuadCLT reference_QuadCLT,
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
...
@@ -7034,6 +7098,8 @@ public class OpticalFlow {
...
@@ -7034,6 +7098,8 @@ public class OpticalFlow {
false
,
// use3D, // boolean use3D, // generate disparity difference
false
,
// use3D, // boolean use3D, // generate disparity difference
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
0
,
// mb_max_gain, // double mb_max_gain,
0
,
// mb_max_gain, // double mb_max_gain,
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
ref_disparity
,
// null, // double [] ref_disparity, // null or alternative reference disparity
ref_disparity
,
// null, // double [] ref_disparity, // null or alternative reference disparity
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene 11653
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene 11653
...
@@ -7309,6 +7375,8 @@ public class OpticalFlow {
...
@@ -7309,6 +7375,8 @@ public class OpticalFlow {
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
...
@@ -7420,6 +7488,8 @@ public class OpticalFlow {
...
@@ -7420,6 +7488,8 @@ public class OpticalFlow {
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
...
@@ -7563,6 +7633,8 @@ public class OpticalFlow {
...
@@ -7563,6 +7633,8 @@ public class OpticalFlow {
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
scenes_xyzatr
[
i
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// double [] ref_disparity, // null or alternative reference disparity
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
null
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
...
@@ -12262,7 +12334,7 @@ public class OpticalFlow {
...
@@ -12262,7 +12334,7 @@ public class OpticalFlow {
* Get average X,Y offsets between inter-scene correlated tiles
* Get average X,Y offsets between inter-scene correlated tiles
* to eliminate correlation between FPN of the same sensor.
* to eliminate correlation between FPN of the same sensor.
* @param max_offset maximal X, Y offset to keep (normally tile size == 8)
* @param max_offset maximal X, Y offset to keep (normally tile size == 8)
* @param tp_tasks_ref reference t
i
asks (should be updated from GPU to have
* @param tp_tasks_ref reference tasks (should be updated from GPU to have
* actual X,Y for each sensor
* actual X,Y for each sensor
* @param tp_tasks scene correlated to the reference, should also have
* @param tp_tasks scene correlated to the reference, should also have
* per-sensor coordinates
* per-sensor coordinates
...
@@ -12322,7 +12394,8 @@ public class OpticalFlow {
...
@@ -12322,7 +12394,8 @@ public class OpticalFlow {
}
}
sx
/=
numSens
;
sx
/=
numSens
;
sy
/=
numSens
;
sy
/=
numSens
;
if
((
Math
.
abs
(
sx
)
<=
max_offset
)
&&
(
Math
.
abs
(
sy
)
<=
max_offset
))
{
// if ((Math.abs(sx) <= max_offset) && (Math.abs(sy) <= max_offset )) {
if
(!(
Math
.
abs
(
sx
)
>
max_offset
)
&&
!(
Math
.
abs
(
sy
)
>
max_offset
))
{
// max_offset== NaN OK
offsets
[
tile
]
=
new
double
[]
{
sx
,
sy
};
offsets
[
tile
]
=
new
double
[]
{
sx
,
sy
};
anum_pairs
.
getAndIncrement
();
anum_pairs
.
getAndIncrement
();
}
}
...
@@ -12492,6 +12565,8 @@ public class OpticalFlow {
...
@@ -12492,6 +12565,8 @@ public class OpticalFlow {
boolean
use3D
,
// generate disparity difference
boolean
use3D
,
// generate disparity difference
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
double
mb_max_gain
,
double
mb_max_gain
,
double
[]
min_max
,
// null or pair of minimal and maximal offsets
int
[]
fail_reason
,
// null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
QuadCLT
ref_scene
,
QuadCLT
ref_scene
,
double
[]
ref_disparity
,
// null or alternative reference disparity
double
[]
ref_disparity
,
// null or alternative reference disparity
double
[][]
pXpYD_ref
,
// pXpYD for the reference scene
double
[][]
pXpYD_ref
,
// pXpYD for the reference scene
...
@@ -12854,7 +12929,50 @@ public class OpticalFlow {
...
@@ -12854,7 +12929,50 @@ public class OpticalFlow {
tilesX
,
// final int tilesX,
tilesX
,
// final int tilesX,
tilesY
);
// final int tilesY);
tilesY
);
// final int tilesY);
}
}
// Verify offsets before running LMA, return null and reason if test fails.
if
(
min_max
!=
null
)
{
double
[][]
offsets
=
getInterCorrOffsets
(
Double
.
NaN
,
// final double max_offset,
tp_tasks_ref
,
// final TpTask[] tp_tasks_ref,
tp_tasks
[
0
],
// final TpTask[] tp_tasks,
ref_scene
.
getNumSensors
(),
// final int numSens,
tilesX
,
// final int tilesX,
tilesY
);
// final int tilesY);
if
(
offsets
==
null
)
{
if
(
fail_reason
!=
null
)
{
fail_reason
[
0
]=
FAIL_REASON_NULL
;
}
return
null
;
}
double
avg_offs2
=
0
;
double
sw
=
0
;
for
(
double
[]
offs:
offsets
)
if
(
offs
!=
null
)
{
double
w
=
1.0
;
avg_offs2
+=
w
*
(
offs
[
0
]
*
offs
[
0
]
+
offs
[
1
]
*
offs
[
1
]);
sw
+=
w
;
}
if
(
sw
==
0
)
{
if
(
fail_reason
!=
null
)
{
fail_reason
[
0
]=
FAIL_REASON_EMPTY
;
}
}
double
avg_offs
=
Math
.
sqrt
(
avg_offs2
/
sw
);
if
(
min_max
.
length
>
2
)
{
min_max
[
2
]
=
avg_offs
;
}
if
(
avg_offs
<
min_max
[
0
])
{
// NaN - do not check;
if
(
fail_reason
!=
null
)
{
fail_reason
[
0
]=
FAIL_REASON_MIN
;
}
return
null
;
}
if
(
avg_offs
>
min_max
[
1
])
{
// NaN - do not check;
if
(
fail_reason
!=
null
)
{
fail_reason
[
0
]=
FAIL_REASON_MAX
;
}
return
null
;
}
}
double
half_disparity
=
near_important
?
0.0
:
clt_parameters
.
imp
.
half_disparity
;
double
half_disparity
=
near_important
?
0.0
:
clt_parameters
.
imp
.
half_disparity
;
double
[][][]
dcorr_tiles
=
(
fclt_corr
!=
null
)?
(
new
double
[
tp_tasks
[
0
].
length
][][]):
null
;
double
[][][]
dcorr_tiles
=
(
fclt_corr
!=
null
)?
(
new
double
[
tp_tasks
[
0
].
length
][][]):
null
;
// will use num_acc with variable number of accumulations (e.g. clusters)
// will use num_acc with variable number of accumulations (e.g. clusters)
...
@@ -12908,6 +13026,9 @@ public class OpticalFlow {
...
@@ -12908,6 +13026,9 @@ public class OpticalFlow {
// final int globalDebugLevel);
// final int globalDebugLevel);
if
(
coord_motion
==
null
)
{
if
(
coord_motion
==
null
)
{
System
.
out
.
println
(
"clt_process_tl_interscene() returned null"
);
System
.
out
.
println
(
"clt_process_tl_interscene() returned null"
);
if
(
fail_reason
!=
null
)
{
fail_reason
[
0
]=
FAIL_REASON_INTERSCENE
;
}
return
null
;
return
null
;
}
}
if
(
use3D
)
{
//(scene_disparity_strength != null)
if
(
use3D
)
{
//(scene_disparity_strength != null)
...
@@ -13122,8 +13243,10 @@ public class OpticalFlow {
...
@@ -13122,8 +13243,10 @@ public class OpticalFlow {
System
.
out
.
println
(
"interCorrPair(): num_defined = "
+
num_defined
+
System
.
out
.
println
(
"interCorrPair(): num_defined = "
+
num_defined
+
", sum_strength = "
+
sum_strength
+
", avg_strength = "
+(
sum_strength
/
num_defined
));
", sum_strength = "
+
sum_strength
+
", avg_strength = "
+(
sum_strength
/
num_defined
));
}
}
if
(
fail_reason
!=
null
)
{
return
coord_motion
;
fail_reason
[
0
]=
0
;
}
return
coord_motion
;
// here non-null
}
}
...
@@ -13948,6 +14071,7 @@ public class OpticalFlow {
...
@@ -13948,6 +14071,7 @@ public class OpticalFlow {
double
half_run_range
=
clt_parameters
.
ilp
.
ilma_motion_filter
;
// 3.50; // make a parameter
double
half_run_range
=
clt_parameters
.
ilp
.
ilma_motion_filter
;
// 3.50; // make a parameter
double
[][]
dbg_scale_dt
=
{
clt_parameters
.
ilp
.
ilma_scale_xyz
,
clt_parameters
.
ilp
.
ilma_scale_atr
};
double
[][]
dbg_scale_dt
=
{
clt_parameters
.
ilp
.
ilma_scale_xyz
,
clt_parameters
.
ilp
.
ilma_scale_atr
};
boolean
debug_ers
=
clt_parameters
.
ilp
.
ilma_debug_ers
;
// true;
boolean
debug_ers
=
clt_parameters
.
ilp
.
ilma_debug_ers
;
// true;
String
dbg_ers_string
=
String
dbg_ers_string
=
((
dbg_scale_dt
[
1
][
0
]
>
0
)?
"a"
:((
dbg_scale_dt
[
1
][
0
]
<
0
)
?
"A"
:
"0"
))+
((
dbg_scale_dt
[
1
][
0
]
>
0
)?
"a"
:((
dbg_scale_dt
[
1
][
0
]
<
0
)
?
"A"
:
"0"
))+
((
dbg_scale_dt
[
1
][
1
]
>
0
)?
"t"
:((
dbg_scale_dt
[
1
][
1
]
<
0
)
?
"T"
:
"0"
))+
((
dbg_scale_dt
[
1
][
1
]
>
0
)?
"t"
:((
dbg_scale_dt
[
1
][
1
]
<
0
)
?
"T"
:
"0"
))+
...
@@ -13977,6 +14101,15 @@ public class OpticalFlow {
...
@@ -13977,6 +14101,15 @@ public class OpticalFlow {
int
ref_index
=
quadCLTs
.
length
-
1
;
int
ref_index
=
quadCLTs
.
length
-
1
;
int
tilesX
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTilesX
();
int
tilesX
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTilesX
();
int
tilesY
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTilesY
();
int
tilesY
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTilesY
();
int
tile_size
=
quadCLTs
[
ref_index
].
getTileProcessor
().
getTileSize
();
double
min_offset
=
clt_parameters
.
imp
.
min_offset
;
double
max_offset
=
clt_parameters
.
imp
.
max_rel_offset
*
tilesX
*
tile_size
;
double
max_roll
=
clt_parameters
.
imp
.
max_roll_deg
*
Math
.
PI
/
180.0
;
boolean
fpn_skip
=
clt_parameters
.
imp
.
fpn_skip
;
// if false - fail as before
boolean
fpn_rematch
=
clt_parameters
.
imp
.
fpn_rematch
;
// if false - keep previous
double
[]
min_max
=
{
min_offset
,
max_offset
,
0.0
}
;
// {min, max, actual rms)
int
[]
fail_reason
=
new
int
[
1
];
// null or int[1]: 0 - OK, 2 - LMA, 3 - min, 4 - max
double
[]
disparity_raw
=
new
double
[
tilesX
*
tilesY
];
double
[]
disparity_raw
=
new
double
[
tilesX
*
tilesY
];
Arrays
.
fill
(
disparity_raw
,
clt_parameters
.
disparity
);
Arrays
.
fill
(
disparity_raw
,
clt_parameters
.
disparity
);
/// double [][] combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
/// double [][] combo_dsn_final = quadCLTs[ref_index].readDoubleArrayFromModelDirectory(
...
@@ -14249,10 +14382,8 @@ public class OpticalFlow {
...
@@ -14249,10 +14382,8 @@ public class OpticalFlow {
}
}
}
}
boolean
fpn_disable
=
false
;
// estimate they are too close
boolean
fpn_disable
=
false
;
// estimate they are too close
// double angle_per_pixel = reference_QuadClt.getGeometryCorrection().getCorrVector().getTiltAzPerPixel() * pix_step;
double
angle_per_pixel
=
ers_reference
.
getCorrVector
().
getTiltAzPerPixel
();
double
angle_per_pixel
=
ers_reference
.
getCorrVector
().
getTiltAzPerPixel
();
//ers_reference
//ers_reference
// double [][] scene_xyzatr_pull = new double [][] {scene_xyz_pre.clone(),scene_atr_pre.clone()};
double
[][]
diff_pull
=
new
double
[
2
][
3
];
double
[][]
diff_pull
=
new
double
[
2
][
3
];
for
(
int
j
=
0
;
j
<
diff_pull
.
length
;
j
++)
{
for
(
int
j
=
0
;
j
<
diff_pull
.
length
;
j
++)
{
for
(
int
k
=
0
;
k
<
diff_pull
[
j
].
length
;
k
++)
{
for
(
int
k
=
0
;
k
<
diff_pull
[
j
].
length
;
k
++)
{
...
@@ -14260,9 +14391,10 @@ public class OpticalFlow {
...
@@ -14260,9 +14391,10 @@ public class OpticalFlow {
}
}
}
}
double
[][]
scene_pull
=
ErsCorrection
.
combineXYZATR
(
scene_xyzatr
,
diff_pull
);
double
[][]
scene_pull
=
ErsCorrection
.
combineXYZATR
(
scene_xyzatr
,
diff_pull
);
// temporary! TODO: replace with smooth version
// double [] min_max = new double[3]; // {min, max, actual rms)
// double [] scene_xyz_pull = scene_xyz_pre.clone();
// int [] fail_reason = new int[1]; // null or int[1]: 0 - OK, 2 - LMA, 3 - min, 4 - max
// double [] scene_atr_pull = scene_atr_pre.clone();
if
(
mb_en
)
{
if
(
mb_en
)
{
// double [][] dxyzatr_dt_scene = getVelocities(
// double [][] dxyzatr_dt_scene = getVelocities(
// quadCLTs, // QuadCLT [] quadCLTs,
// quadCLTs, // QuadCLT [] quadCLTs,
...
@@ -14283,6 +14415,8 @@ public class OpticalFlow {
...
@@ -14283,6 +14415,8 @@ public class OpticalFlow {
scenes_xyzatr
[
nscene
]
=
adjustPairsLMAInterscene
(
scenes_xyzatr
[
nscene
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
fpn_disable
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
fpn_disable
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
quadCLTs
[
ref_index
],
// QuadCLT reference_QuadCLT,
quadCLTs
[
ref_index
],
// QuadCLT reference_QuadCLT,
interscene_ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
interscene_ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
ref_pXpYD
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
ref_pXpYD
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
...
@@ -14302,13 +14436,30 @@ public class OpticalFlow {
...
@@ -14302,13 +14436,30 @@ public class OpticalFlow {
mb_max_gain
,
// double mb_max_gain, // 5.0; // motion blur maximal gain (if more - move second point more than a pixel
mb_max_gain
,
// double mb_max_gain, // 5.0; // motion blur maximal gain (if more - move second point more than a pixel
mb_vectors
,
// double [][] mb_vectors, // now [2][ntiles];
mb_vectors
,
// double [][] mb_vectors, // now [2][ntiles];
clt_parameters
.
imp
.
debug_level
);
// 1); // -1); // int debug_level);
clt_parameters
.
imp
.
debug_level
);
// 1); // -1); // int debug_level);
if
(
scenes_xyzatr
[
nscene
]
==
null
)
{
boolean
adjust_OK
=
scenes_xyzatr
[
nscene
]
!=
null
;
System
.
out
.
println
(
"LMA failed at nscene = "
+
nscene
+
". Truncating series."
);
if
(
adjust_OK
&&
(
Math
.
abs
(
scenes_xyzatr
[
nscene
][
1
][
2
])
>
max_roll
))
{
fail_reason
[
0
]
=
FAIL_REASON_ROLL
;
adjust_OK
=
false
;
}
// FAIL_REASON_ROLL
if
(!
adjust_OK
)
{
boolean
OK
=
false
;
System
.
out
.
println
(
"LMA failed at nscene = "
+
nscene
+
". Reason = "
+
fail_reason
[
0
]);
if
(
fail_reason
[
0
]==
FAIL_REASON_MIN
)
{
if
(
fpn_skip
)
{
System
.
out
.
println
(
"fpn_skip is set, just skipping this scene"
);
continue
;
// to next scene
}
else
{
System
.
out
.
println
(
"fpn_skip is not set, aborting series and adjusting earliest_scene"
);
// set this and all previous to null
}
}
// all other reasons lead to failure
earliest_scene
=
nscene
+
1
;
earliest_scene
=
nscene
+
1
;
if
(
debugLevel
>
-
4
)
{
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"reAdjustPairsLMAInterscene "
+
nscene
+
" (of "
+
quadCLTs
.
length
+
") "
+
System
.
out
.
println
(
"reAdjustPairsLMAInterscene "
+
nscene
+
" (of "
+
quadCLTs
.
length
+
") "
+
quadCLTs
[
ref_index
].
getImageName
()
+
"/"
+
ts
+
quadCLTs
[
ref_index
].
getImageName
()
+
"/"
+
ts
+
" FAILED. Setting earliest_scene to "
+
earliest_scene
);
" FAILED. Setting earliest_scene to "
+
earliest_scene
+
" Failure reason: "
+
fail_reason
[
0
]
);
}
}
// set this and all previous to null
// set this and all previous to null
for
(;
nscene
>=
0
;
nscene
--)
{
for
(;
nscene
>=
0
;
nscene
--)
{
...
@@ -14317,8 +14468,7 @@ public class OpticalFlow {
...
@@ -14317,8 +14468,7 @@ public class OpticalFlow {
}
}
break
;
break
;
}
}
// overwrite old data
// System.out.println("lma_rms={"+lma_rms[0]+","+lma_rms[1]+"}");
ers_reference
.
addScene
(
ts
,
ers_reference
.
addScene
(
ts
,
scenes_xyzatr
[
nscene
][
0
],
scenes_xyzatr
[
nscene
][
0
],
scenes_xyzatr
[
nscene
][
1
],
scenes_xyzatr
[
nscene
][
1
],
...
@@ -14336,6 +14486,9 @@ public class OpticalFlow {
...
@@ -14336,6 +14486,9 @@ public class OpticalFlow {
}
}
}
}
}
// for (int nscene = ref_index; nscene > earliest_scene; nscene--) {
}
// for (int nscene = ref_index; nscene > earliest_scene; nscene--) {
// TODO: after all scenes done, see if any of scenes_xyzatr[] is null, and if fpn_rematch - rematch
if
(
dbg_mb_img
!=
null
)
{
if
(
dbg_mb_img
!=
null
)
{
String
[]
dbg_mb_titles
=
new
String
[
quadCLTs
.
length
];
String
[]
dbg_mb_titles
=
new
String
[
quadCLTs
.
length
];
for
(
int
i
=
0
;
i
<
quadCLTs
.
length
;
i
++)
if
(
quadCLTs
[
i
]
!=
null
)
{
for
(
int
i
=
0
;
i
<
quadCLTs
.
length
;
i
++)
if
(
quadCLTs
[
i
]
!=
null
)
{
...
@@ -14589,6 +14742,8 @@ public class OpticalFlow {
...
@@ -14589,6 +14742,8 @@ public class OpticalFlow {
public
static
double
[][]
adjustPairsLMAInterscene
(
public
static
double
[][]
adjustPairsLMAInterscene
(
CLTParameters
clt_parameters
,
CLTParameters
clt_parameters
,
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
double
[]
min_max
,
// null or pair of minimal and maximal offsets
int
[]
fail_reason
,
// null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
QuadCLT
reference_QuadClt
,
QuadCLT
reference_QuadClt
,
double
[]
ref_disparity
,
// null or alternative reference disparity
double
[]
ref_disparity
,
// null or alternative reference disparity
boolean
[]
reliable_ref
,
// null or bitmask of reliable reference tiles
boolean
[]
reliable_ref
,
// null or bitmask of reliable reference tiles
...
@@ -14632,6 +14787,8 @@ public class OpticalFlow {
...
@@ -14632,6 +14787,8 @@ public class OpticalFlow {
return
adjustPairsLMAInterscene
(
// assumes reference GPU data is already set - once for multiple scenes
return
adjustPairsLMAInterscene
(
// assumes reference GPU data is already set - once for multiple scenes
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadClt,
reference_QuadClt
,
// QuadCLT reference_QuadClt,
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
...
@@ -14657,6 +14814,8 @@ public class OpticalFlow {
...
@@ -14657,6 +14814,8 @@ public class OpticalFlow {
public
static
double
[][]
adjustPairsLMAInterscene
(
// assumes reference scene already set in GPU.
public
static
double
[][]
adjustPairsLMAInterscene
(
// assumes reference scene already set in GPU.
CLTParameters
clt_parameters
,
CLTParameters
clt_parameters
,
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
double
[]
min_max
,
// null or pair of minimal and maximal offsets
int
[]
fail_reason
,
// null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
QuadCLT
reference_QuadClt
,
QuadCLT
reference_QuadClt
,
double
[]
ref_disparity
,
// null or alternative reference disparity
double
[]
ref_disparity
,
// null or alternative reference disparity
double
[][]
pXpYD_ref
,
// pXpYD for the reference scene
double
[][]
pXpYD_ref
,
// pXpYD for the reference scene
...
@@ -14703,6 +14862,8 @@ public class OpticalFlow {
...
@@ -14703,6 +14862,8 @@ public class OpticalFlow {
use3D
,
// boolean use3D, // generate disparity difference
use3D
,
// boolean use3D, // generate disparity difference
fpn_disable
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
fpn_disable
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
mb_max_gain
,
// double mb_max_gain,
mb_max_gain
,
// double mb_max_gain,
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
...
@@ -14749,6 +14910,9 @@ public class OpticalFlow {
...
@@ -14749,6 +14910,9 @@ public class OpticalFlow {
debug_level
);
// int debug_level)
debug_level
);
// int debug_level)
if
(
lmaResult
<
0
)
{
if
(
lmaResult
<
0
)
{
System
.
out
.
println
(
"Interscene adjustment failed, lmaResult="
+
lmaResult
+
" < 0"
);
System
.
out
.
println
(
"Interscene adjustment failed, lmaResult="
+
lmaResult
+
" < 0"
);
if
(
fail_reason
!=
null
)
{
fail_reason
[
0
]=
FAIL_REASON_LMA
;
}
return
null
;
return
null
;
}
}
camera_xyz0
=
intersceneLma
.
getSceneXYZ
(
false
);
// true for initial values
camera_xyz0
=
intersceneLma
.
getSceneXYZ
(
false
);
// true for initial values
...
@@ -14778,6 +14942,8 @@ public class OpticalFlow {
...
@@ -14778,6 +14942,8 @@ public class OpticalFlow {
false
,
// boolean use3D, // generate disparity difference
false
,
// boolean use3D, // generate disparity difference
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
mb_max_gain
,
// double mb_max_gain,
mb_max_gain
,
// double mb_max_gain,
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
...
@@ -14821,6 +14987,8 @@ public class OpticalFlow {
...
@@ -14821,6 +14987,8 @@ public class OpticalFlow {
false
,
// boolean use3D, // generate disparity difference
false
,
// boolean use3D, // generate disparity difference
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
mb_max_gain
,
// double mb_max_gain,
mb_max_gain
,
// double mb_max_gain,
null
,
// double [] min_max, // null or pair of minimal and maximal offsets
null
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
reference_QuadClt
,
// QuadCLT reference_QuadCLT,
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
...
...
src/main/java/com/elphel/imagej/tileprocessor/TexturedModel.java
View file @
38b6b0d7
...
@@ -7309,6 +7309,9 @@ public class TexturedModel {
...
@@ -7309,6 +7309,9 @@ public class TexturedModel {
dbg_titles
[
i
]
=
dbg_subtitles
[
i
%
dbg_subtitles
.
length
]
+
"-"
+
(
i
/
dbg_subtitles
.
length
);
dbg_titles
[
i
]
=
dbg_subtitles
[
i
%
dbg_subtitles
.
length
]
+
"-"
+
(
i
/
dbg_subtitles
.
length
);
}
}
ref_scene
.
writePreview
(
dbg_textures
[
0
],
// double [] data,
debugLevel
);
// int debugLevel
String
suffix
=
"-combined_textures-prenorm-pre_UM"
;
String
suffix
=
"-combined_textures-prenorm-pre_UM"
;
if
(!
batch_run
&&
(
debugLevel
>
-
1
))
{
if
(!
batch_run
&&
(
debugLevel
>
-
1
))
{
ShowDoubleFloatArrays
.
showArrays
(
ShowDoubleFloatArrays
.
showArrays
(
...
@@ -7520,9 +7523,9 @@ public class TexturedModel {
...
@@ -7520,9 +7523,9 @@ public class TexturedModel {
dbg_titles
[
i
]
=
dbg_subtitles
[
i
%
dbg_subtitles
.
length
]
+
"-"
+
(
i
/
dbg_subtitles
.
length
);
dbg_titles
[
i
]
=
dbg_subtitles
[
i
%
dbg_subtitles
.
length
]
+
"-"
+
(
i
/
dbg_subtitles
.
length
);
}
}
ref_scene
.
writePreview
(
// may movbe to different (earlier) stage of processing, (search for "-combined_textures")
//
ref_scene.writePreview( // may movbe to different (earlier) stage of processing, (search for "-combined_textures")
dbg_textures
[
0
],
// double [] data,
//
dbg_textures[0], // double [] data,
debugLevel
);
// int debugLevel
//
debugLevel); // int debugLevel
String
suffix
=
"-combined_textures"
;
String
suffix
=
"-combined_textures"
;
if
(!
batch_run
&&
(
debugLevel
>
-
1
))
{
if
(!
batch_run
&&
(
debugLevel
>
-
1
))
{
...
...
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