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
c14405c9
Commit
c14405c9
authored
Dec 30, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on new LMA correlation
parent
2fab35c1
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1847 additions
and
574 deletions
+1847
-574
Corr2dLMA.java
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
+1119
-0
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+252
-98
Correlations2dLMA.java
...va/com/elphel/imagej/tileprocessor/Correlations2dLMA.java
+33
-33
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+126
-126
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+145
-145
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+172
-172
No files found.
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
0 → 100644
View file @
c14405c9
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
c14405c9
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/Correlations2dLMA.java
View file @
c14405c9
package
com
.
elphel
.
imagej
.
tileprocessor
;
/**
**
** Correlation2dLMA - Fit multi - baseline corre
al
tion pairs to the model
** Correlation2dLMA - Fit multi - baseline corre
la
tion pairs to the model
**
** Copyright (C) 2018 Elphel, Inc.
**
...
...
@@ -84,7 +84,7 @@ public class Correlations2dLMA {
double
[]
poly_coeff
=
null
;
// 6 elements - Xc, Yx, f(x,y), A, B, C (from A*x^2 + B*y^2 +C*x*y+...)
double
[]
poly_xyvwh
=
null
;
// result of 2-d polynomial approximation instead of the LMA - used for lazy eye correction
public
class
NumDiag
{
public
class
NumDiag
{
// USED in lwir
int
num
;
boolean
diag
;
public
NumDiag
(
int
num
,
boolean
diag
)
{
...
...
@@ -93,7 +93,7 @@ public class Correlations2dLMA {
}
}
public
class
Sample
{
public
class
Sample
{
// USED in lwir
double
x
;
// x coordinate on the common scale (corresponding to the largest baseline), along the disparity axis
double
y
;
// y coordinate (0 - disparity axis)
double
v
;
// correlation value at that point
...
...
@@ -117,7 +117,7 @@ public class Correlations2dLMA {
}
}
public
void
printParams
()
{
public
void
printParams
()
{
// not used in lwir
for
(
int
np
=
0
;
np
<
all_pars
.
length
;
np
++)
{
System
.
out
.
println
(
String
.
format
(
"%2d%1s %22s %f"
,
np
,
...
...
@@ -127,7 +127,7 @@ public class Correlations2dLMA {
}
}
public
void
printInputDataFx
(
boolean
show_fx
){
public
void
printInputDataFx
(
boolean
show_fx
){
// not used in lwir
if
(
show_fx
)
{
Sample
s
=
null
;
double
[]
fx
=
getPolyFx
();
...
...
@@ -151,18 +151,18 @@ public class Correlations2dLMA {
}
}
public
double
[]
getRMS
()
{
public
double
[]
getRMS
()
{
// USED in lwir
return
last_rms
;
}
public
double
[]
getGoodOrBadRMS
()
{
public
double
[]
getGoodOrBadRMS
()
{
// not used in lwir
return
good_or_bad_rms
;
}
public
double
[]
getAllPars
()
{
public
double
[]
getAllPars
()
{
// not used in lwir
return
all_pars
;
}
public
double
[]
getDisparityStrength
()
{
public
double
[]
getDisparityStrength
()
{
// USED in lwir
if
(
group_weights
==
null
)
return
null
;
double
disparity
=
-
all_pars
[
X0_INDEX
];
double
sum_amp
=
0.0
;
...
...
@@ -176,7 +176,7 @@ public class Correlations2dLMA {
double
[]
ds
=
{
disparity
,
sum_amp
};
return
ds
;
}
public
double
[]
getDisparityStrengthWidth
()
{
public
double
[]
getDisparityStrengthWidth
()
{
// USED in lwir
double
[]
ds
=
getDisparityStrength
();
if
(
ds
==
null
)
return
null
;
double
[]
dsw
=
{
ds
[
0
],
ds
[
1
],
all_pars
[
WM_INDEX
],
all_pars
[
WXY_INDEX
]};
// asymmetry
...
...
@@ -184,16 +184,16 @@ public class Correlations2dLMA {
}
public
Correlations2dLMA
(
public
Correlations2dLMA
(
// USED in lwir
double
[]
scales
// null - use default table
)
{
if
(
scales
!=
null
)
this
.
scales
=
scales
.
clone
();
}
public
void
setDiag
(
boolean
diag_in
)
{
public
void
setDiag
(
boolean
diag_in
)
{
// USED in lwir
this
.
input_diag
=
diag_in
;
}
public
void
addSample
(
public
void
addSample
(
// USED in lwir
double
x
,
// x coordinate on the common scale (corresponding to the largest baseline), along the disparity axis
double
y
,
// y coordinate (0 - disparity axis)
double
v
,
// correlation value at that point
...
...
@@ -209,7 +209,7 @@ public class Correlations2dLMA {
//NumDiag
// TODO: add auto x0, half-width?
// should be called ater all samples are entered (to list groups)
public
void
initVector
(
public
void
initVector
(
// USED in lwir
boolean
adjust_wm
,
boolean
adjust_wy
,
boolean
adjust_wxy
,
...
...
@@ -242,7 +242,7 @@ public class Correlations2dLMA {
toVector
();
}
public
void
setWeightsValues
(
public
void
setWeightsValues
(
// USED in lwir
double
half_width
,
// expected width
double
cost_wm
,
// cost of non-zero this.all_pars[WYD_INDEX]
double
cost_wxy
)
{
// cost of non-zero this.all_pars[WXY_INDEX]
...
...
@@ -260,7 +260,7 @@ public class Correlations2dLMA {
weights
[
i
]
=
s
.
w
;
values
[
i
]
=
s
.
v
;
group_weights
[
groups
.
get
(
s
.
gi
).
num
]
+=
s
.
w
;
if
(
Double
.
isNaN
(
values
[
i
])
||
Double
.
isNaN
(
weights
[
i
]))
{
if
(
Double
.
isNaN
(
values
[
i
])
||
Double
.
isNaN
(
weights
[
i
]))
{
// not used in lwir
weights
[
i
]
=
0.0
;
values
[
i
]
=
0.0
;
}
...
...
@@ -277,7 +277,7 @@ public class Correlations2dLMA {
pure_weight
*=
sw
;
}
public
void
toVector
()
{
public
void
toVector
()
{
// USED in lwir
int
np
=
0
;
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
np
++;
vector
=
new
double
[
np
];
...
...
@@ -285,12 +285,12 @@ public class Correlations2dLMA {
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
vector
[
np
++]
=
all_pars
[
i
];
}
public
void
updateFromVector
()
{
public
void
updateFromVector
()
{
// USED in lwir
int
np
=
0
;
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
all_pars
[
i
]
=
vector
[
np
++];
}
public
double
[]
fromVector
(
double
[]
vector
)
{
// mix fixed and variable parameters
public
double
[]
fromVector
(
double
[]
vector
)
{
// mix fixed and variable parameters
// USED in lwir
if
(
all_pars
==
null
)
return
null
;
double
[]
ap
=
all_pars
.
clone
();
int
np
=
0
;
...
...
@@ -298,7 +298,7 @@ public class Correlations2dLMA {
return
ap
;
}
public
void
debugJt
(
public
void
debugJt
(
// not used in lwir
double
delta
,
double
[]
vector
)
{
int
num_points
=
this
.
values
.
length
;
...
...
@@ -338,7 +338,7 @@ public class Correlations2dLMA {
}
public
double
[]
getFxJt
(
public
double
[]
getFxJt
(
// not used in lwir
double
delta
,
// for testing derivatives: calculates as delta-F/delta_x
double
[]
vector
,
double
[][]
jt
)
{
// should be either [vector.length][samples.size()] or null - then only fx is calculated
...
...
@@ -361,11 +361,11 @@ public class Correlations2dLMA {
public
double
[]
getFx
()
{
public
double
[]
getFx
()
{
// not used in lwir
return
getFxJt
(
this
.
vector
,
null
);
}
public
double
[]
getFxJt
(
public
double
[]
getFxJt
(
// USED in lwir
double
[]
vector
,
double
[][]
jt
)
{
// should be either [vector.length][samples.size()] or null - then only fx is calculated
if
(
vector
==
null
)
return
null
;
...
...
@@ -415,7 +415,7 @@ public class Correlations2dLMA {
return
fx
;
}
public
double
[][]
getWJtJlambda
(
public
double
[][]
getWJtJlambda
(
// USED in lwir
double
lambda
,
double
[][]
jt
){
int
num_pars
=
jt
.
length
;
...
...
@@ -439,7 +439,7 @@ public class Correlations2dLMA {
}
// returns {rms, rms_pure}
public
double
[]
getWYmFxRms
(
public
double
[]
getWYmFxRms
(
// USED in lwir
double
[]
fx
)
{
// will be replaced with y-fx
int
num_samples
=
samples
.
size
();
int
num_points
=
fx
.
length
;
// includes 2 extra for regularization
...
...
@@ -460,7 +460,7 @@ public class Correlations2dLMA {
return
rslt
;
}
public
double
[]
getJtWdiff
(
public
double
[]
getJtWdiff
(
// not used in lwir
double
[]
wdiff
,
double
[][]
jt
){
int
num_pars
=
jt
.
length
;
...
...
@@ -474,7 +474,7 @@ public class Correlations2dLMA {
return
wjtymfx
;
}
public
boolean
runLma
(
public
boolean
runLma
(
// USED in lwir
double
lambda
,
// 0.1
double
lambda_scale_good
,
// 0.5
double
lambda_scale_bad
,
// 8.0
...
...
@@ -502,7 +502,7 @@ public class Correlations2dLMA {
}
else
{
lambda
*=
lambda_scale_bad
;
if
(
lambda
>
lambda_max
)
{
break
;
break
;
// not used in lwir
}
}
}
...
...
@@ -530,7 +530,7 @@ public class Correlations2dLMA {
// returns {success, done}
public
boolean
[]
lmaStep
(
public
boolean
[]
lmaStep
(
// USED in lwir
double
lambda
,
double
rms_diff
,
int
debug_level
)
{
...
...
@@ -640,7 +640,7 @@ public class Correlations2dLMA {
}
// modify to reuse Samples and apply polynomial approximation to resolve x0,y0 and strength?
public
double
[]
getMaxXYPoly
(
// get interpolated maximum coordinates using 2-nd degree polynomial
public
double
[]
getMaxXYPoly
(
// get interpolated maximum coordinates using 2-nd degree polynomial
// not used in lwir
/// double outside, // how much solution may be outside of the samples
boolean
debug
)
{
...
...
@@ -703,11 +703,11 @@ public class Correlations2dLMA {
this
.
poly_xyvwh
=
xyvwh
;
return
xyvwh
;
// rslt;
}
public
double
[]
getPoly
()
{
public
double
[]
getPoly
()
{
// not used in lwir
return
poly_xyvwh
;
}
public
double
[]
getPolyFx
()
{
return
getPolyFx
(
this
.
poly_coeff
);}
public
double
[]
getPolyFx
(
public
double
[]
getPolyFx
()
{
return
getPolyFx
(
this
.
poly_coeff
);}
// not used in lwir
public
double
[]
getPolyFx
(
// not used in lwir
double
[]
coeff
)
{
// 6 elements - Xc, Yx, f(x,y), A, B, C (from A*x^2 + B*y^2 +C*x*y+...)
if
(
coeff
==
null
)
{
return
null
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
c14405c9
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
c14405c9
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
c14405c9
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