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
f60cc3af
Commit
f60cc3af
authored
Apr 10, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merging planes
parent
cee97f1b
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
415 additions
and
99 deletions
+415
-99
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+34
-14
QuadCLT.java
src/main/java/QuadCLT.java
+1
-1
SuperTiles.java
src/main/java/SuperTiles.java
+298
-47
TilePlanes.java
src/main/java/TilePlanes.java
+53
-24
TileProcessor.java
src/main/java/TileProcessor.java
+29
-13
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
f60cc3af
...
...
@@ -2150,9 +2150,13 @@ public class EyesisCorrectionParameters {
public
double
plMinStrength
=
0.1
;
// Minimal total strength of a plane
public
double
plMaxEigen
=
0.3
;
// Maximal eigenvalue of a plane
public
boolean
plDbgMerge
=
true
;
// Combine 'other' plane with current
public
double
plWorstWorsening
=
2
.0
;
// Worst case worsening after merge
public
double
plWorstWorsening
=
1
.0
;
// Worst case worsening after merge
public
boolean
plMutualOnly
=
true
;
// keep only mutual links, remove weakest if conflict
public
double
plPull
=
.
1
;
// Relative weight of original (measured) plane when combing with neighbors
public
int
plIterations
=
10
;
// Maximal number of smoothing iterations for each step
public
int
plPrecision
=
6
;
// Maximal step difference (1/power of 10)
// other debug images
public
boolean
show_ortho_combine
=
false
;
// Show 'ortho_combine'
...
...
@@ -2397,6 +2401,10 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"plWorstWorsening"
,
this
.
plWorstWorsening
+
""
);
properties
.
setProperty
(
prefix
+
"plMutualOnly"
,
this
.
plMutualOnly
+
""
);
properties
.
setProperty
(
prefix
+
"plPull"
,
this
.
plPull
+
""
);
properties
.
setProperty
(
prefix
+
"plIterations"
,
this
.
plIterations
+
""
);
properties
.
setProperty
(
prefix
+
"plPrecision"
,
this
.
plPrecision
+
""
);
properties
.
setProperty
(
prefix
+
"show_ortho_combine"
,
this
.
show_ortho_combine
+
""
);
properties
.
setProperty
(
prefix
+
"show_refine_supertiles"
,
this
.
show_refine_supertiles
+
""
);
properties
.
setProperty
(
prefix
+
"show_bgnd_nonbgnd"
,
this
.
show_bgnd_nonbgnd
+
""
);
...
...
@@ -2631,6 +2639,10 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"plWorstWorsening"
)!=
null
)
this
.
plWorstWorsening
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWorstWorsening"
));
if
(
properties
.
getProperty
(
prefix
+
"plMutualOnly"
)!=
null
)
this
.
plMutualOnly
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"plMutualOnly"
));
if
(
properties
.
getProperty
(
prefix
+
"plPull"
)!=
null
)
this
.
plPull
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plPull"
));
if
(
properties
.
getProperty
(
prefix
+
"plIterations"
)!=
null
)
this
.
plIterations
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"plIterations"
));
if
(
properties
.
getProperty
(
prefix
+
"plPrecision"
)!=
null
)
this
.
plPrecision
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"plPrecision"
));
if
(
properties
.
getProperty
(
prefix
+
"show_ortho_combine"
)!=
null
)
this
.
show_ortho_combine
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"show_ortho_combine"
));
if
(
properties
.
getProperty
(
prefix
+
"show_refine_supertiles"
)!=
null
)
this
.
show_refine_supertiles
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"show_refine_supertiles"
));
if
(
properties
.
getProperty
(
prefix
+
"show_bgnd_nonbgnd"
)!=
null
)
this
.
show_bgnd_nonbgnd
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"show_bgnd_nonbgnd"
));
...
...
@@ -2887,6 +2899,10 @@ public class EyesisCorrectionParameters {
gd
.
addNumericField
(
"Worst case worsening after merge"
,
this
.
plWorstWorsening
,
6
);
gd
.
addCheckbox
(
"Keep only mutual links, remove weakest if conflict"
,
this
.
plMutualOnly
);
gd
.
addNumericField
(
"Relative weight of original (measured) plane when combing with neighbors"
,
this
.
plPull
,
6
);
gd
.
addNumericField
(
"Maximal number of smoothing iterations for each step"
,
this
.
plIterations
,
0
);
gd
.
addNumericField
(
"Maximal step difference (1/power of 10) "
,
this
.
plPrecision
,
0
);
gd
.
addMessage
(
"--- Other debug images ---"
);
gd
.
addCheckbox
(
"Show 'ortho_combine'"
,
this
.
show_ortho_combine
);
gd
.
addCheckbox
(
"Show 'refine_disparity_supertiles'"
,
this
.
show_refine_supertiles
);
...
...
@@ -3130,8 +3146,12 @@ public class EyesisCorrectionParameters {
this
.
plWorstWorsening
=
gd
.
getNextNumber
();
this
.
plMutualOnly
=
gd
.
getNextBoolean
();
this
.
plPull
=
gd
.
getNextNumber
();
this
.
plIterations
=
(
int
)
gd
.
getNextNumber
();
this
.
plPrecision
=
(
int
)
gd
.
getNextNumber
();
this
.
show_ortho_combine
=
gd
.
getNextBoolean
();
this
.
show_refine_supertiles
=
gd
.
getNextBoolean
();
this
.
show_refine_supertiles
=
gd
.
getNextBoolean
();
this
.
show_bgnd_nonbgnd
=
gd
.
getNextBoolean
();
// first on second pass
this
.
show_filter_scan
=
gd
.
getNextBoolean
();
// first on refine
this
.
show_combined
=
gd
.
getNextBoolean
();
...
...
src/main/java/QuadCLT.java
View file @
f60cc3af
...
...
@@ -5126,7 +5126,7 @@ public class QuadCLT {
System
.
out
.
println
(
"Generating cluster images (limit is set to "
+
clt_parameters
.
max_clusters
+
") largest, scan #"
+
scanIndex
);
}
// ImagePlus cluster_image = getPassImage( // get image form a single pass
String
texturePath
=
getPassImage
(
// get image f
or
m a single pass
String
texturePath
=
getPassImage
(
// get image f
ro
m a single pass
clt_parameters
,
colorProcParameters
,
rgbParameters
,
...
...
src/main/java/SuperTiles.java
View file @
f60cc3af
This diff is collapsed.
Click to expand it.
src/main/java/TilePlanes.java
View file @
f60cc3af
...
...
@@ -57,8 +57,8 @@ public class TilePlanes {
double
[]
world_v1
=
null
;
// world in-plane vector, corresponding to vectors[1]
double
[]
world_v2
=
null
;
// world in-plane vector, corresponding to vectors[1]
// double [] daxy = null; // disparity and 2 relative angles (ax and ay) corresponding to fisheye view, near (0,0) scale is pixel size
double
[][]
neib_match
=
null
;
// for each of the directions (N, NE, .. NW) quality match for each layer
int
[]
neib_best
=
new
int
[
8
];
// for each of the directions (N, NE, .. NW) index of best match, -1 if none
double
[][]
merged_eig_val
=
null
;
// for each of the directions (N, NE, .. NW) quality match for each layer
int
[]
neib_best
=
n
ull
;
// n
ew int [8]; // for each of the directions (N, NE, .. NW) index of best match, -1 if none
// stores "worsening" of merging 2 planes. if L1,L2,L = values[0] of plane1, plane2 plane composite: w1, w2 - weights for plane1, plane2
// Lav = Math.sqrt((L1 * L1 * w1 + L2 * L2 * w2)/(w1 + w2))
// worsening_12 = (L - Lav) * (w1 + w2) * (w1 + w2) / (Lav * x1 * w2)
...
...
@@ -92,18 +92,44 @@ public class TilePlanes {
pd
.
vectors
[
1
]
=
this
.
vectors
[
1
].
clone
();
pd
.
vectors
[
2
]
=
this
.
vectors
[
2
].
clone
();
}
if
(
this
.
neib_match
!=
null
){
pd
.
neib_match
=
this
.
neib_match
.
clone
();
for
(
int
i
=
0
;
i
<
this
.
neib_match
.
length
;
i
++){
if
(
this
.
neib_match
[
i
]
!=
null
){
pd
.
neib_match
[
i
]
=
this
.
neib_match
[
i
].
clone
();
copyNeib
(
this
,
pd
);
/*
if (this.merged_eig_val != null){
pd.merged_eig_val = this.merged_eig_val.clone();
for (int i = 0; i<this.merged_eig_val.length; i++){
if (this.merged_eig_val[i] != null){
pd.merged_eig_val[i] = this.merged_eig_val[i].clone();
}
}
}
if (this.neib_best != null) pd.neib_best = this.neib_best.clone();
*/
return
pd
;
}
public
void
copyNeib
(
PlaneData
src
,
PlaneData
dst
)
{
if
(
src
.
merged_eig_val
!=
null
){
dst
.
merged_eig_val
=
src
.
merged_eig_val
.
clone
();
for
(
int
i
=
0
;
i
<
src
.
merged_eig_val
.
length
;
i
++){
if
(
src
.
merged_eig_val
[
i
]
!=
null
){
dst
.
merged_eig_val
[
i
]
=
src
.
merged_eig_val
[
i
].
clone
();
}
}
}
if
(
src
.
neib_best
!=
null
)
dst
.
neib_best
=
src
.
neib_best
.
clone
();
}
public
void
invalidateCalculated
()
{
this
.
center_xyz
=
null
;
// center of this supertile this plane center in world coordinates
this
.
world_xyz
=
null
;
// world coordinates of the nearest point of the plane, in meters
this
.
world_v1
=
null
;
// world in-plane vector, corresponding to vectors[1]
this
.
world_v2
=
null
;
// world in-plane vector, corresponding to vectors[1]
}
public
PlaneData
(
int
[]
sTileXY
,
...
...
@@ -117,40 +143,40 @@ public class TilePlanes {
this
.
sTileXY
=
sTileXY
.
clone
();
}
public
double
[][]
init
NeibMatch
()
public
double
[][]
init
MergedValue
()
{
this
.
neib_match
=
new
double
[
8
][];
return
this
.
neib_match
;
this
.
merged_eig_val
=
new
double
[
8
][];
return
this
.
merged_eig_val
;
}
public
double
[][]
get
NeibMatch
()
public
double
[][]
get
MergedValue
()
{
return
this
.
neib_match
;
return
this
.
merged_eig_val
;
}
public
double
[]
init
NeibMatch
(
int
dir
,
int
leng
)
public
double
[]
init
MergedValue
(
int
dir
,
int
leng
)
{
this
.
neib_match
[
dir
]
=
new
double
[
leng
];
for
(
int
i
=
0
;
i
<
leng
;
i
++)
this
.
neib_match
[
dir
][
i
]
=
Double
.
NaN
;
return
get
NeibMatch
(
dir
);
this
.
merged_eig_val
[
dir
]
=
new
double
[
leng
];
for
(
int
i
=
0
;
i
<
leng
;
i
++)
this
.
merged_eig_val
[
dir
][
i
]
=
Double
.
NaN
;
return
get
MergedValue
(
dir
);
}
public
double
[]
get
NeibMatch
(
int
dir
)
public
double
[]
get
MergedValue
(
int
dir
)
{
if
(
this
.
neib_match
==
null
)
{
if
(
this
.
merged_eig_val
==
null
)
{
return
null
;
}
return
this
.
neib_match
[
dir
];
return
this
.
merged_eig_val
[
dir
];
}
public
double
get
NeibMatch
(
int
dir
,
int
plane
)
public
double
get
MergedValue
(
int
dir
,
int
plane
)
{
if
((
this
.
neib_match
==
null
)
||(
this
.
neib_match
[
dir
]
==
null
)){
if
((
this
.
merged_eig_val
==
null
)
||(
this
.
merged_eig_val
[
dir
]
==
null
)){
return
Double
.
NaN
;
}
return
this
.
neib_match
[
dir
][
plane
];
return
this
.
merged_eig_val
[
dir
][
plane
];
}
public
void
setNeibMatch
(
int
dir
,
int
plane
,
double
value
)
{
this
.
neib_match
[
dir
][
plane
]
=
value
;
this
.
merged_eig_val
[
dir
][
plane
]
=
value
;
}
public
int
[]
initNeibBest
()
...
...
@@ -452,6 +478,7 @@ public class TilePlanes {
PlaneData
pd
=
this
.
clone
();
// will copy selections too
pd
.
invalidateCalculated
();
// real world vectors
pd
.
setValues
(
eig_val
[
oindx
][
oindx
],
eig_val
[
vindx
][
vindx
],
eig_val
[
hindx
][
hindx
]);
// eigenvalues [0] - thickness, 2 other to detect skinny (poles)
pd
.
setVectors
(
plane
);
...
...
@@ -477,7 +504,8 @@ public class TilePlanes {
PlaneData
otherPd
,
int
debugLevel
)
{
PlaneData
pd
=
otherPd
.
clone
();
PlaneData
pd
=
otherPd
.
clone
();
// TODO: use clone of this, copy only needed info from otherPD
// keep world vectors from otherPd
if
(
debugLevel
>
0
)
{
System
.
out
.
println
(
"getPlaneToThis()"
);
}
...
...
@@ -596,6 +624,7 @@ public class TilePlanes {
// System.out.println("getPlaneToThis(): "+pd.sTileXY[0]+":"+pd.sTileXY[1]+" -> "+pd.vectors[0][0]+", disp = "+disp+
// ", other_det = "+((new Matrix(otherPd.vectors).det()) +", pdr_det = "+((new Matrix(pd.vectors).det()))));
}
copyNeib
(
this
,
pd
);
return
pd
;
// make sure pd are updated // "this" is not used. Should it be used instead of pd?
}
...
...
src/main/java/TileProcessor.java
View file @
f60cc3af
...
...
@@ -2823,7 +2823,6 @@ public class TileProcessor {
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
if
(
clt_parameters
.
plMutualOnly
)
{
st
.
selectNeighborPlanesMutual
(
clt_parameters
.
plWorstWorsening
,
// final double worst_worsening,
clt_parameters
.
plMaxEigen
,
...
...
@@ -2831,19 +2830,30 @@ public class TileProcessor {
0
,
// final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
TilePlanes
.
PlaneData
[][]
planes_mod
=
null
;
if
(
clt_parameters
.
plMutualOnly
)
{
// temporarily re-use obsolete parameter to test smoothing
planes_mod
=
st
.
planesSmooth
(
clt_parameters
.
plPull
,
// final double meas_pull,// relative pull of the original (measured) plane with respect to the average of the neighbors
clt_parameters
.
plIterations
,
// final int num_passes,
Math
.
pow
(
10.0
,
-
clt_parameters
.
plPrecision
),
// final double maxDiff, // maximal change in any of the disparity values
0
,
// final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
}
else
{
st
.
selectNeighborPlanes
(
clt_parameters
.
plWorstWorsening
,
// final double worst_worsening,
clt_parameters
.
plMutualOnly
,
// final boolean mutual_only,
0
);
// final int debugLevel)
//
} else {
//
st.selectNeighborPlanes(
//
clt_parameters.plWorstWorsening, // final double worst_worsening,
//
clt_parameters.plMutualOnly, // final boolean mutual_only,
//
0); // final int debugLevel)
}
if
(
clt_parameters
.
show_planes
){
int
[]
wh
=
st
.
getShowPlanesWidthHeight
();
double
[][]
plane_data_nonan
=
st
.
getShowPlanes
(
st
.
getPlanes
(),
(
planes_mod
!=
null
)
?
st
.
getPlanesMod
():
st
.
getPlanes
(),
clt_parameters
.
plMinStrength
,
// minWeight,
clt_parameters
.
plMaxEigen
,
// maxEigen,
clt_parameters
.
plDispNorm
,
...
...
@@ -2851,7 +2861,7 @@ public class TileProcessor {
0.0
,
10.0
);
double
[][]
plane_data_nan
=
st
.
getShowPlanes
(
st
.
getPlanes
(),
(
planes_mod
!=
null
)
?
st
.
getPlanesMod
():
st
.
getPlanes
(),
clt_parameters
.
plMinStrength
,
// minWeight,
clt_parameters
.
plMaxEigen
,
// maxEigen,
clt_parameters
.
plDispNorm
,
...
...
@@ -2870,6 +2880,12 @@ public class TileProcessor {
// sdfa_instance.showArrays(plane_data_nonan, wh[0], wh[1], true, "plane_data_noNaN");
// sdfa_instance.showArrays(plane_data_nan, wh[0], wh[1], true, "plane_data_NaN");
sdfa_instance
.
showArrays
(
plane_data
,
wh
[
0
],
wh
[
1
],
true
,
"plane_data"
);
// show plane data
/*
...
...
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