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
d24659c3
Commit
d24659c3
authored
May 24, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing different cost functions
parent
1183ecd4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
208 additions
and
31 deletions
+208
-31
ConnectionCosts.java
src/main/java/ConnectionCosts.java
+13
-7
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+15
-0
SuperTiles.java
src/main/java/SuperTiles.java
+109
-7
TilePlanes.java
src/main/java/TilePlanes.java
+42
-4
TileProcessor.java
src/main/java/TileProcessor.java
+18
-13
TwoLayerNeighbors.java
src/main/java/TwoLayerNeighbors.java
+11
-0
No files found.
src/main/java/ConnectionCosts.java
View file @
d24659c3
...
...
@@ -32,7 +32,9 @@ public class ConnectionCosts {
double
orthoWeight
;
double
diagonalWeight
;
double
starPwr
;
// Divide cost by number of connections to this power
double
starWeightPwr
;
// Use this power of tile weight when calculating connection cost
double
starValPwr
;
// Raise value of each tile before averaging
int
steps
;
int
[][][]
neibs_init
;
int
[]
mod_tiles
;
...
...
@@ -48,6 +50,7 @@ public class ConnectionCosts {
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
int
steps
,
TilePlanes
.
PlaneData
[][]
planes
,
...
...
@@ -60,6 +63,7 @@ public class ConnectionCosts {
this
.
orthoWeight
=
orthoWeight
;
this
.
diagonalWeight
=
diagonalWeight
;
this
.
starPwr
=
starPwr
;
// Divide cost by number of connections to this power
this
.
starWeightPwr
=
starWeightPwr
;
this
.
starValPwr
=
starValPwr
;
// Raise value of each tile before averaging
this
.
steps
=
steps
;
}
...
...
@@ -203,7 +207,7 @@ public class ConnectionCosts {
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
// starValPwr, //double starValPwr, // Raise value of each tile before averaging
starWeightPwr
,
tnSurface
,
preferDisparity
,
-
1
);
// debugLevel);
...
...
@@ -268,7 +272,7 @@ public class ConnectionCosts {
}
if
(
neibs_changed
){
vw
[
isTile
][
nl
]
=
getStarValueWeight
(
vw
[
isTile
][
nl
]
=
getStarValueWeight
2
(
nsTile
,
nl
,
neibs0
,
...
...
@@ -276,7 +280,7 @@ public class ConnectionCosts {
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
// starValPwr, //double starValPwr, // Raise value of each tile before averaging
starWeightPwr
,
//
tnSurface
,
preferDisparity
,
-
1
);
// debugLevel);
...
...
@@ -348,7 +352,7 @@ public class ConnectionCosts {
* @param neibs array of 8 neighbors layers (N,NE,...NW), -1 - not connected
* @param orthoWeight multiply contribution of ortho neighbors
* @param diagonalWeight multiply contribution of diagonal neighbors
* @param
diagonalWeight divide value by number of connections to this power (if !=0)
* @param
starPwr, // Divide cost by number of connections to this power
* @param tnSurface TileNeibs instance to navigate tile index and control array borders
* @param preferDisparity - the first eigenvalue/vector is the most disparity-like
* (false - smallest eigenvalue)
...
...
@@ -362,7 +366,7 @@ public class ConnectionCosts {
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
// double starValPwr, // Raise value of each tile before averaging
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
TileSurface
.
TileNeibs
tnSurface
,
boolean
preferDisparity
,
int
debugLevel
)
...
...
@@ -377,6 +381,7 @@ public class ConnectionCosts {
merged_plane
=
merged_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
other_weight
,
// double scale_other,
starWeightPwr
,
//
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -409,7 +414,7 @@ public class ConnectionCosts {
*/
public
double
[]
getStarValueWeight
(
public
double
[]
getStarValueWeight
2
(
int
nsTile
,
int
nl
,
int
[]
neibs
,
...
...
@@ -417,7 +422,7 @@ public class ConnectionCosts {
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
// double starValPwr, // Raise value of each tile before averaging
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
TileSurface
.
TileNeibs
tnSurface
,
boolean
preferDisparity
,
int
debugLevel
)
...
...
@@ -453,6 +458,7 @@ public class ConnectionCosts {
merged_plane
=
merged_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
entry
.
getValue
(),
// double scale_other,
starPwr
,
// Divide cost by number of connections to this power
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
src/main/java/EyesisCorrectionParameters.java
View file @
d24659c3
...
...
@@ -2172,6 +2172,8 @@ public class EyesisCorrectionParameters {
public
boolean
plDbgMerge
=
true
;
// Combine 'other' plane with current
public
double
plWorstWorsening
=
2.0
;
// Worst case worsening after merge
public
double
plWorstWorsening2
=
5.0
;
// Worst case worsening for thin planes
public
double
plWorstEq
=
1.0
;
// Worst case worsening after merge with equal weights
public
double
plWorstEq2
=
2.0
;
// Worst case worsening for thin planes with equal weights
public
double
plOKMergeEigen
=
0.03
;
// If result of the merged planes is below, OK to use thin planes (higher) threshold
public
double
plMaxWorldSin2
=
0.1
;
// Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable
public
double
plWeakWorsening
=
1.0
;
// Relax merge requirements for weaker planes
...
...
@@ -2185,6 +2187,7 @@ public class EyesisCorrectionParameters {
public
double
plStarOrtho
=
0.5
;
// When calculating cost for the connections scale 4 ortho neighbors
public
double
plStarDiag
=
0.25
;
// When calculating cost for the connections scale 4 diagonal neighbors
public
double
plStarPwr
=
0.5
;
// Divide cost by number of connections to this power
public
double
plStarWeightPwr
=
0.5
;
// use this power of tile weight when calculating connection cost
public
double
plStarValPwr
=
1.0
;
// Raise value of each tile before averaging
public
double
plDblTriLoss
=
0.0001
;
// When resolving double triangles allow minor degradation (0.0 - strict)
public
boolean
plNewConfl
=
false
;
// Allow more conflicts if overall cost is reduced
...
...
@@ -2535,6 +2538,8 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"plDbgMerge"
,
this
.
plDbgMerge
+
""
);
properties
.
setProperty
(
prefix
+
"plWorstWorsening"
,
this
.
plWorstWorsening
+
""
);
properties
.
setProperty
(
prefix
+
"plWorstWorsening2"
,
this
.
plWorstWorsening2
+
""
);
properties
.
setProperty
(
prefix
+
"plWorstEq"
,
this
.
plWorstEq
+
""
);
properties
.
setProperty
(
prefix
+
"plWorstEq2"
,
this
.
plWorstEq2
+
""
);
properties
.
setProperty
(
prefix
+
"plOKMergeEigen"
,
this
.
plOKMergeEigen
+
""
);
properties
.
setProperty
(
prefix
+
"plMaxWorldSin2"
,
this
.
plMaxWorldSin2
+
""
);
properties
.
setProperty
(
prefix
+
"plWeakWorsening"
,
this
.
plWeakWorsening
+
""
);
...
...
@@ -2547,6 +2552,7 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"plStarOrtho"
,
this
.
plStarOrtho
+
""
);
properties
.
setProperty
(
prefix
+
"plStarDiag"
,
this
.
plStarDiag
+
""
);
properties
.
setProperty
(
prefix
+
"plStarPwr"
,
this
.
plStarPwr
+
""
);
properties
.
setProperty
(
prefix
+
"plStarWeightPwr"
,
this
.
plStarWeightPwr
+
""
);
properties
.
setProperty
(
prefix
+
"plStarValPwr"
,
this
.
plStarValPwr
+
""
);
properties
.
setProperty
(
prefix
+
"plDblTriLoss"
,
this
.
plDblTriLoss
+
""
);
properties
.
setProperty
(
prefix
+
"plNewConfl"
,
this
.
plNewConfl
+
""
);
...
...
@@ -2877,6 +2883,8 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"plDbgMerge"
)!=
null
)
this
.
plDbgMerge
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"plDbgMerge"
));
if
(
properties
.
getProperty
(
prefix
+
"plWorstWorsening"
)!=
null
)
this
.
plWorstWorsening
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWorstWorsening"
));
if
(
properties
.
getProperty
(
prefix
+
"plWorstWorsening2"
)!=
null
)
this
.
plWorstWorsening2
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWorstWorsening2"
));
if
(
properties
.
getProperty
(
prefix
+
"plWorstEq"
)!=
null
)
this
.
plWorstEq
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWorstEq"
));
if
(
properties
.
getProperty
(
prefix
+
"plWorstEq2"
)!=
null
)
this
.
plWorstEq2
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWorstEq2"
));
if
(
properties
.
getProperty
(
prefix
+
"plOKMergeEigen"
)!=
null
)
this
.
plOKMergeEigen
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plOKMergeEigen"
));
if
(
properties
.
getProperty
(
prefix
+
"plMaxWorldSin2"
)!=
null
)
this
.
plMaxWorldSin2
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plMaxWorldSin2"
));
if
(
properties
.
getProperty
(
prefix
+
"plWeakWorsening"
)!=
null
)
this
.
plWeakWorsening
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWeakWorsening"
));
...
...
@@ -2889,6 +2897,7 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"plStarOrtho"
)!=
null
)
this
.
plStarOrtho
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plStarOrtho"
));
if
(
properties
.
getProperty
(
prefix
+
"plStarDiag"
)!=
null
)
this
.
plStarDiag
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plStarDiag"
));
if
(
properties
.
getProperty
(
prefix
+
"plStarPwr"
)!=
null
)
this
.
plStarPwr
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plStarPwr"
));
if
(
properties
.
getProperty
(
prefix
+
"plStarWeightPwr"
)!=
null
)
this
.
plStarWeightPwr
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plStarWeightPwr"
));
if
(
properties
.
getProperty
(
prefix
+
"plStarValPwr"
)!=
null
)
this
.
plStarValPwr
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plStarValPwr"
));
if
(
properties
.
getProperty
(
prefix
+
"plDblTriLoss"
)!=
null
)
this
.
plDblTriLoss
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plDblTriLoss"
));
if
(
properties
.
getProperty
(
prefix
+
"plNewConfl"
)!=
null
)
this
.
plNewConfl
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"plNewConfl"
));
...
...
@@ -3247,6 +3256,8 @@ public class EyesisCorrectionParameters {
gd
.
addCheckbox
(
"Combine 'other' plane with the current (unused)"
,
this
.
plDbgMerge
);
gd
.
addNumericField
(
"Worst case worsening after merge"
,
this
.
plWorstWorsening
,
6
);
gd
.
addNumericField
(
"Worst case worsening for thin planes"
,
this
.
plWorstWorsening2
,
6
);
gd
.
addNumericField
(
"Worst case worsening after merge with equal weights"
,
this
.
plWorstEq
,
6
);
gd
.
addNumericField
(
"Worst case worsening for thin planes with equal weights"
,
this
.
plWorstEq2
,
6
);
gd
.
addNumericField
(
"If result of the merged planes is below, OK to use thin planes (higher) threshold "
,
this
.
plOKMergeEigen
,
6
);
gd
.
addNumericField
(
"Maximal sine squared of the world angle between planes to merge. Set to >= 1.0 to disable"
,
this
.
plMaxWorldSin2
,
6
);
gd
.
addNumericField
(
"Relax merge requirements for weaker planes"
,
this
.
plWeakWorsening
,
6
);
...
...
@@ -3259,6 +3270,7 @@ public class EyesisCorrectionParameters {
gd
.
addNumericField
(
"When calculating cost for the connections scale 4 ortho neighbors"
,
this
.
plStarOrtho
,
6
);
gd
.
addNumericField
(
"When calculating cost for the connections scale 4 diagonal neighbors"
,
this
.
plStarDiag
,
6
);
gd
.
addNumericField
(
"Divide cost by number of connections to this power"
,
this
.
plStarPwr
,
6
);
gd
.
addNumericField
(
"Use this power of tile weight when calculating connection cost"
,
this
.
plStarWeightPwr
,
6
);
gd
.
addNumericField
(
"Raise value of each tile before averaging"
,
this
.
plStarValPwr
,
6
);
gd
.
addNumericField
(
"When resolving double triangles allow minor degradation (0.0 - strict)"
,
this
.
plDblTriLoss
,
6
);
gd
.
addCheckbox
(
"Allow more conflicts if overall cost is reduced"
,
this
.
plNewConfl
);
...
...
@@ -3602,6 +3614,8 @@ public class EyesisCorrectionParameters {
this
.
plDbgMerge
=
gd
.
getNextBoolean
();
this
.
plWorstWorsening
=
gd
.
getNextNumber
();
this
.
plWorstWorsening2
=
gd
.
getNextNumber
();
this
.
plWorstEq
=
gd
.
getNextNumber
();
this
.
plWorstEq2
=
gd
.
getNextNumber
();
this
.
plOKMergeEigen
=
gd
.
getNextNumber
();
this
.
plMaxWorldSin2
=
gd
.
getNextNumber
();
this
.
plWeakWorsening
=
gd
.
getNextNumber
();
...
...
@@ -3614,6 +3628,7 @@ public class EyesisCorrectionParameters {
this
.
plStarOrtho
=
gd
.
getNextNumber
();
this
.
plStarDiag
=
gd
.
getNextNumber
();
this
.
plStarPwr
=
gd
.
getNextNumber
();
this
.
plStarWeightPwr
=
gd
.
getNextNumber
();
this
.
plStarValPwr
=
gd
.
getNextNumber
();
this
.
plDblTriLoss
=
gd
.
getNextNumber
();
this
.
plNewConfl
=
gd
.
getNextBoolean
();
...
...
src/main/java/SuperTiles.java
View file @
d24659c3
...
...
@@ -3178,6 +3178,7 @@ public class SuperTiles{
TilePlanes
.
PlaneData
this_this_pd
=
planes
[
nsTile0
][
indx
].
mergePlaneToThis
(
planes
[
nsTile0
][
indx
],
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
true
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -3186,6 +3187,7 @@ public class SuperTiles{
TilePlanes
.
PlaneData
other_other_pd
=
other_pd
.
mergePlaneToThis
(
other_pd
,
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
true
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -3195,6 +3197,7 @@ public class SuperTiles{
TilePlanes
.
PlaneData
merged_pd
=
planes
[
nsTile0
][
indx
].
mergePlaneToThis
(
other_pd
,
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
true
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -3212,6 +3215,7 @@ public class SuperTiles{
TilePlanes
.
PlaneData
merged_pd
=
planes
[
nsTile0
][
best_index
].
mergePlaneToThis
(
other_pd
,
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -3321,6 +3325,7 @@ public class SuperTiles{
TilePlanes
.
PlaneData
merged_pd
=
this_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -3330,6 +3335,22 @@ public class SuperTiles{
/// merged_pd.scaleWeight(0.5);
this_plane
.
setNeibMatch
(
dir
,
np
,
merged_pd
.
getValue
());
// smallest eigenValue
}
merged_pd
=
this_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
true
,
// false, // boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
dl
-
1
);
// int debugLevel)
if
(
merged_pd
!=
null
)
{
// now always, but may add later
/// merged_pd.scaleWeight(0.5);
this_plane
.
setNeibMatchEq
(
dir
,
np
,
merged_pd
.
getValue
());
// smallest eigenValue
}
}
}
}
...
...
@@ -3380,6 +3401,10 @@ public class SuperTiles{
if
(
nm
!=
null
)
{
this_plane
.
setNeibMatch
(
dir
,
np
,
nm
[
np0
]);
//
}
nm
=
other_planes
[
np
].
getMergedValueEq
(
dir
-
4
);
if
(
nm
!=
null
)
{
this_plane
.
setNeibMatchEq
(
dir
,
np
,
nm
[
np0
]);
//
}
}
}
...
...
@@ -3691,6 +3716,7 @@ public class SuperTiles{
double
weakWorsening
,
double
okMergeEigen
,
double
maxWorldSin2
,
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
dispNorm
,
double
maxEigen
,
// maximal eigenvalue of planes to consider
boolean
preferDisparity
,
...
...
@@ -3728,6 +3754,7 @@ public class SuperTiles{
weakWorsening
,
okMergeEigen
,
maxWorldSin2
,
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
dispNorm
,
maxEigen
,
// maximal eigenvalue of planes to consider
tnSurface
,
...
...
@@ -3755,6 +3782,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
preferDisparity
,
...
...
@@ -3795,6 +3823,7 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// double dblTriLoss, // When resolving double triangles allow minor degradation (0.0 - strict)
preferDisparity
,
// boolean preferDisparity,
...
...
@@ -3823,6 +3852,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
preferDisparity
,
...
...
@@ -3884,6 +3914,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
this
.
planes
,
...
...
@@ -3904,6 +3935,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
);
...
...
@@ -3984,6 +4016,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
);
...
...
@@ -4078,6 +4111,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
preferDisparity
,
...
...
@@ -4139,6 +4173,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
this
.
planes
,
...
...
@@ -4158,6 +4193,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
);
...
...
@@ -4228,6 +4264,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
);
...
...
@@ -4345,6 +4382,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
preferDisparity
,
...
...
@@ -4378,6 +4416,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
preferDisparity
,
...
...
@@ -4398,6 +4437,7 @@ public class SuperTiles{
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starValPwr
,
// Raise value of each tile before averaging
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
newConfl
,
// Allow more conflicts if overall cost is reduced
int
maxChanges
,
// Maximal number of simultaneous connection changes around one tile (0 - any)
...
...
@@ -4430,6 +4470,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
newConfl
,
// boolean newConfl, // Allow more conflicts if overall cost is reduced
...
...
@@ -4455,6 +4496,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
newConfl
,
// Allow more conflicts if overall cost is reduced
...
...
@@ -4538,6 +4580,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
this
.
planes
,
...
...
@@ -4748,6 +4791,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
newConfl
,
// Allow more conflicts if overall cost is reduced
...
...
@@ -4834,6 +4878,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
this
.
planes
,
...
...
@@ -5049,6 +5094,7 @@ public class SuperTiles{
orthoWeight
,
// final double orthoWeight,
diagonalWeight
,
// final double diagonalWeight,
starPwr
,
// final double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
// final int steps,
planes
,
// final TilePlanes.PlaneData [][] planes,
...
...
@@ -5062,6 +5108,7 @@ public class SuperTiles{
final
double
orthoWeight
,
final
double
diagonalWeight
,
final
double
starPwr
,
// Divide cost by number of connections to this power
final
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
final
double
starValPwr
,
// Raise value of each tile before averaging
final
int
steps
,
final
TilePlanes
.
PlaneData
[][]
planes
,
...
...
@@ -5084,7 +5131,8 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starWeightPwr
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
steps
,
// int steps,
planes
,
// TilePlanes.PlaneData [][] planes,
tnSurface
,
// TileSurface.TileNeibs tnSurface,
...
...
@@ -5113,6 +5161,7 @@ public class SuperTiles{
final
double
orthoWeight
,
final
double
diagonalWeight
,
final
double
starPwr
,
// Divide cost by number of connections to this power
final
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
final
double
starValPwr
,
// Raise value of each tile before averaging
final
int
steps
,
final
TilePlanes
.
PlaneData
[][]
planes
,
...
...
@@ -5134,6 +5183,7 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
steps
,
// int steps,
planes
,
// TilePlanes.PlaneData [][] planes,
...
...
@@ -5418,6 +5468,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
newConfl
,
// Allow more conflicts if overall cost is reduced
...
...
@@ -5432,6 +5483,7 @@ public class SuperTiles{
orthoWeight
,
// final double orthoWeight,
diagonalWeight
,
// final double diagonalWeight,
starPwr
,
// final double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// final double starWeightPwr, // Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
// final int steps,
this
.
planes
,
// final TilePlanes.PlaneData [][] planes,
...
...
@@ -5459,6 +5511,7 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// double diagonalWeight,
preferDisparity
,
...
...
@@ -5475,6 +5528,7 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// double diagonalWeight,
preferDisparity
,
...
...
@@ -5491,6 +5545,7 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// double diagonalWeight,
preferDisparity
,
...
...
@@ -5507,6 +5562,7 @@ public class SuperTiles{
orthoWeight
,
// double orthoWeight,
diagonalWeight
,
// double diagonalWeight,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
dblTriLoss
,
// double diagonalWeight,
newConfl
,
// Allow more conflicts if overall cost is reduced
...
...
@@ -5575,6 +5631,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
starValPwr
,
// Raise value of each tile before averaging
double
dblTriLoss
,
// When resolving double triangles allow minor degradation (0.0 - strict)
boolean
preferDisparity
,
...
...
@@ -5617,6 +5674,7 @@ public class SuperTiles{
conflicts
[
nsTile
][
nConfl
][
1
],
dir4
,
maxEigen
,
// maximal eigenvalue of planes to consider
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
+
((
nsTile
==
dbgTile
)?
1
:
0
));
...
...
@@ -5650,6 +5708,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
starValPwr
,
//double starValPwr, // Raise value of each tile before averaging
starSteps
,
this
.
planes
,
...
...
@@ -5667,6 +5726,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
);
...
...
@@ -5735,6 +5795,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
debugLevel
);
...
...
@@ -5873,6 +5934,7 @@ public class SuperTiles{
int
nl2
,
int
dir4
,
double
maxEigen
,
// maximal eigenvalue of planes to consider
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
TileSurface
.
TileNeibs
tnSurface
,
boolean
preferDisparity
,
int
debugLevel
)
...
...
@@ -5911,6 +5973,7 @@ public class SuperTiles{
tri_plane
=
tri_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -5964,6 +6027,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
TileSurface
.
TileNeibs
tnSurface
,
boolean
preferDisparity
,
int
debugLevel
)
...
...
@@ -5978,6 +6042,7 @@ public class SuperTiles{
merged_plane
=
merged_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
other_weight
,
// double scale_other,
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -6052,6 +6117,7 @@ public class SuperTiles{
double
orthoWeight
,
double
diagonalWeight
,
double
starPwr
,
// Divide cost by number of connections to this power
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
TileSurface
.
TileNeibs
tnSurface
,
boolean
preferDisparity
,
int
debugLevel
)
...
...
@@ -6106,6 +6172,7 @@ public class SuperTiles{
orthoWeight
,
diagonalWeight
,
starPwr
,
// double starPwr, // Divide cost by number of connections to this power
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
tnSurface
,
preferDisparity
,
-
1
);
// debugLevel);
...
...
@@ -6167,6 +6234,7 @@ public class SuperTiles{
double
weakWorsening
,
double
okMergeEigen
,
double
maxWorldSin2
,
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
double
dispNorm
,
double
maxEigen
,
// maximal eigenvalue of planes to consider
TileSurface
.
TileNeibs
tnSurface
,
...
...
@@ -6204,6 +6272,7 @@ public class SuperTiles{
merged_plane
=
merged_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -6220,6 +6289,7 @@ public class SuperTiles{
merged
[
np
]
=
these
[
np
].
mergePlaneToThis
(
merged_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -6297,7 +6367,9 @@ public class SuperTiles{
*/
public
void
filterNeighborPlanes
(
final
double
rquality
,
final
double
worstWorsening2
,
// final double worst_worsening2 Worst case worsening for thin planes,
final
double
worstWorsening2
,
// Worst case worsening for thin planes,
final
double
worstEq
,
// Worst case worsening after merge with equal weights
final
double
worstEq2
,
// Worst case worsening for thin planes with equal weights
final
double
weakWorsening
,
final
double
okMergeEigen
,
final
double
maxWorldSin2
,
...
...
@@ -6347,7 +6419,9 @@ public class SuperTiles{
for
(
int
np0
=
np0_min
;
np0
<
planes
[
nsTile0
].
length
;
np0
++){
if
((
planes
[
nsTile0
][
np0
]
!=
null
)
&&
(
planes
[
nsTile0
][
np0
].
getMergedValue
(
dir
)
!=
null
)){
double
[]
merge_ev
=
planes
[
nsTile0
][
np0
].
getMergedValue
(
dir
);
double
[]
merge_ev_eq
=
planes
[
nsTile0
][
np0
].
getMergedValueEq
(
dir
);
if
(
(
merge_ev
!=
null
)
&&
(
merge_ev_eq
!=
null
)
&&
((
maxEigen
==
0.0
)
||
(
planes
[
nsTile0
][
np0
].
getValue
()
<
corrMaxEigen
(
maxEigen
,
...
...
@@ -6373,13 +6447,33 @@ public class SuperTiles{
w1
,
// double w1,
w2
);
// double w2)
double
this_rq_norm
=
this_rq
;
if
((
w1
+
w2
)
<
weakWorsening
)
this_rq_norm
*=
(
w1
+
w2
)
/
weakWorsening
;
// forgive more for weak planes
if
((
w1
+
w2
)
<
weakWorsening
)
this_rq_norm
*=
(
w1
+
w2
)
/
weakWorsening
;
// forgive more for weak planes
double
this_rq_eq
=
mergeRQuality
(
planes
[
nsTile0
][
np0
].
getValue
(),
// double L1,
planes
[
nsTile
][
np
].
getValue
(),
// double L2,
merge_ev
[
np
],
// double L,
1.0
,
// double w1,
1.0
);
// double w2)
double
this_rq_eq_norm
=
this_rq_eq
;
if
((
w1
+
w2
)
<
weakWorsening
)
this_rq_eq_norm
*=
(
w1
+
w2
)
/
weakWorsening
;
// forgive more for weak planes
if
((
this_rq_norm
<=
rquality
)
||
((
merge_ev
[
np
]
<=
okMergeEigen
)
&&
(
this_rq_norm
<=
worstWorsening2
))
// use higher threshold
((
merge_ev
[
np
]
<=
okMergeEigen
)
&&
(
this_rq_norm
<=
worstWorsening2
))
||
// use higher threshold
(
this_rq_eq_norm
<=
worstEq
)
||
((
merge_ev_eq
[
np
]
<=
okMergeEigen
)
&&
(
this_rq_eq_norm
<=
worstEq2
))
// use higher threshold
)
{
if
((
maxWorldSin2
>=
1.0
)
||
(
planes
[
nsTile0
][
np0
].
getWorldSin2
(
planes
[
nsTile
][
np
])
<=
maxWorldSin2
))
{
if
(
dl
>
0
){
System
.
out
.
println
(
"filterNeighborPlanes : nsTile0="
+
nsTile0
+
":"
+
np0
+
", nsTile="
+
nsTile
+
":"
+
np
+
" dir="
+
dir
+
" is VALID"
);
System
.
out
.
print
(
"filterNeighborPlanes : nsTile0="
+
nsTile0
+
":"
+
np0
+
", nsTile="
+
nsTile
+
":"
+
np
+
" dir="
+
dir
+
" is VALID, because "
);
if
(
this_rq_norm
<=
rquality
)
System
.
out
.
print
(
" (this_rq_norm="
+
this_rq_norm
+
" <= rquality)"
);
if
((
merge_ev
[
np
]
<=
okMergeEigen
)
&&
(
this_rq_norm
<=
worstWorsening2
))
System
.
out
.
print
(
" merge_ev[np]="
+
merge_ev
[
np
]+
" <= okMergeEigen) && (this_rq_norm="
+
this_rq_norm
+
" <= worstWorsening2)"
);
if
(
this_rq_eq_norm
<=
worstEq
)
System
.
out
.
print
(
" this_rq_eq_norm="
+
this_rq_eq_norm
+
" <= worstEq"
);
if
((
merge_ev_eq
[
np
]
<=
okMergeEigen
)
&&
(
this_rq_eq_norm
<=
worstEq2
))
System
.
out
.
print
(
" ((merge_ev_eq[np]="
+
merge_ev_eq
[
np
]+
" <= okMergeEigen) && (this_rq_eq_norm="
+
this_rq_eq_norm
+
" <= worstEq2)"
);
System
.
out
.
println
();
}
planes
[
nsTile0
][
np0
].
setMergedValid
(
dir
,
np
,
true
,
planes
[
nsTile
].
length
);
planes
[
nsTile
][
np
].
setMergedValid
((
dir
+
4
)
%
8
,
np0
,
true
,
planes
[
nsTile0
].
length
);
...
...
@@ -6393,10 +6487,12 @@ public class SuperTiles{
" L1="
+
planes
[
nsTile0
][
np0
].
getValue
()+
" L2="
+
planes
[
nsTile
][
np
].
getValue
()+
" L="
+
merge_ev
[
np
]);
}
}
if
(
dl
>
0
)
{
if
(
dl
>
3
)
{
System
.
out
.
println
(
"nsTile0="
+
nsTile0
+
":"
+
np0
+
", nsTile="
+
nsTile
+
":"
+
np
+
", this_rq="
+
this_rq
+
", this_rq_eq="
+
this_rq_eq
+
" w1="
+
w1
+
" w2="
+
w2
+
" L1="
+
planes
[
nsTile0
][
np0
].
getValue
()+
" L2="
+
planes
[
nsTile
][
np
].
getValue
()+
" L="
+
merge_ev
[
np
]);
" L1="
+
planes
[
nsTile0
][
np0
].
getValue
()+
" L2="
+
planes
[
nsTile
][
np
].
getValue
()+
" L="
+
merge_ev
[
np
]+
" L_eq="
+
merge_ev_eq
[
np
]);
System
.
out
.
println
(
"nsTile0="
+
nsTile0
+
":"
+
np0
+
", nsTile="
+
nsTile
+
":"
+
np
+
", world sin2 ="
+
planes
[
nsTile0
][
np0
].
getWorldSin2
(
planes
[
nsTile
][
np
]));
System
.
out
.
println
(
"nsTile0="
+
nsTile0
+
":"
+
np0
+
", nsTile="
+
nsTile
+
":"
+
np
+
...
...
@@ -7482,6 +7578,8 @@ public class SuperTiles{
this_new_plane
=
this_new_plane
.
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
// here it should be no power function for the weights
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -7523,6 +7621,7 @@ public class SuperTiles{
this_new_plane
=
this_new_plane
.
mergePlaneToThis
(
measured_planes
[
nsTile0
][
np0
],
// PlaneData otherPd,
meas_pull
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -8195,6 +8294,7 @@ public class SuperTiles{
plane_triads
[
nSplit
][
nis
]
=
plane_triads
[
nSplit
][
nis
].
mergePlaneToThis
(
other_plane
,
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -8218,6 +8318,7 @@ public class SuperTiles{
plane_triads
[
nSplit
][
2
]
=
plane_triads
[
nSplit
][
0
].
clone
().
mergePlaneToThis
(
plane_triads
[
nSplit
][
1
],
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
@@ -8244,6 +8345,7 @@ public class SuperTiles{
plane_triads
[
best_index
][
2
]
=
plane_triads
[
best_index
][
0
].
clone
().
mergePlaneToThis
(
plane_triads
[
best_index
][
1
],
// PlaneData otherPd,
1.0
,
// double scale_other,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false
,
// boolean ignore_weights,
true
,
// boolean sum_weights,
preferDisparity
,
...
...
src/main/java/TilePlanes.java
View file @
d24659c3
...
...
@@ -2033,9 +2033,27 @@ public class TilePlanes {
* @return PlaneData object representing merged planes with combined weight (scale_other*otherPd.weight + this.weight),
* recalculated center, eigenvalues and eigenvectors
*/
public
PlaneData
mergePlaneToThis1
(
PlaneData
otherPd
,
double
scale_other
,
boolean
ignore_weights
,
boolean
sum_weights
,
boolean
preferDisparity
,
// Always start with disparity-most axis (false - lowest eigenvalue)
int
debugLevel
)
{
return
mergePlaneToThis
(
otherPd
,
scale_other
,
1.0
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
ignore_weights
,
sum_weights
,
preferDisparity
,
// Always start with disparity-most axis (false - lowest eigenvalue)
debugLevel
);
}
public
PlaneData
mergePlaneToThis
(
PlaneData
otherPd
,
double
scale_other
,
double
starWeightPwr
,
// Use this power of tile weight when calculating connection cost
boolean
ignore_weights
,
boolean
sum_weights
,
boolean
preferDisparity
,
// Always start with disparity-most axis (false - lowest eigenvalue)
...
...
@@ -2058,8 +2076,17 @@ public class TilePlanes {
Matrix
this_eig_vectors
=
new
Matrix
(
this
.
vectors
).
transpose
();
// vectors are saved as rows
Matrix
this_center
=
new
Matrix
(
this
.
getZxy
(),
3
);
Matrix
other_center
=
new
Matrix
(
otherPd
.
getZxy
(),
3
);
// should already be relative to this supertile center
double
sum_weight
=
scale_other
*
otherPd
.
weight
+
this
.
weight
;
double
other_fraction
=
ignore_weights
?
(
scale_other
/(
scale_other
+
1.0
)):
((
scale_other
*
otherPd
.
weight
)
/
sum_weight
);
double
this_weight
=
this
.
weight
;
double
other_weight
=
otherPd
.
weight
;
if
(
starWeightPwr
==
0
){
ignore_weights
=
true
;
}
else
if
(
starWeightPwr
!=
1.0
){
this_weight
=
Math
.
pow
(
this_weight
,
starWeightPwr
);
other_weight
=
Math
.
pow
(
other_weight
,
starWeightPwr
);
}
double
sum_weight
=
scale_other
*
other_weight
+
this_weight
;
// should be the same for
double
other_fraction
=
ignore_weights
?
(
scale_other
/(
scale_other
+
1.0
)):
((
scale_other
*
other_weight
)
/
sum_weight
);
Matrix
common_center
=
this_center
.
times
(
1.0
-
other_fraction
).
plus
(
other_center
.
times
(
other_fraction
));
Matrix
other_offset
=
other_center
.
minus
(
this_center
);
// other center from this center
if
((
this
.
values
[
0
]
==
0.0
)
||
(
otherPd
.
values
[
0
]
==
0.0
))
{
...
...
@@ -2189,12 +2216,23 @@ public class TilePlanes {
pd
.
setZxy
(
common_center
.
getColumnPackedCopy
());
// set new center
// what weight to use? cloned is original weight for this supertile
// or use weighted average like below?
double
new_weight
;
if
(
sum_weights
)
{
new_weight
=
sum_weight
;
// normalize while averaging by the caller
}
else
{
// how it was before
new_weight
=
other_fraction
*
other_weight
+
(
1.0
-
other_fraction
)
*
this_weight
;
}
if
(!
ignore_weights
&&
((
starWeightPwr
!=
1.0
))){
new_weight
=
Math
.
pow
(
new_weight
,
1.0
/
starWeightPwr
);
}
pd
.
setWeight
(
new_weight
);
/*
if (sum_weights) {
pd.setWeight(sum_weight); // normalize while averaging by the caller
} else { // how it was before
pd
.
setWeight
(
other_fraction
*
other
Pd
.
weight
+
(
1.0
-
other_fraction
)
*
this
.
weight
);
pd.setWeight(other_fraction * other
_weight + (1.0 - other_fraction) * this_
weight);
}
*/
return
pd
;
}
...
...
src/main/java/TileProcessor.java
View file @
d24659c3
...
...
@@ -3419,6 +3419,8 @@ public class TileProcessor {
st
.
filterNeighborPlanes
(
clt_parameters
.
plWorstWorsening
,
// final double worst_worsening,
clt_parameters
.
plWorstWorsening2
,
// final double worst_worsening2 Worst case worsening for thin planes,
clt_parameters
.
plWorstEq
,
// final double worstEq, // Worst case worsening after merge with equal weights
clt_parameters
.
plWorstEq2
,
// final double worstEq2, // Worst case worsening for thin planes with equal weights
clt_parameters
.
plWeakWorsening
,
// final double worst_worsening,
clt_parameters
.
plOKMergeEigen
,
// final double okMergeEigen, f result of the merged planes is below, OK to use thin planes (higher) threshold
clt_parameters
.
plMaxWorldSin2
,
// final double maxWorldSin2,
...
...
@@ -3458,6 +3460,7 @@ public class TileProcessor {
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plStarPwr
,
// double starPwr, // Divide cost by number of connections to this power
clt_parameters
.
plStarWeightPwr
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
clt_parameters
.
plStarValPwr
,
// double starValPwr, // Raise value of each tile before averaging
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
clt_parameters
.
plNewConfl
,
// boolean preferDisparity, // Allow more conflicts if overall cost is reduced
...
...
@@ -3568,6 +3571,8 @@ public class TileProcessor {
st
.
filterNeighborPlanes
(
clt_parameters
.
plWorstWorsening
,
// final double worst_worsening,
clt_parameters
.
plWorstWorsening2
,
// final double worst_worsening2 Worst case worsening for thin planes,
clt_parameters
.
plWorstEq
,
// ffinal double worstEq, // Worst case worsening after merge with equal weights
clt_parameters
.
plWorstEq2
,
// ffinal double worstEq2, // Worst case worsening for thin planes with equal weights
clt_parameters
.
plWeakWorsening
,
// final double worst_worsening,
clt_parameters
.
plOKMergeEigen
,
// final double okMergeEigen,
clt_parameters
.
plMaxWorldSin2
,
// final double maxWorldSin2,
...
...
@@ -3586,23 +3591,23 @@ public class TileProcessor {
st
.
resolveConflicts
(
clt_parameters
.
plMaxEigen
,
clt_parameters
.
plConflDualTri
,
// boolean conflDualTri, // Resolve dual triangles conflict (odoodo)
clt_parameters
.
plConflMulti
,
// boolean conflMulti, // Resolve multiple odo triangles conflicts
clt_parameters
.
plConflDiag
,
// boolean conflDiag, // Resolve diagonal (ood) conflicts
clt_parameters
.
plConflStar
,
// boolean conflStar, // Resolve all conflicts around a supertile
clt_parameters
.
plStarSteps
,
// int starSteps, // How far to look around when calculationg connection cost
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plStarPwr
,
// double starPwr, // Divide cost by number of connections to this power
clt_parameters
.
plStarValPwr
,
// double starValPwr, // Raise value of each tile before averaging
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
clt_parameters
.
plNewConfl
,
// boolean preferDisparity, // Allow more conflicts if overall cost is reduced
clt_parameters
.
plMaxChanges
,
// int maxChanges, // Maximal number of simultaneous connection changes around one tile (0 - any)
clt_parameters
.
plConflDualTri
,
// boolean conflDualTri, // Resolve dual triangles conflict (odoodo)
clt_parameters
.
plConflMulti
,
// boolean conflMulti, // Resolve multiple odo triangles conflicts
clt_parameters
.
plConflDiag
,
// boolean conflDiag, // Resolve diagonal (ood) conflicts
clt_parameters
.
plConflStar
,
// boolean conflStar, // Resolve all conflicts around a supertile
clt_parameters
.
plStarSteps
,
// int starSteps, // How far to look around when calculationg connection cost
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plStarPwr
,
// double starPwr, // Divide cost by number of connections to this power
clt_parameters
.
plStarWeightPwr
,
// double starWeightPwr, // Use this power of tile weight when calculating connection cost
clt_parameters
.
plStarValPwr
,
// double starValPwr, // Raise value of each tile before averaging
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
clt_parameters
.
plNewConfl
,
// boolean preferDisparity, // Allow more conflicts if overall cost is reduced
clt_parameters
.
plMaxChanges
,
// int maxChanges, // Maximal number of simultaneous connection changes around one tile (0 - any)
clt_parameters
.
plPreferDisparity
,
1
,
// final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
}
while
(
true
)
{
...
...
src/main/java/TwoLayerNeighbors.java
View file @
d24659c3
...
...
@@ -399,6 +399,17 @@ public class TwoLayerNeighbors {
{
ArrayList
<
NeibVariant
>
variant_list
=
new
ArrayList
<
NeibVariant
>();
while
(
nextSelection
()){
if
(
debugLevel
>
0
)
{
System
.
out
.
print
(
"trying variant: ["
);
for
(
int
i
=
0
;
i
<
selection_star
.
length
;
i
++){
System
.
out
.
print
(
selection_star
[
i
]);
}
System
.
out
.
print
(
"] ["
);
for
(
int
i
=
0
;
i
<
selection_conns
.
length
;
i
++){
System
.
out
.
print
(
selection_conns
[
i
]);
}
System
.
out
.
print
(
"]: "
);
}
NeibVariant
variant
=
generateVariant
(
debugLevel
);
if
(
variant
!=
null
){
int
num_changes
=
variant
.
diffToOther
(
neibs_init
,
0
);
...
...
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