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
3f43f2ac
Commit
3f43f2ac
authored
Oct 21, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tested fitting convergence on long image sets
parent
ef473c40
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1150 additions
and
193 deletions
+1150
-193
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+82
-0
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+209
-68
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+1
-1
IntersceneLma.java
...n/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
+83
-24
IntersceneLmaParameters.java
.../elphel/imagej/tileprocessor/IntersceneLmaParameters.java
+58
-6
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+570
-88
OpticalFlowParameters.java
...om/elphel/imagej/tileprocessor/OpticalFlowParameters.java
+15
-0
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+1
-1
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+3
-2
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+128
-3
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
3f43f2ac
...
@@ -700,6 +700,7 @@ private Panel panel1,
...
@@ -700,6 +700,7 @@ private Panel panel1,
addButton
(
"DSI histogram"
,
panelClt5
,
color_report
);
addButton
(
"DSI histogram"
,
panelClt5
,
color_report
);
addButton
(
"ML recalc"
,
panelClt5
,
color_process
);
addButton
(
"ML recalc"
,
panelClt5
,
color_process
);
addButton
(
"Inter Test"
,
panelClt5
,
color_stop
);
addButton
(
"Inter Test"
,
panelClt5
,
color_stop
);
addButton
(
"Inter Pairs"
,
panelClt5
,
color_process
);
addButton
(
"Inter LMA"
,
panelClt5
,
color_stop
);
addButton
(
"Inter LMA"
,
panelClt5
,
color_stop
);
plugInFrame
.
add
(
panelClt5
);
plugInFrame
.
add
(
panelClt5
);
}
}
...
@@ -5108,6 +5109,13 @@ private Panel panel1,
...
@@ -5108,6 +5109,13 @@ private Panel panel1,
CLT_PARAMETERS
.
batch_run
=
true
;
CLT_PARAMETERS
.
batch_run
=
true
;
testInterScene
();
testInterScene
();
return
;
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Inter Pairs"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
interPairsLMA
();
return
;
/* ======================================================================== */
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Inter LMA"
))
{
}
else
if
(
label
.
equals
(
"Inter LMA"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
...
@@ -5116,6 +5124,7 @@ private Panel panel1,
...
@@ -5116,6 +5124,7 @@ private Panel panel1,
testInterLMA
();
testInterLMA
();
return
;
return
;
/* ======================================================================== */
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"CLT rig edit"
))
{
}
else
if
(
label
.
equals
(
"CLT rig edit"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
...
@@ -6533,6 +6542,79 @@ private Panel panel1,
...
@@ -6533,6 +6542,79 @@ private Panel panel1,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES
,
// Properties properties,
PROPERTIES
,
// Properties properties,
true
,
// false, // boolean reset_from_extrinsics,
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
DEBUG_LEVEL
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
//final int debugLevel);
if
(
configPath
!=
null
)
{
saveTimestampedProperties
(
// save config again
configPath
,
// full path or null
null
,
// use as default directory if path==null
true
,
PROPERTIES
);
}
System
.
out
.
println
(
"batchRig(): Processing finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
return
true
;
}
public
boolean
interPairsLMA
()
{
long
startTime
=
System
.
nanoTime
();
// load needed sensor and kernels files
if
(!
prepareRigImages
())
return
false
;
String
configPath
=
getSaveCongigPath
();
if
(
configPath
.
equals
(
"ABORT"
))
return
false
;
setAllProperties
(
PROPERTIES
);
// batchRig may save properties with the model. Extrinsics will be updated, others should be set here
if
(
DEBUG_LEVEL
>
-
2
){
System
.
out
.
println
(
"++++++++++++++ Testing Interscene processing ++++++++++++++"
);
}
if
(
CLT_PARAMETERS
.
useGPU
())
{
// only init GPU instances if it is used
if
(
GPU_TILE_PROCESSOR
==
null
)
{
try
{
GPU_TILE_PROCESSOR
=
new
GPUTileProcessor
(
CORRECTION_PARAMETERS
.
tile_processor_gpu
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GPU class"
);
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
false
;
}
//final int debugLevel);
}
if
(
CLT_PARAMETERS
.
useGPU
(
false
)
&&
(
QUAD_CLT
!=
null
)
&&
(
GPU_QUAD
==
null
))
{
// if GPU main is needed
try
{
GPU_QUAD
=
GPU_TILE_PROCESSOR
.
new
GpuQuad
(
QUAD_CLT
,
4
,
3
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GpuQuad class"
);
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
false
;
}
//final int debugLevel);
QUAD_CLT
.
setGPU
(
GPU_QUAD
);
}
}
try
{
TWO_QUAD_CLT
.
interPairsLMA
(
QUAD_CLT
,
// QuadCLT quadCLT_main,
// QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
COLOR_PROC_PARAMETERS_AUX
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters_aux,
CHANNEL_GAINS_PARAMETERS
,
//CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES
,
// Properties properties,
true
,
// false, // boolean reset_from_extrinsics,
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
UPDATE_STATUS
,
//final boolean updateStatus,
DEBUG_LEVEL
);
DEBUG_LEVEL
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
3f43f2ac
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
3f43f2ac
...
@@ -57,7 +57,7 @@ public class GeometryCorrection {
...
@@ -57,7 +57,7 @@ public class GeometryCorrection {
"velocity_x"
,
"velocity_y"
,
"velocity_z"
};
"velocity_x"
,
"velocity_y"
,
"velocity_z"
};
public
int
debugLevel
=
0
;
public
int
debugLevel
=
0
;
public
double
line_time
=
26.5
E
-
6
;
// duration of sensor scan line (for ERS)
public
double
line_time
=
26.5
E
-
6
;
// duration of sensor scan line (for ERS)
Wrong, 36.38us (change and re-run ERS
public
int
pixelCorrectionWidth
=
2592
;
// virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
public
int
pixelCorrectionWidth
=
2592
;
// virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
public
int
pixelCorrectionHeight
=
1936
;
public
int
pixelCorrectionHeight
=
1936
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
View file @
3f43f2ac
package
com
.
elphel
.
imagej
.
tileprocessor
;
package
com
.
elphel
.
imagej
.
tileprocessor
;
import
java.util.ArrayList
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.DoubleAdder
;
import
java.util.concurrent.atomic.DoubleAdder
;
...
@@ -19,9 +20,10 @@ public class IntersceneLma {
...
@@ -19,9 +20,10 @@ public class IntersceneLma {
private
double
pure_weight
;
// weight of samples only
private
double
pure_weight
;
// weight of samples only
private
boolean
[]
par_mask
=
null
;
private
boolean
[]
par_mask
=
null
;
private
int
[]
par_indices
=
null
;
private
int
[]
par_indices
=
null
;
private
double
[]
backup_parameters_full
=
null
;
// indices match DP_DPX...DP_DSZ (first 3 are not used)
private
double
[]
parameters_full
=
null
;
// full parameters vector for the currenl LMA run
private
double
[]
backup_parameters_full
=
null
;
// full parameters vector before first LMA run
private
double
[]
parameters_vector
=
null
;
private
double
[]
parameters_vector
=
null
;
private
double
[]
parameters_initial
=
null
;
// (will be used to pull for regularization)
//
private double [] parameters_initial = null; // (will be used to pull for regularization)
private
double
[][]
macrotile_centers
=
null
;
// (will be used to pull for regularization)
private
double
[][]
macrotile_centers
=
null
;
// (will be used to pull for regularization)
private
double
infinity_disparity
=
0.1
;
// treat lower as infinity
private
double
infinity_disparity
=
0.1
;
// treat lower as infinity
private
int
num_samples
=
0
;
private
int
num_samples
=
0
;
...
@@ -31,48 +33,91 @@ public class IntersceneLma {
...
@@ -31,48 +33,91 @@ public class IntersceneLma {
this
.
opticalFlow
=
opticalFlow
;
this
.
opticalFlow
=
opticalFlow
;
}
}
public
double
[]
getSceneXYZ
()
{
public
double
[]
getSceneXYZ
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DSX
],
full_vector
[
ErsCorrection
.
DP_DSY
],
full_vector
[
ErsCorrection
.
DP_DSZ
]};
full_vector
[
ErsCorrection
.
DP_DSX
],
full_vector
[
ErsCorrection
.
DP_DSY
],
full_vector
[
ErsCorrection
.
DP_DSZ
]};
}
}
public
double
[]
getSceneATR
()
{
public
double
[]
getSceneATR
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DSAZ
],
full_vector
[
ErsCorrection
.
DP_DSTL
],
full_vector
[
ErsCorrection
.
DP_DSRL
]};
full_vector
[
ErsCorrection
.
DP_DSAZ
],
full_vector
[
ErsCorrection
.
DP_DSTL
],
full_vector
[
ErsCorrection
.
DP_DSRL
]};
}
}
public
double
[]
getReferenceXYZ
()
{
public
double
[]
getReferenceXYZ
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DX
],
full_vector
[
ErsCorrection
.
DP_DY
],
full_vector
[
ErsCorrection
.
DP_DZ
]};
full_vector
[
ErsCorrection
.
DP_DX
],
full_vector
[
ErsCorrection
.
DP_DY
],
full_vector
[
ErsCorrection
.
DP_DZ
]};
}
}
public
double
[]
getReferenceATR
()
{
public
double
[]
getReferenceATR
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DAZ
],
full_vector
[
ErsCorrection
.
DP_DTL
],
full_vector
[
ErsCorrection
.
DP_DRL
]};
full_vector
[
ErsCorrection
.
DP_DAZ
],
full_vector
[
ErsCorrection
.
DP_DTL
],
full_vector
[
ErsCorrection
.
DP_DRL
]};
}
}
public
double
[]
getSceneERSXYZ
()
{
public
double
[]
getSceneERSXYZ
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DSVX
],
full_vector
[
ErsCorrection
.
DP_DSVY
],
full_vector
[
ErsCorrection
.
DP_DSVZ
]};
full_vector
[
ErsCorrection
.
DP_DSVX
],
full_vector
[
ErsCorrection
.
DP_DSVY
],
full_vector
[
ErsCorrection
.
DP_DSVZ
]};
}
}
public
double
[]
getSceneERSATR
()
{
public
double
[]
getSceneERSATR
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DSVAZ
],
full_vector
[
ErsCorrection
.
DP_DSVTL
],
full_vector
[
ErsCorrection
.
DP_DSVRL
]};
full_vector
[
ErsCorrection
.
DP_DSVAZ
],
full_vector
[
ErsCorrection
.
DP_DSVTL
],
full_vector
[
ErsCorrection
.
DP_DSVRL
]};
}
}
public
double
[]
getReferenceERSXYZ
()
{
public
double
[]
getReferenceERSXYZ
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DSVX
],
full_vector
[
ErsCorrection
.
DP_DSVY
],
full_vector
[
ErsCorrection
.
DP_DSVZ
]};
full_vector
[
ErsCorrection
.
DP_DSVX
],
full_vector
[
ErsCorrection
.
DP_DSVY
],
full_vector
[
ErsCorrection
.
DP_DSVZ
]};
}
}
public
double
[]
getReferenceERSATR
()
{
public
double
[]
getReferenceERSATR
(
boolean
initial
)
{
double
[]
full_vector
=
getFullVector
(
parameters_vector
);
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
return
new
double
[]
{
return
new
double
[]
{
full_vector
[
ErsCorrection
.
DP_DSVAZ
],
full_vector
[
ErsCorrection
.
DP_DSVTL
],
full_vector
[
ErsCorrection
.
DP_DSVRL
]};
full_vector
[
ErsCorrection
.
DP_DSVAZ
],
full_vector
[
ErsCorrection
.
DP_DSVTL
],
full_vector
[
ErsCorrection
.
DP_DSVRL
]};
}
}
public
String
[]
printOldNew
(
boolean
allvectors
)
{
return
printOldNew
(
allvectors
,
8
,
5
);
}
public
String
[]
printOldNew
(
boolean
allvectors
,
int
w
,
int
d
)
{
ArrayList
<
String
>
lines
=
new
ArrayList
<
String
>();
for
(
int
n
=
ErsCorrection
.
DP_DVAZ
;
n
<
ErsCorrection
.
DP_NUM_PARS
;
n
+=
3
)
{
boolean
adj
=
false
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
adj
|=
par_mask
[
n
+
i
];
if
(
allvectors
||
adj
)
{
String
line
=
printNameV3
(
n
,
false
,
w
,
d
)+
" (was "
+
printNameV3
(
n
,
true
,
w
,
d
)+
")"
;
lines
.
add
(
line
);
}
}
return
lines
.
toArray
(
new
String
[
lines
.
size
()]);
}
public
String
printNameV3
(
int
indx
,
boolean
initial
,
int
w
,
int
d
)
{
double
[]
full_vector
=
initial
?
backup_parameters_full:
getFullVector
(
parameters_vector
);
double
[]
vector
=
new
double
[
3
];
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
vector
[
i
]
=
full_vector
[
indx
+
i
];
}
String
name
=
ErsCorrection
.
DP_VECTORS_NAMES
[
indx
];
return
printNameV3
(
name
,
vector
,
w
,
d
);
}
public
static
String
printNameV3
(
String
name
,
double
[]
vector
)
{
return
printNameV3
(
name
,
vector
,
8
,
5
);
}
public
static
String
printNameV3
(
String
name
,
double
[]
vector
,
int
w
,
int
d
)
{
return
String
.
format
(
"%14s: %s"
,
name
,
printV3
(
vector
,
w
,
d
));
}
public
static
String
printV3
(
double
[]
vector
)
{
return
printV3
(
vector
,
8
,
5
);
}
public
static
String
printV3
(
double
[]
vector
,
int
w
,
int
d
)
{
String
fmt
=
String
.
format
(
"[%%%d.%df, %%%d.%df, %%%d.%df]"
,
w
,
d
,
w
,
d
,
w
,
d
);
return
String
.
format
(
fmt
,
vector
[
0
],
vector
[
1
],
vector
[
2
]);
}
public
void
prepareLMA
(
public
void
prepareLMA
(
...
@@ -85,6 +130,7 @@ public class IntersceneLma {
...
@@ -85,6 +130,7 @@ public class IntersceneLma {
final
double
[]
param_regweights
,
final
double
[]
param_regweights
,
final
double
[][]
vector_XYS
,
// optical flow X,Y, confidence obtained from the correlate2DIterate()
final
double
[][]
vector_XYS
,
// optical flow X,Y, confidence obtained from the correlate2DIterate()
final
double
[][]
centers
,
// macrotile centers (in pixels and average disparities
final
double
[][]
centers
,
// macrotile centers (in pixels and average disparities
boolean
first_run
,
final
int
debug_level
)
final
int
debug_level
)
{
{
scenesCLT
=
new
QuadCLT
[]
{
reference_QuadClt
,
scene_QuadClt
};
scenesCLT
=
new
QuadCLT
[]
{
reference_QuadClt
,
scene_QuadClt
};
...
@@ -108,7 +154,10 @@ public class IntersceneLma {
...
@@ -108,7 +154,10 @@ public class IntersceneLma {
ers_scene
.
ers_wxyz_center_dt
[
0
],
ers_scene
.
ers_wxyz_center_dt
[
1
],
ers_scene
.
ers_wxyz_center_dt
[
2
],
ers_scene
.
ers_wxyz_center_dt
[
0
],
ers_scene
.
ers_wxyz_center_dt
[
1
],
ers_scene
.
ers_wxyz_center_dt
[
2
],
scene_atr
[
0
],
scene_atr
[
1
],
scene_atr
[
2
],
scene_atr
[
0
],
scene_atr
[
1
],
scene_atr
[
2
],
scene_xyz
[
0
],
scene_xyz
[
1
],
scene_xyz
[
2
]};
scene_xyz
[
0
],
scene_xyz
[
1
],
scene_xyz
[
2
]};
parameters_full
=
full_parameters_vector
.
clone
();
if
(
first_run
||
(
backup_parameters_full
==
null
))
{
backup_parameters_full
=
full_parameters_vector
.
clone
();
backup_parameters_full
=
full_parameters_vector
.
clone
();
}
int
num_pars
=
0
;
int
num_pars
=
0
;
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
num_pars
++;
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
num_pars
++;
par_indices
=
new
int
[
num_pars
];
par_indices
=
new
int
[
num_pars
];
...
@@ -116,7 +165,7 @@ public class IntersceneLma {
...
@@ -116,7 +165,7 @@ public class IntersceneLma {
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
par_indices
[
num_pars
++]
=
i
;
for
(
int
i
=
0
;
i
<
par_mask
.
length
;
i
++)
if
(
par_mask
[
i
])
par_indices
[
num_pars
++]
=
i
;
parameters_vector
=
new
double
[
par_indices
.
length
];
parameters_vector
=
new
double
[
par_indices
.
length
];
for
(
int
i
=
0
;
i
<
par_indices
.
length
;
i
++)
parameters_vector
[
i
]
=
full_parameters_vector
[
par_indices
[
i
]];
for
(
int
i
=
0
;
i
<
par_indices
.
length
;
i
++)
parameters_vector
[
i
]
=
full_parameters_vector
[
par_indices
[
i
]];
parameters_initial
=
parameters_vector
.
clone
();
//
parameters_initial = parameters_vector.clone();
setSamplesWeights
(
vector_XYS
);
// not regularization yet !
setSamplesWeights
(
vector_XYS
);
// not regularization yet !
...
@@ -158,13 +207,14 @@ public class IntersceneLma {
...
@@ -158,13 +207,14 @@ public class IntersceneLma {
good_or_bad_rms
=
this
.
last_rms
.
clone
();
good_or_bad_rms
=
this
.
last_rms
.
clone
();
}
}
public
boolean
runLma
(
public
int
runLma
(
// <0 - failed, >=0 iteration number (1 - immediately)
double
lambda
,
// 0.1
double
lambda
,
// 0.1
double
lambda_scale_good
,
// 0.5
double
lambda_scale_good
,
// 0.5
double
lambda_scale_bad
,
// 8.0
double
lambda_scale_bad
,
// 8.0
double
lambda_max
,
// 100
double
lambda_max
,
// 100
double
rms_diff
,
// 0.001
double
rms_diff
,
// 0.001
int
num_iter
,
// 20
int
num_iter
,
// 20
boolean
last_run
,
int
debug_level
)
int
debug_level
)
{
{
boolean
[]
rslt
=
{
false
,
false
};
boolean
[]
rslt
=
{
false
,
false
};
...
@@ -176,7 +226,7 @@ public class IntersceneLma {
...
@@ -176,7 +226,7 @@ public class IntersceneLma {
rms_diff
,
rms_diff
,
debug_level
);
debug_level
);
if
(
rslt
==
null
)
{
if
(
rslt
==
null
)
{
return
false
;
// need to check
return
-
1
;
//
false; // need to check
}
}
if
(
debug_level
>
1
)
{
if
(
debug_level
>
1
)
{
System
.
out
.
println
(
"LMA step "
+
iter
+
": {"
+
rslt
[
0
]+
","
+
rslt
[
1
]+
"} full RMS= "
+
good_or_bad_rms
[
0
]+
System
.
out
.
println
(
"LMA step "
+
iter
+
": {"
+
rslt
[
0
]+
","
+
rslt
[
1
]+
"} full RMS= "
+
good_or_bad_rms
[
0
]+
...
@@ -212,7 +262,16 @@ public class IntersceneLma {
...
@@ -212,7 +262,16 @@ public class IntersceneLma {
if
(
debug_level
>
0
)
{
if
(
debug_level
>
0
)
{
System
.
out
.
println
(
"LMA: full RMS="
+
last_rms
[
0
]+
" ("
+
initial_rms
[
0
]+
"), pure RMS="
+
last_rms
[
1
]+
" ("
+
initial_rms
[
1
]+
") + lambda="
+
lambda
);
System
.
out
.
println
(
"LMA: full RMS="
+
last_rms
[
0
]+
" ("
+
initial_rms
[
0
]+
"), pure RMS="
+
last_rms
[
1
]+
" ("
+
initial_rms
[
1
]+
") + lambda="
+
lambda
);
}
}
return
rslt
[
0
];
if
(
debug_level
>
0
)
{
if
((
debug_level
>
1
)
||
(
iter
==
1
)
||
last_run
)
{
String
[]
lines
=
printOldNew
(
false
);
// boolean allvectors)
for
(
String
line
:
lines
)
{
System
.
out
.
println
(
line
);
}
}
}
return
rslt
[
0
]?
iter
:
-
1
;
}
}
private
boolean
[]
lmaStep
(
private
boolean
[]
lmaStep
(
...
@@ -445,7 +504,7 @@ public class IntersceneLma {
...
@@ -445,7 +504,7 @@ public class IntersceneLma {
private
double
[]
getFullVector
(
double
[]
vector
)
{
private
double
[]
getFullVector
(
double
[]
vector
)
{
double
[]
full_vector
=
backup_
parameters_full
.
clone
();
double
[]
full_vector
=
parameters_full
.
clone
();
for
(
int
i
=
0
;
i
<
par_indices
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
par_indices
.
length
;
i
++)
{
full_vector
[
par_indices
[
i
]]
=
vector
[
i
];
full_vector
[
par_indices
[
i
]]
=
vector
[
i
];
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLmaParameters.java
View file @
3f43f2ac
...
@@ -13,15 +13,59 @@ public class IntersceneLmaParameters {
...
@@ -13,15 +13,59 @@ public class IntersceneLmaParameters {
public
double
ilma_lambda_max
=
100
;
public
double
ilma_lambda_max
=
100
;
public
double
ilma_rms_diff
=
0.001
;
public
double
ilma_rms_diff
=
0.001
;
public
int
ilma_num_iter
=
20
;
public
int
ilma_num_iter
=
20
;
public
int
ilma_num_corr
=
10
;
// maximal number of full correlatiobn+LMA cycles
public
int
ilma_debug_level
=
1
;
public
int
ilma_debug_level
=
1
;
public
IntersceneLmaParameters
()
{
public
IntersceneLmaParameters
()
{
ilma_lma_select
[
ErsCorrection
.
DP_DVAZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DVTL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DVRL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DVX
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DVY
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DVZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DAZ
]=
false
;
ilma_lma_select
[
ErsCorrection
.
DP_DTL
]=
false
;
ilma_lma_select
[
ErsCorrection
.
DP_DRL
]=
false
;
ilma_lma_select
[
ErsCorrection
.
DP_DX
]=
false
;
ilma_lma_select
[
ErsCorrection
.
DP_DY
]=
false
;
ilma_lma_select
[
ErsCorrection
.
DP_DZ
]=
false
;
ilma_lma_select
[
ErsCorrection
.
DP_DSVAZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSVTL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSVRL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSVX
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSVY
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSVZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSAZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSAZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSTL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSTL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSRL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSRL
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSX
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSX
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSY
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSY
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSZ
]=
true
;
ilma_lma_select
[
ErsCorrection
.
DP_DSZ
]=
true
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DVAZ
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DVTL
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DVRL
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DVX
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DVY
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DVZ
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DAZ
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DTL
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DRL
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DX
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DY
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DZ
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSVAZ
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSVTL
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSVRL
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSVX
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSVY
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSVZ
]=
0.001
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSAZ
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSTL
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSRL
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSX
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSY
]=
0.0
;
ilma_regularization_weights
[
ErsCorrection
.
DP_DSZ
]=
0.0
;
}
}
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
...
@@ -49,6 +93,10 @@ public class IntersceneLmaParameters {
...
@@ -49,6 +93,10 @@ public class IntersceneLmaParameters {
"Exit LMA iterations if relative RMSE improvement drops below this value."
);
"Exit LMA iterations if relative RMSE improvement drops below this value."
);
gd
.
addNumericField
(
"Maximal number of LMA iterations"
,
this
.
ilma_num_iter
,
0
,
3
,
""
,
gd
.
addNumericField
(
"Maximal number of LMA iterations"
,
this
.
ilma_num_iter
,
0
,
3
,
""
,
"A hard limit on LMA iterations."
);
"A hard limit on LMA iterations."
);
gd
.
addNumericField
(
"Maximal number of correlation +LMA iterations"
,
this
.
ilma_num_corr
,
0
,
3
,
""
,
"Outer cycle (recalculate correlations + lma). Otherwise exits if LMA exits at first iteration."
);
gd
.
addNumericField
(
"Debug level"
,
this
.
ilma_debug_level
,
0
,
3
,
""
,
gd
.
addNumericField
(
"Debug level"
,
this
.
ilma_debug_level
,
0
,
3
,
""
,
"Debug level of interscene LMA operation."
);
"Debug level of interscene LMA operation."
);
}
}
...
@@ -65,6 +113,7 @@ public class IntersceneLmaParameters {
...
@@ -65,6 +113,7 @@ public class IntersceneLmaParameters {
this
.
ilma_lambda_max
=
gd
.
getNextNumber
();
this
.
ilma_lambda_max
=
gd
.
getNextNumber
();
this
.
ilma_rms_diff
=
gd
.
getNextNumber
();
this
.
ilma_rms_diff
=
gd
.
getNextNumber
();
this
.
ilma_num_iter
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_num_iter
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_num_corr
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_debug_level
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_debug_level
=
(
int
)
gd
.
getNextNumber
();
}
}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
public
void
setProperties
(
String
prefix
,
Properties
properties
){
...
@@ -78,6 +127,7 @@ public class IntersceneLmaParameters {
...
@@ -78,6 +127,7 @@ public class IntersceneLmaParameters {
properties
.
setProperty
(
prefix
+
"ilma_lambda_max"
,
this
.
ilma_lambda_max
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_max"
,
this
.
ilma_lambda_max
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_rms_diff"
,
this
.
ilma_rms_diff
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_rms_diff"
,
this
.
ilma_rms_diff
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_iter"
,
this
.
ilma_num_iter
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_iter"
,
this
.
ilma_num_iter
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_num_corr"
,
this
.
ilma_num_corr
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_level"
,
this
.
ilma_debug_level
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_level"
,
this
.
ilma_debug_level
+
""
);
}
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
public
void
getProperties
(
String
prefix
,
Properties
properties
){
...
@@ -94,6 +144,7 @@ public class IntersceneLmaParameters {
...
@@ -94,6 +144,7 @@ public class IntersceneLmaParameters {
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
)!=
null
)
this
.
ilma_lambda_max
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
)!=
null
)
this
.
ilma_lambda_max
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_max"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
)!=
null
)
this
.
ilma_rms_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
)!=
null
)
this
.
ilma_rms_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_rms_diff"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
)!=
null
)
this
.
ilma_num_iter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
)!=
null
)
this
.
ilma_num_iter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_iter"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_num_corr"
)!=
null
)
this
.
ilma_num_corr
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_num_corr"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
)!=
null
)
this
.
ilma_debug_level
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
)!=
null
)
this
.
ilma_debug_level
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"ilma_debug_level"
));
}
}
...
@@ -108,6 +159,7 @@ public class IntersceneLmaParameters {
...
@@ -108,6 +159,7 @@ public class IntersceneLmaParameters {
ilp
.
ilma_lambda_max
=
this
.
ilma_lambda_max
;
ilp
.
ilma_lambda_max
=
this
.
ilma_lambda_max
;
ilp
.
ilma_rms_diff
=
this
.
ilma_rms_diff
;
ilp
.
ilma_rms_diff
=
this
.
ilma_rms_diff
;
ilp
.
ilma_num_iter
=
this
.
ilma_num_iter
;
ilp
.
ilma_num_iter
=
this
.
ilma_num_iter
;
ilp
.
ilma_num_corr
=
this
.
ilma_num_corr
;
ilp
.
ilma_debug_level
=
this
.
ilma_debug_level
;
ilp
.
ilma_debug_level
=
this
.
ilma_debug_level
;
return
ilp
;
return
ilp
;
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
3f43f2ac
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlowParameters.java
View file @
3f43f2ac
...
@@ -39,6 +39,8 @@ public class OpticalFlowParameters {
...
@@ -39,6 +39,8 @@ public class OpticalFlowParameters {
public
double
tolerance_relative_inter
=
0.2
;
// relative disparity half-range in each tile
public
double
tolerance_relative_inter
=
0.2
;
// relative disparity half-range in each tile
public
double
occupancy_inter
=
0.25
;
// fraction of remaining tiles in the center 8x8 area (<1.0)
public
double
occupancy_inter
=
0.25
;
// fraction of remaining tiles in the center 8x8 area (<1.0)
public
double
nsigma
=
1.5
;
// Remove outliers by more that this scaled sigma
public
double
nsigma2
=
2.0
;
// Second time outlier filter (<0 - disable)
public
double
[]
chn_weights
=
{
1.0
,
1.0
,
1.0
,
1.0
};
// strength, r,b,g
public
double
[]
chn_weights
=
{
1.0
,
1.0
,
1.0
,
1.0
};
// strength, r,b,g
// double [] chn_weights = {1.0,0.0,0.0,0.0}; // strength, r,b,g
// double [] chn_weights = {1.0,0.0,0.0,0.0}; // strength, r,b,g
// double [] chn_weights = {0.0,1.0,1.0,1.0}; // strength, r,b,g
// double [] chn_weights = {0.0,1.0,1.0,1.0}; // strength, r,b,g
...
@@ -63,6 +65,7 @@ public class OpticalFlowParameters {
...
@@ -63,6 +65,7 @@ public class OpticalFlowParameters {
public
boolean
combine_empty_only
=
true
;
// false;
public
boolean
combine_empty_only
=
true
;
// false;
public
boolean
late_normalize_iterate
=
true
;
public
boolean
late_normalize_iterate
=
true
;
public
int
test_corr_rad_max
=
3
;
public
int
test_corr_rad_max
=
3
;
// for recalculateFlowXY()
// for recalculateFlowXY()
...
@@ -97,6 +100,10 @@ public class OpticalFlowParameters {
...
@@ -97,6 +100,10 @@ public class OpticalFlowParameters {
gd
.
addMessage
(
"Interscene 2D correlation"
);
gd
.
addMessage
(
"Interscene 2D correlation"
);
gd
.
addNumericField
(
"Remove outliers (relative to sigma)"
,
this
.
nsigma
,
3
,
6
,
""
,
"Remove optical flow macrotiles that differ from weighted average by more that this factor scaled standard deviation"
);
gd
.
addNumericField
(
"Remove outliers (relative to sigma), second pass (-1 disable)"
,
this
.
nsigma2
,
3
,
6
,
""
,
"Second pass of outlier removal (with new sigma). Set to -1 to disable second pass"
);
gd
.
addNumericField
(
"Correlation weight of the intrascene strength channel"
,
this
.
chn_weights
[
0
],
3
,
6
,
""
,
gd
.
addNumericField
(
"Correlation weight of the intrascene strength channel"
,
this
.
chn_weights
[
0
],
3
,
6
,
""
,
"Weight of the intrascene correlation strength in interscene macrotile correlation (will be normalized)"
);
"Weight of the intrascene correlation strength in interscene macrotile correlation (will be normalized)"
);
gd
.
addNumericField
(
"Correlation weight of the intrascene red channel"
,
this
.
chn_weights
[
1
],
3
,
6
,
""
,
gd
.
addNumericField
(
"Correlation weight of the intrascene red channel"
,
this
.
chn_weights
[
1
],
3
,
6
,
""
,
...
@@ -166,6 +173,8 @@ public class OpticalFlowParameters {
...
@@ -166,6 +173,8 @@ public class OpticalFlowParameters {
this
.
tolerance_absolute_inter
=
gd
.
getNextNumber
();
this
.
tolerance_absolute_inter
=
gd
.
getNextNumber
();
this
.
tolerance_relative_inter
=
gd
.
getNextNumber
();
this
.
tolerance_relative_inter
=
gd
.
getNextNumber
();
this
.
occupancy_inter
=
gd
.
getNextNumber
();
this
.
occupancy_inter
=
gd
.
getNextNumber
();
this
.
nsigma
=
gd
.
getNextNumber
();
this
.
nsigma2
=
gd
.
getNextNumber
();
this
.
chn_weights
[
0
]
=
gd
.
getNextNumber
();
this
.
chn_weights
[
0
]
=
gd
.
getNextNumber
();
this
.
chn_weights
[
1
]
=
gd
.
getNextNumber
();
this
.
chn_weights
[
1
]
=
gd
.
getNextNumber
();
this
.
chn_weights
[
2
]
=
gd
.
getNextNumber
();
this
.
chn_weights
[
2
]
=
gd
.
getNextNumber
();
...
@@ -207,6 +216,8 @@ public class OpticalFlowParameters {
...
@@ -207,6 +216,8 @@ public class OpticalFlowParameters {
properties
.
setProperty
(
prefix
+
"tolerance_absolute_inter"
,
this
.
tolerance_absolute_inter
+
""
);
properties
.
setProperty
(
prefix
+
"tolerance_absolute_inter"
,
this
.
tolerance_absolute_inter
+
""
);
properties
.
setProperty
(
prefix
+
"tolerance_relative_inter"
,
this
.
tolerance_relative_inter
+
""
);
properties
.
setProperty
(
prefix
+
"tolerance_relative_inter"
,
this
.
tolerance_relative_inter
+
""
);
properties
.
setProperty
(
prefix
+
"occupancy_inter"
,
this
.
occupancy_inter
+
""
);
properties
.
setProperty
(
prefix
+
"occupancy_inter"
,
this
.
occupancy_inter
+
""
);
properties
.
setProperty
(
prefix
+
"nsigma"
,
this
.
nsigma
+
""
);
properties
.
setProperty
(
prefix
+
"nsigma2"
,
this
.
nsigma2
+
""
);
for
(
int
i
=
0
;
i
<
chn_weights
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
chn_weights
.
length
;
i
++)
{
properties
.
setProperty
(
prefix
+
"chn_weights_"
+
i
,
this
.
chn_weights
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
"chn_weights_"
+
i
,
this
.
chn_weights
[
i
]+
""
);
}
}
...
@@ -246,6 +257,8 @@ public class OpticalFlowParameters {
...
@@ -246,6 +257,8 @@ public class OpticalFlowParameters {
if
(
properties
.
getProperty
(
prefix
+
"tolerance_absolute_inter"
)!=
null
)
this
.
tolerance_absolute_inter
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"tolerance_absolute_inter"
));
if
(
properties
.
getProperty
(
prefix
+
"tolerance_absolute_inter"
)!=
null
)
this
.
tolerance_absolute_inter
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"tolerance_absolute_inter"
));
if
(
properties
.
getProperty
(
prefix
+
"tolerance_relative_inter"
)!=
null
)
this
.
tolerance_relative_inter
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"tolerance_relative_inter"
));
if
(
properties
.
getProperty
(
prefix
+
"tolerance_relative_inter"
)!=
null
)
this
.
tolerance_relative_inter
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"tolerance_relative_inter"
));
if
(
properties
.
getProperty
(
prefix
+
"occupancy_inter"
)!=
null
)
this
.
occupancy_inter
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"occupancy_inter"
));
if
(
properties
.
getProperty
(
prefix
+
"occupancy_inter"
)!=
null
)
this
.
occupancy_inter
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"occupancy_inter"
));
if
(
properties
.
getProperty
(
prefix
+
"nsigma"
)!=
null
)
this
.
nsigma
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"nsigma"
));
if
(
properties
.
getProperty
(
prefix
+
"nsigma2"
)!=
null
)
this
.
nsigma2
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"nsigma2"
));
for
(
int
i
=
0
;
i
<
chn_weights
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
chn_weights
.
length
;
i
++)
{
String
s_chn_weight
=
"chn_weights_"
+
i
;
String
s_chn_weight
=
"chn_weights_"
+
i
;
if
(
properties
.
getProperty
(
prefix
+
s_chn_weight
)!=
null
)
this
.
chn_weights
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
s_chn_weight
));
if
(
properties
.
getProperty
(
prefix
+
s_chn_weight
)!=
null
)
this
.
chn_weights
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
s_chn_weight
));
...
@@ -287,6 +300,8 @@ public class OpticalFlowParameters {
...
@@ -287,6 +300,8 @@ public class OpticalFlowParameters {
ofp
.
tolerance_absolute_inter
=
this
.
tolerance_absolute_inter
;
ofp
.
tolerance_absolute_inter
=
this
.
tolerance_absolute_inter
;
ofp
.
tolerance_relative_inter
=
this
.
tolerance_relative_inter
;
ofp
.
tolerance_relative_inter
=
this
.
tolerance_relative_inter
;
ofp
.
occupancy_inter
=
this
.
occupancy_inter
;
ofp
.
occupancy_inter
=
this
.
occupancy_inter
;
ofp
.
nsigma
=
this
.
nsigma
;
ofp
.
nsigma2
=
this
.
nsigma2
;
ofp
.
chn_weights
=
this
.
chn_weights
.
clone
();
ofp
.
chn_weights
=
this
.
chn_weights
.
clone
();
ofp
.
corr_sigma
=
this
.
corr_sigma
;
ofp
.
corr_sigma
=
this
.
corr_sigma
;
ofp
.
fat_zero
=
this
.
fat_zero
;
ofp
.
fat_zero
=
this
.
fat_zero
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
3f43f2ac
...
@@ -113,7 +113,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -113,7 +113,7 @@ public class QuadCLT extends QuadCLTCPU {
restoreDSI
(
"-DSI_MAIN"
);
// "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
restoreDSI
(
"-DSI_MAIN"
);
// "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
restoreInterProperties
(
// restore properties for interscene processing (extrinsics, ers, ...)
restoreInterProperties
(
// restore properties for interscene processing (extrinsics, ers, ...)
null
,
// String path, // full name with extension or null to use x3d directory
null
,
// String path, // full name with extension or null to use x3d directory
// null, // Properties properties, // if null - will only save extrinsics)
false
,
// boolean all_properties,
// null, // Properties properties, // if null - will only save extrinsics)
debugLevel
);
debugLevel
);
// showDSIMain();
// showDSIMain();
return
this
;
// can only be QuadCLT instance
return
this
;
// can only be QuadCLT instance
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
3f43f2ac
...
@@ -340,11 +340,12 @@ public class QuadCLTCPU {
...
@@ -340,11 +340,12 @@ public class QuadCLTCPU {
public
Properties
restoreInterProperties
(
// restore properties for interscene processing (extrinsics, ers, ...)
public
Properties
restoreInterProperties
(
// restore properties for interscene processing (extrinsics, ers, ...)
String
path
,
// full name with extension or null to use x3d directory
String
path
,
// full name with extension or null to use x3d directory
// Properties properties, // if null - will only save extrinsics)
boolean
all_properties
,
int
debugLevel
)
int
debugLevel
)
{
{
if
(
path
==
null
)
{
if
(
path
==
null
)
{
path
=
image_name
+
((
properties
==
null
)
?
"-INTERFRAME"
:
""
)+
".corr-xml"
;
// path = image_name + ((properties == null) ? "-INTERFRAME":"")+".corr-xml";
path
=
image_name
+
(
all_properties
?
""
:
"-INTERFRAME"
)+
".corr-xml"
;
}
}
if
(!
path
.
contains
(
Prefs
.
getFileSeparator
()))
{
if
(!
path
.
contains
(
Prefs
.
getFileSeparator
()))
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
3f43f2ac
...
@@ -8281,6 +8281,117 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8281,6 +8281,117 @@ if (debugLevel > -100) return true; // temporarily !
}
}
public
void
interPairsLMA
(
QuadCLT
quadCLT_main
,
// tiles should be set
CLTParameters
clt_parameters
,
EyesisCorrectionParameters
.
DebayerParameters
debayerParameters
,
ColorProcParameters
colorProcParameters
,
ColorProcParameters
colorProcParameters_aux
,
CorrectionColorProc
.
ColorGainsParameters
channelGainParameters
,
EyesisCorrectionParameters
.
RGBParameters
rgbParameters
,
EyesisCorrectionParameters
.
EquirectangularParameters
equirectangularParameters
,
Properties
properties
,
boolean
reset_from_extrinsics
,
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
int
debugLevel
)
throws
Exception
{
if
((
quadCLT_main
!=
null
)
&&
(
quadCLT_main
.
getGPU
()
!=
null
))
{
quadCLT_main
.
getGPU
().
resetGeometryCorrection
();
quadCLT_main
.
gpuResetCorrVector
();
// .getGPU().resetGeometryCorrectionVector();
}
// final boolean batch_mode = clt_parameters.batch_run;
this
.
startTime
=
System
.
nanoTime
();
String
[]
sourceFiles0
=
quadCLT_main
.
correctionsParameters
.
getSourcePaths
();
QuadCLT
.
SetChannels
[]
set_channels_main
=
quadCLT_main
.
setChannels
(
debugLevel
);
if
((
set_channels_main
==
null
)
||
(
set_channels_main
.
length
==
0
))
{
System
.
out
.
println
(
"No files to process (of "
+
sourceFiles0
.
length
+
")"
);
return
;
}
QuadCLT
.
SetChannels
[]
set_channels
=
quadCLT_main
.
setChannels
(
debugLevel
);
// String set_name = set_channels[0].set_name;
QuadCLT
[]
quadCLTs
=
new
QuadCLT
[
set_channels
.
length
];
for
(
int
i
=
0
;
i
<
quadCLTs
.
length
;
i
++)
{
quadCLTs
[
i
]
=
quadCLT_main
.
spawnQuadCLT
(
set_channels
[
i
].
set_name
,
clt_parameters
,
colorProcParameters
,
//
threadsMax
,
debugLevel
);
// temporarily fix wrong sign:
// ErsCorrection ers = (ErsCorrection) (quadCLTs[i].getGeometryCorrection());
ErsCorrection
ers
=
quadCLTs
[
i
].
getErsCorrection
();
if
(
reset_from_extrinsics
)
{
System
.
out
.
println
(
"Reset ERS parameters from intraframe extrinsics"
);
ers
.
setupERSfromExtrinsics
();
}
quadCLTs
[
i
].
setDSRBG
(
clt_parameters
,
// CLTParameters clt_parameters,
threadsMax
,
// int threadsMax, // maximal number of threads to launch
updateStatus
,
// boolean updateStatus,
debugLevel
);
// int debugLevel)
/// quadCLTs[i].showDSIMain();
}
OpticalFlow
opticalFlow
=
new
OpticalFlow
(
threadsMax
,
// int threadsMax, // maximal number of threads to launch
updateStatus
);
// boolean updateStatus);
for
(
int
i
=
1
;
i
<
quadCLTs
.
length
;
i
++)
{
QuadCLT
qPrev
=
(
i
>
0
)
?
quadCLTs
[
i
-
1
]
:
null
;
// double [][][] pair_sets =
double
[][]
pose
=
opticalFlow
.
getPoseFromErs
(
clt_parameters
.
ofp
.
k_prev
,
// k_prev,
quadCLTs
[
i
],
qPrev
,
clt_parameters
.
ofp
.
debug_level_optical
);
// 1); // -1); // int debug_level);
// how was it working before? qPrev.getErsCorrection() shoud remain what was set in the previous adjustment
quadCLTs
[
i
].
getErsCorrection
().
setupERSfromExtrinsics
();
qPrev
.
getErsCorrection
().
setupERSfromExtrinsics
();
opticalFlow
.
adjustPairsLMA
(
clt_parameters
,
// CLTParameters clt_parameters,
// clt_parameters.ofp.k_prev, // k_prev,
quadCLTs
[
i
],
qPrev
,
pose
[
0
],
// xyz
pose
[
1
],
// atr
clt_parameters
.
ilp
.
ilma_lma_select
,
// final boolean[] param_select,
clt_parameters
.
ilp
.
ilma_regularization_weights
,
// final double [] param_regweights,
// clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters
.
ofp
.
debug_level_optical
);
// 1); // -1); // int debug_level);
/*
scenes_xyzatr[i] = adjustPairsLMA(
clt_parameters, // CLTParameters clt_parameters,
reference_QuadClt, // QuadCLT reference_QuadCLT,
scene_QuadClt, // QuadCLT scene_QuadCLT,
pose[0], // xyz
pose[1], // atr
clt_parameters.ilp.ilma_lma_select, // final boolean[] param_select,
clt_parameters.ilp.ilma_regularization_weights, // final double [] param_regweights,
debug_level); // int debug_level)
*
*
* reversed
opticalFlow.test_LMA(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters.ofp.k_prev, // k_prev,
qPrev,
quadCLTs[i],
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
*/
}
System
.
out
.
println
(
"End of test"
);
}
public
void
TestInterLMA
(
public
void
TestInterLMA
(
QuadCLT
quadCLT_main
,
// tiles should be set
QuadCLT
quadCLT_main
,
// tiles should be set
CLTParameters
clt_parameters
,
CLTParameters
clt_parameters
,
...
@@ -8291,6 +8402,7 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8291,6 +8402,7 @@ if (debugLevel > -100) return true; // temporarily !
EyesisCorrectionParameters
.
RGBParameters
rgbParameters
,
EyesisCorrectionParameters
.
RGBParameters
rgbParameters
,
EyesisCorrectionParameters
.
EquirectangularParameters
equirectangularParameters
,
EyesisCorrectionParameters
.
EquirectangularParameters
equirectangularParameters
,
Properties
properties
,
Properties
properties
,
boolean
reset_from_extrinsics
,
final
int
threadsMax
,
// maximal number of threads to launch
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
boolean
updateStatus
,
final
int
debugLevel
)
throws
Exception
final
int
debugLevel
)
throws
Exception
...
@@ -8320,7 +8432,10 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8320,7 +8432,10 @@ if (debugLevel > -100) return true; // temporarily !
debugLevel
);
debugLevel
);
// temporarily fix wrong sign:
// temporarily fix wrong sign:
ErsCorrection
ers
=
(
ErsCorrection
)
(
quadCLTs
[
i
].
getGeometryCorrection
());
ErsCorrection
ers
=
(
ErsCorrection
)
(
quadCLTs
[
i
].
getGeometryCorrection
());
if
(
reset_from_extrinsics
)
{
System
.
out
.
println
(
"Reset ERS parameters from intraframe extrinsics"
);
ers
.
setupERSfromExtrinsics
();
ers
.
setupERSfromExtrinsics
();
}
quadCLTs
[
i
].
setDSRBG
(
quadCLTs
[
i
].
setDSRBG
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
threadsMax
,
// int threadsMax, // maximal number of threads to launch
threadsMax
,
// int threadsMax, // maximal number of threads to launch
...
@@ -8334,10 +8449,17 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8334,10 +8449,17 @@ if (debugLevel > -100) return true; // temporarily !
threadsMax
,
// int threadsMax, // maximal number of threads to launch
threadsMax
,
// int threadsMax, // maximal number of threads to launch
updateStatus
);
// boolean updateStatus);
updateStatus
);
// boolean updateStatus);
opticalFlow
.
adjustPairsDualPass
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
.
ofp
.
k_prev
,
// k_prev,
quadCLTs
,
// QuadCLT [] scenes, // ordered by increasing timestamps
clt_parameters
.
ofp
.
debug_level_optical
);
// 1); // -1); // int debug_level);
/*
for (int i = 1; i < quadCLTs.length; i++) {
for (int i = 1; i < quadCLTs.length; i++) {
QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null;
QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null;
// double [][][] pair_sets =
// double [][][] pair_sets =
/*
opticalFlow.test_LMA(
opticalFlow.test_LMA(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters, // CLTParameters clt_parameters,
clt_parameters.ofp.k_prev, // k_prev,
clt_parameters.ofp.k_prev, // k_prev,
...
@@ -8346,6 +8468,7 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8346,6 +8468,7 @@ if (debugLevel > -100) return true; // temporarily !
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
*/
*/
/* reversed
opticalFlow.test_LMA(
opticalFlow.test_LMA(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters, // CLTParameters clt_parameters,
clt_parameters.ofp.k_prev, // k_prev,
clt_parameters.ofp.k_prev, // k_prev,
...
@@ -8353,8 +8476,10 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8353,8 +8476,10 @@ if (debugLevel > -100) return true; // temporarily !
quadCLTs[i],
quadCLTs[i],
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
*/
/*
}
}
*/
System
.
out
.
println
(
"End of test"
);
System
.
out
.
println
(
"End of test"
);
...
...
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