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
Expand all
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 {
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
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
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
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
plMaxDisp
=
0.6
;
// Maximal disparity of one of the planes to apply maximal ratio
...
...
@@ -2616,8 +2618,9 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"plNeOwn"
,
this
.
plNeOwn
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibCost"
,
this
.
plExNeibCost
+
""
);
properties
.
setProperty
(
prefix
+
"plExNeibCostSngl"
,
this
.
plExNeibCostSngl
+
""
);
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
+
"plConflRelax"
,
this
.
plConflRelax
+
""
);
...
...
@@ -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
+
"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
+
"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
+
"plConflRelax"
)!=
null
)
this
.
plConflRelax
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plConflRelax"
));
...
...
@@ -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, 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 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
(
"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
.
addCheckbox
(
"Try to merge conflicting planes"
,
this
.
plConflMerge
);
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 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
.
addNumericField
(
"Maximal ratio of Z to allow plane merging"
,
this
.
plMaxZRatio
,
6
);
...
...
@@ -3858,8 +3863,9 @@ public class EyesisCorrectionParameters {
this
.
plNeOwn
=
gd
.
getNextNumber
();
this
.
plExNeibCost
=
gd
.
getNextNumber
();
this
.
plExNeibCostSngl
=
gd
.
getNextNumber
();
this
.
plExNeibSmooth
=
gd
.
getNextNumber
();
this
.
plMergeCostStar
=
gd
.
getNextNumber
();
this
.
plMergeCost
=
gd
.
getNextNumber
();
this
.
plConflMerge
=
gd
.
getNextBoolean
();
this
.
plConflRelax
=
gd
.
getNextNumber
();
...
...
src/main/java/LinkPlanes.java
View file @
9b8a5082
...
...
@@ -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
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
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
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
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 {
plNeNeibCost
=
clt_parameters
.
plNeNeibCost
;
plNeOwn
=
clt_parameters
.
plNeOwn
;
plExNeibCost
=
clt_parameters
.
plExNeibCost
;
plExNeibCostSngl
=
clt_parameters
.
plExNeibCostSngl
;
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
;
plCostKrq
=
clt_parameters
.
plCostKrq
;
plCostKrqEq
=
clt_parameters
.
plCostKrqEq
;
...
...
@@ -135,13 +146,24 @@ public class LinkPlanes {
public
double
getExNeibCost
(){
return
plExNeibCost
;
}
public
double
ExNeibCostSngl
(){
return
plExNeibCostSngl
;
public
double
getMergeCostStar
(){
return
plMergeCostStar
;
}
public
double
getMergeCostNoStar
(){
return
plMergeCost
;
}
public
double
getExNeibSmooth
(){
return
plExNeibSmooth
;
}
public
double
getConflRelax
(){
return
plConflRelax
;
}
public
boolean
getConflMerge
(){
return
plConflMerge
;
}
public
boolean
areWeakSimilar
(
TilePlanes
.
PlaneData
plane1
,
// should belong to the same supertile (or be converted for one)
TilePlanes
.
PlaneData
plane2
,
...
...
@@ -634,9 +656,11 @@ public class LinkPlanes {
// 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
cost_near
=
average_disp
*
average_disp
/
(
average_disp
*
average_disp
+
this
.
plCostDist
*
this
.
plCostDist
);
double
plCostKrq
=
this
.
plCostKrq
*
(
1.0
-
cost_near
);
double
plCostKrqEq
=
this
.
plCostKrqEq
*
(
1.0
-
cost_near
);
double
cost_near
=
(
this
.
plCostDist
>
0.0
)
?
(
2.0
*
average_disp
*
average_disp
/
(
average_disp
*
average_disp
+
this
.
plCostDist
*
this
.
plCostDist
))
:
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
plCostWrqEq
=
this
.
plCostWrqEq
*
cost_near
;
...
...
@@ -968,7 +992,7 @@ public class LinkPlanes {
}
ImageDtt
.
startAndJoin
(
threads
);
}
/*
public void setExclusiveLinks(
final TilePlanes.PlaneData [][] planes,
final int debugLevel,
...
...
@@ -981,7 +1005,8 @@ public class LinkPlanes {
debugLevel,
dbg_X,
dbg_Y);
}
}
*/
public
void
setExclusiveLinks
(
final
TilePlanes
.
PlaneData
[][]
planes
,
final
double
max_cost
,
...
...
@@ -2668,6 +2693,7 @@ public class LinkPlanes {
}
public
int
[][][]
filterPairsByConflicts
(
final
TilePlanes
.
PlaneData
[][]
planes
,
final
int
[][][]
merge_candidates
,
final
int
[][][]
conflicts
)
{
...
...
@@ -2685,6 +2711,20 @@ public class LinkPlanes {
public
void
run
()
{
for
(
int
nsTile
=
ai
.
getAndIncrement
();
nsTile
<
nStiles
;
nsTile
=
ai
.
getAndIncrement
())
{
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
>();
for
(
int
i
=
0
;
i
<
merge_candidates
[
nsTile
].
length
;
i
++
){
if
(
merge_candidates
[
nsTile
][
i
]
!=
null
){
...
...
src/main/java/TileProcessor.java
View file @
9b8a5082
This diff is collapsed.
Click to expand it.
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