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
9b8a5082
Commit
9b8a5082
authored
Jun 17, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
before some refactoring
parent
d1be5d00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
57 deletions
+115
-57
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+13
-7
LinkPlanes.java
src/main/java/LinkPlanes.java
+49
-9
TileProcessor.java
src/main/java/TileProcessor.java
+53
-41
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
9b8a5082
...
@@ -2192,13 +2192,15 @@ public class EyesisCorrectionParameters {
...
@@ -2192,13 +2192,15 @@ public class EyesisCorrectionParameters {
public
double
plNeOwn
=
5.0
;
// When calculating non-exclusive planes, use center plane relative weight
public
double
plNeOwn
=
5.0
;
// When calculating non-exclusive planes, use center plane relative weight
public
double
plExNeibCost
=
5.0
;
// When calculating exclusive planes links, do not use neighbors with high cost
public
double
plExNeibCost
=
5.0
;
// When calculating exclusive planes links, do not use neighbors with high cost
public
double
plExNeibCostSngl
=
10.0
;
// When calculating exclusive planes links, do not use no-link neighbors with high cost
//
public double plExNeibCostSngl = 10.0; // When calculating exclusive planes links, do not use no-link neighbors with high cost
public
double
plExNeibSmooth
=
0.5
;
// Scale down maximal costs for smoothed planes (tighter requirements)
public
double
plExNeibSmooth
=
0.5
;
// Scale down maximal costs for smoothed planes (tighter requirements)
public
double
plMergeCostStar
=
5.0
;
// Cost threshold for merging same tile planes if the plane has connected neighbors
public
double
plMergeCost
=
10.0
;
// Cost threshold for merging same tile planes if not connected
public
boolean
plConflMerge
=
true
;
// Try to merge conflicting planes
public
boolean
plConflMerge
=
true
;
// Try to merge conflicting planes
public
double
plConflRelax
=
1.5
;
// Scale parameters to relax planes fit for merging conflicting planes
public
double
plConflRelax
=
1.5
;
// Scale parameters to relax planes fit for merging conflicting planes
public
boolean
plConflSngl
=
true
;
// Only merge conflicting planes if this is the only conflicting pair in the supertile
public
boolean
plConflSngl
=
true
;
// Only merge conflicting planes if this is the only conflicting pair in the supertile
public
boolean
plConflSnglPair
=
true
;
// Only merge conflicting planes only if there are
only
two planes in the supertile
public
boolean
plConflSnglPair
=
true
;
// Only merge conflicting planes only if there are
just
two planes in the supertile
public
double
plMaxZRatio
=
2.0
;
// Maximal ratio of Z to allow plane merging
public
double
plMaxZRatio
=
2.0
;
// Maximal ratio of Z to allow plane merging
public
double
plMaxDisp
=
0.6
;
// Maximal disparity of one of the planes to apply maximal ratio
public
double
plMaxDisp
=
0.6
;
// Maximal disparity of one of the planes to apply maximal ratio
...
@@ -2616,8 +2618,9 @@ public class EyesisCorrectionParameters {
...
@@ -2616,8 +2618,9 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"plNeOwn"
,
this
.
plNeOwn
+
""
);
properties
.
setProperty
(
prefix
+
"plNeOwn"
,
this
.
plNeOwn
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibCost"
,
this
.
plExNeibCost
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibCost"
,
this
.
plExNeibCost
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibCostSngl"
,
this
.
plExNeibCostSngl
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibSmooth"
,
this
.
plExNeibSmooth
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibSmooth"
,
this
.
plExNeibSmooth
+
""
);
properties
.
setProperty
(
prefix
+
"plMergeCostStar"
,
this
.
plMergeCostStar
+
""
);
properties
.
setProperty
(
prefix
+
"plMergeCost"
,
this
.
plMergeCost
+
""
);
properties
.
setProperty
(
prefix
+
"plConflMerge"
,
this
.
plConflMerge
+
""
);
properties
.
setProperty
(
prefix
+
"plConflMerge"
,
this
.
plConflMerge
+
""
);
properties
.
setProperty
(
prefix
+
"plConflRelax"
,
this
.
plConflRelax
+
""
);
properties
.
setProperty
(
prefix
+
"plConflRelax"
,
this
.
plConflRelax
+
""
);
...
@@ -3015,8 +3018,9 @@ public class EyesisCorrectionParameters {
...
@@ -3015,8 +3018,9 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"plNeOwn"
)!=
null
)
this
.
plNeOwn
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plNeOwn"
));
if
(
properties
.
getProperty
(
prefix
+
"plNeOwn"
)!=
null
)
this
.
plNeOwn
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plNeOwn"
));
if
(
properties
.
getProperty
(
prefix
+
"plExNeibCost"
)!=
null
)
this
.
plExNeibCost
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plExNeibCost"
));
if
(
properties
.
getProperty
(
prefix
+
"plExNeibCost"
)!=
null
)
this
.
plExNeibCost
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plExNeibCost"
));
if
(
properties
.
getProperty
(
prefix
+
"plExNeibCostSngl"
)!=
null
)
this
.
plExNeibCostSngl
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plExNeibCostSngl"
));
if
(
properties
.
getProperty
(
prefix
+
"plExNeibSmooth"
)!=
null
)
this
.
plExNeibSmooth
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plExNeibSmooth"
));
if
(
properties
.
getProperty
(
prefix
+
"plExNeibSmooth"
)!=
null
)
this
.
plExNeibSmooth
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plExNeibSmooth"
));
if
(
properties
.
getProperty
(
prefix
+
"plMergeCostStar"
)!=
null
)
this
.
plMergeCostStar
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plMergeCostStar"
));
if
(
properties
.
getProperty
(
prefix
+
"plMergeCost"
)!=
null
)
this
.
plMergeCost
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plMergeCost"
));
if
(
properties
.
getProperty
(
prefix
+
"plConflMerge"
)!=
null
)
this
.
plConflMerge
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"plConflMerge"
));
if
(
properties
.
getProperty
(
prefix
+
"plConflMerge"
)!=
null
)
this
.
plConflMerge
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"plConflMerge"
));
if
(
properties
.
getProperty
(
prefix
+
"plConflRelax"
)!=
null
)
this
.
plConflRelax
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plConflRelax"
));
if
(
properties
.
getProperty
(
prefix
+
"plConflRelax"
)!=
null
)
this
.
plConflRelax
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plConflRelax"
));
...
@@ -3442,14 +3446,15 @@ public class EyesisCorrectionParameters {
...
@@ -3442,14 +3446,15 @@ public class EyesisCorrectionParameters {
gd
.
addNumericField
(
"When calculating non-exclusive planes, do not use neighbors with high cost"
,
this
.
plNeNeibCost
,
6
);
gd
.
addNumericField
(
"When calculating non-exclusive planes, do not use neighbors with high cost"
,
this
.
plNeNeibCost
,
6
);
gd
.
addNumericField
(
"When calculating non-exclusive planes, use cenrter plane relative weight"
,
this
.
plNeOwn
,
6
);
gd
.
addNumericField
(
"When calculating non-exclusive planes, use cenrter plane relative weight"
,
this
.
plNeOwn
,
6
);
gd
.
addNumericField
(
"When calculating exclusive planes links, do not use neighbors with high cost"
,
this
.
plExNeibCost
,
6
);
gd
.
addNumericField
(
"When calculating exclusive planes links, do not use neighbors with high cost"
,
this
.
plExNeibCost
,
6
);
gd
.
addNumericField
(
"When calculating exclusive planes links, do not use no-link neighbors with high cost"
,
this
.
plExNeibCostSngl
,
6
);
gd
.
addNumericField
(
"Scale down maximal costs for smoothed planes links (tighter requirements)"
,
this
.
plExNeibSmooth
,
6
);
gd
.
addNumericField
(
"Scale down maximal costs for smoothed planes links (tighter requirements)"
,
this
.
plExNeibSmooth
,
6
);
gd
.
addNumericField
(
"Cost threshold for merging same tile planes if the plane has connected neighbors"
,
this
.
plMergeCostStar
,
6
);
gd
.
addNumericField
(
"Cost threshold for merging same tile planes if not connected"
,
this
.
plMergeCost
,
6
);
gd
.
addMessage
(
"--- Merging planes with topological conflicts ---"
);
gd
.
addMessage
(
"--- Merging planes with topological conflicts ---"
);
gd
.
addCheckbox
(
"Try to merge conflicting planes"
,
this
.
plConflMerge
);
gd
.
addCheckbox
(
"Try to merge conflicting planes"
,
this
.
plConflMerge
);
gd
.
addNumericField
(
"Scale parameters to relax planes fit for merging conflicting planes"
,
this
.
plConflRelax
,
6
);
gd
.
addNumericField
(
"Scale parameters to relax planes fit for merging conflicting planes"
,
this
.
plConflRelax
,
6
);
gd
.
addCheckbox
(
"Only merge conflicting planes if this is the only conflicting pair in the supertile"
,
this
.
plConflSngl
);
gd
.
addCheckbox
(
"Only merge conflicting planes if this is the only conflicting pair in the supertile"
,
this
.
plConflSngl
);
gd
.
addCheckbox
(
"Only merge conflicting planes only if there are
only
two planes in the supertile"
,
this
.
plConflSnglPair
);
gd
.
addCheckbox
(
"Only merge conflicting planes only if there are
just
two planes in the supertile"
,
this
.
plConflSnglPair
);
gd
.
addMessage
(
"--- ---"
);
gd
.
addMessage
(
"--- ---"
);
gd
.
addNumericField
(
"Maximal ratio of Z to allow plane merging"
,
this
.
plMaxZRatio
,
6
);
gd
.
addNumericField
(
"Maximal ratio of Z to allow plane merging"
,
this
.
plMaxZRatio
,
6
);
...
@@ -3858,8 +3863,9 @@ public class EyesisCorrectionParameters {
...
@@ -3858,8 +3863,9 @@ public class EyesisCorrectionParameters {
this
.
plNeOwn
=
gd
.
getNextNumber
();
this
.
plNeOwn
=
gd
.
getNextNumber
();
this
.
plExNeibCost
=
gd
.
getNextNumber
();
this
.
plExNeibCost
=
gd
.
getNextNumber
();
this
.
plExNeibCostSngl
=
gd
.
getNextNumber
();
this
.
plExNeibSmooth
=
gd
.
getNextNumber
();
this
.
plExNeibSmooth
=
gd
.
getNextNumber
();
this
.
plMergeCostStar
=
gd
.
getNextNumber
();
this
.
plMergeCost
=
gd
.
getNextNumber
();
this
.
plConflMerge
=
gd
.
getNextBoolean
();
this
.
plConflMerge
=
gd
.
getNextBoolean
();
this
.
plConflRelax
=
gd
.
getNextNumber
();
this
.
plConflRelax
=
gd
.
getNextNumber
();
...
...
src/main/java/LinkPlanes.java
View file @
9b8a5082
...
@@ -58,9 +58,14 @@ public class LinkPlanes {
...
@@ -58,9 +58,14 @@ public class LinkPlanes {
public
double
plNeNeibCost
;
// = 5.0; // When calculating non-exclusive planes, do not use neighbors with high cost
public
double
plNeNeibCost
;
// = 5.0; // When calculating non-exclusive planes, do not use neighbors with high cost
public
double
plNeOwn
;
// = 5.0; // When calculating non-exclusive planes, use center plane relative weight
public
double
plNeOwn
;
// = 5.0; // When calculating non-exclusive planes, use center plane relative weight
public
double
plExNeibCost
;
// = 5.0; // When calculating non-exclusive planes, do not use neighbors with high cost
public
double
plExNeibCost
;
// = 5.0; // When calculating non-exclusive planes, do not use neighbors with high cost
public
double
plExNeibCostSngl
;
// = 10.0; // When calculating exclusive planes links, do not use no-link neighbors with high cost
public
double
plExNeibSmooth
;
// = 0.5; // Scale down maximal costs for smoothed planes (tighter requirements)
public
double
plExNeibSmooth
;
// = 0.5; // Scale down maximal costs for smoothed planes (tighter requirements)
public
double
plMergeCostStar
;
// = 5.0; // Cost threshold for merging same tile planes if the plane has connected neighbors
public
double
plMergeCost
;
// = 10.0; // Cost threshold for merging same tile planes if not connected
public
boolean
plConflMerge
;
// = true; // Try to merge conflicting planes
public
double
plConflRelax
;
// = 1.5; // Scale parameters to relax planes fit for merging conflicting planes
public
boolean
plConflSngl
;
// = true; // Only merge conflicting planes if this is the only conflicting pair in the supertile
public
boolean
plConflSnglPair
;
// = true; // Only merge conflicting planes only if there are only two planes in the supertile
// comparing merge quality for plane pairs
// comparing merge quality for plane pairs
public
double
plCostDist
;
// = 4.0; // Disparity (pix) - closer cost will use more of the real world, farther - disparity
public
double
plCostDist
;
// = 4.0; // Disparity (pix) - closer cost will use more of the real world, farther - disparity
...
@@ -111,9 +116,15 @@ public class LinkPlanes {
...
@@ -111,9 +116,15 @@ public class LinkPlanes {
plNeNeibCost
=
clt_parameters
.
plNeNeibCost
;
plNeNeibCost
=
clt_parameters
.
plNeNeibCost
;
plNeOwn
=
clt_parameters
.
plNeOwn
;
plNeOwn
=
clt_parameters
.
plNeOwn
;
plExNeibCost
=
clt_parameters
.
plExNeibCost
;
plExNeibCost
=
clt_parameters
.
plExNeibCost
;
plExNeibCostSngl
=
clt_parameters
.
plExNeibCostSngl
;
plExNeibSmooth
=
clt_parameters
.
plExNeibSmooth
;
plExNeibSmooth
=
clt_parameters
.
plExNeibSmooth
;
plMergeCostStar
=
clt_parameters
.
plMergeCostStar
;
plMergeCost
=
clt_parameters
.
plMergeCost
;
plConflMerge
=
clt_parameters
.
plConflMerge
;
plConflRelax
=
clt_parameters
.
plConflRelax
;
plConflSngl
=
clt_parameters
.
plConflSngl
;
plConflSnglPair
=
clt_parameters
.
plConflSnglPair
;
plCostDist
=
clt_parameters
.
plCostDist
;
plCostDist
=
clt_parameters
.
plCostDist
;
plCostKrq
=
clt_parameters
.
plCostKrq
;
plCostKrq
=
clt_parameters
.
plCostKrq
;
plCostKrqEq
=
clt_parameters
.
plCostKrqEq
;
plCostKrqEq
=
clt_parameters
.
plCostKrqEq
;
...
@@ -135,13 +146,24 @@ public class LinkPlanes {
...
@@ -135,13 +146,24 @@ public class LinkPlanes {
public
double
getExNeibCost
(){
public
double
getExNeibCost
(){
return
plExNeibCost
;
return
plExNeibCost
;
}
}
public
double
ExNeibCostSngl
(){
public
double
getMergeCostStar
(){
return
plExNeibCostSngl
;
return
plMergeCostStar
;
}
public
double
getMergeCostNoStar
(){
return
plMergeCost
;
}
}
public
double
getExNeibSmooth
(){
public
double
getExNeibSmooth
(){
return
plExNeibSmooth
;
return
plExNeibSmooth
;
}
}
public
double
getConflRelax
(){
return
plConflRelax
;
}
public
boolean
getConflMerge
(){
return
plConflMerge
;
}
public
boolean
areWeakSimilar
(
public
boolean
areWeakSimilar
(
TilePlanes
.
PlaneData
plane1
,
// should belong to the same supertile (or be converted for one)
TilePlanes
.
PlaneData
plane1
,
// should belong to the same supertile (or be converted for one)
TilePlanes
.
PlaneData
plane2
,
TilePlanes
.
PlaneData
plane2
,
...
@@ -634,9 +656,11 @@ public class LinkPlanes {
...
@@ -634,9 +656,11 @@ public class LinkPlanes {
// reduce cost contribution for disparity space parameters for near objects, increase - for far
// reduce cost contribution for disparity space parameters for near objects, increase - for far
double
average_disp
=
0.5
*
(
plane1
.
getZxy
()[
0
]
+
plane2
.
getZxy
()[
0
]);
double
average_disp
=
0.5
*
(
plane1
.
getZxy
()[
0
]
+
plane2
.
getZxy
()[
0
]);
double
cost_near
=
average_disp
*
average_disp
/
(
average_disp
*
average_disp
+
this
.
plCostDist
*
this
.
plCostDist
);
double
cost_near
=
(
this
.
plCostDist
>
0.0
)
?
double
plCostKrq
=
this
.
plCostKrq
*
(
1.0
-
cost_near
);
(
2.0
*
average_disp
*
average_disp
/
(
average_disp
*
average_disp
+
this
.
plCostDist
*
this
.
plCostDist
))
:
double
plCostKrqEq
=
this
.
plCostKrqEq
*
(
1.0
-
cost_near
);
1.0
;
double
plCostKrq
=
this
.
plCostKrq
*
(
2.0
-
cost_near
);
double
plCostKrqEq
=
this
.
plCostKrqEq
*
(
2.0
-
cost_near
);
double
plCostWrq
=
this
.
plCostWrq
*
cost_near
;
double
plCostWrq
=
this
.
plCostWrq
*
cost_near
;
double
plCostWrqEq
=
this
.
plCostWrqEq
*
cost_near
;
double
plCostWrqEq
=
this
.
plCostWrqEq
*
cost_near
;
...
@@ -968,7 +992,7 @@ public class LinkPlanes {
...
@@ -968,7 +992,7 @@ public class LinkPlanes {
}
}
ImageDtt
.
startAndJoin
(
threads
);
ImageDtt
.
startAndJoin
(
threads
);
}
}
/*
public void setExclusiveLinks(
public void setExclusiveLinks(
final TilePlanes.PlaneData [][] planes,
final TilePlanes.PlaneData [][] planes,
final int debugLevel,
final int debugLevel,
...
@@ -981,7 +1005,8 @@ public class LinkPlanes {
...
@@ -981,7 +1005,8 @@ public class LinkPlanes {
debugLevel,
debugLevel,
dbg_X,
dbg_X,
dbg_Y);
dbg_Y);
}
}
*/
public
void
setExclusiveLinks
(
public
void
setExclusiveLinks
(
final
TilePlanes
.
PlaneData
[][]
planes
,
final
TilePlanes
.
PlaneData
[][]
planes
,
final
double
max_cost
,
final
double
max_cost
,
...
@@ -2668,6 +2693,7 @@ public class LinkPlanes {
...
@@ -2668,6 +2693,7 @@ public class LinkPlanes {
}
}
public
int
[][][]
filterPairsByConflicts
(
public
int
[][][]
filterPairsByConflicts
(
final
TilePlanes
.
PlaneData
[][]
planes
,
final
int
[][][]
merge_candidates
,
final
int
[][][]
merge_candidates
,
final
int
[][][]
conflicts
)
final
int
[][][]
conflicts
)
{
{
...
@@ -2685,6 +2711,20 @@ public class LinkPlanes {
...
@@ -2685,6 +2711,20 @@ public class LinkPlanes {
public
void
run
()
{
public
void
run
()
{
for
(
int
nsTile
=
ai
.
getAndIncrement
();
nsTile
<
nStiles
;
nsTile
=
ai
.
getAndIncrement
())
{
for
(
int
nsTile
=
ai
.
getAndIncrement
();
nsTile
<
nStiles
;
nsTile
=
ai
.
getAndIncrement
())
{
if
((
merge_candidates
[
nsTile
]
!=
null
)
&&
(
conflicts
[
nsTile
]
!=
null
))
{
if
((
merge_candidates
[
nsTile
]
!=
null
)
&&
(
conflicts
[
nsTile
]
!=
null
))
{
if
(
plConflSnglPair
){
int
num_planes
=
0
;
for
(
int
i
=
0
;
i
<
planes
[
nsTile
].
length
;
i
++){
if
(
planes
[
nsTile
][
i
]
!=
null
)
num_planes
++;
}
if
(
num_planes
>
2
)
{
continue
;
}
}
if
(
plConflSngl
&&
(
conflicts
[
nsTile
].
length
>
1
)){
continue
;
}
// TODO: maybe additionally check link costs correlation
HashSet
<
Point
>
pairs_set
=
new
HashSet
<
Point
>();
HashSet
<
Point
>
pairs_set
=
new
HashSet
<
Point
>();
for
(
int
i
=
0
;
i
<
merge_candidates
[
nsTile
].
length
;
i
++
){
for
(
int
i
=
0
;
i
<
merge_candidates
[
nsTile
].
length
;
i
++
){
if
(
merge_candidates
[
nsTile
][
i
]
!=
null
){
if
(
merge_candidates
[
nsTile
][
i
]
!=
null
){
...
...
src/main/java/TileProcessor.java
View file @
9b8a5082
...
@@ -3309,7 +3309,8 @@ public class TileProcessor {
...
@@ -3309,7 +3309,8 @@ public class TileProcessor {
// Just overwrite results of the previous method
// Just overwrite results of the previous method
lp
.
setExclusiveLinks
(
lp
.
setExclusiveLinks
(
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
lp
.
getExNeibCost
(),
// final double max_cost,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
@@ -3380,8 +3381,10 @@ public class TileProcessor {
...
@@ -3380,8 +3381,10 @@ public class TileProcessor {
// System.out.println("merge_cost_data.length = " + merge_cost_data.length);
// System.out.println("merge_cost_data.length = " + merge_cost_data.length);
lp
.
costSameTileConnectionsAlt
(
lp
.
costSameTileConnectionsAlt
(
5.0
,
// final double threshold,
//5.0, // final double threshold,
10.0
,
// final double threshold_nostar,
//10.0, // final double threshold_nostar,
lp
.
getMergeCostStar
(),
// relax_for_conflicts * 5.0, // final double threshold, //
lp
.
getMergeCostNoStar
(),
//relax_for_conflicts * 10.0, // final double threshold_nostar,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
merge_candidates
,
// final int [][][] merge_candidates,
merge_candidates
,
// final int [][][] merge_candidates,
...
@@ -3649,7 +3652,8 @@ public class TileProcessor {
...
@@ -3649,7 +3652,8 @@ public class TileProcessor {
//Just overwrite results of the previous method
//Just overwrite results of the previous method
lp
.
setExclusiveLinks
(
lp
.
setExclusiveLinks
(
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
lp
.
getExNeibCost
(),
// final double max_cost,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
@@ -3805,7 +3809,8 @@ public class TileProcessor {
...
@@ -3805,7 +3809,8 @@ public class TileProcessor {
// Just overwrite results of the previous method
// Just overwrite results of the previous method
lp
.
setExclusiveLinks
(
lp
.
setExclusiveLinks
(
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
lp
.
getExNeibCost
(),
// final double max_cost,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
@@ -3854,7 +3859,7 @@ public class TileProcessor {
...
@@ -3854,7 +3859,7 @@ public class TileProcessor {
TilePlanes
.
PlaneData
[][]
planes_mod
=
null
;
TilePlanes
.
PlaneData
[][]
planes_mod
=
null
;
// smooth planes (by averaging with neighbors and the "measured" one with variable "pull")
// smooth planes (by averaging with neighbors and the "measured" one with variable "pull")
double
relax_for_conflicts
=
1.5
;
// double relax_for_conflicts = lp.getConflRelax(); //
1.5;
if
(
clt_parameters
.
plIterations
>
0
)
{
if
(
clt_parameters
.
plIterations
>
0
)
{
for
(
int
num_merge_try
=
0
;
num_merge_try
<
10
;
num_merge_try
++
)
{
// smooth and merge
for
(
int
num_merge_try
=
0
;
num_merge_try
<
10
;
num_merge_try
++
)
{
// smooth and merge
...
@@ -3880,7 +3885,8 @@ public class TileProcessor {
...
@@ -3880,7 +3885,8 @@ public class TileProcessor {
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
lp
.
setExclusiveLinks
(
lp
.
setExclusiveLinks
(
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
2.5
,
//final double max_cost
// 2.5, //final double max_cost
lp
.
getExNeibCost
()*
lp
.
getExNeibSmooth
(),
// final double max_cost,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
@@ -3906,7 +3912,8 @@ public class TileProcessor {
...
@@ -3906,7 +3912,8 @@ public class TileProcessor {
// recalculate links? more smooth?
// recalculate links? more smooth?
lp
.
setExclusiveLinks
(
lp
.
setExclusiveLinks
(
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
2.5
,
//final double max_cost
// 2.5, //final double max_cost
lp
.
getExNeibCost
()*
lp
.
getExNeibSmooth
(),
// final double max_cost,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
@@ -3953,15 +3960,16 @@ public class TileProcessor {
...
@@ -3953,15 +3960,16 @@ public class TileProcessor {
1
);
// final int debugLevel)
1
);
// final int debugLevel)
int
[][][]
conflicting_candidates
=
lp
.
filterPairsByConflicts
(
int
[][][]
conflicting_candidates
=
lp
.
filterPairsByConflicts
(
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
merge_candidates
,
// final int [][][] merge_candidates,
merge_candidates
,
// final int [][][] merge_candidates,
conflicts0
);
// final int [][][] conflicts)
conflicts0
);
// final int [][][] conflicts)
// * Possible problem is that "normalizing" merge quality for low weights is not applicable for "star" plane that include neighhbors
// * Possible problem is that "normalizing" merge quality for low weights is not applicable for "star" plane that include neighhbors
// * Switch to a single "cost" function (costSameTileConnectionsAlt())
// * Switch to a single "cost" function (costSameTileConnectionsAlt())
// Still - how to merge stray tiles that do not have neighbors/star? Still merge them "old way" (costSameTileConnections()) if at least 1 does not
// Still - how to merge stray tiles that do not have neighbors/star? Still merge them "old way" (costSameTileConnections()) if at least 1 does not
// have a "star"
// have a "star"
lp
.
costSameTileConnections
(
lp
.
costSameTileConnections
(
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
merge_candidates
,
// final int [][][] merge_candidates,
merge_candidates
,
// final int [][][] merge_candidates,
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
...
@@ -3969,11 +3977,14 @@ public class TileProcessor {
...
@@ -3969,11 +3977,14 @@ public class TileProcessor {
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
// System.out.println("merge_cost_data.length = " + merge_cost_data.length);
// System.out.println("merge_cost_data.length = " + merge_cost_data.length);
lp
.
costSameTileConnectionsAlt
(
lp
.
costSameTileConnectionsAlt
(
5.0
,
// final double threshold,
//5.0, // final double threshold,
10.0
,
// final double threshold_nostar,
//10.0, // final double threshold_nostar,
lp
.
getMergeCostStar
(),
// relax_for_conflicts * 5.0, // final double threshold, //
lp
.
getMergeCostNoStar
(),
//relax_for_conflicts * 10.0, // final double threshold_nostar,
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
merge_candidates
,
// final int [][][] merge_candidates,
merge_candidates
,
// final int [][][] merge_candidates,
...
@@ -3981,7 +3992,7 @@ public class TileProcessor {
...
@@ -3981,7 +3992,7 @@ public class TileProcessor {
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
int
[][][]
merge_groups
=
lp
.
extractMergeSameTileGroups
(
int
[][][]
merge_groups
=
lp
.
extractMergeSameTileGroups
(
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes_mod
,
// final TilePlanes.PlaneData [][] planes,
merge_candidates
,
// final int [][][] merge_candidates,
merge_candidates
,
// final int [][][] merge_candidates,
...
@@ -3990,7 +4001,7 @@ public class TileProcessor {
...
@@ -3990,7 +4001,7 @@ public class TileProcessor {
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
int
num_removed_by_merging
=
st
.
applyMergePlanes
(
int
num_removed_by_merging
=
st
.
applyMergePlanes
(
st
.
planes
,
// final TilePlanes.PlaneData[][] planes,
st
.
planes
,
// final TilePlanes.PlaneData[][] planes,
merge_groups
,
// final int [][][] merge_groups,
merge_groups
,
// final int [][][] merge_groups,
...
@@ -4045,23 +4056,23 @@ public class TileProcessor {
...
@@ -4045,23 +4056,23 @@ public class TileProcessor {
// try to merge original (measured) planes, not smoothed ones
// try to merge original (measured) planes, not smoothed ones
lp
.
costSameTileConnections
(
lp
.
costSameTileConnections
(
// st.planes_mod,
// final TilePlanes.PlaneData [][] planes,
// st.planes_mod,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
conflicting_candidates
,
// final int [][][] merge_candidates,
conflicting_candidates
,
// final int [][][] merge_candidates,
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
relax_for_conflicts
,
// final double relax,
lp
.
getConflRelax
(),
//
relax_for_conflicts, // final double relax,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
// System.out.println("merge_cost_data.length = " + merge_cost_data.length);
// System.out.println("merge_cost_data.length = " + merge_cost_data.length);
lp
.
costSameTileConnectionsAlt
(
lp
.
costSameTileConnectionsAlt
(
// relax_for_conflicts, // final double relax,
// relax_for_conflicts, // final double relax,
relax_for_conflicts
*
5.0
,
// final double threshold, //
lp
.
getConflRelax
()
*
lp
.
getMergeCostStar
(),
//
relax_for_conflicts * 5.0, // final double threshold, //
relax_for_conflicts
*
10.0
,
// final double threshold_nostar,
lp
.
getConflRelax
()
*
lp
.
getMergeCostNoStar
(),
//
relax_for_conflicts * 10.0, // final double threshold_nostar,
// st.planes_mod, // final TilePlanes.PlaneData [][] planes,
// st.planes_mod, // final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
conflicting_candidates
,
// final int [][][] merge_candidates,
conflicting_candidates
,
// final int [][][] merge_candidates,
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
...
@@ -4070,12 +4081,12 @@ public class TileProcessor {
...
@@ -4070,12 +4081,12 @@ public class TileProcessor {
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
merge_groups
=
lp
.
extractMergeSameTileGroups
(
merge_groups
=
lp
.
extractMergeSameTileGroups
(
// st.planes_mod, // final TilePlanes.PlaneData [][] planes,
// st.planes_mod, // final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
merge_candidates
,
// final int [][][] merge_candidates,
conflicting_candidates
,
// final int [][][] merge_candidates,
plane_nooverlaps
,
// boolean [][][] plane_overlaps,
plane_nooverlaps
,
// boolean [][][] plane_overlaps,
relax_for_conflicts
,
// final double relax,
lp
.
getConflRelax
(),
//
relax_for_conflicts, // final double relax,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
@@ -4100,7 +4111,7 @@ public class TileProcessor {
...
@@ -4100,7 +4111,7 @@ public class TileProcessor {
break
;
break
;
}
}
}
}
// Do the same as in conditionSuperTiles before smoothing again
// Do the same as in conditionSuperTiles before smoothing again
...
@@ -4143,7 +4154,8 @@ public class TileProcessor {
...
@@ -4143,7 +4154,8 @@ public class TileProcessor {
// Just overwrite results of the previous method
// Just overwrite results of the previous method
lp
.
setExclusiveLinks
(
lp
.
setExclusiveLinks
(
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
st
.
planes
,
// final TilePlanes.PlaneData [][] planes,
2.5
,
//final double max_cost
// 2.5, //final double max_cost
lp
.
getExNeibCost
()*
lp
.
getExNeibSmooth
(),
// final double max_cost,
2
,
// -1, // debugLevel, // final int debugLevel)
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
...
...
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