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
8a2df8e5
Commit
8a2df8e5
authored
May 15, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made ortho-diag-ortho type on conflicts resolved
parent
241391f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
37 deletions
+96
-37
SuperTiles.java
src/main/java/SuperTiles.java
+56
-32
TileProcessor.java
src/main/java/TileProcessor.java
+40
-5
No files found.
src/main/java/SuperTiles.java
View file @
8a2df8e5
...
@@ -3754,9 +3754,14 @@ public class SuperTiles{
...
@@ -3754,9 +3754,14 @@ public class SuperTiles{
replacement_neibs
[
repl_indx2
][
np2
];
replacement_neibs
[
repl_indx2
][
np2
];
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
int
np3
=
neibs2
[
dir2
];
// planes[nsTile2][np2].getNeibBest(dir2);
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
if
((
np3
>=
0
)
&&
(
np3
!=
np0
)){
int
cls
=
conflicts_list
.
size
();
Conflict
conflict
=
new
Conflict
(
np0
,
np3
,
dir
/
2
);
Conflict
conflict
=
new
Conflict
(
np0
,
np3
,
dir
/
2
);
if
((
cls
==
0
)
||
!
conflicts_list
.
get
(
cls
-
1
).
combine
(
conflict
))
{
label_apply:
{
for
(
Conflict
conf_old:
conflicts_list
){
if
(
conf_old
.
combine
(
conflict
)){
break
label_apply
;
}
}
conflicts_list
.
add
(
conflict
);
conflicts_list
.
add
(
conflict
);
}
}
}
}
...
@@ -3783,11 +3788,15 @@ public class SuperTiles{
...
@@ -3783,11 +3788,15 @@ public class SuperTiles{
{
{
System
.
out
.
print
(
"Detected conflicts:"
);
System
.
out
.
print
(
"Detected conflicts:"
);
for
(
int
i
=
0
;
i
<
8
;
i
++){
for
(
int
i
=
0
;
i
<
8
;
i
++){
if
(
conflict_stats
[
i
]
>
0
)
System
.
out
.
print
(
" type "
+
i
+
": "
+
conflict_stats
[
i
]);
if
(
conflict_stats
[
i
]
!=
0
)
System
.
out
.
print
(
" type "
+
i
+
": "
+
conflict_stats
[
i
]);
}
}
System
.
out
.
println
(
" number of incompatible triangles = "
+
conflict_stats
[
8
]+
if
(
conflict_stats
[
8
]
!=
0
)
{
" number of dual triangles = "
+
conflict_stats
[
9
]);
System
.
out
.
print
(
" number of incompatible triangles = "
+
conflict_stats
[
8
]);
}
if
(
conflict_stats
[
9
]
!=
0
)
{
System
.
out
.
print
(
" number of dual triangles = "
+
conflict_stats
[
9
]);
}
System
.
out
.
println
();
}
}
/**
/**
...
@@ -4094,29 +4103,14 @@ public class SuperTiles{
...
@@ -4094,29 +4103,14 @@ public class SuperTiles{
tnSurface
,
tnSurface
,
preferDisparity
,
preferDisparity
,
debugLevel
);
debugLevel
);
int
[][][]
neibs
=
neibs_prev
.
clone
();
for
(
int
i
=
0
;
i
<
neibs
.
length
;
i
++)
if
(
neibs_prev
[
i
]
!=
null
){
neibs
[
i
]
=
neibs_prev
[
i
].
clone
();
for
(
int
j
=
0
;
j
<
neibs
[
i
].
length
;
j
++)
if
(
neibs_prev
[
i
][
j
]
!=
null
){
neibs
[
i
][
j
]
=
neibs_prev
[
i
][
j
].
clone
();
}
}
int
[][][]
conflicts_old
=
new
int
[
nsTiles
.
length
][][];
int
[][][]
conflicts_old
=
new
int
[
nsTiles
.
length
][][];
// int [][][] conflicts_new = new int [nsTiles.length][][];
for
(
int
isTile
=
0
;
isTile
<
nsTiles
.
length
;
isTile
++){
for
(
int
isTile
=
0
;
isTile
<
nsTiles
.
length
;
isTile
++){
conflicts_old
[
isTile
]
=
detectTriangularTileConflicts
(
conflicts_old
[
isTile
]
=
detectTriangularTileConflicts
(
nsTiles
[
isTile
],
// int nsTile0,
nsTiles
[
isTile
],
// int nsTile0,
replacement_tiles
,
//HashMap<Integer,Integer> replacement_tiles, //
replacement_tiles
,
//HashMap<Integer,Integer> replacement_tiles, //
neibs_prev
,
// int [][][] replacement_neibs,
neibs_prev
,
// int [][][] replacement_neibs,
tnSurface
);
// TileSurface.TileNeibs tnSurface)
tnSurface
);
// TileSurface.TileNeibs tnSurface)
/*
conflicts_new[isTile] = detectTriangularTileConflicts(
nsTiles[isTile], // int nsTile0,
replacement_tiles, //HashMap<Integer,Integer> replacement_tiles, //
neibs, // int [][][] replacement_neibs,
tnSurface); // TileSurface.TileNeibs tnSurface)
*/
}
}
if
(
debugLevel
>
1
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"Involved supertiles:"
);
System
.
out
.
println
(
"Involved supertiles:"
);
...
@@ -4162,7 +4156,7 @@ public class SuperTiles{
...
@@ -4162,7 +4156,7 @@ public class SuperTiles{
variant_conflicts
[
variant
][
isTile
]
=
detectTriangularTileConflicts
(
variant_conflicts
[
variant
][
isTile
]
=
detectTriangularTileConflicts
(
nsTiles
[
isTile
],
// int nsTile0,
nsTiles
[
isTile
],
// int nsTile0,
replacement_tiles
,
//HashMap<Integer,Integer> replacement_tiles, //
replacement_tiles
,
//HashMap<Integer,Integer> replacement_tiles, //
neibs
,
// int [][][] replacement_neibs,
neibs
_vars
[
variant
],
// neibs
, // int [][][] replacement_neibs,
tnSurface
);
// TileSurface.TileNeibs tnSurface)
tnSurface
);
// TileSurface.TileNeibs tnSurface)
}
}
int
[]
conflict_stats_new
=
getNumConflicts
(
int
[]
conflict_stats_new
=
getNumConflicts
(
...
@@ -4174,14 +4168,14 @@ public class SuperTiles{
...
@@ -4174,14 +4168,14 @@ public class SuperTiles{
variant_conflicts_stats
[
variant
][
i
]
=
conflict_stats_new
[
i
]-
conflict_stats_old
[
i
];
variant_conflicts_stats
[
variant
][
i
]
=
conflict_stats_new
[
i
]-
conflict_stats_old
[
i
];
}
}
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
-
1
)
{
System
.
out
.
println
(
"resolveMultiTriangularConflict(): resolving conflict for tile "
+
nsTile
+
System
.
out
.
println
(
"resolveMultiTriangularConflict(): resolving conflict for tile "
+
nsTile
+
", nl1 = "
+
nl1
+
", nl1 = "
+
nl1
+
", nl2 = "
+
nl2
+
", nl2 = "
+
nl2
+
", dir_mask = "
+
dir_mask
+
" variant = "
+
variant
+
" improvement (negative diff) = "
+
variant_costs_diff
[
variant
]);
", dir_mask = "
+
dir_mask
+
" variant = "
+
variant
+
" improvement (negative diff) = "
+
variant_costs_diff
[
variant
]);
}
}
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
-
1
)
{
System
.
out
.
print
(
"Conflicts difference after resolution:"
);
System
.
out
.
print
(
"Conflicts difference after resolution:"
);
printConflictSummary
(
variant_conflicts_stats
[
variant
]);
printConflictSummary
(
variant_conflicts_stats
[
variant
]);
}
}
...
@@ -4193,19 +4187,30 @@ public class SuperTiles{
...
@@ -4193,19 +4187,30 @@ public class SuperTiles{
int
num_worse
=
0
;
int
num_worse
=
0
;
int
num_better
=
0
;
int
num_better
=
0
;
for
(
int
i
=
0
;
i
<
variant_conflicts_stats
[
variant
].
length
;
i
++){
for
(
int
i
=
0
;
i
<
variant_conflicts_stats
[
variant
].
length
;
i
++){
if
(
variant_conflicts_stats
[
variant
][
i
]
<
0
)
{
if
(
variant_conflicts_stats
[
variant
][
i
]
<
0
)
{
num_better
+=
1
;
num_better
+=
1
;
}
else
if
(
variant_conflicts_stats
[
variant
][
i
]
<
0
)
{
}
else
if
(
variant_conflicts_stats
[
variant
][
i
]
>
0
)
{
num_worse
+=
1
;
num_worse
+=
1
;
}
}
}
}
num_better_worse
[
variant
][
0
]
=
num_better
;
num_better_worse
[
variant
][
0
]
=
num_better
;
num_better_worse
[
variant
][
1
]
=
num_worse
;
num_better_worse
[
variant
][
1
]
=
num_worse
;
if
((
num_worse
==
0
)
&&
((
best_variant
<
0
)
||
(
variant_costs_diff
[
variant
]
<
variant_costs_diff
[
variant
]))){
if
((
num_worse
==
0
)
&&
(
variant_costs_diff
[
variant
]
<=
dblTriLoss
)
&&
// not too worse
((
variant_costs_diff
[
variant
]
<
0
)
||
(
num_better
>
0
))
&&
// either
((
best_variant
<
0
)
||
(
num_better_worse
[
variant
][
0
]
>
num_better_worse
[
best_variant
][
0
])
||
((
num_better_worse
[
variant
][
0
]
==
num_better_worse
[
best_variant
][
0
])
&&
(
variant_costs_diff
[
variant
]
<
variant_costs_diff
[
best_variant
])))){
best_variant
=
variant
;
best_variant
=
variant
;
}
}
}
}
if
(
best_variant
<
0
){
if
(
debugLevel
>
1
){
System
.
out
.
println
(
"resolveMultiTriangularConflict(): for tile "
+
nsTile
);
}
if
((
best_variant
<
0
)
||
(
variant_costs_diff
[
best_variant
]
>
dblTriLoss
)){
if
(
debugLevel
>
-
1
)
{
if
(
debugLevel
>
-
1
)
{
System
.
out
.
println
(
"resolveMultiTriangularConflict(): FAILED find a sutable solution for tile "
+
nsTile
+
System
.
out
.
println
(
"resolveMultiTriangularConflict(): FAILED find a sutable solution for tile "
+
nsTile
+
", nl1 = "
+
nl1
+
", nl1 = "
+
nl1
+
...
@@ -4218,18 +4223,33 @@ public class SuperTiles{
...
@@ -4218,18 +4223,33 @@ public class SuperTiles{
System
.
out
.
println
(
"resolveMultiTriangularConflict(): SUCCESS to find a sutable solution for tile "
+
nsTile
+
System
.
out
.
println
(
"resolveMultiTriangularConflict(): SUCCESS to find a sutable solution for tile "
+
nsTile
+
", nl1 = "
+
nl1
+
", nl1 = "
+
nl1
+
", nl2 = "
+
nl2
+
", nl2 = "
+
nl2
+
", dir_mask = "
+
dir_mask
+
"
o
f "
+
neibs_vars
.
length
+
" variants - use variant # "
+
best_variant
+
", dir_mask = "
+
dir_mask
+
"
. O
f "
+
neibs_vars
.
length
+
" variants - use variant # "
+
best_variant
+
" cost difference (negative) = "
+
variant_costs_diff
[
best_variant
]+
" num conflict reductions = "
+
num_better_worse
[
best_variant
][
0
]);
" cost difference (negative) = "
+
variant_costs_diff
[
best_variant
]+
" num conflict reductions = "
+
num_better_worse
[
best_variant
][
0
]);
System
.
out
.
print
(
"Conflicts number change per type: "
);
System
.
out
.
print
(
"Conflicts number change per type: "
);
printConflictSummary
(
variant_conflicts_stats
[
best_variant
]);
printConflictSummary
(
variant_conflicts_stats
[
best_variant
]);
System
.
out
.
print
(
"Conflicts before resolution: "
);
System
.
out
.
print
(
"Conflicts before resolution: "
);
printConflictSummary
(
conflict_stats_old
);
printConflictSummary
(
conflict_stats_old
);
// update statistics
for
(
int
i
=
0
;
i
<
conflict_stats
.
length
;
i
++){
conflict_stats
[
i
]
+=
variant_conflicts_stats
[
best_variant
][
i
];
}
// update conflict
for
(
int
i
=
0
;
i
<
nsTiles
.
length
;
i
++){
conflicts
[
nsTiles
[
i
]]=
variant_conflicts
[
best_variant
][
i
];
}
// apply resolution
for
(
int
i
=
0
;
i
<
mod_supertiles
.
length
;
i
++){
for
(
int
nl
=
0
;
nl
<
neibs_vars
[
best_variant
][
i
].
length
;
nl
++)
if
(
neibs_vars
[
best_variant
][
i
][
nl
]
!=
null
){
planes
[
mod_supertiles
[
i
]][
nl
].
setNeibBest
(
neibs_vars
[
best_variant
][
i
][
nl
]);
}
}
}
}
}
}
return
true
;
return
true
;
}
}
//
/**
/**
* Generate variants for changing connections while preserving number of connections between each pair of tiles
* Generate variants for changing connections while preserving number of connections between each pair of tiles
* each variant is free of own conflicts, but may lead to conflicts on other layers or tiles
* each variant is free of own conflicts, but may lead to conflicts on other layers or tiles
...
@@ -4360,7 +4380,7 @@ public class SuperTiles{
...
@@ -4360,7 +4380,7 @@ public class SuperTiles{
neib_var
[
4
][
nl2
][
dir_f
]
=
selection
[
dir4
][
0
]
?
layers
[
dir4
][
0
]
:
other_layer
;
neib_var
[
4
][
nl2
][
dir_f
]
=
selection
[
dir4
][
0
]
?
layers
[
dir4
][
0
]
:
other_layer
;
neib_var
[
dir4
][
layers
[
dir4
][
0
]][
dir_r
]
=
selection
[
dir4
][
0
]
?
nl2
:
nl1
;
neib_var
[
dir4
][
layers
[
dir4
][
0
]][
dir_r
]
=
selection
[
dir4
][
0
]
?
nl2
:
nl1
;
if
(
other_layer
>=
0
)
{
// only if it is connected
if
(
other_layer
>=
0
)
{
// only if it is connected
neib_var
s
[
var_num
][
dir4
][
other_layer
][
dir_r
]
=
selection
[
dir4
][
0
]
?
nl1
:
nl2
;
neib_var
[
dir4
][
other_layer
][
dir_r
]
=
selection
[
dir4
][
0
]
?
nl1
:
nl2
;
// null
}
}
}
}
// diagonal connections - some make this variant invalid
// diagonal connections - some make this variant invalid
...
@@ -4467,9 +4487,13 @@ public class SuperTiles{
...
@@ -4467,9 +4487,13 @@ public class SuperTiles{
}
}
}
}
// trim neib_vars
// trim neib_vars
if
(
debugLevel
>
-
1
){
System
.
out
.
println
(
"getTriangularResolutionVariants() nsTile = "
+
nsTile
+
" ACTUAL variants: "
+
var_num
);
}
if
(
var_num
==
neib_vars
.
length
)
return
neib_vars
;
if
(
var_num
==
neib_vars
.
length
)
return
neib_vars
;
int
[][][][]
neib_vars_trimmed
=
new
int
[
var_num
][][][];
int
[][][][]
neib_vars_trimmed
=
new
int
[
var_num
][][][];
for
(
int
i
=
0
;
i
<
var_num
;
i
++
)
neib_vars_trimmed
[
i
]
=
neib_vars
[
i
];
for
(
int
i
=
0
;
i
<
var_num
;
i
++
)
neib_vars_trimmed
[
i
]
=
neib_vars
[
i
];
return
neib_vars_trimmed
;
return
neib_vars_trimmed
;
}
}
...
@@ -4971,7 +4995,7 @@ public class SuperTiles{
...
@@ -4971,7 +4995,7 @@ public class SuperTiles{
diagonalWeight
,
diagonalWeight
,
tnSurface
,
tnSurface
,
preferDisparity
,
preferDisparity
,
debugLevel
);
-
1
);
//
debugLevel);
}
}
}
else
{
}
else
{
val_weights
[
isTile
][
nl
]
=
null
;
val_weights
[
isTile
][
nl
]
=
null
;
...
...
src/main/java/TileProcessor.java
View file @
8a2df8e5
...
@@ -3452,7 +3452,19 @@ public class TileProcessor {
...
@@ -3452,7 +3452,19 @@ public class TileProcessor {
if (dual_tri_results[0] == 0) break;
if (dual_tri_results[0] == 0) break;
}
}
*/
*/
for
(
int
pass
=
0
;
pass
<
1
;
pass
++)
{
for
(
int
pass
=
0
;
pass
<
10
;
pass
++)
{
int
[]
dual_tri_results
=
st
.
resolveDualTriangularConflicts
(
conflicts0
,
// int [][][] conflicts,
conflicts0_stats
,
clt_parameters
.
plMaxEigen
,
clt_parameters
.
plStarOrtho
,
// double orthoWeight,
clt_parameters
.
plStarDiag
,
// double diagonalWeight,
clt_parameters
.
plDblTriLoss
,
// double diagonalWeight,
clt_parameters
.
plPreferDisparity
,
1
,
// final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
System
.
out
.
println
(
"Pass "
+(
pass
+
1
)+
": dual_tri_results (success/failures) = "
+
dual_tri_results
[
0
]+
" / "
+
dual_tri_results
[
1
]);
int
[]
conflict_resoultion_results
=
st
.
resolveMultiTriangularConflicts
(
int
[]
conflict_resoultion_results
=
st
.
resolveMultiTriangularConflicts
(
conflicts0
,
// int [][][] conflicts,
conflicts0
,
// int [][][] conflicts,
conflicts0_stats
,
conflicts0_stats
,
...
@@ -3464,15 +3476,38 @@ public class TileProcessor {
...
@@ -3464,15 +3476,38 @@ public class TileProcessor {
1
,
// final int debugLevel)
1
,
// final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
clt_parameters
.
tileY
);
System
.
out
.
println
(
"Pass "
+(
pass
+
1
)+
":
dual
_tri_results (success/failures) = "
+
conflict_resoultion_results
[
0
]+
" / "
+
conflict_resoultion_results
[
1
]);
System
.
out
.
println
(
"Pass "
+(
pass
+
1
)+
":
multi
_tri_results (success/failures) = "
+
conflict_resoultion_results
[
0
]+
" / "
+
conflict_resoultion_results
[
1
]);
if
(
conflict_resoultion_results
[
0
]
==
0
)
break
;
if
(
(
dual_tri_results
[
0
]
==
0
)
&&(
conflict_resoultion_results
[
0
]
==
0
)
)
break
;
}
}
int
[]
conflicts1_stats
=
st
.
getNumConflicts
(
int
[]
conflicts1_stats
=
st
.
getNumConflicts
(
conflicts0
,
conflicts0
,
-
1
);
// debugLevel);
1
);
//
-1); // debugLevel);
st
.
printConflictSummary
(
conflicts1_stats
);
st
.
printConflictSummary
(
conflicts1_stats
);
/*
for (int pass = 0; pass < 10; pass ++) {
int [] dual_tri_results = st. resolveDualTriangularConflicts(
conflicts0, // int [][][] conflicts,
conflicts0_stats,
clt_parameters.plMaxEigen,
clt_parameters.plStarOrtho, // double orthoWeight,
clt_parameters.plStarDiag, // double diagonalWeight,
clt_parameters.plDblTriLoss, // double diagonalWeight,
clt_parameters.plPreferDisparity,
1, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
System.out.println("Pass "+(pass+1)+": dual_tri_results (success/failures) = "+dual_tri_results[0]+" / "+dual_tri_results[1]);
if (dual_tri_results[0] == 0) break;
}
conflicts1_stats = st.getNumConflicts(
conflicts0,
1); // -1); // debugLevel);
st.printConflictSummary(conflicts1_stats);
*/
/*
/*
// re-checking conflicts (make sure update is correct)
// re-checking conflicts (make sure update is correct)
int [][][] conflicts1r = st.detectTriangularConflicts(
int [][][] conflicts1r = st.detectTriangularConflicts(
...
...
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