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
12d3c947
Commit
12d3c947
authored
Apr 07, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up/implemented generation of the scene stats and combo images
parent
640b8df3
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
737 additions
and
146 deletions
+737
-146
ComboMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
+20
-60
ItemMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ItemMatch.java
+51
-0
ItemPatternMatch.java
.../java/com/elphel/imagej/orthomosaic/ItemPatternMatch.java
+19
-0
OrthoMap.java
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
+1
-1
OrthoMapsCollection.java
...va/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
+646
-85
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
View file @
12d3c947
...
...
@@ -148,11 +148,12 @@ public class ComboMatch {
int
gpu_width
=
clt_parameters
.
imp
.
rln_gpu_width
;
// 3008;
int
gpu_height
=
clt_parameters
.
imp
.
rln_gpu_height
;
// 3008;
int
zoom_lev
=
-
3
;
// 0; // +1 - zoom in twice, -1 - zoom out twice
boolean
show_map_stats
=
false
;
boolean
show_combo_map
=
false
;
// true;
boolean
show_combo_mask
=
false
;
// generate image mas (where it is defined)_
boolean
use_alt
=
false
;
boolean
show_centers
=
true
;
// boolean show_map_stats = false;
boolean
show_combo
=
false
;
// true;
// boolean show_combo_mask = false; // generate image mas (where it is defined)_
// boolean use_alt = false;
// boolean show_centers = true;
boolean
use_saved_collection
=
true
;
// false;
boolean
save_collection
=
true
;
boolean
process_correlation
=
true
;
// use false to save new version of data
...
...
@@ -212,11 +213,11 @@ public class ComboMatch {
"GPU image width"
);
gd
.
addNumericField
(
"GPU image height"
,
gpu_height
,
0
,
4
,
""
,
"GPU image height"
);
gd
.
addCheckbox
(
"Show transformation centers"
,
show_centers
,
"Mark verticals from the UAS on the ground."
);
gd
.
addCheckbox
(
"Show statistics for ortho images"
,
show_map_stats
,
"Generate and show statistics for ortho maps."
);
gd
.
addCheckbox
(
"Show combo
image map"
,
show_combo_map
,
"Load and process altitude map
s."
);
gd
.
addCheckbox
(
"Show combo image mask"
,
show_combo_mask
,
"Display combo binary image."
);
gd
.
addCheckbox
(
"Show altitude combo image"
,
use_alt
,
"Load and process altitude maps."
);
//
gd.addCheckbox ("Show transformation centers", show_centers, "Mark verticals from the UAS on the ground.");
//
gd.addCheckbox ("Show statistics for ortho images", show_map_stats, "Generate and show statistics for ortho maps.");
gd
.
addCheckbox
(
"Show combo
maps/stats"
,
show_combo
,
"Generate/save combo maps and stat
s."
);
//
gd.addCheckbox ("Show combo image mask", show_combo_mask, "Display combo binary image.");
//
gd.addCheckbox ("Show altitude combo image", use_alt, "Load and process altitude maps.");
gd
.
addNumericField
(
"Remove fraction of worst matches"
,
frac_remove
,
3
,
7
,
""
,
"When fitting scenes remove this fraction of worst match."
);
gd
.
addNumericField
(
"Maximal metric error"
,
metric_error
,
3
,
7
,
"m"
,
"Maximal tolerable fitting error caused by elevation variations."
);
if
(
use_marked_image
)
{
...
...
@@ -257,11 +258,11 @@ public class ComboMatch {
OrthoMap
.
setGPUWidthHeight
(
gpu_width
,
gpu_height
);
show_centers
=
gd
.
getNextBoolean
();
show_map_stats
=
gd
.
getNextBoolean
();
show_combo
_map
=
gd
.
getNextBoolean
();
show_combo_mask
=
gd
.
getNextBoolean
();
use_alt
=
gd
.
getNextBoolean
();
//
show_centers = gd.getNextBoolean();
//
show_map_stats = gd.getNextBoolean();
show_combo
=
gd
.
getNextBoolean
();
//
show_combo_mask = gd.getNextBoolean();
//
use_alt = gd.getNextBoolean();
// gpu_spair[0] = gd.getNextString();
// gpu_spair[1] = gd.getNextString();
...
...
@@ -741,48 +742,9 @@ public class ComboMatch {
// which pair to compare
// String [] gpu_spair = {names[gpu_ipair[0]],names[gpu_ipair[1]]};
int
[]
origin
=
new
int
[
2
];
ImagePlus
imp_img
=
null
;
if
(
show_map_stats
)
{
boolean
ok
=
maps_collection
.
showScenesStats
(
false
);
// boolean select_all)
if
(!
ok
)
{
return
false
;
}
// System.out.println("Exiting after generating stats");
// return true; // do not process anything else
}
if
(
show_combo_map
)
{
imp_img
=
maps_collection
.
renderMulti
(
"multi_zoom"
+
zoom_lev
,
// String title,
OrthoMapsCollection
.
MODE_IMAGE
,
// int mode, // 0 - regular image, 1 - altitudes, 2 - black/white mask // boolean use_alt,
show_centers
,
// boolean show_centers,
zoom_lev
,
// int zoom_level,
temp_mode
,
// int temp_mode, // 0 - do nothing, 1 - equalize average,2 - try to correct
origin
);
// int [] origin){
imp_img
.
show
();
}
ImagePlus
imp_alt
=
null
;
if
(
use_alt
)
{
imp_alt
=
maps_collection
.
renderMulti
(
"multi_alt_zoom"
+
zoom_lev
,
// String title,
// true, // boolean use_alt,
OrthoMapsCollection
.
MODE_ALT
,
// int mode, // 0 - regular image, 1 - altitudes, 2 - black/white mask // boolean use_alt,
show_centers
,
// boolean show_centers,
zoom_lev
,
// int zoom_level,
0
,
// int temp_mode, // 0 - do nothing, 1 - equalize average,2 - try to correct
origin
);
// int [] origin){
imp_alt
.
show
();
}
if
(
show_combo_mask
)
{
imp_alt
=
maps_collection
.
renderMulti
(
"multi_alt_zoom"
+
zoom_lev
,
// String title,
// true, // boolean use_alt,
OrthoMapsCollection
.
MODE_MASK
,
// int mode, // 0 - regular image, 1 - altitudes, 2 - black/white mask // boolean use_alt,
show_centers
,
// boolean show_centers,
zoom_lev
,
// int zoom_level,
0
,
// int temp_mode, // 0 - do nothing, 1 - equalize average,2 - try to correct
origin
);
// int [] origin){
imp_alt
.
show
();
if
(
show_combo
)
{
// now all modes, and stats?
maps_collection
.
processComboMap
(
debugLevel
);
return
true
;
}
if
(
process_correlation
||
render_match
||
pattern_match
)
{
// int [] gpu_pair;
...
...
@@ -953,8 +915,6 @@ public class ComboMatch {
}
}
if
(
pattern_match
)
{
ImagePlus
imp_pat_match
=
maps_collection
.
patternMatchDualWrap
(
gpu_pair
,
// int [] indices, // null or which indices to use (normally just 2 for pairwise comparison)
...
...
@@ -974,7 +934,7 @@ public class ComboMatch {
temp_mode
,
// int temp_mode, // 0 - do nothing, 1 - equalize average,2 - try to correct
affines
,
// double [][][] affines, // null or [indices.length][2][3]
warp
,
// FineXYCorr warp,
show_centers
,
// boolean show_centers,
true
,
//
show_centers, // boolean show_centers,
min_zoom_lev
,
// int zoom_level,
origin
);
// int [] origin){
imp_img_pair
.
show
();
...
...
src/main/java/com/elphel/imagej/orthomosaic/ItemMatch.java
View file @
12d3c947
...
...
@@ -200,6 +200,16 @@ public class ItemMatch {
return
match
.
getMatch
(
indx
);
}
public
double
getMatchBestValue
(
String
pattern_path
)
{
ItemPatternMatch
match
=
pattern_matches
.
get
(
pattern_path
);
if
(
match
==
null
)
{
System
.
out
.
println
(
"No matches found for pattern "
+
pattern_path
);
return
Double
.
NaN
;
}
return
match
.
getBestMatchValue
();
}
/**
...
...
@@ -212,6 +222,17 @@ public class ItemMatch {
return
getMatchValue
(
groundObjectPattern
.
getPatternPath
());
}
/**
* Return actual best correlation value regardless of where best subpattern index
* points to - it may be forced to point to the full pattern by absolute contrast
* @param groundObjectPattern
* @return maximal correlation value amoong the full pattern and all half-patterns.
*/
public
double
getMatchBestValue
(
GroundObjectPattern
groundObjectPattern
)
{
return
getMatchBestValue
(
groundObjectPattern
.
getPatternPath
());
}
public
double
getMatchValue
(
String
pattern_path
)
{
int
indx
=
getPatternMatch
(
pattern_path
).
getBestSub
();
// -1;
...
...
@@ -231,6 +252,7 @@ public class ItemMatch {
int
indx
){
String
pattern_path
=
groundObjectPattern
.
getPatternPath
();
return
sortByMatch
(
match_list
,
pattern_path
,
keep_removed
,
indx
);
}
public
static
ArrayList
<
Integer
>
sortByMatch
(
...
...
@@ -238,6 +260,9 @@ public class ItemMatch {
String
pattern_path
,
boolean
keep_removed
,
int
indx
){
if
(
indx
<
0
)
{
return
sortByBestMatch
(
match_list
,
pattern_path
,
keep_removed
);
}
double
large_enough
=
1.0
;
ArrayList
<
Integer
>
result_list
=
new
ArrayList
<
Integer
>(
match_list
.
size
());
for
(
int
i
=
0
;
i
<
match_list
.
size
();
i
++)
{
...
...
@@ -258,6 +283,32 @@ public class ItemMatch {
return
result_list
;
}
public
static
ArrayList
<
Integer
>
sortByBestMatch
(
ArrayList
<
ItemMatch
>
match_list
,
String
pattern_path
,
boolean
keep_removed
){
double
large_enough
=
1.0
;
ArrayList
<
Integer
>
result_list
=
new
ArrayList
<
Integer
>(
match_list
.
size
());
for
(
int
i
=
0
;
i
<
match_list
.
size
();
i
++)
{
if
(
keep_removed
||
!
match_list
.
get
(
i
).
isRemoved
())
{
result_list
.
add
(
i
);
}
}
Collections
.
sort
(
result_list
,
new
Comparator
<
Integer
>()
{
@Override
public
int
compare
(
Integer
lhs
,
Integer
rhs
)
{
ItemMatch
rhsm
=
match_list
.
get
(
rhs
);
ItemMatch
lhsm
=
match_list
.
get
(
lhs
);
double
rhsd
=
rhsm
.
getMatchBestValue
(
pattern_path
)
-
(
rhsm
.
isRemoved
()
?
large_enough:
0
);
double
lhsd
=
lhsm
.
getMatchBestValue
(
pattern_path
)
-
(
lhsm
.
isRemoved
()
?
large_enough:
0
);
return
(
rhsd
>
lhsd
)
?
1
:
(
rhsd
<
lhsd
)
?
-
1
:
0
;
// decreasing
}
});
return
result_list
;
}
public
static
void
setExtractedObjects
(
int
scene_num
,
int
extr_size
,
...
...
src/main/java/com/elphel/imagej/orthomosaic/ItemPatternMatch.java
View file @
12d3c947
...
...
@@ -41,6 +41,25 @@ public class ItemPatternMatch {
}
return
sub_matches
[
indx
];
}
/**
* Return actual largest value of full and all half patterns, regardless of best_sub which can point
* to full pattern even if the correlation value is larger for partial
* @return
*/
public
double
getBestMatchValue
()
{
//
if
(
sub_matches
==
null
)
{
return
Double
.
NaN
;
}
double
best
=
0
;
for
(
int
i
=
1
;
i
<
sub_matches
.
length
;
i
++)
{
if
(
sub_matches
[
i
]
>
best
)
{
best
=
sub_matches
[
i
];
}
}
return
best
;
}
public
double
[]
getMatches
()
{
return
sub_matches
;
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
View file @
12d3c947
...
...
@@ -2165,7 +2165,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}
}
double
threshold
=
obscure_frac
*
avg
[
0
]
+
(
1.0
-
obscure_frac
)
*
avg
[
1
];
double
threshold
=
(
1.0
-
obscure_frac
)
*
avg
[
0
]
+
obscure_frac
*
avg
[
1
];
double
over_thresh
=
(
avg
[
0
]
<
avg
[
1
])
?
(
zone3_min_max
[
0
]
-
threshold
)
:
(
threshold
-
zone3_min_max
[
1
]);
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
View file @
12d3c947
This diff is collapsed.
Click to expand it.
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