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
e4c6d901
Commit
e4c6d901
authored
Aug 08, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Before motion blur correction
parent
cfa9c56d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
21 deletions
+115
-21
EyesisCorrectionParameters.java
...com/elphel/imagej/cameras/EyesisCorrectionParameters.java
+5
-2
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+5
-0
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+7
-0
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+37
-16
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+47
-3
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+14
-0
No files found.
src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java
View file @
e4c6d901
...
@@ -1527,10 +1527,12 @@ public class EyesisCorrectionParameters {
...
@@ -1527,10 +1527,12 @@ public class EyesisCorrectionParameters {
public
String
path
;
public
String
path
;
public
int
first
=
0
;
public
int
first
=
0
;
public
int
last
=
-
1
;
public
int
last
=
-
1
;
PathFirstLast
(
String
path
,
int
first
,
int
last
){
public
int
movement_size
=
-
1
;
PathFirstLast
(
String
path
,
int
first
,
int
last
,
int
movement_size
){
this
.
path
=
path
;
this
.
path
=
path
;
this
.
first
=
first
;
this
.
first
=
first
;
this
.
last
=
last
;
this
.
last
=
last
;
this
.
movement_size
=
movement_size
;
}
}
}
}
public
PathFirstLast
[]
getSourceSets
(
public
PathFirstLast
[]
getSourceSets
(
...
@@ -1623,7 +1625,8 @@ public class EyesisCorrectionParameters {
...
@@ -1623,7 +1625,8 @@ public class EyesisCorrectionParameters {
path_list
.
add
(
new
PathFirstLast
(
path_list
.
add
(
new
PathFirstLast
(
dir_path
.
toString
(),
dir_path
.
toString
(),
((
tokens
.
length
>
1
)?
Integer
.
parseInt
(
tokens
[
1
]):
0
),
((
tokens
.
length
>
1
)?
Integer
.
parseInt
(
tokens
[
1
]):
0
),
((
tokens
.
length
>
2
)?
Integer
.
parseInt
(
tokens
[
2
]):-
1
)));
((
tokens
.
length
>
2
)?
Integer
.
parseInt
(
tokens
[
2
]):-
1
),
((
tokens
.
length
>
3
)?
Integer
.
parseInt
(
tokens
[
3
]):-
1
)));
}
}
}
}
return
path_list
.
toArray
(
new
PathFirstLast
[
0
]);
return
path_list
.
toArray
(
new
PathFirstLast
[
0
]);
...
...
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
e4c6d901
...
@@ -26,6 +26,7 @@ package com.elphel.imagej.tileprocessor;
...
@@ -26,6 +26,7 @@ package com.elphel.imagej.tileprocessor;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Properties
;
import
java.util.Properties
;
...
@@ -398,6 +399,10 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -398,6 +399,10 @@ public class ErsCorrection extends GeometryCorrection {
scenes_poses
.
put
(
timestamp
,
new
XyzAtr
(
xyz
,
atr
,
ers_xyz_dt
,
ers_atr_dt
,
ers_xyz_d2t
,
ers_atr_d2t
));
scenes_poses
.
put
(
timestamp
,
new
XyzAtr
(
xyz
,
atr
,
ers_xyz_dt
,
ers_atr_dt
,
ers_xyz_d2t
,
ers_atr_d2t
));
}
}
public
String
getEarliestScene
()
{
return
Collections
.
min
(
scenes_poses
.
keySet
());
}
public
XyzAtr
getScene
(
String
timestamp
)
{
// null if not found
public
XyzAtr
getScene
(
String
timestamp
)
{
// null if not found
return
scenes_poses
.
get
(
timestamp
);
return
scenes_poses
.
get
(
timestamp
);
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
e4c6d901
...
@@ -146,6 +146,7 @@ public class IntersceneMatchParameters {
...
@@ -146,6 +146,7 @@ public class IntersceneMatchParameters {
public
int
seed_rows
=
5
;
// sky should appear in this top rows
public
int
seed_rows
=
5
;
// sky should appear in this top rows
public
double
sky_lim
=
15.0
;
// then expand to product of strength by diff_second below this
public
double
sky_lim
=
15.0
;
// then expand to product of strength by diff_second below this
public
int
sky_expand_extra
=
0
;
// 1?
public
int
sky_expand_extra
=
0
;
// 1?
public
int
sky_bottleneck
=
5
;
public
double
min_strength
=
0.08
;
public
double
min_strength
=
0.08
;
public
int
lowest_sky_row
=
50
;
// appears that low - invalid, remove completely
public
int
lowest_sky_row
=
50
;
// appears that low - invalid, remove completely
public
double
sky_bottom_override
=
-
300
;
// maximal average sky value to override lowest_sky_row test
public
double
sky_bottom_override
=
-
300
;
// maximal average sky value to override lowest_sky_row test
...
@@ -530,6 +531,8 @@ public class IntersceneMatchParameters {
...
@@ -530,6 +531,8 @@ public class IntersceneMatchParameters {
"Expand while FOM is below this value (usually to a high-contrast skyline)."
);
"Expand while FOM is below this value (usually to a high-contrast skyline)."
);
gd
.
addNumericField
(
"Expand extra"
,
this
.
sky_expand_extra
,
0
,
3
,
""
,
gd
.
addNumericField
(
"Expand extra"
,
this
.
sky_expand_extra
,
0
,
3
,
""
,
"Additionally expand sky area after reaching threshold in the previous step."
);
"Additionally expand sky area after reaching threshold in the previous step."
);
gd
.
addNumericField
(
"Bottleneck width"
,
this
.
sky_bottleneck
,
0
,
3
,
""
,
"Shrink/reexpand from the seed detected sky to prevent \"leaks\" through narrow gaps in the high-contrast sky limit."
);
gd
.
addNumericField
(
"Modify strength to be at least this"
,
this
.
min_strength
,
5
,
7
,
""
,
gd
.
addNumericField
(
"Modify strength to be at least this"
,
this
.
min_strength
,
5
,
7
,
""
,
"Input strength has some with zero values resulting in zero FOM. Make them at least this."
);
"Input strength has some with zero values resulting in zero FOM. Make them at least this."
);
gd
.
addNumericField
(
"Lowest sky row"
,
this
.
lowest_sky_row
,
0
,
3
,
""
,
gd
.
addNumericField
(
"Lowest sky row"
,
this
.
lowest_sky_row
,
0
,
3
,
""
,
...
@@ -910,6 +913,7 @@ public class IntersceneMatchParameters {
...
@@ -910,6 +913,7 @@ public class IntersceneMatchParameters {
this
.
seed_rows
=
(
int
)
gd
.
getNextNumber
();
this
.
seed_rows
=
(
int
)
gd
.
getNextNumber
();
this
.
sky_lim
=
gd
.
getNextNumber
();
this
.
sky_lim
=
gd
.
getNextNumber
();
this
.
sky_expand_extra
=
(
int
)
gd
.
getNextNumber
();
this
.
sky_expand_extra
=
(
int
)
gd
.
getNextNumber
();
this
.
sky_bottleneck
=
(
int
)
gd
.
getNextNumber
();
this
.
min_strength
=
gd
.
getNextNumber
();
this
.
min_strength
=
gd
.
getNextNumber
();
this
.
lowest_sky_row
=
(
int
)
gd
.
getNextNumber
();
this
.
lowest_sky_row
=
(
int
)
gd
.
getNextNumber
();
this
.
sky_bottom_override
=
gd
.
getNextNumber
();
this
.
sky_bottom_override
=
gd
.
getNextNumber
();
...
@@ -1182,6 +1186,7 @@ public class IntersceneMatchParameters {
...
@@ -1182,6 +1186,7 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"seed_rows"
,
this
.
seed_rows
+
""
);
// int
properties
.
setProperty
(
prefix
+
"seed_rows"
,
this
.
seed_rows
+
""
);
// int
properties
.
setProperty
(
prefix
+
"sky_lim"
,
this
.
sky_lim
+
""
);
// double
properties
.
setProperty
(
prefix
+
"sky_lim"
,
this
.
sky_lim
+
""
);
// double
properties
.
setProperty
(
prefix
+
"sky_expand_extra"
,
this
.
sky_expand_extra
+
""
);
// int
properties
.
setProperty
(
prefix
+
"sky_expand_extra"
,
this
.
sky_expand_extra
+
""
);
// int
properties
.
setProperty
(
prefix
+
"sky_bottleneck"
,
this
.
sky_bottleneck
+
""
);
// int
properties
.
setProperty
(
prefix
+
"min_strength"
,
this
.
min_strength
+
""
);
// double
properties
.
setProperty
(
prefix
+
"min_strength"
,
this
.
min_strength
+
""
);
// double
properties
.
setProperty
(
prefix
+
"lowest_sky_row"
,
this
.
lowest_sky_row
+
""
);
// int
properties
.
setProperty
(
prefix
+
"lowest_sky_row"
,
this
.
lowest_sky_row
+
""
);
// int
properties
.
setProperty
(
prefix
+
"sky_bottom_override"
,
this
.
sky_bottom_override
+
""
);
// double
properties
.
setProperty
(
prefix
+
"sky_bottom_override"
,
this
.
sky_bottom_override
+
""
);
// double
...
@@ -1405,6 +1410,7 @@ public class IntersceneMatchParameters {
...
@@ -1405,6 +1410,7 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"seed_rows"
)!=
null
)
this
.
seed_rows
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"seed_rows"
));
if
(
properties
.
getProperty
(
prefix
+
"seed_rows"
)!=
null
)
this
.
seed_rows
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"seed_rows"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_lim"
)!=
null
)
this
.
sky_lim
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"sky_lim"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_lim"
)!=
null
)
this
.
sky_lim
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"sky_lim"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_expand_extra"
)!=
null
)
this
.
sky_expand_extra
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"sky_expand_extra"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_expand_extra"
)!=
null
)
this
.
sky_expand_extra
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"sky_expand_extra"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_bottleneck"
)!=
null
)
this
.
sky_bottleneck
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"sky_bottleneck"
));
if
(
properties
.
getProperty
(
prefix
+
"min_strength"
)!=
null
)
this
.
min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"min_strength"
)!=
null
)
this
.
min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"lowest_sky_row"
)!=
null
)
this
.
lowest_sky_row
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"lowest_sky_row"
));
if
(
properties
.
getProperty
(
prefix
+
"lowest_sky_row"
)!=
null
)
this
.
lowest_sky_row
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"lowest_sky_row"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_bottom_override"
)!=
null
)
this
.
sky_bottom_override
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"sky_bottom_override"
));
if
(
properties
.
getProperty
(
prefix
+
"sky_bottom_override"
)!=
null
)
this
.
sky_bottom_override
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"sky_bottom_override"
));
...
@@ -1645,6 +1651,7 @@ public class IntersceneMatchParameters {
...
@@ -1645,6 +1651,7 @@ public class IntersceneMatchParameters {
imp
.
seed_rows
=
this
.
seed_rows
;
imp
.
seed_rows
=
this
.
seed_rows
;
imp
.
sky_lim
=
this
.
sky_lim
;
imp
.
sky_lim
=
this
.
sky_lim
;
imp
.
sky_expand_extra
=
this
.
sky_expand_extra
;
imp
.
sky_expand_extra
=
this
.
sky_expand_extra
;
imp
.
sky_bottleneck
=
this
.
sky_bottleneck
;
imp
.
min_strength
=
this
.
min_strength
;
imp
.
min_strength
=
this
.
min_strength
;
imp
.
lowest_sky_row
=
this
.
lowest_sky_row
;
imp
.
lowest_sky_row
=
this
.
lowest_sky_row
;
imp
.
sky_bottom_override
=
this
.
sky_bottom_override
;
imp
.
sky_bottom_override
=
this
.
sky_bottom_override
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
e4c6d901
...
@@ -4131,6 +4131,7 @@ public class OpticalFlow {
...
@@ -4131,6 +4131,7 @@ public class OpticalFlow {
double
sky_seed
=
clt_parameters
.
imp
.
sky_seed
;
double
sky_seed
=
clt_parameters
.
imp
.
sky_seed
;
double
lma_seed
=
clt_parameters
.
imp
.
lma_seed
;
double
lma_seed
=
clt_parameters
.
imp
.
lma_seed
;
int
sky_shrink
=
clt_parameters
.
imp
.
sky_shrink
;
int
sky_shrink
=
clt_parameters
.
imp
.
sky_shrink
;
int
sky_bottleneck
=
clt_parameters
.
imp
.
sky_bottleneck
;
int
seed_rows
=
clt_parameters
.
imp
.
seed_rows
;
int
seed_rows
=
clt_parameters
.
imp
.
seed_rows
;
double
sky_lim
=
clt_parameters
.
imp
.
sky_lim
;
double
sky_lim
=
clt_parameters
.
imp
.
sky_lim
;
int
sky_expand_extra
=
clt_parameters
.
imp
.
sky_expand_extra
;
int
sky_expand_extra
=
clt_parameters
.
imp
.
sky_expand_extra
;
...
@@ -4268,6 +4269,7 @@ public class OpticalFlow {
...
@@ -4268,6 +4269,7 @@ public class OpticalFlow {
sky_lim
,
// double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_lim
,
// double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_shrink
,
// int sky_shrink, // = 4;
sky_shrink
,
// int sky_shrink, // = 4;
sky_expand_extra
,
// int sky_expand_extra, // = 100; // 1?
sky_expand_extra
,
// int sky_expand_extra, // = 100; // 1?
sky_bottleneck
,
//int sky_bottleneck, //
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
...
@@ -4321,6 +4323,7 @@ public class OpticalFlow {
...
@@ -4321,6 +4323,7 @@ public class OpticalFlow {
sky_lim
,
// double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_lim
,
// double sky_lim, // = 15.0; // then expand to product of strength by diff_second below this
sky_shrink
,
// int sky_shrink, // = 4;
sky_shrink
,
// int sky_shrink, // = 4;
sky_expand_extra
,
// int sky_expand_extra, // = 100; // 1?
sky_expand_extra
,
// int sky_expand_extra, // = 100; // 1?
sky_bottleneck
,
//int sky_bottleneck, //
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
...
@@ -4530,9 +4533,23 @@ public class OpticalFlow {
...
@@ -4530,9 +4533,23 @@ public class OpticalFlow {
debugLevel
-
2
);
debugLevel
-
2
);
}
}
}
}
for
(
int
scene_index
=
ref_index
-
1
;
scene_index
>=
earliest_scene
;
scene_index
--)
{
if
(!
quadCLTs
[
ref_index
].
tsExists
(
set_channels
[
scene_index
].
set_name
))
{
earliest_scene
=
scene_index
+
1
;
}
}
if
((
ref_index
-
earliest_scene
+
1
)
<
min_num_scenes
)
{
System
.
out
.
println
(
"2.Total number of useful scenes = "
+(
ref_index
-
earliest_scene
+
1
)+
" < "
+
min_num_scenes
+
". Scrapping this series."
);
if
(
start_ref_pointers
!=
null
)
{
start_ref_pointers
[
0
]
=
earliest_scene
;
}
return
null
;
}
}
}
// just in case that orientations were calculated before:
// just in case that orientations were calculated before:
earliest_scene
=
getEarliestScene
(
quadCLTs
);
//
earliest_scene = getEarliestScene(quadCLTs);
double
[][]
combo_dsn_final
=
null
;
double
[][]
combo_dsn_final
=
null
;
while
(!
reuse_video
&&
((
quadCLTs
[
ref_index
].
getNumOrient
()
<
min_num_orient
)
||
(
quadCLTs
[
ref_index
].
getNumAccum
()
<
min_num_interscene
)))
{
while
(!
reuse_video
&&
((
quadCLTs
[
ref_index
].
getNumOrient
()
<
min_num_orient
)
||
(
quadCLTs
[
ref_index
].
getNumAccum
()
<
min_num_interscene
)))
{
...
@@ -4852,18 +4869,18 @@ public class OpticalFlow {
...
@@ -4852,18 +4869,18 @@ public class OpticalFlow {
if
(
views
[
ibase
][
2
]
!=
0
)
{
if
(
views
[
ibase
][
2
]
!=
0
)
{
scenes_suffix
+=
"-Z"
+
String
.
format
(
"%.0f"
,
views
[
ibase
][
2
]);
scenes_suffix
+=
"-Z"
+
String
.
format
(
"%.0f"
,
views
[
ibase
][
2
]);
}
}
double
[][]
ds_vantage
=
new
double
[][]
{
selected_disparity
,
selected_strength
};
if
((
views
[
ibase
][
0
]
!=
0
)
||
(
views
[
ibase
][
1
]
!=
0
)
||
(
views
[
ibase
][
2
]
!=
0
))
{
ds_vantage
=
transformCameraVew
(
null
,
// (debug_ds_fg_virt?"transformCameraVew":null), // final String title,
ds_vantage
,
// final double [][] dsrbg_camera_in,
xyz_offset
,
// _inverse[0], // final double [] scene_xyz, // camera center in world coordinates
ZERO3
,
// _inverse[1], // final double [] scene_atr, // camera orientation relative to world frame
quadCLTs
[
ref_index
],
// final QuadCLT scene_QuadClt,
quadCLTs
[
ref_index
],
// final QuadCLT reference_QuadClt,
8
);
// iscale); // final int iscale);
}
if
(
generate_mapped
)
{
if
(
generate_mapped
)
{
double
[][]
ds_vantage
=
new
double
[][]
{
selected_disparity
,
selected_strength
};
if
((
views
[
ibase
][
0
]
!=
0
)
||
(
views
[
ibase
][
1
]
!=
0
)
||
(
views
[
ibase
][
2
]
!=
0
))
{
ds_vantage
=
transformCameraVew
(
null
,
// (debug_ds_fg_virt?"transformCameraVew":null), // final String title,
ds_vantage
,
// final double [][] dsrbg_camera_in,
xyz_offset
,
// _inverse[0], // final double [] scene_xyz, // camera center in world coordinates
ZERO3
,
// _inverse[1], // final double [] scene_atr, // camera orientation relative to world frame
quadCLTs
[
ref_index
],
// final QuadCLT scene_QuadClt,
quadCLTs
[
ref_index
],
// final QuadCLT reference_QuadClt,
8
);
// iscale); // final int iscale);
}
imp_scenes_pair
[
nstereo
]=
renderSceneSequence
(
imp_scenes_pair
[
nstereo
]=
renderSceneSequence
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
fov_tiles
,
// Rectangle fov_tiles,
fov_tiles
,
// Rectangle fov_tiles,
...
@@ -10054,15 +10071,19 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
...
@@ -10054,15 +10071,19 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
ErsCorrection
ers_reference
=
scenes
[
ref_index
].
getErsCorrection
();
ErsCorrection
ers_reference
=
scenes
[
ref_index
].
getErsCorrection
();
for
(
int
nscene
=
ref_index
-
1
;
nscene
>=
00
;
nscene
--)
{
for
(
int
nscene
=
ref_index
-
1
;
nscene
>=
00
;
nscene
--)
{
String
ts
=
scenes
[
nscene
].
getImageName
();
String
ts
=
scenes
[
nscene
].
getImageName
();
double
[]
scene_xyz
=
ers_reference
.
getSceneXYZ
(
ts
);
if
(!
scenes
[
ref_index
].
tsExists
(
ts
)
)
{
double
[]
scene_atr
=
ers_reference
.
getSceneATR
(
ts
);
if
((
scene_xyz
==
null
)
||
(
scene_atr
==
null
)){
return
nscene
+
1
;
// scene is not matched
return
nscene
+
1
;
// scene is not matched
}
}
// double [] scene_xyz = ers_reference.getSceneXYZ(ts);
// double [] scene_atr = ers_reference.getSceneATR(ts);
// if ((scene_xyz == null) || (scene_atr == null)){
// return nscene + 1; // scene is not matched
// }
}
}
return
0
;
return
0
;
}
}
// Cleaned up and optimized version to reduce memory usage (on-the-fly integration, not saving full correlation data)
// Cleaned up and optimized version to reduce memory usage (on-the-fly integration, not saving full correlation data)
public
double
[][]
correlateInterscene
(
public
double
[][]
correlateInterscene
(
final
CLTParameters
clt_parameters
,
final
CLTParameters
clt_parameters
,
...
@@ -12723,7 +12744,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
...
@@ -12723,7 +12744,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
}
}
double
target_str
=
Math
.
exp
(
double
target_str
=
Math
.
exp
(
eq_level
*
Math
.
log
(
avg_stile_str
)
+
eq_level
*
Math
.
log
(
avg_stile_str
)
+
(
1.0
-
eq_level
)*
stile_weight
[
sTile
]
);
(
1.0
-
eq_level
)*
Math
.
log
(
stile_weight
[
sTile
])
);
Arrays
.
fill
(
mod_weights
,
0
);
Arrays
.
fill
(
mod_weights
,
0
);
double
sum_weights
=
0.0
;
double
sum_weights
=
0.0
;
int
num_tiles
=
0
;
// for partial stiles
int
num_tiles
=
0
;
// for partial stiles
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
e4c6d901
...
@@ -432,6 +432,7 @@ public class QuadCLTCPU {
...
@@ -432,6 +432,7 @@ public class QuadCLTCPU {
* be expanded
* be expanded
* @param sky_shrink shrink initial sky area to eliminate small non-sky areas.
* @param sky_shrink shrink initial sky area to eliminate small non-sky areas.
* @param sky_expand_extra additionally expand
* @param sky_expand_extra additionally expand
* @param int sky_bottleneck - shrink/reexpand from the seed detected sky to prevent "leaks"
* @param width number of tiles in a row
* @param width number of tiles in a row
* @param strength 1d array of tile strengths in scanline order
* @param strength 1d array of tile strengths in scanline order
* @param spread 1d array of tile spreads (second maximal difference from
* @param spread 1d array of tile spreads (second maximal difference from
...
@@ -447,6 +448,7 @@ public class QuadCLTCPU {
...
@@ -447,6 +448,7 @@ public class QuadCLTCPU {
double
sky_lim
,
// = 15.0; // then expand to product of strength by diff_second below this
double
sky_lim
,
// = 15.0; // then expand to product of strength by diff_second below this
int
sky_shrink
,
// = 4;
int
sky_shrink
,
// = 4;
int
sky_expand_extra
,
// = 100; // 1?
int
sky_expand_extra
,
// = 100; // 1?
int
sky_bottleneck
,
//
double
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
double
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
double
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
double
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
double
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
double
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
...
@@ -465,6 +467,8 @@ public class QuadCLTCPU {
...
@@ -465,6 +467,8 @@ public class QuadCLTCPU {
if
((
strength
==
null
)
||
(
spread
==
null
))
{
if
((
strength
==
null
)
||
(
spread
==
null
))
{
return
null
;
return
null
;
}
}
// int sky_bottleneck = 5; // shrink full selection, then re-expand from seed to disable
// small (narrow) leaks (or just disable leaks near margins)?
// int shrink_for_temp = 10;
// int shrink_for_temp = 10;
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
double
[]
temp_scales
=
null
;
double
[]
temp_scales
=
null
;
...
@@ -485,7 +489,7 @@ public class QuadCLTCPU {
...
@@ -485,7 +489,7 @@ public class QuadCLTCPU {
num_def
++;
num_def
++;
}
}
}
}
if
(
num_def
>
0
0
)
{
if
(
num_def
>
0
)
{
avg_temp
/=
num_def
;
avg_temp
/=
num_def
;
// build a histogram from min to max
// build a histogram from min to max
double
[]
hist
=
new
double
[
num_bins
];
double
[]
hist
=
new
double
[
num_bins
];
...
@@ -550,7 +554,7 @@ public class QuadCLTCPU {
...
@@ -550,7 +554,7 @@ public class QuadCLTCPU {
String
[]
dbg_in_titles
=
{
"fom"
,
"strength"
,
"spread"
,
"disparity"
,
"avg_val"
,
"tscale"
};
String
[]
dbg_in_titles
=
{
"fom"
,
"strength"
,
"spread"
,
"disparity"
,
"avg_val"
,
"tscale"
};
String
[]
dbg_titles
=
{
"sky"
,
"seed"
,
"max"
,
"shrank"
,
"full_shrank"
};
String
[]
dbg_titles
=
{
"sky"
,
"seed"
,
"max"
,
"shrank"
,
"full_shrank"
,
"neck_shrank"
,
"reexpand"
};
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
0
)
{
double
[]
fom
=
new
double
[
strength
.
length
];
double
[]
fom
=
new
double
[
strength
.
length
];
...
@@ -595,15 +599,17 @@ public class QuadCLTCPU {
...
@@ -595,15 +599,17 @@ public class QuadCLTCPU {
if
(
seed_rows
>
0
)
{
if
(
seed_rows
>
0
)
{
Arrays
.
fill
(
sky_tiles
,
seed_rows
*
width
,
sky_tiles
.
length
,
false
);
Arrays
.
fill
(
sky_tiles
,
seed_rows
*
width
,
sky_tiles
.
length
,
false
);
}
}
boolean
[]
seed_sky
=
sky_tiles
.
clone
();
if
(
dbg_img
!=
null
)
{
if
(
dbg_img
!=
null
)
{
for
(
int
i
=
0
;
i
<
sky_tiles
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
sky_tiles
.
length
;
i
++)
{
dbg_img
[
3
][
i
]
=
sky_tiles
[
i
]?
1
:
0
;
dbg_img
[
3
][
i
]
=
sky_tiles
[
i
]?
1
:
0
;
}
}
}
}
// Calculate average seed "temperature"
// Calculate average seed "temperature"
tn
.
growSelection
(
tn
.
growSelection
(
2
*
width
,
// int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
4
*
width
,
// int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_tiles
,
// boolean [] tiles,
sky_tiles
,
// boolean [] tiles,
prohibit_tiles
);
// boolean [] prohibit)
prohibit_tiles
);
// boolean [] prohibit)
if
(
sky_expand_extra
>
0
)
{
if
(
sky_expand_extra
>
0
)
{
...
@@ -612,6 +618,36 @@ public class QuadCLTCPU {
...
@@ -612,6 +618,36 @@ public class QuadCLTCPU {
sky_tiles
,
// boolean [] tiles,
sky_tiles
,
// boolean [] tiles,
null
);
// boolean [] prohibit)
null
);
// boolean [] prohibit)
}
}
//shrink_neck
// Remove leaks through small holes
if
(
sky_bottleneck
>
0
)
{
tn
.
shrinkSelection
(
sky_bottleneck
,
// int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_tiles
,
// boolean [] tiles,
null
);
// boolean [] prohibit)
boolean
[]
prohibit_neck
=
new
boolean
[
sky_tiles
.
length
];
for
(
int
i
=
0
;
i
<
prohibit_neck
.
length
;
i
++)
{
prohibit_neck
[
i
]
=
!
seed_sky
[
i
]
&&
!
sky_tiles
[
i
];
}
sky_tiles
=
seed_sky
.
clone
();
tn
.
growSelection
(
4
*
width
,
// int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_tiles
,
// boolean [] tiles,
prohibit_neck
);
// boolean [] prohibit)
tn
.
growSelection
(
sky_bottleneck
,
// int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
sky_tiles
,
// boolean [] tiles,
prohibit_tiles
);
// boolean [] prohibit)
if
(
dbg_img
!=
null
)
{
for
(
int
i
=
0
;
i
<
sky_tiles
.
length
;
i
++)
{
dbg_img
[
5
][
i
]
=
prohibit_neck
[
i
]?
0
:
1
;
dbg_img
[
6
][
i
]
=
sky_tiles
[
i
]?
1
:
0
;
}
}
//prohibit_tiles
}
double
sky_max_temp
=
Double
.
NaN
;
double
sky_max_temp
=
Double
.
NaN
;
if
(
avg_val
!=
null
)
{
if
(
avg_val
!=
null
)
{
boolean
[]
shrank_sky
=
sky_tiles
.
clone
();
boolean
[]
shrank_sky
=
sky_tiles
.
clone
();
...
@@ -678,6 +714,7 @@ public class QuadCLTCPU {
...
@@ -678,6 +714,7 @@ public class QuadCLTCPU {
double
sky_lim
,
// = 15.0; // then expand to product of strength by diff_second below this
double
sky_lim
,
// = 15.0; // then expand to product of strength by diff_second below this
int
sky_shrink
,
// = 4;
int
sky_shrink
,
// = 4;
int
sky_expand_extra
,
// = 100; // 1?
int
sky_expand_extra
,
// = 100; // 1?
int
sky_bottleneck
,
//
double
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
double
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
double
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
double
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
double
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
double
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
...
@@ -699,6 +736,7 @@ public class QuadCLTCPU {
...
@@ -699,6 +736,7 @@ public class QuadCLTCPU {
sky_lim
,
// = 15.0; // then expand to product of strength by diff_second below this
sky_lim
,
// = 15.0; // then expand to product of strength by diff_second below this
sky_shrink
,
// = 4;
sky_shrink
,
// = 4;
sky_expand_extra
,
// = 100; // 1?
sky_expand_extra
,
// = 100; // 1?
sky_bottleneck
,
//
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_scale
,
// = 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
cold_frac
,
// = 0.005; // this and lower will scale fom by cold_scale
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
hot_frac
,
// = 0.9; // this and above will scale fom by 1.0
...
@@ -2158,6 +2196,12 @@ public class QuadCLTCPU {
...
@@ -2158,6 +2196,12 @@ public class QuadCLTCPU {
}
}
}
}
public
boolean
tsExists
(
String
ts
)
{
ErsCorrection
ers_reference
=
getErsCorrection
();
return
((
ers_reference
.
getSceneXYZ
(
ts
)
!=
null
)
&&
(
ers_reference
.
getSceneATR
(
ts
)
!=
null
));
}
public
double
[][][][][][]
getCLTKernels
(){
// USED in lwir
public
double
[][][][][][]
getCLTKernels
(){
// USED in lwir
return
clt_kernels
;
return
clt_kernels
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
e4c6d901
...
@@ -8650,6 +8650,20 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8650,6 +8650,20 @@ if (debugLevel > -100) return true; // temporarily !
scene_dirs
,
// File [] scene_dirs,
scene_dirs
,
// File [] scene_dirs,
pathFirstLast
[
nseq
].
first
,
// int scene_first, // first scene to process
pathFirstLast
[
nseq
].
first
,
// int scene_first, // first scene to process
pathFirstLast
[
nseq
].
last
);
// int scene_last); // last scene to process (negative - add length
pathFirstLast
[
nseq
].
last
);
// int scene_last); // last scene to process (negative - add length
if
(
pathFirstLast
[
nseq
].
movement_size
<
0
)
{
clt_parameters
.
imp
.
mov_en
=
false
;
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"Disabling movement detection for this scene."
);
}
}
else
{
clt_parameters
.
imp
.
mov_en
=
true
;
clt_parameters
.
imp
.
mov_max_len
=
pathFirstLast
[
nseq
].
movement_size
;
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"Enabling movement detection for this scene with maximum cluster linear size of "
+
clt_parameters
.
imp
.
mov_max_len
+
" tiles."
);
}
}
}
}
String
[][]
video_list
=
new
String
[
1
][];
String
[][]
video_list
=
new
String
[
1
][];
...
...
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