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
58750471
Commit
58750471
authored
Oct 05, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementing/testing interscene accumulation
parent
605aa42c
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1467 additions
and
353 deletions
+1467
-353
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+199
-94
GpuQuad.java
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
+8
-3
TpTask.java
src/main/java/com/elphel/imagej/gpu/TpTask.java
+31
-1
Corr2dLMA.java
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
+1
-1
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+5
-1
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+1
-1
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+3
-3
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+422
-85
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+717
-81
OpticalFlowParameters.java
...om/elphel/imagej/tileprocessor/OpticalFlowParameters.java
+7
-0
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+2
-1
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+33
-10
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+38
-72
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
58750471
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
View file @
58750471
...
...
@@ -2305,7 +2305,11 @@ public class GpuQuad{ // quad camera description
final
double
[]
max_py
=
new
double
[
num_cams
]
;
for
(
int
i
=
0
;
i
<
num_cams
;
i
++)
{
min_py
[
i
]
=
margin
+
geometryCorrection
.
getWOITops
()[
i
];
max_py
[
i
]
=
geometryCorrection
.
getWOITops
()[
i
]
+
geometryCorrection
.
getCameraHeights
()[
i
]
-
1
-
margin
;
// camera_heights array is only set during conditionImageSet(), not called by the intersceneAccumulate()
// That was correct, as all scenes should be conditioned
// max_py [i] = geometryCorrection.getWOITops()[i] + geometryCorrection.getCameraHeights()[i] - 1 - margin;
max_py
[
i
]
=
geometryCorrection
.
getSensorWH
()[
1
]
-
1
-
margin
;
//.getSensorWH()[0]
}
if
(
valid_tiles
!=
null
)
{
Arrays
.
fill
(
valid_tiles
,
false
);
...
...
@@ -2334,17 +2338,18 @@ public class GpuQuad{ // quad camera description
tp_task
.
task
=
task_code
;
double
disparity
=
pXpYD
[
nTile
][
2
]
+
disparity_corr
;
tp_task
.
target_disparity
=
(
float
)
disparity
;
// will it be used?
double
[][]
disp_dist
_main
=
new
double
[
quad_main
][];
// used to correct 3D correlations (not yet used here)
double
[][]
disp_dist
=
new
double
[
quad_main
][];
// used to correct 3D correlations (not yet used here)
double
[][]
centersXY_main
=
geometryCorrection
.
getPortsCoordinatesAndDerivatives
(
geometryCorrection
,
// GeometryCorrection gc_main,
false
,
// boolean use_rig_offsets,
corr_rots
,
// Matrix [] rots,
null
,
// Matrix [][] deriv_rots,
null
,
// double [][] pXYderiv, // if not null, should be double[8][]
disp_dist
_main
,
// used to correct 3D correlations
disp_dist
,
// used to correct 3D correlations
pXpYD
[
nTile
][
0
],
pXpYD
[
nTile
][
1
],
disparity
);
// + disparity_corr);
tp_task
.
setDispDist
(
disp_dist
);
tp_task
.
xy
=
new
float
[
centersXY_main
.
length
][
2
];
boolean
bad_margins
=
false
;
for
(
int
i
=
0
;
i
<
centersXY_main
.
length
;
i
++)
{
...
...
src/main/java/com/elphel/imagej/gpu/TpTask.java
View file @
58750471
...
...
@@ -54,6 +54,18 @@ public class TpTask {
public
float
[][]
getDispDist
(){
return
disp_dist
;
}
public
void
setDispDist
(
float
[][]
disp_dist
){
this
.
disp_dist
=
disp_dist
;
}
public
void
setDispDist
(
double
[][]
disp_dist
){
this
.
disp_dist
=
new
float
[
disp_dist
.
length
][
disp_dist
[
0
].
length
];
for
(
int
i
=
0
;
i
<
disp_dist
.
length
;
i
++)
{
for
(
int
j
=
0
;
j
<
disp_dist
[
0
].
length
;
j
++)
{
this
.
disp_dist
[
i
][
j
]
=
(
float
)
disp_dist
[
i
][
j
];
}
}
}
public
double
[][]
getDoubleDispDist
(){
if
(
disp_dist
==
null
)
{
// can it happen?
return
null
;
...
...
@@ -66,10 +78,11 @@ public class TpTask {
}
return
ddisp_dist
;
}
@Deprecated
public
float
[][]
getXY
(
boolean
use_aux
){
return
use_aux
?
xy_aux
:
xy
;
}
@Deprecated
public
double
[][]
getDoubleXY
(
boolean
use_aux
){
float
[][]
fXY
=
getXY
(
use_aux
);
if
(
fXY
==
null
)
{
...
...
@@ -83,6 +96,23 @@ public class TpTask {
}
return
dXY
;
}
public
float
[][]
getXY
(){
return
xy
;
}
public
double
[][]
getDoubleXY
(){
float
[][]
fXY
=
getXY
();
if
(
fXY
==
null
)
{
return
null
;
}
double
[][]
dXY
=
new
double
[
fXY
.
length
][
fXY
[
0
].
length
];
for
(
int
nsens
=
0
;
nsens
<
fXY
.
length
;
nsens
++)
{
for
(
int
i
=
0
;
i
<
fXY
[
nsens
].
length
;
i
++)
{
dXY
[
nsens
][
i
]
=
fXY
[
nsens
][
i
];
}
}
return
dXY
;
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
View file @
58750471
...
...
@@ -2024,7 +2024,7 @@ public class Corr2dLMA {
double
lambda
,
double
[][]
jt
){
int
num_pars
=
jt
.
length
;
int
nup_points
=
jt
[
0
].
length
;
int
nup_points
=
(
num_pars
>
0
)?
jt
[
0
].
length
:
0
;
double
[][]
wjtjl
=
new
double
[
num_pars
][
num_pars
];
for
(
int
i
=
0
;
i
<
num_pars
;
i
++)
{
for
(
int
j
=
i
;
j
<
num_pars
;
j
++)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
58750471
...
...
@@ -274,6 +274,10 @@ public class Correlation2d {
return
pair_start_end
.
length
;
}
public
static
int
getNumPairs
(
int
numSensors
)
{
return
numSensors
*
(
numSensors
-
1
)
/
2
;
}
public
void
setCorrPairs
(
boolean
[]
sel
)
{
// these pairs will be correlated
corr_pairs
=
sel
.
clone
();
}
...
...
@@ -782,7 +786,7 @@ public class Correlation2d {
true
,
// boolean normalize,
true
,
// boolean notch,
wndx_scale
);
// double scale);
int
num_pairs
=
numSensors
*
(
numSensors
-
1
)
/
2
;
int
num_pairs
=
getNumPairs
(
numSensors
);
//
numSensors * (numSensors-1) /2;
pair_start_end
=
new
int
[
num_pairs
][
2
];
pair_orient
=
new
int
[
num_pairs
][
num_pairs
];
pair_length
=
new
int
[
num_pairs
];
...
...
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
58750471
...
...
@@ -371,7 +371,7 @@ public class ErsCorrection extends GeometryCorrection {
public
void
addScene
(
String
timestamp
,
double
[]
xyz
,
double
[]
atr
,
double
[]
ers_xyz_dt
,
double
[]
ers_atr_dt
)
{
scenes_poses
.
put
(
timestamp
,
new
XyzAtr
(
xyz
,
atr
,
ers_xyz_dt
,
ers_atr_dt
));
}
//not used
public
void
addScene
(
String
timestamp
,
double
[]
xyz
,
double
[]
atr
,
double
[]
ers_xyz_dt
,
double
[]
ers_atr_dt
,
double
[]
ers_xyz_d2t
,
double
[]
ers_atr_d2t
)
{
scenes_poses
.
put
(
timestamp
,
new
XyzAtr
(
xyz
,
atr
,
ers_xyz_dt
,
ers_atr_dt
,
ers_xyz_d2t
,
ers_atr_d2t
));
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
58750471
...
...
@@ -336,7 +336,7 @@ public class ImageDtt extends ImageDttCPU {
fdisp_dist
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getDispDist
();
}
if
(
fpxpy
!=
null
)
{
fpxpy
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getXY
(
use_main
);
// boolean use_aux);
fpxpy
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getXY
(
);
//
use_main); // boolean use_aux);
}
}
// end of tile
}
...
...
@@ -1171,7 +1171,7 @@ public class ImageDtt extends ImageDttCPU {
fdisp_dist
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getDispDist
();
}
if
(
fpxpy
!=
null
)
{
fpxpy
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getXY
(
use_main
);
// boolean use_aux);
fpxpy
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getXY
(
);
//
use_main); // boolean use_aux);
}
}
// end of tile
}
...
...
@@ -1193,7 +1193,7 @@ public class ImageDtt extends ImageDttCPU {
for
(
int
indx_tile
=
ai
.
getAndIncrement
();
indx_tile
<
tp_tasks_full
.
length
;
indx_tile
=
ai
.
getAndIncrement
())
{
TpTask
task
=
tp_tasks_full
[
indx_tile
];
if
(
fpxpy
!=
null
)
{
fpxpy_test
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getXY
(
use_main
);
// boolean use_aux);
fpxpy_test
[
task
.
getTileY
()][
task
.
getTileX
()]
=
task
.
getXY
(
);
//
use_main); // boolean use_aux);
}
}
// end of tile
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
58750471
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
58750471
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlowParameters.java
View file @
58750471
...
...
@@ -28,6 +28,7 @@ import java.util.Properties;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
public
class
OpticalFlowParameters
{
public
double
scale_no_lma_disparity
=
1.0
;
// multiply strength were disparity_lma = NaN;
public
double
k_prev
=
0.75
;
public
double
ers_to_pose_scale
=
0.75
;
public
double
tolerance_absolute_ref
=
0.25
;
// absolute disparity half-range in each tile
...
...
@@ -75,6 +76,8 @@ public class OpticalFlowParameters {
public
boolean
enable_debug_images
=
true
;
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
gd
.
addNumericField
(
"Scale strength for the tiles with no LMA disparity"
,
this
.
scale_no_lma_disparity
,
3
,
6
,
""
,
"Reduce strength (but kip less reliable CM-measured disparity for the tiles with no disparity measured with LMA"
);
gd
.
addMessage
(
"Intraframe ERS to pose"
);
gd
.
addNumericField
(
"Previous (in time) frame weight (0.75)"
,
this
.
k_prev
,
3
,
6
,
""
,
"Earlier frame ERS was sampled closer to interframe"
);
...
...
@@ -165,6 +168,7 @@ public class OpticalFlowParameters {
}
public
void
dialogAnswers
(
GenericJTabbedDialog
gd
)
{
this
.
scale_no_lma_disparity
=
gd
.
getNextNumber
();
this
.
k_prev
=
gd
.
getNextNumber
();
this
.
ers_to_pose_scale
=
gd
.
getNextNumber
();
this
.
tolerance_absolute_ref
=
gd
.
getNextNumber
();
...
...
@@ -209,6 +213,7 @@ public class OpticalFlowParameters {
}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
properties
.
setProperty
(
prefix
+
"scale_no_lma_disparity"
,
this
.
scale_no_lma_disparity
+
""
);
properties
.
setProperty
(
prefix
+
"k_prev"
,
this
.
k_prev
+
""
);
properties
.
setProperty
(
prefix
+
"ers_to_pose_scale"
,
this
.
ers_to_pose_scale
+
""
);
properties
.
setProperty
(
prefix
+
"tolerance_absolute_ref"
,
this
.
tolerance_absolute_ref
+
""
);
...
...
@@ -250,6 +255,7 @@ public class OpticalFlowParameters {
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"scale_no_lma_disparity"
)!=
null
)
this
.
scale_no_lma_disparity
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"scale_no_lma_disparity"
));
if
(
properties
.
getProperty
(
prefix
+
"k_prev"
)!=
null
)
this
.
k_prev
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"k_prev"
));
if
(
properties
.
getProperty
(
prefix
+
"ers_to_pose_scale"
)!=
null
)
this
.
ers_to_pose_scale
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ers_to_pose_scale"
));
if
(
properties
.
getProperty
(
prefix
+
"tolerance_absolute_ref"
)!=
null
)
this
.
tolerance_absolute_ref
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"tolerance_absolute_ref"
));
...
...
@@ -294,6 +300,7 @@ public class OpticalFlowParameters {
@Override
public
OpticalFlowParameters
clone
()
throws
CloneNotSupportedException
{
OpticalFlowParameters
ofp
=
new
OpticalFlowParameters
();
ofp
.
scale_no_lma_disparity
=
this
.
scale_no_lma_disparity
;
ofp
.
k_prev
=
this
.
k_prev
;
ofp
.
ers_to_pose_scale
=
this
.
ers_to_pose_scale
;
ofp
.
tolerance_absolute_ref
=
this
.
tolerance_absolute_ref
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
58750471
...
...
@@ -3491,7 +3491,7 @@ public class QuadCLT extends QuadCLTCPU {
double
[][]
ports_xy
=
new
double
[
tilesY
*
tilesX
][];
TpTask
[]
tp_tasks
=
gpuQuad
.
getTasks
(
use_aux
);
// use_aux);
for
(
TpTask
tp_task:
tp_tasks
)
{
float
[][]
txy
=
tp_task
.
getXY
(
use_aux
);
float
[][]
txy
=
tp_task
.
getXY
(
);
//
use_aux);
double
[]
tile_ports_xy
=
new
double
[
txy
.
length
*
txy
[
0
].
length
];
int
indx
=
0
;
for
(
int
i
=
0
;
i
<
txy
.
length
;
i
++)
{
...
...
@@ -3616,6 +3616,7 @@ public class QuadCLT extends QuadCLTCPU {
return
disparity_map
;
}
@Deprecated
public
double
[][]
CLTCorrDisparityMapCPUTasks
(
String
suffix
,
CLTParameters
clt_parameters
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
58750471
...
...
@@ -314,7 +314,7 @@ public class QuadCLTCPU {
System
.
out
.
println
(
"Failed to open "
+
file_path
);
return
-
1
;
}
System
.
out
.
println
(
"restoreDSI(): got "
+
imp
.
getStackSize
()+
" slices
"
);
System
.
out
.
println
(
"restoreDSI(): got "
+
imp
.
getStackSize
()+
" slices
from file: "
+
file_path
);
if
(
imp
.
getStackSize
()
<
2
)
{
System
.
out
.
println
(
"Failed to read "
+
file_path
);
return
-
1
;
...
...
@@ -359,7 +359,9 @@ public class QuadCLTCPU {
path
=
x3d_path
+
Prefs
.
getFileSeparator
()+
path
;
}
Properties
inter_properties
=
new
Properties
();
setProperties
(
QuadCLT
.
PREFIX
,
inter_properties
);
String
prefix
=
is_aux
?
PREFIX_AUX:
PREFIX
;
// setProperties(QuadCLT.PREFIX,inter_properties);
setProperties
(
prefix
,
inter_properties
);
// quadCLT_aux.setProperties(QuadCLT.PREFIX_AUX,properties);
OutputStream
os
;
try
{
...
...
@@ -433,6 +435,7 @@ public class QuadCLTCPU {
ers
.
getPropertiesERS
(
prefix
,
properties
);
ers
.
getPropertiesScenes
(
prefix
,
properties
);
ers
.
getPropertiesLineTime
(
prefix
,
properties
);
// will set old value if not in the file
System
.
out
.
println
(
"Restored interframe properties from :"
+
path
);
return
properties
;
}
...
...
@@ -443,8 +446,10 @@ public class QuadCLTCPU {
}
public
String
[]
getDSRGGTiltes
()
{
return
isMonochrome
()?
(
new
String
[]{
"disparity"
,
"strength"
,
"disparity_lma"
,
"Y"
}):
(
new
String
[]{
"disparity"
,
"strength"
,
"disparity_lma"
,
"R"
,
"B"
,
"G"
});
// (new String[]{"disparity","strength", "disparity_lma","Y"}):
// (new String[]{"disparity","strength", "disparity_lma","R","B","G"});
(
new
String
[]{
"disparity"
,
"strength"
,
"Y"
}):
(
new
String
[]{
"disparity"
,
"strength"
,
"R"
,
"B"
,
"G"
});
}
public
void
setDSRBG
(
...
...
@@ -471,6 +476,17 @@ public class QuadCLTCPU {
boolean
updateStatus
,
int
debugLevel
)
{
double
snld
=
clt_parameters
.
ofp
.
scale_no_lma_disparity
;
if
((
snld
!=
1.0
)
&&
(
disparity_lma
!=
null
))
{
strength
=
strength
.
clone
();
for
(
int
i
=
0
;
i
<
strength
.
length
;
i
++)
{
if
(
Double
.
isNaN
(
disparity_lma
[
i
]))
{
strength
[
i
]
*=
snld
;
}
}
}
double
[][]
rbg
=
getTileRBG
(
clt_parameters
,
disparity
,
...
...
@@ -483,13 +499,13 @@ public class QuadCLTCPU {
this
.
dsrbg
=
new
double
[][]
{
disparity
,
strength
,
disparity_lma
,
//
disparity_lma,
rbg
[
2
]};
}
else
{
this
.
dsrbg
=
new
double
[][]
{
disparity
,
strength
,
disparity_lma
,
//
disparity_lma,
rbg
[
0
],
rbg
[
1
],
rbg
[
2
]};
}
if
(
debugLevel
>
1
)
{
// -2) {
...
...
@@ -943,15 +959,22 @@ public class QuadCLTCPU {
0
);
// int jpegQuality)
}
public
void
showDSIMain
()
{
showDSIMain
(
this
.
dsi
);
showDSIMain
(
this
.
dsi
,
isAux
());
}
public
void
showDSIMain
(
double
[][]
dsi
)
double
[][]
dsi
,
boolean
use_aux
)
{
String
title
=
image_name
+
"-DSI_MAIN"
;
String
[]
titles
=
{
TwoQuadCLT
.
DSI_SLICES
[
TwoQuadCLT
.
DSI_DISPARITY_MAIN
],
TwoQuadCLT
.
DSI_SLICES
[
TwoQuadCLT
.
DSI_STRENGTH_MAIN
]};
double
[][]
dsi_main
=
{
dsi
[
TwoQuadCLT
.
DSI_DISPARITY_MAIN
],
dsi
[
TwoQuadCLT
.
DSI_STRENGTH_MAIN
]};
String
[]
titles
=
{
TwoQuadCLT
.
DSI_SLICES
[
use_aux
?
TwoQuadCLT
.
DSI_DISPARITY_AUX
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN
],
TwoQuadCLT
.
DSI_SLICES
[
use_aux
?
TwoQuadCLT
.
DSI_STRENGTH_AUX
:
TwoQuadCLT
.
DSI_STRENGTH_MAIN
]};
double
[][]
dsi_main
=
{
dsi
[
use_aux
?
TwoQuadCLT
.
DSI_DISPARITY_AUX
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN
],
dsi
[
use_aux
?
TwoQuadCLT
.
DSI_STRENGTH_AUX
:
TwoQuadCLT
.
DSI_STRENGTH_MAIN
]};
(
new
ShowDoubleFloatArrays
()).
showArrays
(
dsi_main
,
tp
.
getTilesX
(),
tp
.
getTilesY
(),
true
,
title
,
titles
);
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
58750471
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