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
6f8ae877
Commit
6f8ae877
authored
Sep 11, 2025
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring for ranging
parent
0d787dca
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
537 additions
and
60 deletions
+537
-60
CuasMotion.java
src/main/java/com/elphel/imagej/cuas/CuasMotion.java
+252
-27
CuasRanging.java
src/main/java/com/elphel/imagej/cuas/CuasRanging.java
+205
-0
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+75
-22
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+1
-11
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+4
-0
No files found.
src/main/java/com/elphel/imagej/cuas/CuasMotion.java
View file @
6f8ae877
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/cuas/CuasRanging.java
0 → 100644
View file @
6f8ae877
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
6f8ae877
...
@@ -57,6 +57,8 @@ import com.elphel.imagej.correction.CorrectionColorProc;
...
@@ -57,6 +57,8 @@ import com.elphel.imagej.correction.CorrectionColorProc;
import
com.elphel.imagej.cuas.CorrectionFPN
;
import
com.elphel.imagej.cuas.CorrectionFPN
;
import
com.elphel.imagej.cuas.Cuas
;
import
com.elphel.imagej.cuas.Cuas
;
import
com.elphel.imagej.cuas.CuasCenterLma
;
import
com.elphel.imagej.cuas.CuasCenterLma
;
import
com.elphel.imagej.cuas.CuasMotion
;
import
com.elphel.imagej.cuas.CuasRanging
;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.gpu.GpuQuad
;
import
com.elphel.imagej.gpu.GpuQuad
;
import
com.elphel.imagej.gpu.TpTask
;
import
com.elphel.imagej.gpu.TpTask
;
...
@@ -6221,6 +6223,20 @@ public class OpticalFlow {
...
@@ -6221,6 +6223,20 @@ public class OpticalFlow {
// Moved to the very end, after 3D
// Moved to the very end, after 3D
boolean
test_vegetation
=
true
;
boolean
test_vegetation
=
true
;
if
(
master_CLT
.
hasCenterClt
())
{
// cuas mode
CuasRanging
cuasRanging
=
new
CuasRanging
(
clt_parameters
,
// CLTParameters clt_parameters,
master_CLT
,
// QuadCLT center_CLT,
quadCLTs
,
// QuadCLT [] scenes,
debugLevel
);
// int debugLevel) {
CuasMotion
cuasMotion
=
cuasRanging
.
detectTargets
(
uasLogReader
,
// UasLogReader uasLogReader,
batch_mode
);
// boolean batch_mode)
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"Target detection DONE"
);
}
}
if
(
generate_mapped
||
reuse_video
)
{
// modifies combo_dsn_final ?
if
(
generate_mapped
||
reuse_video
)
{
// modifies combo_dsn_final ?
int
tilesX
=
master_CLT
.
getTileProcessor
().
getTilesX
();
int
tilesX
=
master_CLT
.
getTileProcessor
().
getTilesX
();
int
tilesY
=
master_CLT
.
getTileProcessor
().
getTilesY
();
int
tilesY
=
master_CLT
.
getTileProcessor
().
getTilesY
();
...
@@ -6394,6 +6410,23 @@ public class OpticalFlow {
...
@@ -6394,6 +6410,23 @@ public class OpticalFlow {
if
(
generate_mapped
)
{
if
(
generate_mapped
)
{
double
[][]
ds_vantage
=
new
double
[][]
{
selected_disparity
,
selected_strength
};
double
[][]
ds_vantage
=
new
double
[][]
{
selected_disparity
,
selected_strength
};
if
((
views
[
ibase
][
0
]
!=
0
)
||
(
views
[
ibase
][
1
]
!=
0
)
||
(
views
[
ibase
][
2
]
!=
0
)
||
(
master_CLT
.
hasCenterClt
())
&&
(
mode3d
>
0
))
{
if
((
views
[
ibase
][
0
]
!=
0
)
||
(
views
[
ibase
][
1
]
!=
0
)
||
(
views
[
ibase
][
2
]
!=
0
)
||
(
master_CLT
.
hasCenterClt
())
&&
(
mode3d
>
0
))
{
boolean
debug_vantage
=
true
;
//dls
double
[][]
dbg_vantage
=
debug_vantage
?
(
new
double
[
7
][]):
null
;
if
(
dbg_vantage
!=
null
)
{
double
[][]
dls
=
{
combo_dsn_final
[
COMBO_DSN_INDX_DISP
],
// **** null on second scene sequence
combo_dsn_final
[
COMBO_DSN_INDX_LMA
],
combo_dsn_final
[
COMBO_DSN_INDX_STRENGTH
]
};
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
dbg_vantage
[
i
]
=
dls
[
i
].
clone
();
}
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
dbg_vantage
[
i
+
3
]
=
ds_vantage
[
i
].
clone
();
}
}
ds_vantage
=
transformCameraVew
(
ds_vantage
=
transformCameraVew
(
null
,
// (debug_ds_fg_virt?"transformCameraVew":null), // final String title,
null
,
// (debug_ds_fg_virt?"transformCameraVew":null), // final String title,
ds_vantage
,
// final double [][] dsrbg_camera_in,
ds_vantage
,
// final double [][] dsrbg_camera_in,
...
@@ -6402,6 +6435,19 @@ public class OpticalFlow {
...
@@ -6402,6 +6435,19 @@ public class OpticalFlow {
master_CLT
,
// quadCLTs[ref_index], // final QuadCLT scene_QuadClt,
master_CLT
,
// quadCLTs[ref_index], // final QuadCLT scene_QuadClt,
master_CLT
,
// quadCLTs[ref_index], // final QuadCLT reference_QuadClt,
master_CLT
,
// quadCLTs[ref_index], // final QuadCLT reference_QuadClt,
8
);
// iscale); // final int iscale);
8
);
// iscale); // final int iscale);
if
(
dbg_vantage
!=
null
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
dbg_vantage
[
i
+
5
]
=
ds_vantage
[
i
].
clone
();
}
ShowDoubleFloatArrays
.
showArrays
(
dbg_vantage
,
master_CLT
.
getTileProcessor
().
getTilesX
(),
master_CLT
.
getTileProcessor
().
getTilesY
(),
true
,
center_CLT
.
getImageName
()+
"-ds_vantage-old"
,
// "-corr2d"+"-"+frame0+"-"+frame1+"-"+corr_pairs,
new
String
[]
{
"disp0"
,
"lma0"
,
"str0"
,
"disp"
,
"str"
,
"virt_disp"
,
"virt_str"
});
}
}
}
if
(
master_CLT
.
getFPN
()
!=
null
)
{
if
(
master_CLT
.
getFPN
()
!=
null
)
{
scenes_suffix
+=
"-FPN"
;
scenes_suffix
+=
"-FPN"
;
...
@@ -6447,30 +6493,37 @@ public class OpticalFlow {
...
@@ -6447,30 +6493,37 @@ public class OpticalFlow {
null
,
// "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
null
,
// "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
imp_scenes_pair
[
nstereo
]);
// imp_scenes); // ImagePlus imp)
imp_scenes_pair
[
nstereo
]);
// imp_scenes); // ImagePlus imp)
if
(
master_CLT
.
hasCenterClt
())
{
// cuas mode
if
(
master_CLT
.
hasCenterClt
())
{
// cuas mode
boolean
insert_average
=
(
master_CLT
.
getCenterAverage
()
!=
null
)
||
clt_parameters
.
imp
.
calculate_average
;
boolean
new_cuas_mode
=
(
debugLevel
<
1000
);
boolean
subtract_average
=
clt_parameters
.
imp
.
subtract_average
&&
insert_average
;
if
(
new_cuas_mode
)
{
if
(
subtract_average
&&
clt_parameters
.
imp
.
cuas_targets
&&
(
mode3d
>
0
))
{
System
.
out
.
println
(
"CuasMotion should be already calculated, disabling old mode below."
);
System
.
out
.
println
(
"Will generate targets images/videos, mode3d="
+
mode3d
);
}
else
{
ImagePlus
imp_targets
=
imp_scenes_pair
[
nstereo
];
System
.
out
.
println
(
"Detecting targets in old mode."
);
int
first_corr
=
insert_average
?
1
:
0
;
// skip average
int
num_scenes
=
imp_targets
.
getStack
().
getSize
()-
first_corr
;
// includes average
boolean
insert_average
=
(
master_CLT
.
getCenterAverage
()
!=
null
)
||
clt_parameters
.
imp
.
calculate_average
;
float
[][]
fpixels
=
new
float
[
num_scenes
][];
boolean
subtract_average
=
clt_parameters
.
imp
.
subtract_average
&&
insert_average
;
String
[]
scene_titles
=
new
String
[
num_scenes
];
if
(
subtract_average
&&
clt_parameters
.
imp
.
cuas_targets
&&
(
mode3d
>
0
))
{
for
(
int
nscene
=
0
;
nscene
<
fpixels
.
length
;
nscene
++)
{
System
.
out
.
println
(
"Will generate targets images/videos, mode3d="
+
mode3d
);
fpixels
[
nscene
]
=
(
float
[])
imp_targets
.
getStack
().
getPixels
(
nscene
+
first_corr
+
1
);
ImagePlus
imp_targets
=
imp_scenes_pair
[
nstereo
];
String
s
=
imp_targets
.
getStack
().
getSliceLabel
(
nscene
+
first_corr
+
1
);
int
first_corr
=
insert_average
?
1
:
0
;
// skip average
if
(
s
.
indexOf
(
"-0"
)
>=
0
)
{
int
num_scenes
=
imp_targets
.
getStack
().
getSize
()-
first_corr
;
// includes average
s
=
s
.
substring
(
0
,
s
.
indexOf
(
"-0"
));
float
[][]
fpixels
=
new
float
[
num_scenes
][];
String
[]
scene_titles
=
new
String
[
num_scenes
];
for
(
int
nscene
=
0
;
nscene
<
fpixels
.
length
;
nscene
++)
{
fpixels
[
nscene
]
=
(
float
[])
imp_targets
.
getStack
().
getPixels
(
nscene
+
first_corr
+
1
);
String
s
=
imp_targets
.
getStack
().
getSliceLabel
(
nscene
+
first_corr
+
1
);
if
(
s
.
indexOf
(
"-0"
)
>=
0
)
{
s
=
s
.
substring
(
0
,
s
.
indexOf
(
"-0"
));
}
scene_titles
[
nscene
]
=
s
;
// imp_targets.getStack().getSliceLabel(nscene+first_corr+1);
}
}
scene_titles
[
nscene
]
=
s
;
// imp_targets.getStack().getSliceLabel(nscene+first_corr+1);
master_CLT
.
processMovingTargets
(
clt_parameters
,
// CLTParameters clt_parameters,
batch_mode
,
// final boolean batch_mode,
fpixels
,
// final float [][] fpixels,
uasLogReader
,
// UasLogReader uasLogReader,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel
);
// final int debugLevel)
}
}
master_CLT
.
processMovingTargets
(
clt_parameters
,
// CLTParameters clt_parameters,
batch_mode
,
// final boolean batch_mode,
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/QuadCLT.java
View file @
6f8ae877
...
@@ -5994,7 +5994,7 @@ if (debugLevel < -100) {
...
@@ -5994,7 +5994,7 @@ if (debugLevel < -100) {
debugLevel
);
debugLevel
);
}
}
@Deprecated
public
void
processMovingTargets
(
public
void
processMovingTargets
(
CLTParameters
clt_parameters
,
CLTParameters
clt_parameters
,
final
boolean
batch_mode
,
final
boolean
batch_mode
,
...
@@ -6010,16 +6010,6 @@ if (debugLevel < -100) {
...
@@ -6010,16 +6010,6 @@ if (debugLevel < -100) {
uasLogReader
,
// UasLogReader uasLogReader,
uasLogReader
,
// UasLogReader uasLogReader,
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
scene_titles
,
// String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel
);
// final int debugLevel)
debugLevel
);
// final int debugLevel)
/*
CuasMotion.processMovingTargets(
clt_parameters, // CLTParameters clt_parameters,
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/QuadCLTCPU.java
View file @
6f8ae877
...
@@ -3089,7 +3089,11 @@ public class QuadCLTCPU {
...
@@ -3089,7 +3089,11 @@ public class QuadCLTCPU {
dls
[
5
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_TERRAIN_AUX
:
TwoQuadCLT
.
DSI_TERRAIN_MAIN
];
dls
[
5
]
=
dsi
[
isAux
()?
TwoQuadCLT
.
DSI_TERRAIN_AUX
:
TwoQuadCLT
.
DSI_TERRAIN_MAIN
];
return
dls
;
return
dls
;
}
}
public
double
[][]
comboFromMain
(){
return
comboFromMain
(
this
.
dsi
);
}
public
double
[][]
comboFromMain
(
double
[][]
dsi
){
public
double
[][]
comboFromMain
(
double
[][]
dsi
){
if
(
dsi
==
null
)
{
if
(
dsi
==
null
)
{
return
null
;
return
null
;
...
...
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