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
23452c5b
Commit
23452c5b
authored
May 23, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testing fast single-stage poses that require DSI for ref scene only
parent
57bfb4d6
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1393 additions
and
380 deletions
+1393
-380
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+107
-1
JP46_Reader_camera.java
src/main/java/com/elphel/imagej/jp4/JP46_Reader_camera.java
+1
-0
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+11
-7
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+17
-0
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+3
-0
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+92
-4
IntersceneLma.java
...n/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
+4
-4
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+86
-5
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+836
-310
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+21
-1
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+110
-16
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+105
-32
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
23452c5b
...
@@ -737,6 +737,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
...
@@ -737,6 +737,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
panelClt5aux
=
new
Panel
();
panelClt5aux
=
new
Panel
();
panelClt5aux
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
// rows, columns, vgap, hgap
panelClt5aux
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
// rows, columns, vgap, hgap
addButton
(
"LIST extrinsics"
,
panelClt5aux
,
color_report
);
addButton
(
"LIST extrinsics"
,
panelClt5aux
,
color_report
);
addButton
(
"Aux Build Series"
,
panelClt5aux
,
color_stop
);
addButton
(
"Aux Inter Test"
,
panelClt5aux
,
color_stop
);
addButton
(
"Aux Inter Test"
,
panelClt5aux
,
color_stop
);
addButton
(
"Aux Inter Pairs"
,
panelClt5aux
,
color_process
);
addButton
(
"Aux Inter Pairs"
,
panelClt5aux
,
color_process
);
addButton
(
"Aux Inter LMA"
,
panelClt5aux
,
color_stop
);
addButton
(
"Aux Inter LMA"
,
panelClt5aux
,
color_stop
);
...
@@ -5132,6 +5133,13 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
...
@@ -5132,6 +5133,13 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
testInterScene
(
false
);
testInterScene
(
false
);
return
;
return
;
/* ======================================================================== */
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Aux Build Series"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
buildSeries
(
true
);
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Aux Inter Test"
))
{
}
else
if
(
label
.
equals
(
"Aux Inter Test"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
...
@@ -6746,6 +6754,102 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
...
@@ -6746,6 +6754,102 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
return
true
;
return
true
;
}
}
public
boolean
buildSeries
(
boolean
use_aux
)
{
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
(
"++++++++++++++ Building series from scratch ++++++++++++++"
);
}
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
(
use_aux
)
{
if
(
CLT_PARAMETERS
.
useGPU
(
true
)
&&
(
QUAD_CLT_AUX
!=
null
)
&&
(
GPU_QUAD_AUX
==
null
))
{
// if GPU AUX is
// needed
try
{
GPU_QUAD_AUX
=
new
GpuQuad
(
//
GPU_TILE_PROCESSOR
,
QUAD_CLT_AUX
,
CLT_PARAMETERS
.
gpu_debug_level
);
}
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_AUX
.
setGPU
(
GPU_QUAD_AUX
);
}
}
else
{
if
(
CLT_PARAMETERS
.
useGPU
(
false
)
&&
(
QUAD_CLT
!=
null
)
&&
(
GPU_QUAD
==
null
))
{
// if GPU main is needed
try
{
GPU_QUAD
=
new
GpuQuad
(
GPU_TILE_PROCESSOR
,
QUAD_CLT
,
CLT_PARAMETERS
.
gpu_debug_level
);
}
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
);
}
}
}
QuadCLT
quadCLT
=
use_aux
?
QUAD_CLT_AUX
:
QUAD_CLT
;
ColorProcParameters
colorProcParameters
=
use_aux
?
COLOR_PROC_PARAMETERS_AUX
:
COLOR_PROC_PARAMETERS
;
CLT_PARAMETERS
.
setColorProcParameters
(
COLOR_PROC_PARAMETERS
,
false
);
CLT_PARAMETERS
.
setColorProcParameters
(
COLOR_PROC_PARAMETERS_AUX
,
true
);
CLT_PARAMETERS
.
setRGBParameters
(
RGB_PARAMETERS
);
try
{
TWO_QUAD_CLT
.
buildSeriesTQ
(
quadCLT
,
// QUAD_CLT, // QuadCLT quadCLT_main,
-
1
,
// int ref_index,
0
,
// int ref_step,
// QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
// EyesisCorrectionParameters.DebayerParameters debayerParameters,
colorProcParameters
,
// COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters
// colorProcParameters,
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
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
testInterLMA
(
boolean
use_aux
)
{
public
boolean
testInterLMA
(
boolean
use_aux
)
{
long
startTime
=
System
.
nanoTime
();
long
startTime
=
System
.
nanoTime
();
// load needed sensor and kernels files
// load needed sensor and kernels files
...
@@ -7791,12 +7895,14 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
...
@@ -7791,12 +7895,14 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
System
.
out
.
println
(
"++++++++++++++ Copying JP4 source files ++++++++++++++"
);
System
.
out
.
println
(
"++++++++++++++ Copying JP4 source files ++++++++++++++"
);
}
}
try
{
try
{
T
WO_QUAD_
CLT
.
copyJP4src
(
// actually there is no sense to process multiple image sets. Combine with other
T
woQuad
CLT
.
copyJP4src
(
// actually there is no sense to process multiple image sets. Combine with other
// processing?
// processing?
null
,
// String set_name
null
,
// String set_name
QUAD_CLT
,
// QuadCLT quadCLT_main,
QUAD_CLT
,
// QuadCLT quadCLT_main,
QUAD_CLT_AUX
,
// QuadCLT quadCLT_aux,
QUAD_CLT_AUX
,
// QuadCLT quadCLT_aux,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
true
,
// boolean skip_existing,
true
,
// boolean search_KML,
DEBUG_LEVEL
);
DEBUG_LEVEL
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
...
...
src/main/java/com/elphel/imagej/jp4/JP46_Reader_camera.java
View file @
23452c5b
...
@@ -328,6 +328,7 @@ public class JP46_Reader_camera implements PlugIn, ActionListener {
...
@@ -328,6 +328,7 @@ public class JP46_Reader_camera implements PlugIn, ActionListener {
imp
=
openJpegOrGif
(
directory
,
fileName
);
imp
=
openJpegOrGif
(
directory
,
fileName
);
if
(
imp
==
null
)
{
if
(
imp
==
null
)
{
IJ
.
showMessage
(
"JP46 Reader Error"
,
"Could not open "
+
directory
+
""
+
fileName
+
" as JPEG/JP46"
);
IJ
.
showMessage
(
"JP46 Reader Error"
,
"Could not open "
+
directory
+
""
+
fileName
+
" as JPEG/JP46"
);
System
.
out
.
println
(
"JP46 Reader Error: Could not open "
+
directory
+
""
+
fileName
+
" as JPEG/JP46"
);
}
else
{
}
else
{
if
((
imp_src
==
null
)&&
showImage
)
imp
.
show
();
/* Shows before re-ordering*/
if
((
imp_src
==
null
)&&
showImage
)
imp
.
show
();
/* Shows before re-ordering*/
ElphelMakerNote
=
readElphelMakerNote
(
directory
,
fileName
,
16
,
xtraExif
);
/* after or 8.2.2 */
ElphelMakerNote
=
readElphelMakerNote
(
directory
,
fileName
,
16
,
xtraExif
);
/* after or 8.2.2 */
...
...
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
23452c5b
...
@@ -2438,11 +2438,13 @@ public class Correlation2d {
...
@@ -2438,11 +2438,13 @@ public class Correlation2d {
for
(
int
ix
=
0
;
ix
<
data_width
;
ix
++)
{
for
(
int
ix
=
0
;
ix
<
data_width
;
ix
++)
{
double
x
=
ix
-
x0
;
double
x
=
ix
-
x0
;
double
d
=
data
[
iy
*
data_width
+
ix
];
double
d
=
data
[
iy
*
data_width
+
ix
];
if
(
d
>
0
)
{
// ignore negative
s0
+=
d
;
s0
+=
d
;
sx
+=
d
*
x
;
sx
+=
d
*
x
;
sy
+=
d
*
y
;
sy
+=
d
*
y
;
}
}
}
}
}
x0
+=
sx
/
s0
;
x0
+=
sx
/
s0
;
y0
+=
sy
/
s0
;
y0
+=
sy
/
s0
;
}
else
{
}
else
{
...
@@ -2457,6 +2459,7 @@ public class Correlation2d {
...
@@ -2457,6 +2459,7 @@ public class Correlation2d {
if
(
r2
<
radius2
)
{
if
(
r2
<
radius2
)
{
double
r
=
Math
.
sqrt
(
r2
);
double
r
=
Math
.
sqrt
(
r2
);
double
d
=
data
[
iy
*
data_width
+
ix
];
double
d
=
data
[
iy
*
data_width
+
ix
];
if
(
d
>
0
)
{
// ignore negative
d
*=
Math
.
cos
(
0.5
*
Math
.
PI
*
r
/
radius
);
d
*=
Math
.
cos
(
0.5
*
Math
.
PI
*
r
/
radius
);
s0
+=
d
;
s0
+=
d
;
sx
+=
d
*
x
;
sx
+=
d
*
x
;
...
@@ -2464,6 +2467,7 @@ public class Correlation2d {
...
@@ -2464,6 +2467,7 @@ public class Correlation2d {
}
}
}
}
}
}
}
x0
+=
sx
/
s0
;
x0
+=
sx
/
s0
;
y0
+=
sy
/
s0
;
y0
+=
sy
/
s0
;
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
23452c5b
...
@@ -1987,6 +1987,23 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -1987,6 +1987,23 @@ public class ErsCorrection extends GeometryCorrection {
}
}
}
}
public
static
double
[][]
combineXYZATR
(
double
[][]
reference_xyzatr
,
double
[][]
scene_xyzatr
){
return
combineXYZATR
(
reference_xyzatr
[
0
],
reference_xyzatr
[
1
],
scene_xyzatr
[
0
],
scene_xyzatr
[
1
]);
}
public
static
double
[][]
invertXYZATR
(
double
[][]
source_xyzatr
){
return
invertXYZATR
(
source_xyzatr
[
0
],
source_xyzatr
[
1
]);
}
public
static
double
[][]
combineXYZATR
(
public
static
double
[][]
combineXYZATR
(
double
[]
reference_xyz
,
double
[]
reference_xyz
,
double
[]
reference_atr
,
double
[]
reference_atr
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
23452c5b
...
@@ -320,6 +320,9 @@ public class GeometryCorrection {
...
@@ -320,6 +320,9 @@ public class GeometryCorrection {
System
.
arraycopy
(
right
,
0
,
egc
.
right
,
0
,
min_nc
);
System
.
arraycopy
(
right
,
0
,
egc
.
right
,
0
,
min_nc
);
System
.
arraycopy
(
height
,
0
,
egc
.
height
,
0
,
min_nc
);
System
.
arraycopy
(
height
,
0
,
egc
.
height
,
0
,
min_nc
);
System
.
arraycopy
(
roll
,
0
,
egc
.
roll
,
0
,
min_nc
);
System
.
arraycopy
(
roll
,
0
,
egc
.
roll
,
0
,
min_nc
);
if
(
woi_tops
==
null
)
{
woi_tops
=
new
int
[
min_nc
];
}
System
.
arraycopy
(
woi_tops
,
0
,
egc
.
woi_tops
,
0
,
min_nc
);
System
.
arraycopy
(
woi_tops
,
0
,
egc
.
woi_tops
,
0
,
min_nc
);
for
(
int
n
=
0
;
n
<
min_nc
;
n
++)
{
for
(
int
n
=
0
;
n
<
min_nc
;
n
++)
{
egc
.
pXY0
[
n
]
=
pXY0
[
n
].
clone
();
egc
.
pXY0
[
n
]
=
pXY0
[
n
].
clone
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
23452c5b
...
@@ -2467,6 +2467,10 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2467,6 +2467,10 @@ public class ImageDtt extends ImageDttCPU {
final
int
n_recenter
,
// when cosine window, re-center window this many times
final
int
n_recenter
,
// when cosine window, re-center window this many times
final
double
min_str
,
// = 0.25;
final
double
min_str
,
// = 0.25;
final
double
min_str_sum
,
// = 0.8; // 5;
final
double
min_str_sum
,
// = 0.8; // 5;
final
int
min_neibs
,
// 2; // minimal number of strong neighbors (> min_str)
final
double
weight_zero_neibs
,
// 0.2; // Reduce weight for no-neib (1.0 for all 8)
final
double
half_disparity
,
// 5.0; // Reduce weight twice for this disparity
final
double
half_avg_diff
,
// 0.2; // when L2 of x,y difference from average of neibs - reduce twice
final
int
debug_tileX
,
final
int
debug_tileX
,
final
int
debug_tileY
,
final
int
debug_tileY
,
final
int
threadsMax
,
// maximal number of threads to launch
final
int
threadsMax
,
// maximal number of threads to launch
...
@@ -2477,6 +2481,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2477,6 +2481,7 @@ public class ImageDtt extends ImageDttCPU {
System
.
out
.
println
(
"clt_process_tl_interscene(): this.gpuQuad is null, bailing out"
);
System
.
out
.
println
(
"clt_process_tl_interscene(): this.gpuQuad is null, bailing out"
);
return
null
;
return
null
;
}
}
// final int min_neibs = clt_parameters.imp.min_neibs;
final
boolean
extra_sum
=
true
;
// use sum of pixel-domain correlations (TD have artifacts for low contrast
final
boolean
extra_sum
=
true
;
// use sum of pixel-domain correlations (TD have artifacts for low contrast
// - maybe -related to float vs. double - not tested yet
// - maybe -related to float vs. double - not tested yet
// final int width = gpuQuad.getImageWidth();
// final int width = gpuQuad.getImageWidth();
...
@@ -2657,15 +2662,19 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2657,15 +2662,19 @@ public class ImageDtt extends ImageDttCPU {
centroid_radius
,
// double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad)
centroid_radius
,
// double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad)
n_recenter
,
// int refine, // re-center window around new maximum. 0 -no refines (single-pass)
n_recenter
,
// int refine, // re-center window around new maximum. 0 -no refines (single-pass)
false
);
// boolean debug)
false
);
// boolean debug)
if
((
mv
!=
null
)
&&
(
mv
[
2
]
<
min_str
))
{
if
(
mv
!=
null
)
{
if
(
mv
[
2
]
<
min_str
)
{
mv
=
null
;
mv
=
null
;
}
else
{
mv
[
2
]
-=
min_str
;
}
}
}
if
(
mv
!=
null
)
{
if
(
mv
!=
null
)
{
if
(
pXpYD
==
null
)
{
if
(
pXpYD
==
null
)
{
coord_motion
[
0
][
nTile
]
=
mv
;
coord_motion
[
0
][
nTile
]
=
mv
;
}
else
{
}
else
{
if
(
pXpYD
[
nTile
]
!=
null
)
{
// seems always
if
(
pXpYD
[
nTile
]
!=
null
)
{
// seems always
coord_motion
[
0
][
nTile
]
=
pXpYD
[
nTile
];
coord_motion
[
0
][
nTile
]
=
pXpYD
[
nTile
]
.
clone
()
;
coord_motion
[
1
][
nTile
]
=
mv
;
coord_motion
[
1
][
nTile
]
=
mv
;
}
}
}
}
...
@@ -2675,6 +2684,85 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2675,6 +2684,85 @@ public class ImageDtt extends ImageDttCPU {
};
};
}
}
startAndJoin
(
threads
);
startAndJoin
(
threads
);
ai
.
set
(
0
);
final
int
tiles
=
tilesX
*
tilesY
;
final
double
[][]
mv
=
coord_motion
[
coord_motion
.
length
-
1
];
final
double
[][]
pxd
=
(
coord_motion
.
length
>
1
)
?
coord_motion
[
0
]
:
null
;
final
double
scale_num_neib
=
((
weight_zero_neibs
>=
0
)
&&
(
weight_zero_neibs
<
1.0
))
?
(
weight_zero_neibs
*
8
/(
1.0
-
weight_zero_neibs
)):
0.0
;
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
@Override
public
void
run
()
{
double
l2
;
TileNeibs
tn
=
new
TileNeibs
(
tilesX
,
tilesY
);
for
(
int
nTile
=
ai
.
getAndIncrement
();
nTile
<
tiles
;
nTile
=
ai
.
getAndIncrement
())
{
if
((
mv
[
nTile
]
!=
null
)
&&
(
pXpYD
[
nTile
]
!=
null
))
{
int
num_neibs
=
0
;
double
sx
=
0.0
,
sy
=
0.0
;
for
(
int
dir
=
0
;
dir
<
8
;
dir
++)
{
int
nTile1
=
tn
.
getNeibIndex
(
nTile
,
dir
);
if
((
nTile1
>=
0
)
&&
(
mv
[
nTile1
]
!=
null
)
&&
(
pXpYD
[
nTile1
]
!=
null
)
&&
!
Double
.
isNaN
(
mv
[
nTile1
][
2
])
&&
!
Double
.
isNaN
(
mv
[
nTile1
][
0
])
&&
!
Double
.
isNaN
(
mv
[
nTile1
][
1
])){
num_neibs
++;
sx
+=
mv
[
nTile1
][
0
];
sy
+=
mv
[
nTile1
][
1
];
}
}
if
(
num_neibs
<
min_neibs
)
{
// filter by minimal neighbors
mv
[
nTile
][
2
]
=
0
;
/*
mv[nTile] = null;
if (pxd != null) {
pxd[nTile] = null;
}
*/
continue
;
}
if
((
weight_zero_neibs
>=
0
)
&&
(
weight_zero_neibs
<
1.0
))
{
// scale weight by number of neighbors
mv
[
nTile
][
2
]
*=
(
num_neibs
+
scale_num_neib
)/(
8.0
+
scale_num_neib
);
}
if
(
half_disparity
>
0.0
)
{
// scale by disparity
mv
[
nTile
][
2
]
*=
half_disparity
/(
half_disparity
+
pxd
[
nTile
][
2
]);
}
if
((
half_avg_diff
>
0.0
)
&&(
num_neibs
>
0
))
{
double
dx
=
mv
[
nTile
][
0
]
-
sx
/
num_neibs
;
double
dy
=
mv
[
nTile
][
1
]
-
sy
/
num_neibs
;
l2
=
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
mv
[
nTile
][
2
]
*=
half_avg_diff
/(
half_avg_diff
+
l2
);
}
}
}
}
};
}
startAndJoin
(
threads
);
ai
.
set
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
@Override
public
void
run
()
{
double
l2
;
TileNeibs
tn
=
new
TileNeibs
(
tilesX
,
tilesY
);
for
(
int
nTile
=
ai
.
getAndIncrement
();
nTile
<
tiles
;
nTile
=
ai
.
getAndIncrement
())
{
if
((
mv
[
nTile
]
!=
null
)
&&
(
pXpYD
[
nTile
]
!=
null
))
{
if
(
mv
[
nTile
][
2
]
<=
0
)
{
mv
[
nTile
]
=
null
;
if
(
pxd
!=
null
)
{
pxd
[
nTile
]
=
null
;
}
}
}
}
}
};
}
startAndJoin
(
threads
);
return
coord_motion
;
return
coord_motion
;
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
View file @
23452c5b
...
@@ -389,7 +389,7 @@ public class IntersceneLma {
...
@@ -389,7 +389,7 @@ public class IntersceneLma {
Matrix
wjtjlambda
=
new
Matrix
(
getWJtJlambda
(
Matrix
wjtjlambda
=
new
Matrix
(
getWJtJlambda
(
lambda
,
// *10, // temporary
lambda
,
// *10, // temporary
this
.
last_jt
));
// double [][] jt)
this
.
last_jt
));
// double [][] jt)
if
(
debug_level
>
1
)
{
if
(
debug_level
>
2
)
{
try
{
try
{
System
.
out
.
println
(
"getFxDerivs(): getChecksum(this.y_vector)="
+
getChecksum
(
this
.
y_vector
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(this.y_vector)="
+
getChecksum
(
this
.
y_vector
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(this.weights)="
+
getChecksum
(
this
.
weights
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(this.weights)="
+
getChecksum
(
this
.
weights
));
...
@@ -427,7 +427,7 @@ public class IntersceneLma {
...
@@ -427,7 +427,7 @@ public class IntersceneLma {
System
.
out
.
println
(
"Jt * (y-fx)"
);
System
.
out
.
println
(
"Jt * (y-fx)"
);
jty
.
print
(
18
,
6
);
jty
.
print
(
18
,
6
);
}
}
if
(
debug_level
>
1
)
{
if
(
debug_level
>
2
)
{
try
{
try
{
System
.
out
.
println
(
"getFxDerivs(): getChecksum(jtjl_inv)="
+
getChecksum
(
jtjl_inv
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(jtjl_inv)="
+
getChecksum
(
jtjl_inv
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(jty)= "
+
getChecksum
(
jty
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(jty)= "
+
getChecksum
(
jty
));
...
@@ -451,7 +451,7 @@ public class IntersceneLma {
...
@@ -451,7 +451,7 @@ public class IntersceneLma {
for
(
int
i
=
0
;
i
<
parameters_vector
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameters_vector
.
length
;
i
++)
{
new_vector
[
i
]
+=
scale
*
delta
[
i
];
new_vector
[
i
]
+=
scale
*
delta
[
i
];
}
}
if
(
debug_level
>
1
)
{
if
(
debug_level
>
2
)
{
try
{
try
{
System
.
out
.
println
(
"getFxDerivs(): getChecksum(mdelta)= "
+
getChecksum
(
mdelta
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(mdelta)= "
+
getChecksum
(
mdelta
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(delta)= "
+
getChecksum
(
delta
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(delta)= "
+
getChecksum
(
delta
));
...
@@ -793,7 +793,7 @@ public class IntersceneLma {
...
@@ -793,7 +793,7 @@ public class IntersceneLma {
fx
[
i
+
2
*
macrotile_centers
.
length
]
=
vector
[
i
];
// - parameters_initial[i]; // scale will be combined with weights
fx
[
i
+
2
*
macrotile_centers
.
length
]
=
vector
[
i
];
// - parameters_initial[i]; // scale will be combined with weights
jt
[
i
][
i
+
2
*
macrotile_centers
.
length
]
=
1.0
;
// scale will be combined with weights
jt
[
i
][
i
+
2
*
macrotile_centers
.
length
]
=
1.0
;
// scale will be combined with weights
}
}
if
(
debug_level
>
1
)
{
if
(
debug_level
>
2
)
{
try
{
try
{
System
.
out
.
println
(
"getFxDerivs(): getChecksum(fx)="
+
getChecksum
(
fx
));
System
.
out
.
println
(
"getFxDerivs(): getChecksum(fx)="
+
getChecksum
(
fx
));
if
(
jt
!=
null
)
{
if
(
jt
!=
null
)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
23452c5b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
23452c5b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
23452c5b
...
@@ -5615,6 +5615,26 @@ if (debugLevel < -100) {
...
@@ -5615,6 +5615,26 @@ if (debugLevel < -100) {
return
quadCLT
;
return
quadCLT
;
}
}
public
QuadCLT
spawnNoModelQuadCLT
(
String
set_name
,
CLTParameters
clt_parameters
,
ColorProcParameters
colorProcParameters
,
//
int
threadsMax
,
int
debugLevel
)
{
QuadCLT
quadCLT
=
new
QuadCLT
(
this
,
set_name
);
//null
quadCLT
.
restoreNoModel
(
clt_parameters
,
colorProcParameters
,
null
,
// double [] noise_sigma_level,
-
1
,
// noise_variant, // <0 - no-variants, compatible with old code
null
,
// final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax
,
debugLevel
);
return
quadCLT
;
}
}
}
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
23452c5b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
23452c5b
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