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
e61d71b1
Commit
e61d71b1
authored
Oct 15, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First SfM tests - 0.05m from 75m AGL
parent
b3dc65da
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
418 additions
and
147 deletions
+418
-147
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+83
-0
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+1
-1
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+13
-6
StructureFromMotion.java
.../com/elphel/imagej/tileprocessor/StructureFromMotion.java
+321
-139
TDCorrTile.java
...main/java/com/elphel/imagej/tileprocessor/TDCorrTile.java
+0
-1
No files found.
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
e61d71b1
...
@@ -2506,6 +2506,89 @@ public class Correlation2d {
...
@@ -2506,6 +2506,89 @@ public class Correlation2d {
}
}
public
static
double
[]
getMaxProjCm
(
double
[]
data
,
int
data_width
,
// = 2 * transform_size - 1;
double
radius
,
// 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad)
int
refine
,
// re-center window around new maximum. 0 -no refines (single-pass)
double
[]
direction_XY
,
boolean
debug
)
{
int
data_height
=
data
.
length
/
data_width
;
int
center_xy
=
(
data_width
-
1
)/
2
;
// = transform_size - 1;
double
x0
=
center_xy
,
y0
=
center_xy
;
int
imax
=
0
;
for
(
int
i
=
1
;
i
<
data
.
length
;
i
++)
{
if
(
data
[
i
]
>
data
[
imax
])
{
imax
=
i
;
}
}
double
mx
=
data
[
imax
];
int
ix0
=
imax
%
data_width
;
int
iy0
=
imax
/
data_width
;
x0
=
ix0
;
y0
=
iy0
;
double
disp0
=
x0
*
direction_XY
[
0
]
+
y0
*
direction_XY
[
1
];
// if (fpn_mask != null
//calculate as "center of mass"
if
(
radius
==
0
)
{
double
s0
=
0
,
sx
=
0
,
sy
=
0
,
sdisp
=
0
;
for
(
int
iy
=
0
;
iy
<
data_height
;
iy
++)
{
double
y
=
iy
-
y0
;
for
(
int
ix
=
0
;
ix
<
data_width
;
ix
++)
{
double
x
=
ix
-
x0
;
double
d
=
data
[
iy
*
data_width
+
ix
];
if
(
d
>
0
)
{
// ignore negative
s0
+=
d
;
sx
+=
d
*
x
;
sy
+=
d
*
y
;
sdisp
+=
d
*
(
x
*
direction_XY
[
0
]
+
y
*
direction_XY
[
1
]);
}
else
if
(
Double
.
isNaN
(
d
))
{
System
.
out
.
println
(
"NaN in getMaxProjCm()"
);
return
null
;
}
}
}
x0
+=
sx
/
s0
;
y0
+=
sy
/
s0
;
disp0
+=
sdisp
/
s0
;
}
else
{
double
radius2
=
radius
*
radius
;
for
(
int
nref
=
0
;
nref
<=
refine
;
nref
++)
{
double
s0
=
0
,
sx
=
0
,
sy
=
0
,
sdisp
=
0
;
for
(
int
iy
=
0
;
iy
<
data_height
;
iy
++)
{
double
y
=
iy
-
y0
;
for
(
int
ix
=
0
;
ix
<
data_width
;
ix
++)
{
double
x
=
ix
-
x0
;
double
r2
=
x
*
x
+
y
*
y
;
if
(
r2
<
radius2
)
{
double
r
=
Math
.
sqrt
(
r2
);
double
d
=
data
[
iy
*
data_width
+
ix
];
if
(
d
>
0
)
{
// ignore negative
d
*=
Math
.
cos
(
0.5
*
Math
.
PI
*
r
/
radius
);
s0
+=
d
;
sx
+=
d
*
x
;
sy
+=
d
*
y
;
sdisp
+=
d
*
(
x
*
direction_XY
[
0
]
+
y
*
direction_XY
[
1
]);
}
}
}
}
x0
+=
sx
/
s0
;
y0
+=
sy
/
s0
;
disp0
+=
sdisp
/
s0
;
}
}
// double [] rslt = {x0 - center_xy, y0 - center_xy, mx};
double
[]
rslt
=
{
disp0
-
center_xy
*
(
direction_XY
[
0
]
+
direction_XY
[
1
]),
mx
};
if
(
debug
){
System
.
out
.
println
(
"getMaxProjCm() -> "
+
rslt
[
0
]+
":"
+
rslt
[
1
]);
}
return
rslt
;
}
/**
/**
* Analyze 1d correlation (single centerline of the 3D phase correlation combined output
* Analyze 1d correlation (single centerline of the 3D phase correlation combined output
...
...
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
e61d71b1
...
@@ -1077,7 +1077,7 @@ public class GeometryCorrection {
...
@@ -1077,7 +1077,7 @@ public class GeometryCorrection {
debugLevel
);
// int debugLevel)
debugLevel
);
// int debugLevel)
int
pars
=
jt_delta
.
length
;
int
pars
=
jt_delta
.
length
;
int
tilesX
=
qc_main
.
tp
.
getTilesX
();
int
tilesX
=
qc_main
.
tp
.
getTilesX
();
int
tilesY
=
qc_main
.
tp
.
getTiles
X
();
int
tilesY
=
qc_main
.
tp
.
getTiles
Y
();
// 10.14.2023: was getTilesX()!
String
[]
titles
=
new
String
[
6
*
pars
];
String
[]
titles
=
new
String
[
6
*
pars
];
double
[][]
dbg_data
=
new
double
[
6
*
pars
][
tilesY
*
tilesX
];
double
[][]
dbg_data
=
new
double
[
6
*
pars
][
tilesY
*
tilesX
];
for
(
int
i
=
0
;
i
<
dbg_data
.
length
;
i
++)
for
(
int
j
=
0
;
j
<
dbg_data
[
i
].
length
;
j
++)
dbg_data
[
i
][
j
]=
Double
.
NaN
;
for
(
int
i
=
0
;
i
<
dbg_data
.
length
;
i
++)
for
(
int
j
=
0
;
j
<
dbg_data
[
i
].
length
;
j
++)
dbg_data
[
i
][
j
]=
Double
.
NaN
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
e61d71b1
...
@@ -4892,14 +4892,21 @@ public class OpticalFlow {
...
@@ -4892,14 +4892,21 @@ public class OpticalFlow {
mb_max_gain
,
// double mb_max_gain,
mb_max_gain
,
// double mb_max_gain,
batch_mode
,
// final boolean batch_mode,
batch_mode
,
// final boolean batch_mode,
debugLevel
);
// final int debugLevel)
debugLevel
);
// final int debugLevel)
int
num_avg_pairs
=
16
;
// number of scene pairs to average
QuadCLT
[]
scenes_pair
=
new
QuadCLT
[]{
QuadCLT
[][]
scenes_pairs
=
new
QuadCLT
[
num_avg_pairs
][
2
];
quadCLTs
[
ref_index
-
1
],
for
(
int
i
=
0
;
i
<
num_avg_pairs
;
i
++)
{
quadCLTs
[
earliest_scene
]};
scenes_pairs
[
i
][
0
]
=
quadCLTs
[
ref_index
-
1
-
i
];
StructureFromMotion
.
sfmPair
(
scenes_pairs
[
i
][
1
]
=
quadCLTs
[
earliest_scene
+
num_avg_pairs
-
1
-
i
];
}
// QuadCLT[] scenes_pair = new QuadCLT[]{
// quadCLTs[ref_index - 1],
// quadCLTs[earliest_scene]};
combo_dsn_final
=
StructureFromMotion
.
sfmPair
(
clt_parameters
,
// final CLTParameters clt_parameters,
clt_parameters
,
// final CLTParameters clt_parameters,
quadCLTs
[
ref_index
],
// final QuadCLT ref_scene,
quadCLTs
[
ref_index
],
// final QuadCLT ref_scene,
scenes_pair
,
// final QuadCLT [] scenes,
scenes_pairs
,
// final QuadCLT [][] scenes_pairs,
// scenes_pair, // final QuadCLT [] scenes,
// num_avg_pairs, // final int num_avg_pairs, // number of scene pairs to average
mb_max_gain
,
// double mb_max_gain,
mb_max_gain
,
// double mb_max_gain,
batch_mode
,
// final boolean batch_mode,
batch_mode
,
// final boolean batch_mode,
debugLevel
);
// final int debugLevel)
debugLevel
);
// final int debugLevel)
...
...
src/main/java/com/elphel/imagej/tileprocessor/StructureFromMotion.java
View file @
e61d71b1
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TDCorrTile.java
View file @
e61d71b1
...
@@ -347,7 +347,6 @@ public class TDCorrTile {
...
@@ -347,7 +347,6 @@ public class TDCorrTile {
final
int
[]
corr_indices
=
new
int
[
num_tiles
];
final
int
[]
corr_indices
=
new
int
[
num_tiles
];
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
(
ImageDtt
.
THREADS_MAX
);
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
(
ImageDtt
.
THREADS_MAX
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
AtomicInteger
anum_tiles
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
public
void
run
()
{
...
...
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