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
69e30a31
Commit
69e30a31
authored
Oct 03, 2025
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Erasing source images
parent
dffd9fb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
215 deletions
+22
-215
CuasRanging.java
src/main/java/com/elphel/imagej/cuas/CuasRanging.java
+15
-17
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+7
-198
No files found.
src/main/java/com/elphel/imagej/cuas/CuasRanging.java
View file @
69e30a31
...
...
@@ -438,6 +438,7 @@ public class CuasRanging {
start_scene
,
// final int start_scene,
num_scenes
,
// final int num_scenes,
clean_up
,
// final boolean clean_up, // remove unneded data
false
,
// final boolean erase_source_images, // erase source images (will not clean up this.img_um)
debugLevel
);
// final int debugLevel)
/*
final double [][][] img_um_seq = QuadCLT.unsharpMaskSourceMono(
...
...
@@ -1007,6 +1008,7 @@ public class CuasRanging {
final
int
start_scene
,
final
int
num_scenes
,
final
boolean
clean_up
,
// remove unneded data
final
boolean
erase_source
,
// erase source images (will not clean up this.img_um, will erase used source images instead)
final
int
debugLevel
)
{
final
boolean
um_en
=
clt_parameters
.
imp
.
cuas_rng_um
;
final
double
um_sigma
=
clt_parameters
.
imp
.
cuas_rng_um_sigma
;
...
...
@@ -1014,11 +1016,15 @@ public class CuasRanging {
final
double
um_weight
=
clt_parameters
.
imp
.
cuas_rng_um_weight
;
if
(
clean_up
)
{
for
(
int
nscene
=
0
;
nscene
<
start_scene
;
nscene
++)
{
this
.
img_um
[
nscene
]
=
null
;
if
(
erase_source
)
{
// keep cache if source images are deleted
this
.
img_um
[
nscene
]
=
null
;
}
scenes
[
nscene
].
setImageDataAlt
(
null
);
}
for
(
int
nscene
=
start_scene
+
num_scenes
;
nscene
<
this
.
img_um
.
length
;
nscene
++)
{
this
.
img_um
[
nscene
]
=
null
;
if
(
erase_source
)
{
// keep cache if source images are deleted
this
.
img_um
[
nscene
]
=
null
;
}
scenes
[
nscene
].
setImageDataAlt
(
null
);
}
Runtime
runtime
=
Runtime
.
getRuntime
();
...
...
@@ -1035,6 +1041,7 @@ public class CuasRanging {
img_um
,
// final double [][][] img_um, // cache for unsharped images, same length as scenes. May be null
false
,
// final boolean unsharped, // ==false, not used
false
,
// final boolean update_source, // ==false, not used if update_source will not generate output, return null
erase_source
,
// final boolean erase_source,
um_sigma
,
// final double um_sigma,
um_twice
,
// final boolean um_twice,
um_weight
,
// final double um_weight,
...
...
@@ -1082,25 +1089,16 @@ public class CuasRanging {
final
int
start_scene
=
frame_center
-
half_accum_range
;
final
int
num_scenes
=
2
*
half_accum_range
+
1
;
boolean
clean_up
=
true
;
// remove unneded data
boolean
erase_source
=
true
;
// check everything works
final
double
[][][]
img_um_seq
=
getUMSequence
(
start_scene
,
// final int start_scene,
start_scene
,
// final int start_scene,
num_scenes
,
// final int num_scenes,
clean_up
,
// final boolean clean_up, // remove unneded data
erase_source
,
// final boolean erase_source, // erase source images (will not clean up this.img_um)
debugLevel
);
// final int debugLevel)
/*
final double [][][] img_um_seq = QuadCLT.unsharpMaskSourceMono( // [num_scenes][num_sens][pixels]
scenes, // final QuadCLT[] scenes,
start_scene, // final int start_scene,
num_scenes, // final int num_scenes,
um_en, // final boolean um_en,
um_all, // final boolean unsharped,
um_sigma, // final double um_sigma,
um_twice, // final boolean um_twice,
um_weight, // final double um_weight,
debugLevel); // final int debugLevel)
*/
double
[][][]
pXpYDs
=
cuasMotion
.
targetPxPyD
(
targets
[
nseq
]);
// final double [][] targets)
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
69e30a31
...
...
@@ -6116,202 +6116,6 @@ if (debugLevel < -100) {
threadsMax
,
debugLevel
);
}
/*
@Deprecated
public void processMovingTargets(
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.processMovingTargetsMulti(
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)
}
*/
public
static
double
[][][]
unsharpMaskSourceMono
(
final
QuadCLT
[]
scenes
,
final
int
start_scene
,
final
int
num_scenes
,
final
boolean
um_en
,
final
boolean
unsharped
,
final
double
um_sigma
,
final
boolean
um_twice
,
final
double
um_weight
,
final
int
debugLevel
){
double
[][][][]
um_color
=
unsharpMaskSource
(
scenes
,
// final QuadCLT[] scenes,
start_scene
,
// final int start_scene,
num_scenes
,
// final int num_scenes,
um_en
,
// final boolean um_en,
unsharped
,
// final boolean unsharped,
false
,
// update_source, // final boolean update_source, // if update_source will not generate output, return null
um_sigma
,
// final double um_sigma,
um_twice
,
// final boolean um_twice,
um_weight
,
// final double um_weight,
debugLevel
);
// final int debugLevel)
double
[][][]
um_mono
=
new
double
[
um_color
.
length
][
um_color
[
0
].
length
][];
for
(
int
nscene
=
0
;
nscene
<
um_mono
.
length
;
nscene
++)
{
for
(
int
nsens
=
0
;
nsens
<
um_mono
[
nscene
].
length
;
nsens
++)
{
um_mono
[
nscene
][
nsens
]
=
um_color
[
nscene
][
nsens
][
0
];
}
}
return
um_mono
;
}
@Deprecated
public
static
double
[][][][]
unsharpMaskSource_old
(
final
QuadCLT
[]
scenes
,
final
int
start_scene
,
final
int
num_scenes
,
final
boolean
um_en
,
final
boolean
unsharped
,
final
boolean
update_source
,
// if update_source will not generate output, return null
final
double
um_sigma
,
final
boolean
um_twice
,
final
double
um_weight
,
final
int
debugLevel
){
final
int
num_sens
=
scenes
[
start_scene
].
getNumSensors
();
int
[]
whc
=
scenes
[
start_scene
].
getWHC
(
false
);
final
int
width
=
whc
[
0
];
final
int
height
=
whc
[
1
];
final
int
num_col
=
whc
[
2
];
final
double
[][][][]
images_um
=
update_source
?
null
:
new
double
[
num_scenes
][
num_sens
][
num_col
][];
final
int
num_sens_col
=
num_sens
*
num_col
;
final
int
num_img
=
num_scenes
*
num_sens_col
;
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
double
[]
img_buf
=
new
double
[
width
*
height
];
double
[]
img_buf2
=
um_twice
?
(
new
double
[
width
*
height
])
:
null
;
DoubleGaussianBlur
gb
=
new
DoubleGaussianBlur
();
// may be faster if process only where vector_field[nseq][ntile] is not null
for
(
int
nImg
=
ai
.
getAndIncrement
();
nImg
<
num_img
;
nImg
=
ai
.
getAndIncrement
())
{
int
dscene
=
nImg
/
num_sens_col
;
int
nscene
=
dscene
+
start_scene
;
int
nsens_col
=
nImg
%
num_sens_col
;
int
nsens
=
nsens_col
/
num_col
;
int
ncol
=
nsens_col
%
num_col
;
double
[]
img_src
=
scenes
[
nscene
].
getOrigImageData
()[
nsens
][
ncol
];
if
(!
unsharped
&&
um_en
)
{
System
.
arraycopy
(
img_src
,
0
,
img_buf
,
0
,
img_buf
.
length
);
gb
.
blurDouble
(
img_buf
,
//
width
,
height
,
um_sigma
,
// double sigmaX,
um_sigma
,
// double sigmaY,
0.01
);
// double accuracy)
if
(
um_weight
!=
1.0
)
{
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_buf
[
i
]
*=
um_weight
;
}
}
if
(
img_buf2
!=
null
)
{
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_buf2
[
i
]
=
img_src
[
i
]
-
img_buf
[
i
];
}
System
.
arraycopy
(
img_buf2
,
0
,
img_buf
,
0
,
img_buf
.
length
);
gb
.
blurDouble
(
img_buf2
,
//
width
,
height
,
um_sigma
,
// double sigmaX,
um_sigma
,
// double sigmaY,
0.01
);
// double accuracy)
if
(
um_weight
!=
1.0
)
{
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_buf2
[
i
]
*=
um_weight
;
}
}
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_buf
[
i
]
-=
img_buf2
[
i
];
}
if
(
update_source
)
{
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_src
[
i
]
=
img_buf
[
i
];
}
}
else
{
images_um
[
dscene
][
nsens
][
ncol
]
=
img_buf
.
clone
();
}
}
else
{
if
(
update_source
)
{
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_src
[
i
]
-=
img_buf
[
i
];
}
}
else
{
for
(
int
i
=
0
;
i
<
img_buf
.
length
;
i
++)
{
img_buf
[
i
]
=
img_src
[
i
]
-
img_buf
[
i
];
}
images_um
[
dscene
][
nsens
][
ncol
]
=
img_buf
.
clone
();
}
}
}
else
{
// just copy
images_um
[
dscene
][
nsens
][
ncol
]
=
img_src
.
clone
();
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
images_um
;
}
public
static
double
[][][][]
unsharpMaskSource
(
final
QuadCLT
[]
scenes
,
final
int
start_scene
,
final
int
num_scenes
,
final
boolean
um_en
,
final
boolean
unsharped
,
final
boolean
update_source
,
// if update_source will not generate output, return null
final
double
um_sigma
,
final
boolean
um_twice
,
final
double
um_weight
,
final
int
debugLevel
){
final
int
num_sens
=
scenes
[
start_scene
].
getNumSensors
();
int
[]
whc
=
scenes
[
start_scene
].
getWHC
(
false
);
final
int
width
=
whc
[
0
];
final
int
height
=
whc
[
1
];
final
int
num_col
=
whc
[
2
];
final
double
[][][][]
images_um
=
update_source
?
null
:
new
double
[
num_scenes
][
num_sens
][
num_col
][];
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
double
[]
img_buf
=
new
double
[
width
*
height
];
double
[]
img_buf2
=
um_twice
?
(
new
double
[
width
*
height
])
:
null
;
for
(
int
iScene
=
ai
.
getAndIncrement
();
iScene
<
num_scenes
;
iScene
=
ai
.
getAndIncrement
())
{
double
[][][]
image_um
=
unsharpMaskSource
(
scenes
[
iScene
+
start_scene
],
// final QuadCLT scene,
um_en
,
// final boolean um_en,
unsharped
,
// final boolean unsharped,
update_source
,
// final boolean update_source, // if update_source will not generate output, return null
um_sigma
,
// final double um_sigma,
img_buf
,
// final double [] img_buf, // = new double [width * height];
img_buf2
,
// final double [] img_buf2, // = um_twice ? (new double [width * height]) : null;
um_weight
,
// final double um_weight,
debugLevel
);
// final int debugLevel)
if
(
images_um
!=
null
)
{
images_um
[
iScene
]
=
image_um
;
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
images_um
;
}
public
static
double
[][][]
unsharpMaskSourceMono
(
final
QuadCLT
[]
scenes
,
...
...
@@ -6321,6 +6125,7 @@ if (debugLevel < -100) {
final
double
[][][]
img_um
,
// cache for unsharped images, same length as scenes. May be null
final
boolean
unsharped
,
// ==false, not used
final
boolean
update_source
,
// ==false, not used if update_source will not generate output, return null
final
boolean
erase_source
,
// saving memory, erase source images when UM ones are calculated and saved in img_um cache
final
double
um_sigma
,
final
boolean
um_twice
,
final
double
um_weight
,
...
...
@@ -6329,7 +6134,7 @@ if (debugLevel < -100) {
int
[]
whc
=
scenes
[
start_scene
].
getWHC
(
false
);
final
int
width
=
whc
[
0
];
final
int
height
=
whc
[
1
];
final
int
num_col
=
whc
[
2
];
//
final int num_col = whc[2];
final
double
[][][]
images_um
=
new
double
[
num_scenes
][
num_sens
][];
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
...
...
@@ -6342,7 +6147,7 @@ if (debugLevel < -100) {
int
nscene
=
iScene
+
start_scene
;
if
((
img_um
==
null
)
||
(
img_um
[
nscene
]
==
null
))
{
double
[][][]
image_um_col
=
unsharpMaskSource
(
// [sensor][color][pixel]
scenes
[
iScene
+
start_scene
],
// final QuadCLT scene,
scenes
[
nscene
],
//
iScene + start_scene], // final QuadCLT scene,
um_en
,
// final boolean um_en,
unsharped
,
// unsharped, // final boolean unsharped,
update_source
,
// update_source, // final boolean update_source, // if update_source will not generate output, return null
...
...
@@ -6351,6 +6156,10 @@ if (debugLevel < -100) {
img_buf2
,
// final double [] img_buf2, // = um_twice ? (new double [width * height]) : null;
um_weight
,
// final double um_weight,
debugLevel
);
// final int debugLevel)
if
(
erase_source
)
{
scenes
[
nscene
].
setImageData
(
null
);
}
// scenes[nscene].setImageDataAlt(null);
for
(
int
nsens
=
0
;
nsens
<
num_sens
;
nsens
++)
{
images_um
[
iScene
][
nsens
]
=
image_um_col
[
nsens
][
0
];
}
...
...
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