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
1517acca
Commit
1517acca
authored
Sep 07, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented/tested terrain layer in *-INTER-INTRA-LMA.tiff
parent
e64fe051
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
11 deletions
+85
-11
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+33
-4
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+38
-3
TexturedModel.java
...n/java/com/elphel/imagej/tileprocessor/TexturedModel.java
+5
-1
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+9
-3
No files found.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
1517acca
...
...
@@ -76,7 +76,7 @@ import ij.plugin.filter.GaussianBlur;
public
class
OpticalFlow
{
public
static
String
[]
COMBO_DSN_TITLES
=
{
"disp"
,
"strength"
,
"disp_lma"
,
"num_valid"
,
"change"
,
"disp_bg"
,
"strength_bg"
,
"disp_lma_bg"
,
"change_bg"
,
"disp_fg"
,
"disp_bg_all"
,
"blue_sky"
,
"sfm_gain"
,
"ground"
};
"disp_bg"
,
"strength_bg"
,
"disp_lma_bg"
,
"change_bg"
,
"disp_fg"
,
"disp_bg_all"
,
"blue_sky"
,
"sfm_gain"
,
"ground"
,
"terrain"
};
public
static
int
COMBO_DSN_INDX_DISP
=
0
;
// cumulative disparity (from CM or POLY), FG
public
static
int
COMBO_DSN_INDX_STRENGTH
=
1
;
// strength, FG
public
static
int
COMBO_DSN_INDX_LMA
=
2
;
// masked copy from 0 - cumulative disparity
...
...
@@ -91,6 +91,7 @@ public class OpticalFlow {
public
static
int
COMBO_DSN_INDX_BLUE_SKY
=
11
;
// Detected featureless infinity (sky)
public
static
int
COMBO_DSN_INDX_SFM_GAIN
=
12
;
// SfM disparity gain pixel/pixel
public
static
int
COMBO_DSN_INDX_GROUND
=
13
;
// Smooth ground surface w/o vegetation
public
static
int
COMBO_DSN_INDX_TERRAIN
=
14
;
// Smooth ground surface w/o vegetation
// move to Interscene class?
// interscene adjustments failure reasons.
...
...
@@ -5858,6 +5859,7 @@ public class OpticalFlow {
}
imp_scenes_pair
[
nstereo
]=
renderSceneSequence
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
.
imp
.
um_mono
,
// boolean um_mono,
fov_tiles
,
// Rectangle fov_tiles,
mode3d
,
// int mode3d,
toRGB
,
// boolean toRGB,
...
...
@@ -6285,7 +6287,33 @@ public class OpticalFlow {
System
.
out
.
println
(
"TexturedModel.output3d() -> "
+
ok_3d
+
" (terrain only, no vegetation)"
);
}
boolean
export_terrain_sequence
=
true
;
if
(
export_terrain_sequence
)
{
combo_dsn_final
=
quadCLTs
[
ref_index
].
restoreComboDSI
(
true
);
if
((
combo_dsn_final
.
length
<=
COMBO_DSN_INDX_TERRAIN
)
||
(
combo_dsn_final
[
COMBO_DSN_INDX_TERRAIN
]
==
null
))
{
System
.
out
.
println
(
"No terrain data available"
);
}
else
{
double
[]
terrain_disparity
=
combo_dsn_final
[
COMBO_DSN_INDX_TERRAIN
];
String
scenes_suffix
=
quadCLTs
[
quadCLTs
.
length
-
1
].
getImageName
()+
"-TERRAIN"
;
ImagePlus
imp_terrain
=
renderSceneSequence
(
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean um_mono,
null
,
// Rectangle fov_tiles,
1
,
// int mode3d,
false
,
// boolean toRGB,
ZERO3
,
// double [] stereo_offset, // offset reference camera {x,y,z}
1
,
// int sensor_mask,
scenes_suffix
,
// String suffix,
terrain_disparity
,
// selected_disparity, // double [] ref_disparity,
quadCLTs
,
// QuadCLT [] quadCLTs,
ref_index
,
// int ref_index,
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel);
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
null
,
// "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
imp_terrain
);
// imp_scenes); // ImagePlus imp)
}
}
if
(
export_images
)
{
if
(
combo_dsn_final
==
null
)
{
...
...
@@ -7320,6 +7348,7 @@ public class OpticalFlow {
public
static
ImagePlus
renderSceneSequence
(
CLTParameters
clt_parameters
,
boolean
um_mono
,
Rectangle
fov_tiles
,
int
mode3d
,
// for older compatibility mode3d = -1 for RAW, 0 - INF, 1 - FG, 2 BG
boolean
toRGB
,
...
...
@@ -7333,7 +7362,7 @@ public class OpticalFlow {
int
debugLevel
)
{
boolean
corr_raw_ers
=
true
;
double
[]
stereo_atr
=
ZERO3
;
// maybe later play with rotated camera
boolean
um_mono
=
clt_parameters
.
imp
.
um_mono
;
//
boolean um_mono = clt_parameters.imp.um_mono;
double
um_sigma
=
clt_parameters
.
imp
.
um_sigma
;
double
um_weight
=
clt_parameters
.
imp
.
um_weight
;
boolean
mb_en
=
clt_parameters
.
imp
.
mb_en
&&
(
fov_tiles
==
null
)
&&
(
mode3d
>
0
);
...
...
@@ -7342,7 +7371,7 @@ public class OpticalFlow {
final
float
fum_weight
=
(
float
)
um_weight
;
boolean
merge_all
=
clt_parameters
.
imp
.
merge_all
;
boolean
merge_all
=
clt_parameters
.
imp
.
merge_all
||
!
um_mono
;
// no unsharp mask -> terrain->merge_all
if
(
mode3d
<
1
)
{
merge_all
=
false
;
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
1517acca
...
...
@@ -1706,6 +1706,26 @@ public class QuadCLTCPU {
tilesX
,
// int width,
tilesY
);
// int height)
}
public
void
setTerrain
(
CLTParameters
clt_parameters
,
double
[]
terrain
,
int
debugLevel
)
{
double
[][]
combo_dsn_final
=
restoreComboDSI
(
true
);
// also sets quadCLTs[ref_index].dsi and blue sky
combo_dsn_final
[
OpticalFlow
.
COMBO_DSN_INDX_TERRAIN
]
=
terrain
;
String
rslt_suffix
=
"-INTER-INTRA"
;
rslt_suffix
+=
(
clt_parameters
.
correlate_lma
?
"-LMA"
:
"-NOLMA"
);
final
int
tilesX
=
tp
.
getTilesX
();
final
int
tilesY
=
tp
.
getTilesY
();
saveDoubleArrayInModelDirectory
(
// error
rslt_suffix
,
// String suffix,
OpticalFlow
.
COMBO_DSN_TITLES
,
// combo_dsn_titles_full, // null, // String [] labels, // or null
combo_dsn_final
,
// dbg_data, // double [][] data,
tilesX
,
// int width,
tilesY
);
// int height)
}
public
double
[]
getFlatGround
(
double
[]
disparity
,
...
...
@@ -2617,12 +2637,14 @@ public class QuadCLTCPU {
// System.out.println("dsi== null, use spawnQuadCLT(), restoreFromModel(), ... to set it");
return
null
;
}
double
[][]
dls
=
new
double
[
5
][];
// double [][] dls = new double[5][];
double
[][]
dls
=
new
double
[
6
][];
dls
[
0
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_DISPARITY_AUX
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN
];
dls
[
1
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_DISPARITY_AUX_LMA
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN_LMA
];
dls
[
2
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_STRENGTH_AUX
:
TwoQuadCLT
.
DSI_STRENGTH_MAIN
];
dls
[
3
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_SFM_GAIN_AUX
:
TwoQuadCLT
.
DSI_SFM_GAIN_MAIN
];
dls
[
4
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_GROUND_AUX
:
TwoQuadCLT
.
DSI_GROUND_MAIN
];
dls
[
4
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_GROUND_AUX
:
TwoQuadCLT
.
DSI_GROUND_MAIN
];
dls
[
5
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_TERRAIN_AUX
:
TwoQuadCLT
.
DSI_TERRAIN_MAIN
];
return
dls
;
}
...
...
@@ -3687,11 +3709,24 @@ public class QuadCLTCPU {
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_SFM_GAIN_AUX
:
TwoQuadCLT
.
DSI_SFM_GAIN_MAIN
]
=
combo_dsi
[
OpticalFlow
.
COMBO_DSN_INDX_SFM_GAIN
];
}
/*
* Was a BUG!
if ((combo_dsi.length > OpticalFlow.COMBO_DSN_INDX_GROUND) && (combo_dsi[OpticalFlow.COMBO_DSN_INDX_GROUND] != null)) {
this.dsi[is_aux?TwoQuadCLT.DSI_SFM_GAIN_AUX:TwoQuadCLT.DSI_SFM_GAIN_MAIN] =
combo_dsi[OpticalFlow.COMBO_DSN_INDX_GROUND];
}
*/
if
((
combo_dsi
.
length
>
OpticalFlow
.
COMBO_DSN_INDX_GROUND
)
&&
(
combo_dsi
[
OpticalFlow
.
COMBO_DSN_INDX_GROUND
]
!=
null
))
{
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_GROUND_AUX
:
TwoQuadCLT
.
DSI_GROUND_MAIN
]
=
combo_dsi
[
OpticalFlow
.
COMBO_DSN_INDX_GROUND
];
}
if
((
combo_dsi
.
length
>
OpticalFlow
.
COMBO_DSN_INDX_TERRAIN
)
&&
(
combo_dsi
[
OpticalFlow
.
COMBO_DSN_INDX_TERRAIN
]
!=
null
))
{
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_TERRAIN_AUX
:
TwoQuadCLT
.
DSI_TERRAIN_MAIN
]
=
combo_dsi
[
OpticalFlow
.
COMBO_DSN_INDX_TERRAIN
];
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/TexturedModel.java
View file @
1517acca
...
...
@@ -2927,7 +2927,11 @@ public class TexturedModel {
expand_above
,
// final int expand,
flat_border
,
// final boolean flat_border,
tilesX
,
// final int width) ;
terr_mask
);
// boolean [] dbg_mask);
terr_mask
);
// boolean [] dbg_mask);
scenes
[
ref_index
].
setTerrain
(
// will save terrain as the last slice in INTER-INTRA-LMA
clt_parameters
,
// CLTParameters clt_parameters,
terrain_disparity
,
// double [] smooth_ground,
debugLevel
);
// int debugLevel)
if
(
save_terrain
||
show_bs_debug
)
{
String
[]
dbg_titles
=
{
"FG"
,
"BG"
,
"FG_LMA"
,
"BG_LMA"
,
"GND"
,
"FLAT"
,
"SINGLE"
,
"TERRAIN"
,
"TERR-MASK"
,
"FS"
,
"BS"
};
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
1517acca
...
...
@@ -80,11 +80,14 @@ public class TwoQuadCLT {
public
static
int
DSI_AVGVAL_AUX
=
12
;
public
static
int
DSI_BLUE_SKY_MAIN
=
13
;
public
static
int
DSI_BLUE_SKY_AUX
=
14
;
public
static
int
DSI_GROUND_MAIN
=
15
;
// ground surface ignoring vegetation
public
static
int
DSI_GROUND_MAIN
=
15
;
// ground surface ignoring vegetation
(smooth, has bumps where vegetation is)
public
static
int
DSI_GROUND_AUX
=
16
;
// ground surface ignoring vegetation
public
static
int
DSI_SFM_GAIN_MAIN
=
17
;
// SfM disparity gain pixel/pixel, RGB
public
static
int
DSI_SFM_GAIN_AUX
=
18
;
// SfM disparity gain pixel/pixel, LWIR
public
static
int
DSI_LENGTH
=
DSI_SFM_GAIN_AUX
+
1
;
public
static
int
DSI_TERRAIN_MAIN
=
19
;
// terrain with bumps (vegetation) completely cut off, RGB
public
static
int
DSI_TERRAIN_AUX
=
20
;
// terrain with bumps (vegetation) completely cut off, LWIR
/// public static int DSI_LENGTH = DSI_SFM_GAIN_AUX+1;
public
static
int
DSI_LENGTH
=
DSI_TERRAIN_AUX
+
1
;
public
static
String
DSI_COMBO_SUFFIX
=
"-DSI_COMBO"
;
public
static
String
DSI_MAIN_SUFFIX
=
"-DSI_MAIN"
;
...
...
@@ -108,7 +111,10 @@ public class TwoQuadCLT {
"ground_main"
,
"ground_aux"
,
"sfm_gain_main"
,
"sfm_gain_aux"
};
"sfm_gain_aux"
,
"terrain_main"
,
"terrain_aux"
};
public
long
startTime
;
// start of batch processing
public
long
startSetTime
;
// start of set processing
...
...
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