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
7180569b
Commit
7180569b
authored
Aug 11, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Before textures artefacts correction
parent
38b6b0d7
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
265 additions
and
90 deletions
+265
-90
IntersceneLma.java
...n/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
+1
-0
IntersceneLmaParameters.java
.../elphel/imagej/tileprocessor/IntersceneLmaParameters.java
+26
-2
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+10
-2
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+179
-83
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+49
-3
No files found.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
View file @
7180569b
...
...
@@ -43,6 +43,7 @@ public class IntersceneLma {
)
{
this
.
thread_invariant
=
thread_invariant
;
this
.
num_components
=
(
disparity_weight
>
0
)
?
3
:
2
;
this
.
disparity_weight
=
disparity_weight
;
}
public
int
getNumComponents
()
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLmaParameters.java
View file @
7180569b
...
...
@@ -36,6 +36,8 @@ public class IntersceneLmaParameters {
public
boolean
ilma_thread_invariant
=
true
;
// Do not use DoubleAdder, provide results not dependent on threads
public
boolean
[]
ilma_lma_select
=
new
boolean
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
double
[]
ilma_regularization_weights
=
new
double
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
double
[]
ilma_regularization_weights0
=
new
double
[
ErsCorrection
.
DP_NUM_PARS
];
// Use after spiral
public
boolean
ilma_translation_priority
=
false
;
// expect translation for thepre-ref scene to be probable than rotation
public
boolean
ilma_ignore_ers
=
false
;
// ignore linear and angular velocities, assume tham zeroes
public
boolean
ilma_ers_adj_lin
=
false
;
// adjust linear ERS for scene-to-ref (LWIR does not work, check with high-speed)
public
boolean
ilma_ers_adj_ang
=
false
;
// adjust angular ERS for scene-to-ref (LWIR does not work, check with high-speed)
...
...
@@ -107,6 +109,7 @@ public class IntersceneLmaParameters {
ilma_regularization_weights
[
ErsCorrection
.
DP_DSX
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSY
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSZ
]=
0.0
;
ilma_regularization_weights0
=
ilma_regularization_weights
.
clone
();
}
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
...
...
@@ -132,6 +135,15 @@ public class IntersceneLmaParameters {
"Weight of "
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
" pull, 1.0 means that the paramter offset from initial corresponding to 1 image pixel\n"
+
" will cause error equal to all reprojection ones"
);
}
gd
.
addMessage
(
"Regularization parameters to be used first after spiral"
);
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
gd
.
addNumericField
(
ErsCorrection
.
DP_DERIV_NAMES
[
i
],
this
.
ilma_regularization_weights0
[
i
],
6
,
8
,
""
,
"Weight of "
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
" pull, 1.0 means that the paramter offset from initial corresponding to 1 image pixel\n"
+
" will cause error equal to all reprojection ones"
);
}
gd
.
addCheckbox
(
"Expect translation not rotation"
,
this
.
ilma_translation_priority
,
"Expect translation to be more likely than rotation for the first movement after the spiral search"
);
gd
.
addMessage
(
"LMA other parameters"
);
gd
.
addCheckbox
(
"Ignore linear and angular velocities"
,
this
.
ilma_ignore_ers
,
"Ignore calculated linear and angular velocities when correlating scenes to the reference one"
);
...
...
@@ -187,6 +199,10 @@ public class IntersceneLmaParameters {
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
this
.
ilma_regularization_weights
[
i
]
=
gd
.
getNextNumber
();
}
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
this
.
ilma_regularization_weights0
[
i
]
=
gd
.
getNextNumber
();
}
this
.
ilma_translation_priority
=
gd
.
getNextBoolean
();
this
.
ilma_ignore_ers
=
gd
.
getNextBoolean
();
this
.
ilma_ers_adj_lin
=
gd
.
getNextBoolean
();
this
.
ilma_ers_adj_ang
=
gd
.
getNextBoolean
();
...
...
@@ -216,7 +232,9 @@ public class IntersceneLmaParameters {
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_sel"
,
this
.
ilma_lma_select
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight"
,
this
.
ilma_regularization_weights
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight0"
,
this
.
ilma_regularization_weights0
[
i
]+
""
);
}
properties
.
setProperty
(
prefix
+
"ilma_translation_priority"
,
this
.
ilma_translation_priority
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ignore_ers"
,
this
.
ilma_ignore_ers
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_lin"
,
this
.
ilma_ers_adj_lin
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_ang"
,
this
.
ilma_ers_adj_ang
+
""
);
...
...
@@ -247,7 +265,11 @@ public class IntersceneLmaParameters {
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_lma_select
[
i
]=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
pn_sel
));
pn_sel
=
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight"
;
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_regularization_weights
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
pn_sel
));
pn_sel
=
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight0"
;
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_regularization_weights0
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
pn_sel
));
}
//
if
(
properties
.
getProperty
(
prefix
+
"ilma_translation_priority"
)!=
null
)
this
.
ilma_translation_priority
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_translation_priority"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
)!=
null
)
this
.
ilma_ignore_ers
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
)!=
null
)
this
.
ilma_ers_adj_lin
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
)!=
null
)
this
.
ilma_ers_adj_ang
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
));
...
...
@@ -287,6 +309,8 @@ public class IntersceneLmaParameters {
ilp
.
ilma_thread_invariant
=
this
.
ilma_thread_invariant
;
System
.
arraycopy
(
this
.
ilma_lma_select
,
0
,
ilp
.
ilma_lma_select
,
0
,
ilma_lma_select
.
length
);
System
.
arraycopy
(
this
.
ilma_regularization_weights
,
0
,
ilp
.
ilma_regularization_weights
,
0
,
ilma_regularization_weights
.
length
);
System
.
arraycopy
(
this
.
ilma_regularization_weights0
,
0
,
ilp
.
ilma_regularization_weights0
,
0
,
ilma_regularization_weights0
.
length
);
ilp
.
ilma_translation_priority
=
this
.
ilma_translation_priority
;
ilp
.
ilma_ignore_ers
=
this
.
ilma_ignore_ers
;
ilp
.
ilma_ers_adj_lin
=
this
.
ilma_ers_adj_lin
;
ilp
.
ilma_ers_adj_ang
=
this
.
ilma_ers_adj_ang
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
7180569b
...
...
@@ -238,7 +238,8 @@ public class IntersceneMatchParameters {
public
double
half_avg_diff
=
0.2
;
// when L2 of x,y difference from average of neibs - reduce twice
// Detect initial match
public
double
min_ref_str
=
0.15
;
// 0.22; // For orientations: use only tiles of the reference scene DSI_MAIN is stronger
public
double
min_ref_str
=
0.33
;
// 0.22; // For orientations: use only tiles of the reference scene DSI_MAIN is stronger
public
double
min_ref_frac
=
0.2
;
// 0.22; if fraction number of reliable tiles is less than this, use best possible
public
int
pix_step
=
4
;
// Azimuth/tilt search step in pixels
public
int
search_rad
=
10
;
// Search radius in steps
public
double
maybe_sum
=
1.0
;
// minimal sum of strengths (will search for the best)
...
...
@@ -759,6 +760,8 @@ public class IntersceneMatchParameters {
gd
.
addMessage
(
"Initial search for the inter-scene match"
);
gd
.
addNumericField
(
"DSI_MAIN minimal strength"
,
this
.
min_ref_str
,
5
,
7
,
""
,
"Match only tiles where DSI_MAIN is stronger than that (and has LMA)."
);
gd
.
addNumericField
(
"DSI_MAIN minimal fraction"
,
this
.
min_ref_frac
,
5
,
7
,
""
,
"If relative number of the reliable tiles is less than this - use this best fraction."
);
gd
.
addNumericField
(
"Azimuth/tilt step"
,
this
.
pix_step
,
0
,
3
,
"pix"
,
"Search in a spiral starting with no-shift with this step between probes, in approximate pixels"
);
...
...
@@ -1169,6 +1172,7 @@ public class IntersceneMatchParameters {
this
.
half_disparity
=
gd
.
getNextNumber
();
this
.
half_avg_diff
=
gd
.
getNextNumber
();
this
.
min_ref_str
=
gd
.
getNextNumber
();
this
.
min_ref_frac
=
gd
.
getNextNumber
();
this
.
pix_step
=
(
int
)
gd
.
getNextNumber
();
this
.
search_rad
=
(
int
)
gd
.
getNextNumber
();
this
.
maybe_sum
=
gd
.
getNextNumber
();
...
...
@@ -1492,6 +1496,7 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"centroid_radius"
,
this
.
centroid_radius
+
""
);
// double
properties
.
setProperty
(
prefix
+
"n_recenter"
,
this
.
n_recenter
+
""
);
// int
properties
.
setProperty
(
prefix
+
"min_ref_str"
,
this
.
min_ref_str
+
""
);
// double
properties
.
setProperty
(
prefix
+
"min_ref_frac"
,
this
.
min_ref_frac
+
""
);
// double
properties
.
setProperty
(
prefix
+
"td_weight"
,
this
.
td_weight
+
""
);
// double
properties
.
setProperty
(
prefix
+
"pd_weight"
,
this
.
pd_weight
+
""
);
// double
properties
.
setProperty
(
prefix
+
"td_nopd_only"
,
this
.
td_nopd_only
+
""
);
// boolean
...
...
@@ -1784,6 +1789,7 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"centroid_radius"
)!=
null
)
this
.
centroid_radius
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"centroid_radius"
));
if
(
properties
.
getProperty
(
prefix
+
"n_recenter"
)!=
null
)
this
.
n_recenter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"n_recenter"
));
if
(
properties
.
getProperty
(
prefix
+
"min_ref_str"
)!=
null
)
this
.
min_ref_str
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_ref_str"
));
if
(
properties
.
getProperty
(
prefix
+
"min_ref_frac"
)!=
null
)
this
.
min_ref_frac
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_ref_frac"
));
if
(
properties
.
getProperty
(
prefix
+
"td_weight"
)!=
null
)
this
.
td_weight
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"td_weight"
));
if
(
properties
.
getProperty
(
prefix
+
"pd_weight"
)!=
null
)
this
.
pd_weight
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"pd_weight"
));
if
(
properties
.
getProperty
(
prefix
+
"td_nopd_only"
)!=
null
)
this
.
td_nopd_only
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"td_nopd_only"
));
...
...
@@ -2086,6 +2092,8 @@ public class IntersceneMatchParameters {
imp
.
centroid_radius
=
this
.
centroid_radius
;
imp
.
n_recenter
=
this
.
n_recenter
;
imp
.
min_ref_str
=
this
.
min_ref_str
;
imp
.
min_ref_frac
=
this
.
min_ref_frac
;
imp
.
td_weight
=
this
.
td_weight
;
imp
.
pd_weight
=
this
.
pd_weight
;
imp
.
td_nopd_only
=
this
.
td_nopd_only
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
7180569b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
7180569b
...
...
@@ -1363,10 +1363,14 @@ public class QuadCLTCPU {
dsi
,
silent
);
}
//min_ref_frac
public
boolean
[]
getReliableTiles
(
double
min_strength
,
boolean
needs_lma
)
{
double
min_ref_frac
,
boolean
needs_lma
,
double
[]
reduced_strength
// if not null will return >0 if had to reduce strength (no change if did not reduce)
)
{
int
NUM_BINS
=
1024
;
double
[][]
main_dsi
=
readDsiMain
();
if
(
main_dsi
==
null
)
{
return
null
;
...
...
@@ -1376,6 +1380,9 @@ public class QuadCLTCPU {
if
((
strength
==
null
)
||
(
needs_lma
&&
(
disparity_lma
==
null
)
))
{
return
null
;
}
int
min_reliable
=
(
int
)
Math
.
round
(
strength
.
length
*
min_ref_frac
);
strength
=
strength
.
clone
();
boolean
[]
reliable
=
new
boolean
[
strength
.
length
];
for
(
int
i
=
0
;
i
<
reliable
.
length
;
i
++)
{
reliable
[
i
]
=
(
strength
[
i
]
>=
min_strength
)
&&
...
...
@@ -1384,11 +1391,50 @@ public class QuadCLTCPU {
boolean
[]
blue_sky
=
getBooleanBlueSky
();
if
(
blue_sky
!=
null
)
{
for
(
int
i
=
0
;
i
<
reliable
.
length
;
i
++)
{
reliable
[
i
]
&=
!
blue_sky
[
i
];
if
(
blue_sky
[
i
]){
reliable
[
i
]
=
false
;
strength
[
i
]
=
0.0
;
}
}
}
int
num_reliable
=
0
;
for
(
boolean
b:
reliable
)
if
(
b
)
num_reliable
++;
if
(
num_reliable
<
min_reliable
)
{
// not enough, select best tiles, ignoring LMA
double
max_str
=
0
;
for
(
double
s:
strength
)
if
((
s
>
max_str
)
)
max_str
=
s
;
// NaN OK
if
(
max_str
==
0
)
return
null
;
int
[]
hist
=
new
int
[
NUM_BINS
];
int
num_gt0
=
0
;
for
(
double
s:
strength
)
if
(
s
>
0
)
{
// verify enough > 0
int
bin
=
(
int
)
Math
.
floor
(
NUM_BINS
*
s
/
max_str
);
if
(
bin
>=
NUM_BINS
)
bin
=
NUM_BINS
-
1
;
hist
[
bin
]++;
num_gt0
++;
}
if
(
num_gt0
<
min_reliable
)
{
return
null
;
// not enough non-zero values
}
num_reliable
=
0
;
int
num_prev
=
0
;
int
bin
=
NUM_BINS
-
1
;
for
(;
num_reliable
<
min_reliable
;
bin
--)
{
num_prev
=
num_reliable
;
num_reliable
+=
hist
[
bin
];
}
double
threshold
=
(
bin
+
1.0
*
(
num_reliable
-
min_reliable
)
/
(
num_reliable
-
num_prev
))
*
max_str
/
NUM_BINS
;
num_reliable
=
0
;
for
(
int
i
=
0
;
i
<
reliable
.
length
;
i
++)
{
reliable
[
i
]
=
(
strength
[
i
]
>
threshold
);
if
(
reliable
[
i
])
num_reliable
++;
}
if
(
reduced_strength
!=
null
)
{
reduced_strength
[
0
]
=
threshold
;
}
}
return
reliable
;
}
public
double
[][]
readDsiMain
(){
double
[][]
main_dsi
=
new
double
[
TwoQuadCLT
.
DSI_SLICES
.
length
][];
int
slices
=
restoreDSI
(
...
...
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