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
1cc6d251
Commit
1cc6d251
authored
5 months ago
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added version to the data files (older will have it = -1) to be able to
add new fields to the classes.
parent
fb87526f
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
35 deletions
+55
-35
ComboMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
+8
-31
OrthoMapsCollection.java
...va/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
+38
-2
PairwiseOrthoMatch.java
...ava/com/elphel/imagej/orthomosaic/PairwiseOrthoMatch.java
+9
-2
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
View file @
1cc6d251
...
...
@@ -169,6 +169,7 @@ public class ComboMatch {
boolean
create_map
=
false
;
boolean
create_equalize
=
false
;
boolean
use_saved_collection
=
true
;
// false;
boolean
save_collection
=
true
;
boolean
process_correlation
=
true
;
// use false to save new version of data
...
...
@@ -191,6 +192,8 @@ public class ComboMatch {
String
log_path
=
clt_parameters
.
imp
.
pwise_log_path
;
String
omtch_img_set
=
clt_parameters
.
imp
.
omtch_img_set
;
// boolean READ_NO_ALT = false; // to read older format data file where pairs do not have alt_data[]
int
suffix_bc_bl_indx
=
2
;
if
(!
use_marked_image
)
{
process_correlation
=
false
;
// use already adjusted by default
...
...
@@ -218,26 +221,12 @@ public class ComboMatch {
gd
.
addCheckbox
(
"Bounds to selected images"
,
bounds_to_indices
,
"Set combo image bounds to selected images only. False - all images."
);
gd
.
addNumericField
(
"Temp mode"
,
temp_mode
,
0
,
4
,
""
,
"O - do not modify average pixels, 1 - equalize second image to first, 2 - try to account for raw average"
);
//temp_mode
/*
for (int n = 0; n < image_enuatr.length; n++) {
gd.addMessage("image["+n+"] pose");
gd.addNumericField("East", image_enuatr[n][0][0], 3,7,"m", "Move image "+n+" East.");
gd.addNumericField("North", image_enuatr[n][0][1], 3,7,"m", "Move image "+n+" North.");
gd.addNumericField("Up", image_enuatr[n][0][2], 3,7,"m", "Move image "+n+" Up.");
gd.addNumericField("Azimuth",image_enuatr[n][1][0], 3,7,"deg", "Rotate image "+n+" around vertical clockwise.");
gd.addNumericField("Tilt", image_enuatr[n][1][1], 3,7,"deg", "Rotate image "+n+" around East.");
gd.addNumericField("Roll", image_enuatr[n][1][2], 3,7,"deg", "Rotate image "+n+" around North.");
}
*/
gd
.
addNumericField
(
"Zoom level"
,
zoom_lev
,
0
,
4
,
""
,
"Zoom level: +1 - zoom in twice, -1 - zoom out twice"
);
gd
.
addNumericField
(
"GPU image width"
,
gpu_width
,
0
,
4
,
""
,
"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 maps/stats"
,
show_combo
,
"Generate/save combo maps and stats."
);
gd
.
addCheckbox
(
"Create overlap pairs"
,
create_pairwise_matches
,
"Create scene pairs overlaps."
);
gd
.
addCheckbox
(
"Create pairwise affines"
,
create_pairwise_affines
,
"Create affines for scene pairs."
);
...
...
@@ -245,8 +234,6 @@ public class ComboMatch {
gd
.
addCheckbox
(
"Equalize overlap pairs"
,
equalize_overlaps
,
"Equalize intensities in overlaps."
);
gd
.
addCheckbox
(
"Create map"
,
create_map
,
"Create combined map from pairwise matches."
);
gd
.
addCheckbox
(
"Equalize intensities"
,
create_equalize
,
"Create map intensities equalization from pairwise matches."
);
// 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
)
{
...
...
@@ -260,8 +247,9 @@ public class ComboMatch {
suffixes_bl_bc
,
suffixes_bl_bc
[
suffix_bc_bl_indx
],
"Select interpolation mode of the source files: old bilinear (empty), bilinear (-BL), or bicubic (-BC)"
,
0
);
gd
.
addCheckbox
(
"Write log file"
,
log_append
,
"Enable writing log file with matching results."
);
gd
.
addStringField
(
"Log file full path"
,
log_path
,
150
,
"Path of the log file to be appended."
);
gd
.
addCheckbox
(
"Write log file"
,
log_append
,
"Enable writing log file with matching results."
);
gd
.
addStringField
(
"Log file full path"
,
log_path
,
150
,
"Path of the log file to be appended."
);
// gd.addCheckbox ("Read no-alt data (old)", READ_NO_ALT, "Read older format data file where pairs do not have alt_data[].");
...
...
@@ -270,9 +258,6 @@ public class ComboMatch {
if
(
gd
.
wasCanceled
())
return
false
;
// int choice_index = gd.getNextChoiceIndex();
// String files_list_path = FILES_LISTS_PATHS[choice_index]+".list";
// String orthoMapsCollection_path =FILES_LISTS_PATHS[choice_index]+".data";
omtch_img_set
=
ComboMatch
.
FILES_LISTS_PATHS
[
gd
.
getNextChoiceIndex
()];
String
files_list_path
=
omtch_img_set
+
".list"
;
String
orthoMapsCollection_path
=
omtch_img_set
+
".data"
;
...
...
@@ -288,16 +273,6 @@ public class ComboMatch {
bounds_to_indices
=
gd
.
getNextBoolean
();
temp_mode
=
(
int
)
gd
.
getNextNumber
();
/*
for (int n = 0; n < image_enuatr.length; n++) {
image_enuatr[n][0][0] = gd.getNextNumber();
image_enuatr[n][0][1] = gd.getNextNumber();
image_enuatr[n][0][2] = gd.getNextNumber();
image_enuatr[n][1][0] = gd.getNextNumber();
image_enuatr[n][1][1] = gd.getNextNumber();
image_enuatr[n][1][2] = gd.getNextNumber();
}
*/
zoom_lev
=
(
int
)
gd
.
getNextNumber
();
gpu_width
=
(
int
)
gd
.
getNextNumber
();
gpu_height
=
(
int
)
gd
.
getNextNumber
();
...
...
@@ -322,6 +297,8 @@ public class ComboMatch {
suffix_bc_bl_indx
=
gd
.
getNextChoiceIndex
();
log_append
=
gd
.
getNextBoolean
();
log_path
=
gd
.
getNextString
();
// READ_NO_ALT = gd.getNextBoolean();
// PairwiseOrthoMatch.READ_NO_ALT = READ_NO_ALT; // modifies PairwiseOrthoMatch.readObject() behavior
OrthoMapsCollection
maps_collection
=
null
;
boolean
use_files_list
=
false
;
if
(
use_saved_collection
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
View file @
1cc6d251
...
...
@@ -58,6 +58,8 @@ public class OrthoMapsCollection implements Serializable{
public
static
final
int
MODE_IMAGE
=
0
;
public
static
final
int
MODE_ALT
=
1
;
public
static
final
int
MODE_MASK
=
2
;
public
static
int
LATEST_VERSION
=
100
;
// use when read from .list
public
transient
int
current_version
=
LATEST_VERSION
;
/*
public static final int PAIR_NONE = 0;
...
...
@@ -76,7 +78,7 @@ public class OrthoMapsCollection implements Serializable{
"kernelsDirectory"
,
"patternsDirectory"
};
public
static
final
String
[]
NAME_FH
=
{
"full"
,
"half"
};
public
static
final
String
[]
NAME_MO
=
{
"main"
,
"other"
};
public
transient
long
version
=
-
1
;
OrthoMap
[]
ortho_maps
;
transient
HashMap
<
Double
,
Integer
>
map_index
;
transient
HashMap
<
String
,
Integer
>
map_index_string
;
...
...
@@ -2306,16 +2308,50 @@ public class OrthoMapsCollection implements Serializable{
public
static
OrthoMapsCollection
readOrthoMapsCollection
(
String
path
)
throws
IOException
,
ClassNotFoundException
{
// try reading current_version, if fails - restart without it (for older formats)
FileInputStream
fileInputStream
=
new
FileInputStream
(
path
);
ObjectInputStream
objectInputStream
=
new
ObjectInputStream
(
fileInputStream
);
OrthoMapsCollection
orthoMapsCollection
=
(
OrthoMapsCollection
)
objectInputStream
.
readObject
();
int
current_version
=
-
1
;
OrthoMapsCollection
orthoMapsCollection
=
null
;
PairwiseOrthoMatch
.
READ_NO_ALT
=
true
;
// reading old version
Object
obj
=
objectInputStream
.
readObject
();
// reads OrthoMapsCollection
/* // do not handle that intermediate version
try {
obj = objectInputStream.readObject(); // reads OrthoMapsCollection
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
fileInputStream.reset();
System.out.println("readOrthoMapsCollection(): error reading stream, using current_version="+current_version);
PairwiseOrthoMatch.READ_NO_ALT = false; // reading new version
obj = objectInputStream.readObject(); // reads OrthoMapsCollection
}
*/
PairwiseOrthoMatch
.
READ_NO_ALT
=
false
;
// reading new version
if
(
obj
instanceof
OrthoMapsCollection
)
{
orthoMapsCollection
=
(
OrthoMapsCollection
)
obj
;
System
.
out
.
println
(
"readOrthoMapsCollection(): got old version, using current_version="
+
current_version
);
}
else
{
current_version
=
(
int
)
obj
;
System
.
out
.
println
(
"readOrthoMapsCollection(): got current_version="
+
current_version
);
PairwiseOrthoMatch
.
READ_NO_ALT
=
false
;
// reading new version
orthoMapsCollection
=
(
OrthoMapsCollection
)
objectInputStream
.
readObject
();
}
// OrthoMapsCollection orthoMapsCollection = (OrthoMapsCollection) objectInputStream.readObject();
objectInputStream
.
close
();
orthoMapsCollection
.
current_version
=
current_version
;
System
.
out
.
println
(
"readOrthoMapsCollection(): got orthoMapsCollection, current_version="
+
current_version
);
return
orthoMapsCollection
;
}
public
void
writeOrthoMapsCollection
(
String
path
)
throws
IOException
{
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
path
);
ObjectOutputStream
objectOutputStream
=
new
ObjectOutputStream
(
fileOutputStream
);
current_version
=
LATEST_VERSION
;
objectOutputStream
.
writeObject
(
current_version
);
objectOutputStream
.
writeObject
(
this
);
objectOutputStream
.
flush
();
objectOutputStream
.
close
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/PairwiseOrthoMatch.java
View file @
1cc6d251
...
...
@@ -9,14 +9,17 @@ import Jama.Matrix;
public
class
PairwiseOrthoMatch
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
public
static
boolean
READ_NO_ALT
=
false
;
// to read old format w/o alt data ( not final!)
private
double
[][]
affine
=
new
double
[
2
][
3
];
public
transient
double
[][]
jtj
=
new
double
[
6
][
6
];
public
int
zoom_lev
;
public
double
rms
=
Double
.
NaN
;
public
transient
int
[]
nxy
=
null
;
// not saved, just to communicate for logging
public
transient
double
overlap
=
0.0
;
public
transient
double
[]
alt_data
=
null
;
public
transient
double
[]
equalize1to0
=
{
1
,
0
};
// value1 = equalize2to1[0]*value2+equalize2to1[1]
public
transient
boolean
ok
=
false
;
// below - not saved/restored
public
transient
boolean
ok
=
false
;
// not saved/restored
public
transient
int
[]
nxy
=
null
;
// not saved, just to communicate for logging
// public PairwiseOrthoMatch() {}
public
double
getOverlap
()
{
...
...
@@ -254,6 +257,7 @@ public class PairwiseOrthoMatch implements Serializable {
}
oos
.
writeObject
(
overlap
);
oos
.
writeObject
(
equalize1to0
);
oos
.
writeObject
(
alt_data
);
}
private
void
readObject
(
ObjectInputStream
ois
)
throws
ClassNotFoundException
,
IOException
{
...
...
@@ -270,6 +274,9 @@ public class PairwiseOrthoMatch implements Serializable {
overlap
=
(
Double
)
ois
.
readObject
();
// equalize1to0 = new double[] {1,0};
equalize1to0
=
(
double
[])
ois
.
readObject
();
if
(!
READ_NO_ALT
)
{
alt_data
=
(
double
[])
ois
.
readObject
();
}
}
//private void readObjectNoData() throws ObjectStreamException; // used to modify default values
}
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