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
0a4fdfe3
Commit
0a4fdfe3
authored
Sep 06, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copied affine export from lwir16 branch
parent
f7200d40
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
73 deletions
+148
-73
ComboMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
+148
-73
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
View file @
0a4fdfe3
...
@@ -195,6 +195,10 @@ public class ComboMatch {
...
@@ -195,6 +195,10 @@ public class ComboMatch {
boolean
update_lla
=
false
;
// re-read file metadata
boolean
update_lla
=
false
;
// re-read file metadata
boolean
update_kernel_patterns
=
false
;
boolean
update_kernel_patterns
=
false
;
boolean
update_bl_bc
=
false
;
boolean
update_bl_bc
=
false
;
boolean
export_affine
=
false
;
// export per-scene affines
boolean
export_affine2
=
false
;
// export per-pair affines
boolean
fix_duplicates
=
false
;
boolean
fix_duplicates
=
false
;
String
[]
suffixes_bl_bc
=
{
""
,
"-BL"
,
"-BC"
};
String
[]
suffixes_bl_bc
=
{
""
,
"-BL"
,
"-BC"
};
boolean
log_append
=
clt_parameters
.
imp
.
pwise_log_append
;
boolean
log_append
=
clt_parameters
.
imp
.
pwise_log_append
;
...
@@ -261,6 +265,10 @@ public class ComboMatch {
...
@@ -261,6 +265,10 @@ public class ComboMatch {
suffixes_bl_bc
,
suffixes_bl_bc
,
suffixes_bl_bc
[
suffix_bc_bl_indx
],
suffixes_bl_bc
[
suffix_bc_bl_indx
],
"Select interpolation mode of the source files: old bilinear (empty), bilinear (-BL), or bicubic (-BC)"
,
0
);
"Select interpolation mode of the source files: old bilinear (empty), bilinear (-BL), or bicubic (-BC)"
,
0
);
gd
.
addCheckbox
(
"Export scene affines"
,
export_affine
,
"Export per-scene affines in text format for migration."
);
gd
.
addCheckbox
(
"Export pairs affines"
,
export_affine2
,
"Export per-pair affines in text format for migration."
);
gd
.
addCheckbox
(
"Write log file"
,
log_append
,
"Enable writing log file with matching results."
);
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
.
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[].");
// gd.addCheckbox ("Read no-alt data (old)", READ_NO_ALT, "Read older format data file where pairs do not have alt_data[].");
...
@@ -275,6 +283,8 @@ public class ComboMatch {
...
@@ -275,6 +283,8 @@ public class ComboMatch {
omtch_img_set
=
ComboMatch
.
FILES_LISTS_PATHS
[
gd
.
getNextChoiceIndex
()];
omtch_img_set
=
ComboMatch
.
FILES_LISTS_PATHS
[
gd
.
getNextChoiceIndex
()];
String
files_list_path
=
omtch_img_set
+
".list"
;
String
files_list_path
=
omtch_img_set
+
".list"
;
String
orthoMapsCollection_path
=
omtch_img_set
+
".data"
;
String
orthoMapsCollection_path
=
omtch_img_set
+
".data"
;
String
affines_path
=
omtch_img_set
+
".affines"
;
// for export per-scene affines
String
affines2_path
=
omtch_img_set
+
".affines2"
;
// for export per-pair affines
use_saved_collection
=
gd
.
getNextBoolean
();
use_saved_collection
=
gd
.
getNextBoolean
();
save_collection
=
gd
.
getNextBoolean
();
save_collection
=
gd
.
getNextBoolean
();
String
orthoMapsCollection_savepath
=
save_collection
?
orthoMapsCollection_path:
null
;
String
orthoMapsCollection_savepath
=
save_collection
?
orthoMapsCollection_path:
null
;
...
@@ -313,6 +323,11 @@ public class ComboMatch {
...
@@ -313,6 +323,11 @@ public class ComboMatch {
fix_duplicates
=
gd
.
getNextBoolean
();
fix_duplicates
=
gd
.
getNextBoolean
();
update_bl_bc
=
gd
.
getNextBoolean
();
update_bl_bc
=
gd
.
getNextBoolean
();
suffix_bc_bl_indx
=
gd
.
getNextChoiceIndex
();
suffix_bc_bl_indx
=
gd
.
getNextChoiceIndex
();
export_affine
=
gd
.
getNextBoolean
();
export_affine2
=
gd
.
getNextBoolean
();
log_append
=
gd
.
getNextBoolean
();
log_append
=
gd
.
getNextBoolean
();
log_path
=
gd
.
getNextString
();
log_path
=
gd
.
getNextString
();
// READ_NO_ALT = gd.getNextBoolean();
// READ_NO_ALT = gd.getNextBoolean();
...
@@ -344,6 +359,64 @@ public class ComboMatch {
...
@@ -344,6 +359,64 @@ public class ComboMatch {
maps_collection
.
updateNumberScenes
();
maps_collection
.
updateNumberScenes
();
maps_collection
.
updateSfmGain
();
maps_collection
.
updateSfmGain
();
}
}
if
(
export_affine
)
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
OrthoMap
omap
:
maps_collection
.
ortho_maps
)
{
String
name
=
omap
.
getName
();
double
[][]
affine
=
omap
.
getAffine
();
if
(
affine
!=
null
)
{
sb
.
append
(
String
.
format
(
"AFFINE %s %11.8f %11.8f %11.8f %11.8f %11.8f %11.8f\n"
,
name
,
affine
[
0
][
0
],
affine
[
0
][
1
],
affine
[
0
][
2
],
affine
[
1
][
0
],
affine
[
1
][
1
],
affine
[
1
][
2
]));
}
}
CalibrationFileManagement
.
saveStringToFile
(
affines_path
,
//String path,
sb
.
toString
(),
// data,
false
);
// boolean append)
}
if
(
export_affine2
)
{
StringBuffer
sb
=
new
StringBuffer
();
ArrayList
<
Point
>
pairs_list
=
new
ArrayList
<
Point
>();
for
(
OrthoMap
map
:
maps_collection
.
ortho_maps
)
{
for
(
String
other_name:
map
.
pairwise_matches
.
keySet
())
{
pairs_list
.
add
(
new
Point
(
maps_collection
.
getIndex
(
map
.
getName
()),
maps_collection
.
getIndex
(
other_name
)));
}
}
Collections
.
sort
(
pairs_list
,
new
Comparator
<
Point
>()
{
@Override
public
int
compare
(
Point
lhs
,
Point
rhs
)
{
return
(
rhs
.
x
>
lhs
.
x
)
?
-
1
:
(
rhs
.
x
<
lhs
.
x
)
?
1
:
((
rhs
.
y
>
lhs
.
y
)
?
-
1
:
(
rhs
.
y
<
lhs
.
y
)
?
1
:
0
);
// increasing
}
});
for
(
Point
pair:
pairs_list
)
{
PairwiseOrthoMatch
pom
=
maps_collection
.
ortho_maps
[
pair
.
x
].
getMatch
(
maps_collection
.
ortho_maps
[
pair
.
y
].
getName
(),
false
);
// undef_only || nan_rms);
if
((
pom
!=
null
)
&&
pom
.
isDefined
())
{
double
overlap
=
pom
.
overlap
;
double
[][]
affine
=
pom
.
getAffine
();
sb
.
append
(
String
.
format
(
"AFFINE2 %s %s %11.8f %11.8f %11.8f %11.8f %11.8f %11.8f %11.8f\n"
,
maps_collection
.
ortho_maps
[
pair
.
x
].
getName
(),
maps_collection
.
ortho_maps
[
pair
.
y
].
getName
(),
overlap
,
affine
[
0
][
0
],
affine
[
0
][
1
],
affine
[
0
][
2
],
affine
[
1
][
0
],
affine
[
1
][
1
],
affine
[
1
][
2
]));
}
}
CalibrationFileManagement
.
saveStringToFile
(
affines2_path
,
//String path,
sb
.
toString
(),
// data,
false
);
// boolean append)
}
if
(
export_affine
||
export_affine2
)
{
return
true
;
// do not save
}
if
(
fix_duplicates
)
{
if
(
fix_duplicates
)
{
removeDuplicateScenes
(
maps_collection
);
removeDuplicateScenes
(
maps_collection
);
}
}
...
@@ -358,6 +431,8 @@ public class ComboMatch {
...
@@ -358,6 +431,8 @@ public class ComboMatch {
}
}
}
}
String
[]
names
=
maps_collection
.
getNames
();
// null
String
[]
names
=
maps_collection
.
getNames
();
// null
if
(
object_list
!=
null
)
{
if
(
object_list
!=
null
)
{
int
corr_size
=
128
;
int
corr_size
=
128
;
...
...
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