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
196c2875
Commit
196c2875
authored
Aug 15, 2025
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding UAS logs processing
parent
90e3e80a
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
811 additions
and
101 deletions
+811
-101
EyesisCorrectionParameters.java
...com/elphel/imagej/cameras/EyesisCorrectionParameters.java
+79
-9
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+54
-1
CuasMotion.java
src/main/java/com/elphel/imagej/cuas/CuasMotion.java
+88
-7
UasLogReader.java
src/main/java/com/elphel/imagej/ims/UasLogReader.java
+304
-78
UasLogRecord.java
src/main/java/com/elphel/imagej/ims/UasLogRecord.java
+231
-0
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+14
-0
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+8
-2
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+17
-4
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+3
-0
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+13
-0
No files found.
src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java
View file @
196c2875
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
196c2875
...
...
@@ -6321,8 +6321,61 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if
(
gd
.
wasCanceled
())
return
false
;
uas_path
=
gd
.
getNextString
();
{
setAllProperties
(
PROPERTIES
);
// batchRig may save properties with the model. Extrinsics will be updated,
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);
}
EYESIS_CORRECTIONS_AUX
.
initSensorFiles
(
DEBUG_LEVEL
);
if
(!
QUAD_CLT_AUX
.
CLTKernelsAvailable
())
{
if
(
DEBUG_LEVEL
>
0
)
{
System
.
out
.
println
(
"Reading AUX CLT kernels"
);
}
QUAD_CLT_AUX
.
readCLTKernels
(
CLT_PARAMETERS
,
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
if
(
DEBUG_LEVEL
>
1
)
{
QUAD_CLT_AUX
.
showCLTKernels
(
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
}
}
if
(!
QUAD_CLT_AUX
.
geometryCorrectionAvailable
())
{
if
(
DEBUG_LEVEL
>
0
)
{
System
.
out
.
println
(
"Calculating geometryCorrection"
);
}
if
(!
QUAD_CLT_AUX
.
initGeometryCorrection
(
DEBUG_LEVEL
+
2
))
{
return
false
;
}
}
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
);
}
}
try
{
UasLogReader
uasLogReader
=
new
UasLogReader
(
uas_path
);
// UasLogReader uasLogReader = new UasLogReader(uas_path);
UasLogReader
.
testUasLogReader
(
uas_path
,
QUAD_CLT_AUX
);
}
catch
(
JSONException
e
)
{
System
.
out
.
println
(
"Error reading/parsing "
+
uas_path
);
System
.
out
.
println
();
...
...
src/main/java/com/elphel/imagej/cuas/CuasMotion.java
View file @
196c2875
...
...
@@ -21,6 +21,7 @@ import com.elphel.imagej.common.ShowDoubleFloatArrays;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.gpu.GpuQuad
;
import
com.elphel.imagej.gpu.TpTask
;
import
com.elphel.imagej.ims.UasLogReader
;
import
com.elphel.imagej.tileprocessor.Correlation2d
;
import
com.elphel.imagej.tileprocessor.ImageDtt
;
import
com.elphel.imagej.tileprocessor.IntersceneMatchParameters
;
...
...
@@ -78,7 +79,7 @@ public class CuasMotion {
{
"Circle21x21.png"
,
"Circle43x43_2px.png"
},
// friend
{
"diamond21x17.png"
,
"diamond43x35_2px.png"
}
// foe
};
public
static
String
ICON_BLUE
=
"Circle63x63blue.png"
;
private
final
GPUTileProcessor
gpuTileProcessor
;
private
CLTParameters
clt_parameters
=
null
;
...
...
@@ -765,6 +766,7 @@ public class CuasMotion {
vf_sequence
,
// final double [][][] vf_sequence, // center tiles (not extended), null /non-null only
// frame0, // final int frame0, // for vector_field[0] // source scene corresponding to the first sequence
cuasMotion
,
// final CuasMotion cuasMotion,
null
,
// UasLogReader uasLogReader,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles
,
// String [] slice_titles,
debugLevel
);
// final int debugLevel)
...
...
@@ -776,9 +778,9 @@ public class CuasMotion {
batch_mode
,
// final boolean batch_mode,
parentCLT
,
// QuadCLT parentCLT, //
fpixels
,
// final float [][] fpixels,
null
,
// String [] scene_titles, // recreate slice_titles from scene titles?
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel
);
// final int debugLevel)
continue
;
}
// while (true) {
...
...
@@ -3099,10 +3101,25 @@ public class CuasMotion {
final
int
frame0
,
final
int
frame_step
,
final
int
width_src
,
String
title
,
String
[]
titles
,
final
String
title
,
final
String
[]
titles
,
String
diamond_path
,
final
UasLogReader
uasLogReader
,
final
int
debugLevel
)
{
String
uas_log_path
=
null
;
boolean
annotate_uas
=
clt_parameters
.
imp
.
cuas_annotate_uas
&&
(
uasLogReader
!=
null
);
if
(
annotate_uas
)
{
String
resource_name
=
ICON_BLUE
;
URL
resourceUrl
=
CuasMotion
.
class
.
getClassLoader
().
getResource
(
"graphics/"
+
resource_name
);
Path
resourcePath
=
null
;
try
{
resourcePath
=
Paths
.
get
(
resourceUrl
.
toURI
());
}
catch
(
URISyntaxException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
uas_log_path
=
resourcePath
.
toString
();
}
if
(
diamond_path
==
null
)
{
String
resource_name
=
TARGET_ICONS
[
target_type
][
scale2x
?
1
:
0
];
URL
resourceUrl
=
CuasMotion
.
class
.
getClassLoader
().
getResource
(
"graphics/"
+
resource_name
);
...
...
@@ -3137,10 +3154,9 @@ public class CuasMotion {
// TODO Auto-generated catch block
e1
.
printStackTrace
();
}
final
int
diamond_width
=
diamond_cp
.
getWidth
();
final
int
diamond_height
=
diamond_cp
.
getHeight
();
final
int
[]
diamond_pixels
=
((
int
[])
diamond_cp
.
getPixels
());
final
int
[][]
diamond_rgba
=
new
int
[
diamond_pixels
.
length
][
4
];
...
...
@@ -3150,6 +3166,28 @@ public class CuasMotion {
}
}
ColorProcessor
uaslog_cp
=
null
;
if
(
uas_log_path
!=
null
)
{
try
{
uaslog_cp
=
new
ColorProcessor
(
ImageIO
.
read
(
new
File
(
diamond_path
)));
}
catch
(
IOException
e1
)
{
// TODO Auto-generated catch block
e1
.
printStackTrace
();
}
}
final
int
uaslog_width
=
(
uaslog_cp
!=
null
)
?
uaslog_cp
.
getWidth
()
:
0
;
final
int
uaslog_height
=
(
uaslog_cp
!=
null
)
?
uaslog_cp
.
getHeight
()
:
0
;
final
int
[]
uaslog_pixels
=
(
uaslog_cp
!=
null
)
?
((
int
[])
uaslog_cp
.
getPixels
())
:
null
;
final
int
[][]
uaslog_rgba
=
(
uaslog_cp
!=
null
)
?
(
new
int
[
uaslog_pixels
.
length
][
4
])
:
null
;
if
(
uaslog_cp
!=
null
)
{
for
(
int
i
=
0
;
i
<
uaslog_rgba
.
length
;
i
++)
{
for
(
int
s
=
0
;
s
<
4
;
s
++)
{
uaslog_rgba
[
i
][
s
]
=
(
uaslog_pixels
[
i
]
>>
(
8
*
s
))
&
0xff
;
}
}
}
final
int
num_scenes
=
fpixels
.
length
;
final
int
num_pixels
=
fpixels
[
0
].
length
;
final
int
num_seq
=
targets60hz
.
length
;
...
...
@@ -3270,6 +3308,45 @@ public class CuasMotion {
for
(
int
dscene
=
half_step0
;
dscene
<
half_step1
;
dscene
++)
{
int
nscene
=
frame_center
+
dscene
;
if
((
nscene
>=
0
)
&&
(
nscene
<
num_scenes
))
{
if
(
uaslog_rgba
!=
null
)
{
// draw uas from log
// get drone pixel coordinates
double
[]
uas_pXpYD
=
uasLogReader
.
getUasPxPyD
(
titles
[
nscene
]);
int
xc
=
(
int
)
Math
.
round
(
scale
*
uas_pXpYD
[
0
]);
int
yc
=
(
int
)
Math
.
round
(
scale
*
uas_pXpYD
[
1
]);
int
xl
=
xc
-
uaslog_width
/
2
;
int
yt
=
yc
-
uaslog_height
/
2
;
for
(
int
y
=
0
;
y
<
uaslog_height
;
y
++)
{
int
py
=
yt
+
y
;
if
((
py
>=
0
)
&&
(
py
<
height
))
{
for
(
int
x
=
0
;
x
<
uaslog_width
;
x
++)
{
int
px
=
xl
+
x
;
int
dpix
=
x
+
y
*
uaslog_width
;
int
ipix
=
px
+
py
*
width
;
if
((
px
>=
0
)
&&
(
px
<
width
))
{
int
alpha
=
uaslog_rgba
[
dpix
][
3
];
if
(
alpha
>
0
)
{
// alpha
int
dp
=
uaslog_pixels
[
x
+
y
*
uaslog_width
];
if
(
alpha
==
255
)
{
ipixels
[
nscene
][
ipix
]
=
dp
;
}
else
{
double
k
=
alpha
/
255.0
;
int
img_pix
=
ipixels
[
nscene
][
ipix
];
int
new_pix
=
0xff000000
;
for
(
int
c
=
0
;
c
<
3
;
c
++)
{
int
rgb
=
(
img_pix
>>
(
8
*
c
))
&
0xff
;
rgb
=
(
int
)
Math
.
round
((
1
-
k
)*
rgb
+
k
*
uaslog_rgba
[
dpix
][
c
]);
if
(
rgb
>
255
)
rgb
=
255
;
new_pix
|=
(
rgb
<<
(
8
*
c
));
}
ipixels
[
nscene
][
ipix
]
=
new_pix
;
}
}
}
}
}
}
}
double
[][]
targets
=
targets60hz
[
nscene
];
if
(
targets
!=
null
)
{
// TODO: find why
for
(
int
ntarget
=
0
;
ntarget
<
targets
.
length
;
ntarget
++)
{
...
...
@@ -3496,6 +3573,7 @@ public class CuasMotion {
final
boolean
batch_mode
,
QuadCLT
parentCLT
,
//
final
float
[][]
fpixels
,
UasLogReader
uasLogReader
,
String
[]
scene_titles
,
// recreate slice_titles from scene titles?
final
int
debugLevel
)
{
...
...
@@ -3549,6 +3627,7 @@ public class CuasMotion {
targets_nonconflict
,
// final double [][][] vf_sequence, // center tiles (not extended), null /non-null only
// frame0, // final int frame0, // for vector_field[0] // source scene corresponding to the first sequence
cuasMotion
,
// final CuasMotion cuasMotion,
uasLogReader
,
// UasLogReader uasLogReader,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles
,
// String [] slice_titles,
debugLevel
);
// final int debugLevel)
...
...
@@ -4511,7 +4590,8 @@ public class CuasMotion {
QuadCLT
parentCLT
,
//
final
float
[][]
fpixels
,
double
[][][]
target_sequence
,
//
final
CuasMotion
cuasMotion
,
CuasMotion
cuasMotion
,
UasLogReader
uasLogReader
,
String
[]
scene_titles
,
// recreate slice_titles from scene titles?
String
[]
slice_titles
,
final
int
debugLevel
)
{
...
...
@@ -4747,6 +4827,7 @@ public class CuasMotion {
model_prefix
+
"-RGB"
+
ra_bg_suffix
,
// String title,
scene_titles
,
// String [] titles,
null
,
// diamond_path, // //String diamond_path, null - use resources
uasLogReader
,
// UasLogReader uasLogReader,
debugLevel
);
// final int debugLevel) {
// save tiff in model directory
if
(
imp_color
!=
null
)
{
...
...
src/main/java/com/elphel/imagej/ims/UasLogReader.java
View file @
196c2875
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/ims/UasLogRecord.java
0 → 100644
View file @
196c2875
package
com
.
elphel
.
imagej
.
ims
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Comparator
;
public
class
UasLogRecord
{
public
static
String
[]
FIELDS_USED
=
{
"timestamp"
,
"distanceFromHome"
,
"gps_lat"
,
"gps_lon"
,
"gps_altitude"
,
"homeLatitude"
,
"homeLongitude"
};
public
double
timestamp
;
// should be first in array
public
double
distance
;
public
double
gps_lat
;
public
double
gps_long
;
public
double
gps_alt
;
// relative to home
public
double
home_lat
;
public
double
home_long
;
public
UasLogRecord
(
double
[]
data
)
{
setData
(
data
);
}
public
void
setData
(
double
[]
data
)
throws
IllegalArgumentException
{
int
n
=
0
;
this
.
timestamp
=
data
[
n
++];
this
.
distance
=
data
[
n
++];
this
.
gps_lat
=
data
[
n
++];
this
.
gps_long
=
data
[
n
++];
this
.
gps_alt
=
data
[
n
++];
// relative to home
this
.
home_lat
=
data
[
n
++];
this
.
home_long
=
data
[
n
++];
if
(
Double
.
isNaN
(
this
.
timestamp
))
{
throw
new
IllegalArgumentException
(
"UasLogRecord).timestamp has to be defined"
);
}
}
public
void
copyOverNaN
(
double
[]
data
)
{
double
[]
arr
=
toArray
();
copyOverNaN
(
arr
,
data
);
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
if
(
Double
.
isNaN
(
arr
[
i
]))
{
arr
[
i
]
=
data
[
i
];
}
}
setData
(
arr
);
}
public
static
void
copyOverNaN
(
double
[]
dst
,
double
[]
src
)
{
for
(
int
i
=
0
;
i
<
dst
.
length
;
i
++)
{
if
(
Double
.
isNaN
(
dst
[
i
]))
{
dst
[
i
]
=
src
[
i
];
}
}
}
public
double
[]
toArray
()
{
double
[]
val
=
new
double
[
FIELDS_USED
.
length
];
int
n
=
0
;
val
[
n
++]
=
this
.
timestamp
;
val
[
n
++]
=
this
.
distance
;
val
[
n
++]
=
this
.
gps_lat
;
val
[
n
++]
=
this
.
gps_long
;
val
[
n
++]
=
this
.
gps_alt
;
val
[
n
++]
=
this
.
home_lat
;
val
[
n
++]
=
this
.
home_long
;
return
val
;
}
public
UasLogRecord
(
double
timestamp
,
double
distance
,
double
gps_lat
,
double
gps_long
,
double
gps_alt
,
// relative to home
double
home_lat
,
double
home_long
)
{
this
.
timestamp
=
timestamp
;
this
.
distance
=
distance
;
this
.
gps_lat
=
gps_lat
;
this
.
gps_long
=
gps_long
;
this
.
gps_alt
=
gps_alt
;
// relative to home
this
.
home_lat
=
home_lat
;
this
.
home_long
=
home_long
;
}
public
boolean
hasUndefined
()
{
return
hasUndefined
(
toArray
());
}
public
static
boolean
hasUndefined
(
double
[]
arr
)
{
for
(
double
v:
arr
)
if
(
Double
.
isNaN
(
v
))
return
true
;
return
false
;
}
public
static
UasLogRecord
[]
getArray
(
ArrayList
<
UasLogRecord
>
rec_list
)
{
UasLogRecord
[]
rec_array
=
rec_list
.
toArray
(
new
UasLogRecord
[
0
]);
Arrays
.
sort
(
rec_array
,
new
Comparator
<
UasLogRecord
>()
{
// decreasing weight
@Override
public
int
compare
(
UasLogRecord
lhs
,
UasLogRecord
rhs
)
{
return
(
rhs
.
timestamp
>
lhs
.
timestamp
)
?
-
1
:
(
rhs
.
timestamp
<
lhs
.
timestamp
)
?
1
:
0
;
}
});
return
rec_array
;
}
public
String
toString
()
{
return
String
.
format
(
"timestamp=%f, distance=%f, gps_lat=%f, gps_lon=%f, alt=%f, home_lat=%f, home_lon=%f"
,
timestamp
,
distance
,
gps_lat
,
gps_long
,
gps_alt
,
home_lat
,
home_long
);
}
public
UasLogRecord
clone
()
{
return
new
UasLogRecord
(
toArray
());
}
public
static
UasLogRecord
interpolate
(
UasLogRecord
[]
rec_arr
,
double
timestamp
)
{
int
last
=
rec_arr
.
length
-
1
;
double
ts0
=
rec_arr
[
0
].
timestamp
;
double
ts1
=
rec_arr
[
last
].
timestamp
;
if
(
timestamp
<=
ts0
)
{
return
rec_arr
[
0
];
}
else
if
(
timestamp
>=
last
)
{
return
rec_arr
[
last
];
}
else
{
// assuming timestamps are uniform, but not requiring that
int
indx
=
(
int
)
Math
.
round
((
timestamp
-
ts0
)/(
ts1
-
ts0
));
while
((
indx
<
(
last
-
1
))
&&
(
rec_arr
[
indx
+
1
].
timestamp
<
timestamp
))
indx
++;
// next record timestamp > requested
while
((
indx
>=
0
)
&&
(
rec_arr
[
indx
].
timestamp
>
timestamp
))
indx
--;
// this record timestamp <= requested
double
k
=
(
timestamp
-
rec_arr
[
indx
].
timestamp
)
/
(
rec_arr
[
indx
+
1
].
timestamp
-
rec_arr
[
indx
].
timestamp
);
double
[]
arr0
=
rec_arr
[
indx
].
toArray
();
double
[]
arr1
=
rec_arr
[
indx
+
1
].
toArray
();
double
[]
arr
=
new
double
[
arr0
.
length
];
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
arr
[
i
]
=
arr0
[
i
]
+
k
*
(
arr1
[
i
]
-
arr0
[
i
]);
}
return
new
UasLogRecord
(
arr
);
}
}
public
static
boolean
fillUndefined
(
UasLogRecord
[]
rec_arr
)
{
// UasLogRecord rec0=rec_arr[0].clone();
// fill initial NaNs to the first record
if
(
rec_arr
[
0
].
hasUndefined
())
{
double
[]
arr0
=
rec_arr
[
0
].
toArray
();
fill_0:
{
for
(
int
i
=
0
;
i
<
rec_arr
.
length
;
i
++)
{
if
(!
hasUndefined
(
arr0
))
{
break
fill_0
;
}
double
[]
v1
=
rec_arr
[
i
].
toArray
();
copyOverNaN
(
arr0
,
v1
);
}
System
.
out
.
println
(
"Still first undefined: "
+(
new
UasLogRecord
(
arr0
).
toString
()));
return
false
;
}
rec_arr
[
0
].
setData
(
arr0
);
}
// fill last
int
last
=
rec_arr
.
length
-
1
;
if
(
rec_arr
[
last
].
hasUndefined
())
{
double
[]
arr_last
=
rec_arr
[
last
].
toArray
();
fill_0:
{
for
(
int
i
=
last
;
i
>=
0
;
i
--)
{
if
(!
hasUndefined
(
arr_last
))
{
break
fill_0
;
}
double
[]
v1
=
rec_arr
[
i
].
toArray
();
copyOverNaN
(
arr_last
,
v1
);
}
System
.
out
.
println
(
"Still last undefined: "
+(
new
UasLogRecord
(
arr_last
).
toString
()));
return
false
;
}
rec_arr
[
last
].
setData
(
arr_last
);
}
// interpolate assuming timestamp is always known
// first and last element should never be NaN here
double
[][]
all_arr
=
new
double
[
rec_arr
.
length
][];
for
(
int
i
=
0
;
i
<
all_arr
.
length
;
i
++)
{
all_arr
[
i
]
=
rec_arr
[
i
].
toArray
();
}
int
num_fields
=
all_arr
[
0
].
length
;
for
(
int
nfield
=
1
;
nfield
<
num_fields
;
nfield
++)
{
// 0 is the timestamp
for
(
int
tail
=
0
;
tail
<=
last
;
tail
++)
{
for
(;
(
tail
<
last
)
&&
!
Double
.
isNaN
(
all_arr
[
tail
][
nfield
]);
tail
++);
if
(
tail
<
last
)
{
tail
--;
// tail is the last non-NaN here
int
head
=
tail
+
2
;
for
(;
(
head
<=
last
)
&&
Double
.
isNaN
(
all_arr
[
head
][
nfield
]);
head
++);
// head is the first non-NaN after NaN
double
time_span
=
all_arr
[
head
][
0
]
-
all_arr
[
tail
][
0
];
double
value_span
=
all_arr
[
head
][
nfield
]
-
all_arr
[
tail
][
nfield
];
double
tail_val
=
all_arr
[
tail
][
nfield
];
for
(
int
i
=
tail
+
1
;
i
<
head
;
i
++)
{
double
since_tail
=
all_arr
[
i
][
0
]
-
all_arr
[
tail
][
0
];
all_arr
[
i
][
nfield
]
=
tail_val
+
value_span
*
since_tail
/
time_span
;
}
tail
=
head
;
// will be added 1
}
}
}
for
(
int
i
=
0
;
i
<
all_arr
.
length
;
i
++)
{
rec_arr
[
i
].
setData
(
all_arr
[
i
]);
}
return
true
;
}
}
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
196c2875
...
...
@@ -1998,6 +1998,20 @@ public class ErsCorrection extends GeometryCorrection {
return
new
double
[][]
{
xyz
,
angles
};
}
public
double
[]
getImageCoordinatesERS
(
double
[]
xyzw
,
boolean
correctDistortions
,
// correct distortion (will need corrected background too !)
double
[]
camera_xyz
,
// camera center in world coordinates
double
[]
camera_atr
)
{
// camera orientation relative to world frame
return
getImageCoordinatesERS
(
xyzw
,
// double [] xyzw,// double [] xyzw,
correctDistortions
,
// boolean correctDistortions, // correct distortion (will need corrected background too !)
camera_xyz
,
// double [] camera_xyz, // camera center in world coordinates
camera_atr
,
//double [] camera_atr, // camera orientation relative to world frame
LINE_ERR
);
// double line_err); // threshold error in scan lines (1.0)
}
public
double
[]
getImageCoordinatesERS
(
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
196c2875
...
...
@@ -800,6 +800,7 @@ min_str_neib_fpn 0.35
public
boolean
cuas_save_video
=
true
;
// save color rendered images (same as videos)
public
boolean
cuas_annotate
=
true
;
// save color rendered images (same as videos)
public
boolean
cuas_annotate_uas
=
true
;
// indicate uas from log if available
public
Color
cuas_text_color
=
new
Color
(
0
,
255
,
255
);
// 220);
public
String
cuas_font_name
=
"Monospaced"
;
public
int
cuas_font_size
=
7
;
// before scaling
...
...
@@ -2411,7 +2412,9 @@ min_str_neib_fpn 0.35
gd
.
addMessage
(
"=== Target Annotation ==="
);
gd
.
addCheckbox
(
"Annotate targets"
,
this
.
cuas_annotate
,
"Add textual annptations to the target icons."
);
"Add textual annotations to the target icons."
);
gd
.
addCheckbox
(
"Show UAS from flighgt log"
,
this
.
cuas_annotate
,
"Indicate UAS position from the UAS flight log, if available."
);
{
String
scolor
=
String
.
format
(
"%08x"
,
getLongColor
(
this
.
cuas_text_color
));
gd
.
addStringField
(
"Tast color"
,
scolor
,
8
,
"Any invalid hex number disables annotation"
);
...
...
@@ -3479,6 +3482,7 @@ min_str_neib_fpn 0.35
this
.
cuas_save_video
=
gd
.
getNextBoolean
();
this
.
cuas_annotate
=
gd
.
getNextBoolean
();
this
.
cuas_annotate_uas
=
gd
.
getNextBoolean
();
{
String
scolor
=
gd
.
getNextString
();
long
lcolor
=
-
1
;
...
...
@@ -4467,6 +4471,7 @@ min_str_neib_fpn 0.35
properties
.
setProperty
(
prefix
+
"cuas_annotate"
,
this
.
cuas_annotate
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"cuas_annotate_uas"
,
this
.
cuas_annotate_uas
+
""
);
// boolean
{
long
lcolor_annotate
=
(
cuas_text_color
==
null
)
?
0xCCFF00
:
getLongColor
(
this
.
cuas_text_color
);
properties
.
setProperty
(
prefix
+
"cuas_text_color"
,
lcolor_annotate
+
""
);
...
...
@@ -5421,6 +5426,7 @@ min_str_neib_fpn 0.35
if
(
properties
.
getProperty
(
prefix
+
"cuas_save_video"
)!=
null
)
this
.
cuas_save_video
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_save_video"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_annotate"
)!=
null
)
this
.
cuas_annotate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_annotate"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_annotate_uas"
)!=
null
)
this
.
cuas_annotate_uas
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_annotate_uas"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_text_color"
)!=
null
)
{
long
lcolor_annotate
=
Long
.
parseLong
(
properties
.
getProperty
(
prefix
+
"cuas_text_color"
));
if
(
lcolor_annotate
<
0
)
this
.
cuas_text_color
=
setLongColor
(
0xCCFF00
);
...
...
@@ -6374,8 +6380,8 @@ min_str_neib_fpn 0.35
imp
.
cuas_save_color
=
this
.
cuas_save_color
;
imp
.
cuas_save_video
=
this
.
cuas_save_video
;
imp
.
cuas_annotate
=
this
.
cuas_annotate
;
imp
.
cuas_annotate_uas
=
this
.
cuas_annotate_uas
;
imp
.
cuas_text_color
=
this
.
cuas_text_color
;
imp
.
cuas_font_name
=
this
.
cuas_font_name
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
196c2875
...
...
@@ -64,6 +64,7 @@ import com.elphel.imagej.ims.Did_ins_1;
import
com.elphel.imagej.ims.Did_ins_2
;
import
com.elphel.imagej.ims.Did_pimu
;
import
com.elphel.imagej.ims.Imx5
;
import
com.elphel.imagej.ims.UasLogReader
;
import
com.elphel.imagej.jp4.JP46_Reader_camera
;
import
com.elphel.imagej.tileprocessor.sfm.StructureFromMotion
;
import
com.elphel.imagej.vegetation.VegetationModel
;
...
...
@@ -4715,7 +4716,8 @@ public class OpticalFlow {
int
[]
start_ref_pointers
,
// [0] - earliest valid scene, [1] ref_index
// each element is 0 for non-stereo and full width for stereo
String
[]
cuas_centers
,
// [0] - cumulative input, [1] - cumulative output
// processing UAS logs
UasLogReader
uasLogReader
,
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
int
debugLevel
)
throws
Exception
...
...
@@ -6458,9 +6460,10 @@ public class OpticalFlow {
master_CLT
.
processMovingTargets
(
clt_parameters
,
// CLTParameters clt_parameters,
batch_mode
,
// final boolean batch_mode,
fpixels
,
// final float [][] fpixels,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel
);
// final int debugLevel)
fpixels
,
// final float [][] fpixels,
uasLogReader
,
// UasLogReader uasLogReader,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel
);
// final int debugLevel)
}
}
}
...
...
@@ -7279,6 +7282,13 @@ public class OpticalFlow {
String
bkp_sourceDirectory
=
quadCLT_main
.
correctionsParameters
.
sourceDirectory
;
String
[]
bkp_sourcePaths
=
quadCLT_main
.
correctionsParameters
.
sourcePaths
;
boolean
bkp_use_set_dirs
=
quadCLT_main
.
correctionsParameters
.
use_set_dirs
;
String
bkp_cuasUasLogs
=
quadCLT_main
.
correctionsParameters
.
cuasUasLogs
;
// json file path containing UAS logs
double
bkp_cuasUasTimeStamp
=
quadCLT_main
.
correctionsParameters
.
cuasUasTimeStamp
;
// 0.0; // timestamp corresponding to the UAS time 0.0
double
[]
bkp_cuasCameraATR
=
quadCLT_main
.
correctionsParameters
.
cuasCameraATR
;
//{0, 0, 0};
master_CLT
.
saveConfInModelDirectory
();
// save all (global) configurations in model/version directory
if
(
master_CLT
!=
quadCLTs
[
ref_index
])
{
quadCLTs
[
ref_index
].
saveConfInModelDirectory
();
// save all (global) configurations in model/version directory
...
...
@@ -7294,6 +7304,9 @@ public class OpticalFlow {
quadCLT_main
.
correctionsParameters
.
sourceDirectory
=
bkp_sourceDirectory
;
quadCLT_main
.
correctionsParameters
.
sourcePaths
=
bkp_sourcePaths
;
quadCLT_main
.
correctionsParameters
.
use_set_dirs
=
bkp_use_set_dirs
;
quadCLT_main
.
correctionsParameters
.
cuasUasLogs
=
bkp_cuasUasLogs
;
quadCLT_main
.
correctionsParameters
.
cuasUasTimeStamp
=
bkp_cuasUasTimeStamp
;
quadCLT_main
.
correctionsParameters
.
cuasCameraATR
=
bkp_cuasCameraATR
;
System
.
out
.
println
(
"buildSeries(): DONE"
);
//
// String top_dir0=quadCLTs[ref_index].getX3dTopDirectory();
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
196c2875
...
...
@@ -54,6 +54,7 @@ import com.elphel.imagej.gpu.GPUTileProcessor;
import
com.elphel.imagej.gpu.GpuQuad
;
import
com.elphel.imagej.gpu.TpTask
;
//import com.elphel.imagej.tileprocessor.SetChannels;
import
com.elphel.imagej.ims.UasLogReader
;
import
ij.IJ
;
import
ij.ImagePlus
;
...
...
@@ -5878,6 +5879,7 @@ if (debugLevel < -100) {
CLTParameters
clt_parameters
,
final
boolean
batch_mode
,
final
float
[][]
fpixels
,
UasLogReader
uasLogReader
,
String
[]
scene_titles
,
// recreate slice_titles from scene titles?
final
int
debugLevel
)
{
CuasMotion
.
processMovingTargets
(
...
...
@@ -5885,6 +5887,7 @@ if (debugLevel < -100) {
batch_mode
,
// final boolean batch_mode,
this
,
// QuadCLT parentCLT, //
fpixels
,
// final float [][] fpixels,
uasLogReader
,
// UasLogReader uasLogReader,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel
);
// final int debugLevel)
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
196c2875
...
...
@@ -57,6 +57,7 @@ import com.elphel.imagej.correction.EyesisCorrections;
import
com.elphel.imagej.gpu.ExportForGPUDevelopment
;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.gpu.GpuQuad
;
import
com.elphel.imagej.ims.UasLogReader
;
import
com.elphel.imagej.jp4.JP46_Reader_camera
;
import
ij.IJ
;
...
...
@@ -8674,6 +8675,16 @@ if (debugLevel > -100) return true; // temporarily !
int
ref_index
=
-
1
;
// -1 - last
int
[]
start_ref_pointers
=
new
int
[
2
];
//{earlist, reference} - reference may be center
boolean
first_in_series
=
true
;
// Process UAS logs
// quadCLT_main.correctionsParameters.cuasUasLogs, // String cuasUasLogs,
// quadCLT_main.correctionsParameters.cuasUasTimeStamp, // double cuasUasTimeStamp,
// quadCLT_main.correctionsParameters.cuasCameraATR, // double [] cuasCameraATR,
UasLogReader
uasLogReader
=
null
;
String
uas_log_path
=
quadCLT_main
.
correctionsParameters
.
getUasLogsPath
();
if
((
uas_log_path
!=
null
)
&&
(
uas_log_path
.
length
()
>
0
))
{
uasLogReader
=
new
UasLogReader
(
uas_log_path
,
quadCLT_main
.
correctionsParameters
.
cuasUasTimeStamp
,
null
,
quadCLT_main
);
uasLogReader
.
setCameraATR
(
quadCLT_main
.
correctionsParameters
.
cuasCameraATR
);
}
while
((
ref_index
<
0
)
||
((
ref_index
+
1
)
>=
min_num_scenes
))
{
String
model_directory
=
opticalFlow
.
buildSeries
(
(
pathFirstLast
!=
null
),
//boolean batch_mode,
...
...
@@ -8692,6 +8703,8 @@ if (debugLevel > -100) return true; // temporarily !
widths_list
,
start_ref_pointers
,
// int [] start_ref_pointers,
cuas_centers
,
// String [] cuas_centers, // [0] - cumulative input, [1] - cumulative output
// processing UAS logs
uasLogReader
,
// UasLogReader uasLogReader,
threadsMax
,
// final int threadsMax, // maximal number of threads to launch
updateStatus
,
// final boolean updateStatus,
debugLevel
+
2
);
// final int debugLevel)
...
...
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