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
9a499c0a
Commit
9a499c0a
authored
Nov 17, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working version
parent
b3ad74ea
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
703 additions
and
32 deletions
+703
-32
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+1
-1
Interscene.java
...main/java/com/elphel/imagej/tileprocessor/Interscene.java
+135
-6
IntersceneLma.java
...n/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
+394
-8
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+44
-5
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+3
-0
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+56
-0
StructureFromMotion.java
.../elphel/imagej/tileprocessor/sfm/StructureFromMotion.java
+1
-0
VegetationLMA.java
...main/java/com/elphel/imagej/vegetation/VegetationLMA.java
+41
-0
VegetationModel.java
...in/java/com/elphel/imagej/vegetation/VegetationModel.java
+28
-12
No files found.
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
9a499c0a
...
...
@@ -1598,7 +1598,7 @@ public class ErsCorrection extends GeometryCorrection {
}
}
@Deprecated
public
void
compareDSItoWorldDerivatives
(
QuadCLT
scene_QuadClt
,
double
max_inf_disparity
,
// absolute value
...
...
src/main/java/com/elphel/imagej/tileprocessor/Interscene.java
View file @
9a499c0a
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
View file @
9a499c0a
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
9a499c0a
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
9a499c0a
...
...
@@ -13256,6 +13256,7 @@ public class OpticalFlow {
param_regweights
,
// final double [] param_regweights,
vector_XYS
,
// final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate()
reference_tiles_macro
,
// final double [][] centers, // macrotile centers (in pixels and average disparities
false
,
// final boolean same_weights,
(
nlma
==
0
),
// boolean first_run,
clt_parameters
.
ilp
.
ilma_debug_level
);
// final int debug_level)
...
...
@@ -13392,6 +13393,7 @@ public class OpticalFlow {
null
,
// final double [] param_regweights,
null
,
// final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate()
ref_pXpYD
,
// final double [][] centers, // macrotile centers (in pixels and average disparities
false
,
// final boolean same_weights,
false
,
// boolean first_run,
debug_level
);
// final int debug_level)
final
double
[][]
last_jt
=
intersceneLma
.
getLastJT
();
// alternating x,y for each selected parameters
...
...
@@ -13716,6 +13718,7 @@ public class OpticalFlow {
clt_parameters
.
ilp
.
ilma_regularization_weights
,
// final double [] param_regweights,
vector_XYS
,
// final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate()
reference_tiles_macro
,
// final double [][] centers, // macrotile centers (in pixels and average disparities
false
,
// final boolean same_weights,
(
nlma
==
0
),
// boolean first_run,
debug_level
);
// final int debug_level)
int
lmaResult
=
intersceneLma
.
runLma
(
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
9a499c0a
...
...
@@ -2630,6 +2630,62 @@ public class QuadCLTCPU {
}
public
double
[]
smoothDisparity
(
double
[]
disparity_in
,
boolean
[]
reliable_ref
,
// optional
double
sigma
,
double
max_diff
,
boolean
apply_nan
)
{
final
int
tilesX
=
tp
.
getTilesX
();
double
[]
disparity
=
disparity_in
.
clone
();
if
(
reliable_ref
!=
null
)
{
for
(
int
i
=
0
;
i
<
reliable_ref
.
length
;
i
++)
{
if
(!
reliable_ref
[
i
])
{
disparity
[
i
]
=
Double
.
NaN
;
}
}
}
boolean
[]
good_tiles
=
new
boolean
[
disparity
.
length
];
for
(
int
i
=
0
;
i
<
disparity
.
length
;
i
++)
{
good_tiles
[
i
]
=
!
Double
.
isNaN
(
disparity
[
i
]);
}
double
scale_sigma
=
5.0
;
// non-NaN - 5 pixels from original NaN for each sigma
int
grow
=
2
*
Math
.
min
((
int
)
Math
.
ceil
(
sigma
*
scale_sigma
),
tilesX
);
disparity
=
TileProcessor
.
fillNaNs
(
disparity
,
// final double [] data,
null
,
// final boolean [] prohibit,
tilesX
,
// int width,
// CAREFUL ! Remaining NaN is grown by unsharp mask filter ************* !
grow
,
// 100, // 2*width, // 16, // final int grow,
0.7
,
// double diagonal_weight, // relative to ortho
100
,
// int num_passes,
0.03
);
// final double max_rchange, // = 0.01 - does not need to be accurate
(
new
DoubleGaussianBlur
()).
blurDouble
(
disparity
,
//
tilesX
,
disparity
.
length
/
tilesX
,
sigma
,
// double sigmaX,
sigma
,
// double sigmaY,
0.01
);
// double accuracy)
if
(
max_diff
>
0
)
{
for
(
int
i
=
0
;
i
<
disparity
.
length
;
i
++)
if
(
good_tiles
[
i
]){
if
(
Math
.
abs
(
disparity
[
i
]
-
disparity_in
[
i
])
>
max_diff
)
{
good_tiles
[
i
]
=
false
;
}
}
}
if
(
apply_nan
)
{
for
(
int
i
=
0
;
i
<
disparity
.
length
;
i
++)
if
(!
good_tiles
[
i
]){
disparity
[
i
]
=
Double
.
NaN
;
}
}
if
(
reliable_ref
!=
null
)
{
System
.
arraycopy
(
good_tiles
,
0
,
reliable_ref
,
0
,
disparity
.
length
);
}
return
disparity
;
}
public
double
[][]
getDLS
(){
// get disparity, disparity_lma, strength, sfm_gain
...
...
src/main/java/com/elphel/imagej/tileprocessor/sfm/StructureFromMotion.java
View file @
9a499c0a
...
...
@@ -2278,6 +2278,7 @@ public class StructureFromMotion {
null
,
// final double [] param_regweights,
null
,
// final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate()
ref_pXpYD
,
// final double [][] centers, // macrotile centers (in pixels and average disparities
false
,
// final boolean same_weights,
false
,
// boolean first_run,
debug_level
);
// final int debug_level)
last_jts
[
nscene
]
=
intersceneLma
.
getLastJT
();
// alternating x,y for each selected parameters
...
...
src/main/java/com/elphel/imagej/vegetation/VegetationLMA.java
View file @
9a499c0a
...
...
@@ -487,6 +487,7 @@ public class VegetationLMA {
max_warp
,
// final double max_warp,
valid_pixels_in
,
// final boolean [] valid_pixels_in, // should be initialized to woi, normally set to all true
max_offset
,
// final int max_offset,
elev_radius
,
// final double [] elev_radius, // this.elevation_radius
max_sacrifice
,
// final int max_sacrifice,
valid_stats
,
// final int [] stats,
max_warp_scene_pix
,
// final int [] max_warp_scene_pix,
...
...
@@ -5200,12 +5201,14 @@ public class VegetationLMA {
final
double
max_warp
,
final
boolean
[]
valid_pixels_in
,
// should be initialized to woi, normally set to all true
final
int
max_offset
,
final
double
[]
elev_radius
,
// this.elevation_radius
final
int
max_sacrifice
,
final
int
[]
stats
,
final
int
[]
max_warp_scene_pix
,
final
Rectangle
woi
,
final
Rectangle
woi_veg
// should be initialized, will be modified
)
{
final
int
dbg_pix
=
801
;
// 918;
final
int
woi_length
=
woi
.
width
*
woi
.
height
;
final
boolean
[]
valid_pixels
=
(
valid_pixels_in
!=
null
)
?
valid_pixels_in
:
(
new
boolean
[
woi_length
]);
if
(
valid_pixels_in
==
null
)
{
...
...
@@ -5255,6 +5258,9 @@ public class VegetationLMA {
int
y
=
indx
/
woi_ext
.
width
+
woi_ext
.
y
;
int
x
=
indx
%
woi_ext
.
width
+
woi_ext
.
x
;
int
npix
=
x
+
y
*
full
.
width
;
double
radius
=
elev_radius
[
npix
];
double
radius2
=
radius
*
radius
;
int
iradius
=
(
int
)
Math
.
ceil
(
radius
);
double
elevation
=
tvao
[
TVAO_ELEVATION
][
npix
];
double
vegetation
=
tvao
[
TVAO_VEGETATION
][
npix
];
if
(!
Double
.
isNaN
(
elevation
)
&&
!
Double
.
isNaN
(
vegetation
))
{
...
...
@@ -5267,6 +5273,37 @@ public class VegetationLMA {
if
(
scales
!=
null
)
{
double
dx
=
scales
[
0
]
*
elevation
;
double
dy
=
scales
[
1
]
*
elevation
;
int
ax0
=
(
int
)
Math
.
floor
(
x
+
dx
-
radius
);
int
ax1
=
(
int
)
Math
.
ceil
(
x
+
dx
+
radius
);
int
ay0
=
(
int
)
Math
.
floor
(
y
+
dy
-
radius
);
int
ay1
=
(
int
)
Math
.
ceil
(
y
+
dy
+
radius
);
Rectangle
ar
=
new
Rectangle
(
ax0
,
ay0
,
ax1
-
ax0
+
1
,
ay1
-
ay0
+
1
);
if
(
woi
.
intersects
(
ar
))
{
boolean
has_valid_dependent
=
false
;
for
(
int
ay
=
ay0
;
ay
<=
ay1
;
ay
++)
{
double
ddy
=
ay
-
(
y
+
dy
);
double
ddy2
=
ddy
*
ddy
;
for
(
int
ax
=
ax0
;
ax
<=
ax1
;
ax
++)
{
if
(
woi
.
contains
(
ax
,
ay
))
{
double
ddx
=
ax
-
(
x
+
dx
);
double
ddr2
=
ddy2
+
ddx
*
ddx
;
if
(
ddr2
<=
radius2
)
{
int
wx
=
ax
-
woi
.
x
;
int
wy
=
ay
-
woi
.
y
;
int
wpix
=
wx
+
wy
*
woi
.
width
;
if
(
valid_pixels
[
wpix
])
{
has_veg_thread
[
nthread
][
nscene
][
wpix
]
=
true
;
has_valid_dependent
=
true
;
}
}
}
}
}
if
(
has_valid_dependent
)
{
veg_scene_used_prefilter
[
indx
]
=
true
;
}
}
/*
int px05 = (int) Math.floor(x + dx); // TODO: check sign! // ELEV-SIGN
int py05 = (int) Math.floor(y + dy); // TODO: check sign! // ELEV-SIGN
if (woi_plus1.contains(px05,py05)) { // up to 1 pixel to the nearest
...
...
@@ -5291,6 +5328,7 @@ public class VegetationLMA {
veg_scene_used_prefilter[indx] = true;
}
}
*/
}
}
}
...
...
@@ -5338,6 +5376,9 @@ public class VegetationLMA {
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
for
(
int
wPix
=
ai
.
getAndIncrement
();
wPix
<
woi_length
;
wPix
=
ai
.
getAndIncrement
())
{
// if (valid_pixels[wPix]){
if
(
wPix
==
dbg_pix
)
{
System
.
out
.
println
(
"getValidScenesPixels() 1 : wpix = "
+
wPix
);
}
boolean
has_offset_middle
=
true
;
for
(
int
nscene
=
first_scene
+
max_sacrifice
;
nscene
<=
last_scene
-
max_sacrifice
;
nscene
++)
if
(
valid_scenes
[
nscene
]){
if
(!
has_veg
[
nscene
][
wPix
])
{
...
...
src/main/java/com/elphel/imagej/vegetation/VegetationModel.java
View file @
9a499c0a
...
...
@@ -401,14 +401,15 @@ public class VegetationModel {
double
min_above
=
0.02
;
// 0.025; // .04;
int
patch_neib
=
4
;
// 5;
double
neibs_pow
=
0.5
;
final
int
grow_vegetation
=
clt_parameters
.
imp
.
terr_veget_grow
;
double
[][]
combo_dsn
=
quadCLTs
[
ref_index
].
restoreComboDSI
(
true
);
double
[][]
terr_veg
=
getTerrainVegetation
(
combo_dsn
,
// double [][] combo_dsn);
tilesX
,
// final int tilesX,
min_above
,
// final double min_above, // absolute disparity difference
patch_neib
,
// final int patch_neib){
neibs_pow
);
// final double neibs_pow);
combo_dsn
,
// double [][] combo_dsn);
tilesX
,
// final int tilesX,
min_above
,
// final double min_above, // absolute disparity difference
patch_neib
,
// final int patch_neib){
neibs_pow
,
// final double neibs_pow);
grow_vegetation
);
// final int grow_vegetation);
if
(
show_debug
)
{
String
[]
titles_terr_veg
=
{
"terrain"
,
"vegetation"
};
...
...
@@ -725,7 +726,8 @@ public class VegetationModel {
final
int
tilesX
,
final
double
min_above
,
// absolute disparity difference
final
int
patch_neibs
,
final
double
neibs_pow
){
// raise strength to this power when averaging neighbors
final
double
neibs_pow
,
// raise strength to this power when averaging neighbors
final
int
grow_vegetation
){
final
double
[]
terrain
=
combo_dsn
[
OpticalFlow
.
COMBO_DSN_INDX_TERRAIN
];
final
double
[]
ground
=
combo_dsn
[
OpticalFlow
.
COMBO_DSN_INDX_GROUND
];
final
double
[]
disparity
=
combo_dsn
[
OpticalFlow
.
COMBO_DSN_INDX_LMA
];
...
...
@@ -733,7 +735,7 @@ public class VegetationModel {
final
int
num_pixels
=
disparity
.
length
;
final
double
[]
vegetation
=
new
double
[
num_pixels
];
Arrays
.
fill
(
vegetation
,
Double
.
NaN
);
final
int
dbg_tile
=
-(
22
+
17
*
80
);
final
int
dbg_tile
=
(
25
+
20
*
80
);
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
(
QuadCLT
.
THREADS_MAX
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
...
...
@@ -771,7 +773,20 @@ public class VegetationModel {
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
new
double
[][]
{
terrain
,
vegetation
};
double
[]
veget
=
vegetation
;
if
(
grow_vegetation
>
0
)
{
veget
=
TileProcessor
.
fillNaNs
(
vegetation
,
// final double [] data,
null
,
// final boolean [] prohibit,
tilesX
,
// int width,
// CAREFUL ! Remaining NaN is grown by unsharp mask filter ************* !
grow_vegetation
,
// 100, // 2*width, // 16, // final int grow,
0.7
,
// double diagonal_weight, // relative to ortho
100
,
// int num_passes,
0.03
);
// final double max_rchange, // = 0.01 - does not need to be accurate
}
return
new
double
[][]
{
terrain
,
veget
};
// ation};
}
...
...
@@ -819,14 +834,15 @@ public class VegetationModel {
double
min_above
=
0.02
;
// 0.025; // .04;
int
patch_neib
=
4
;
// 5;
double
neibs_pow
=
0.5
;
final
int
grow_vegetation
=
clt_parameters
.
imp
.
terr_veget_grow
;
double
[][]
combo_dsn
=
quadCLTs
[
ref_index
].
restoreComboDSI
(
true
);
double
[][]
terr_veg
=
getTerrainVegetation
(
combo_dsn
,
// double [][] combo_dsn);
tilesX
,
// final int tilesX,
min_above
,
// final double min_above, // absolute disparity difference
patch_neib
,
// final int patch_neib){
neibs_pow
);
// final double neibs_pow);
neibs_pow
,
// final double neibs_pow);
grow_vegetation
);
// final int grow_vegetation);
String
[]
titles_terr_veg
=
{
"terrain"
,
"vegetation"
};
ShowDoubleFloatArrays
.
showArrays
(
...
...
@@ -2089,7 +2105,7 @@ public class VegetationModel {
lambda_scale_bad
,
// double lambda_scale_bad, // 8.0
lambda_max
,
// double lambda_max, // 100
rms_diff
,
// double rms_diff, // 0.001
15
,
// num_iter, //int num_iter, // 20
num_iter
,
//
15, // num_iter, //int num_iter, // 20
last_run
,
// boolean last_run,
null
,
// String dbg_prefix,
debugLevel
);
// int debug_level)
...
...
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