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
d9770c1e
Commit
d9770c1e
authored
Sep 06, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented affine export
parent
2d5052a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
ComboMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
+76
-0
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
View file @
d9770c1e
...
@@ -53,6 +53,7 @@ public class ComboMatch {
...
@@ -53,6 +53,7 @@ public class ComboMatch {
public
static
int
gpu_max_width
=
4096
;
public
static
int
gpu_max_width
=
4096
;
public
static
int
gpu_max_height
=
4096
;
public
static
int
gpu_max_height
=
4096
;
public
static
String
[]
FILES_LISTS_PATHS
=
{
public
static
String
[]
FILES_LISTS_PATHS
=
{
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/nov3_50-75-orange"
,
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/nov3_50-75"
,
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/nov3_50-75"
,
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/maps_sep12-13_50-25-50-75-100m"
,
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/maps_sep12-13_50-25-50-75-100m"
,
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/maps_19_sep13_25-50-75-100m"
,
"/media/elphel/SSD3-4GB/lwir16-proc/ortho_videos/maps_19_sep13_25-50-75-100m"
,
...
@@ -193,6 +194,10 @@ public class ComboMatch {
...
@@ -193,6 +194,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
;
...
@@ -258,6 +263,10 @@ public class ComboMatch {
...
@@ -258,6 +263,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[].");
...
@@ -272,6 +281,8 @@ public class ComboMatch {
...
@@ -272,6 +281,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
;
...
@@ -309,6 +320,11 @@ public class ComboMatch {
...
@@ -309,6 +320,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();
...
@@ -339,6 +355,64 @@ public class ComboMatch {
...
@@ -339,6 +355,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
);
}
}
...
@@ -353,6 +427,8 @@ public class ComboMatch {
...
@@ -353,6 +427,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