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
18306caa
Commit
18306caa
authored
7 years ago
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using non-exclusive planes
parent
c4468ec2
master
cuda10.0
dct
foliage
gpu
lwir
lwir-distort
lwir-distort-test2
lwir16
lwir16-dbg1
orange
No related merge requests found
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
383 additions
and
55 deletions
+383
-55
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+10
-1
LinkPlanes.java
src/main/java/LinkPlanes.java
+313
-24
SuperTiles.java
src/main/java/SuperTiles.java
+16
-12
TilePlanes.java
src/main/java/TilePlanes.java
+42
-17
TileProcessor.java
src/main/java/TileProcessor.java
+2
-1
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
18306caa
...
...
@@ -2186,7 +2186,8 @@ public class EyesisCorrectionParameters {
public
double
plWeakWeight2
=
10.0
;
// Maximal weight of the weak plane to merge (second variant)
public
double
plWeakEigen2
=
0.05
;
// Maximal eigenvalue of the result of non-weighted merge (second variant)
public
double
plSumThick
=
1.2
;
// Do not merge if any sqrt of merged eigenvalue exceeds scaled sum of components
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 cenrter plane relative weight
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
plCutTail
=
1.4
;
// When merging with neighbors cut the tail that is worse than scaled best
...
...
@@ -2596,6 +2597,8 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"plWeakWeight2"
,
this
.
plWeakWeight2
+
""
);
properties
.
setProperty
(
prefix
+
"plWeakEigen2"
,
this
.
plWeakEigen2
+
""
);
properties
.
setProperty
(
prefix
+
"plSumThick"
,
this
.
plSumThick
+
""
);
properties
.
setProperty
(
prefix
+
"plNeNeibCost"
,
this
.
plNeNeibCost
+
""
);
properties
.
setProperty
(
prefix
+
"plNeOwn"
,
this
.
plNeOwn
+
""
);
properties
.
setProperty
(
prefix
+
"plMaxZRatio"
,
this
.
plMaxZRatio
+
""
);
properties
.
setProperty
(
prefix
+
"plMaxDisp"
,
this
.
plMaxDisp
+
""
);
...
...
@@ -2981,6 +2984,8 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"plWeakWeight2"
)!=
null
)
this
.
plWeakWeight2
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWeakWeight2"
));
if
(
properties
.
getProperty
(
prefix
+
"plWeakEigen2"
)!=
null
)
this
.
plWeakEigen2
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plWeakEigen2"
));
if
(
properties
.
getProperty
(
prefix
+
"plSumThick"
)!=
null
)
this
.
plSumThick
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plSumThick"
));
if
(
properties
.
getProperty
(
prefix
+
"plNeNeibCost"
)!=
null
)
this
.
plNeNeibCost
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plNeNeibCost"
));
if
(
properties
.
getProperty
(
prefix
+
"plNeOwn"
)!=
null
)
this
.
plNeOwn
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plNeOwn"
));
if
(
properties
.
getProperty
(
prefix
+
"plMaxZRatio"
)!=
null
)
this
.
plMaxZRatio
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plMaxZRatio"
));
if
(
properties
.
getProperty
(
prefix
+
"plMaxDisp"
)!=
null
)
this
.
plMaxDisp
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"plMaxDisp"
));
...
...
@@ -3395,6 +3400,8 @@ public class EyesisCorrectionParameters {
gd
.
addNumericField
(
"Maximal weight of the weak plane to merge (second variant)"
,
this
.
plWeakWeight2
,
6
);
gd
.
addNumericField
(
"Maximal eigenvalue of the result of non-weighted merge (second variant)"
,
this
.
plWeakEigen2
,
6
);
gd
.
addNumericField
(
"Do not merge if any sqrt of merged eigenvalue exceeds scaled sum of components"
,
this
.
plSumThick
,
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
.
addMessage
(
"--- ---"
);
gd
.
addNumericField
(
"Maximal ratio of Z to allow plane merging"
,
this
.
plMaxZRatio
,
6
);
...
...
@@ -3796,6 +3803,8 @@ public class EyesisCorrectionParameters {
this
.
plWeakWeight2
=
gd
.
getNextNumber
();
this
.
plWeakEigen2
=
gd
.
getNextNumber
();
this
.
plSumThick
=
gd
.
getNextNumber
();
this
.
plNeNeibCost
=
gd
.
getNextNumber
();
this
.
plNeOwn
=
gd
.
getNextNumber
();
this
.
plMaxZRatio
=
gd
.
getNextNumber
();
this
.
plMaxDisp
=
gd
.
getNextNumber
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/LinkPlanes.java
View file @
18306caa
This diff is collapsed.
Click to expand it.
src/main/java/SuperTiles.java
View file @
18306caa
...
...
@@ -1156,6 +1156,7 @@ public class SuperTiles{
int
num_p
=
(
selections
==
null
)
?
0
:
selections
.
length
;
int
num_pm
=
num_ml
*
num_p
;
int
num_pd
=
(
planes
!=
null
)
?
(
planes
.
length
-
LOWEST_PLANE
(
planes
.
length
))
:
0
;
final
double
[][]
lapWeight
=
getLapWeights
();
double
[][]
data
=
new
double
[
num_pm
+
3
*
num_ml
+
4
*
num_pd
][];
// 4* superTileSize*superTileSize];
for
(
int
np
=
0
;
np
<
num_p
;
np
++)
if
(
selections
[
np
]
!=
null
){
for
(
int
ml
=
0
;
ml
<
num_ml
;
ml
++)
if
((
disp_strength
[
ml
]!=
null
)
&&
(
selections
[
np
][
ml
]
!=
null
)){
...
...
@@ -1185,7 +1186,14 @@ public class SuperTiles{
}
}
data
[
num_pm
+
0
*
num_ml
+
ml
]
=
disp_strength
[
ml
][
0
];
data
[
num_pm
+
1
*
num_ml
+
ml
]
=
disp_strength
[
ml
][
1
];
data
[
num_pm
+
1
*
num_ml
+
ml
]
=
disp_strength
[
ml
][
1
].
clone
();
// undo lapweight to show
for
(
int
sty
=
0
;
sty
<
2
*
superTileSize
;
sty
++){
for
(
int
stx
=
0
;
stx
<
2
*
superTileSize
;
stx
++){
data
[
num_pm
+
1
*
num_ml
+
ml
][
stx
+
2
*
superTileSize
*
sty
]
/=
lapWeight
[
sty
][
stx
];
}
}
}
for
(
int
npd
=
0
;
npd
<
num_pd
;
npd
++)
if
(
planes
[
npd
+
LOWEST_PLANE
(
planes
.
length
)]
!=
null
){
double
[][]
ellipsoids
=
planes
[
npd
+
LOWEST_PLANE
(
planes
.
length
)].
getDoublePlaneDisparityStrength
(
...
...
@@ -2099,15 +2107,11 @@ public class SuperTiles{
// separately merge corresponding nonexclusiveStar and nonexclusiveStarEq of these planes - kit is not exact,
// but is needed just for a hint and is compatible with multithreading without recalculating other planes
TilePlanes
.
PlaneData
plane1Ex
=
these_planes
[
merge_planes
[
0
]].
getNonexclusiveStar
();
if
(
plane1Ex
==
null
)
plane1Ex
=
these_planes
[
merge_planes
[
0
]];
TilePlanes
.
PlaneData
plane1ExEq
=
these_planes
[
merge_planes
[
0
]].
getNonexclusiveStarEq
();
if
(
plane1ExEq
==
null
)
plane1ExEq
=
these_planes
[
merge_planes
[
0
]];
TilePlanes
.
PlaneData
plane1Ex
=
these_planes
[
merge_planes
[
0
]].
getNonexclusiveStarFb
();
TilePlanes
.
PlaneData
plane1ExEq
=
these_planes
[
merge_planes
[
0
]].
getNonexclusiveStarEqFb
();
TilePlanes
.
PlaneData
plane2Ex
=
these_planes
[
merge_planes
[
1
]].
getNonexclusiveStar
();
if
(
plane2Ex
==
null
)
plane2Ex
=
these_planes
[
merge_planes
[
1
]];
TilePlanes
.
PlaneData
plane2ExEq
=
these_planes
[
merge_planes
[
1
]].
getNonexclusiveStarEq
();
if
(
plane2ExEq
==
null
)
plane2ExEq
=
these_planes
[
merge_planes
[
1
]];
TilePlanes
.
PlaneData
plane2Ex
=
these_planes
[
merge_planes
[
1
]].
getNonexclusiveStarFb
();
TilePlanes
.
PlaneData
plane2ExEq
=
these_planes
[
merge_planes
[
1
]].
getNonexclusiveStarEqFb
();
TilePlanes
.
PlaneData
plane1NonExcl
=
plane1Ex
.
mergePlaneToThis
(
plane2Ex
,
// PlaneData otherPd,
...
...
@@ -5816,7 +5820,7 @@ public class SuperTiles{
int
[]
neibs
=
this_new_plane
.
getNeibBest
();
double
[][]
costs
=
new
double
[
neibs
.
length
][];
double
[]
weights
=
new
double
[
neibs
.
length
];
int
cost_index
=
1
;
int
cost_index
=
2
;
// overall cost
double
sum_rcosts
=
0.0
;
int
non_zero
=
0
;
for
(
int
dir
=
0
;
dir
<
neibs
.
length
;
dir
++)
if
(
neibs
[
dir
]
>=
0
)
{
...
...
@@ -5841,7 +5845,7 @@ public class SuperTiles{
sum_rcosts
+=
weights
[
dir
];
}
for
(
int
dir
=
0
;
dir
<
neibs
.
length
;
dir
++)
if
(
neibs
[
dir
]
>=
0
)
{
weights
[
dir
]
*=
non_zero
/
sum_rcosts
;
// average weight f
c
or active links will be 1.0
weights
[
dir
]
*=
non_zero
/
sum_rcosts
;
// average weight for active links will be 1.0
}
if
(
dl
>
0
)
{
for
(
int
dir
=
0
;
dir
<
8
;
dir
++)
if
(
costs
[
dir
]
!=
null
){
...
...
@@ -5856,7 +5860,7 @@ public class SuperTiles{
System
.
out
.
println
();
}
this_new_plane
=
this_new_plane
.
clone
();
// not to change weight!
this_new_plane
.
setWeight
(
0.0
);
//
double
num_merged
=
0.0
;
// double to add fractional pull weight of the center
for
(
int
dir
=
0
;
dir
<
neibs
.
length
;
dir
++){
...
...
This diff is collapsed.
Click to expand it.
src/main/java/TilePlanes.java
View file @
18306caa
...
...
@@ -199,7 +199,7 @@ public class TilePlanes {
public
String
getNeibString
()
{
if
(
neib_best
==
null
)
{
return
"[ undefined ]"
;
return
"[ undefined ]
"
;
}
String
s
=
"["
;
for
(
int
dir
=
0
;
dir
<
8
;
dir
++){
...
...
@@ -294,6 +294,12 @@ public class TilePlanes {
{
return
this
.
nonexclusiveStar
;
}
public
PlaneData
getNonexclusiveStarFb
()
// fallback to this plane if nonexclusiveStar is not available
{
if
(
this
.
nonexclusiveStar
!=
null
)
return
this
.
nonexclusiveStar
;
return
this
;
}
public
void
setNonexclusiveStar
(
PlaneData
pd
)
{
this
.
nonexclusiveStar
=
pd
;
...
...
@@ -303,6 +309,14 @@ public class TilePlanes {
{
return
this
.
nonexclusiveStarEq
;
}
public
PlaneData
getNonexclusiveStarEqFb
()
// fallback to this plane if nonexclusiveStarEq is not available
{
if
(
this
.
nonexclusiveStarEq
!=
null
)
return
this
.
nonexclusiveStarEq
;
return
this
;
}
public
void
setNonexclusiveStarEq
(
PlaneData
pd
)
{
this
.
nonexclusiveStarEq
=
pd
;
...
...
@@ -2792,7 +2806,7 @@ public class TilePlanes {
System
.
out
.
println
(
"Zero eigenvalue"
);
debugLevel
=
10
;
}
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"other_eig_vals"
);
other_eig_vals
.
print
(
8
,
6
);
System
.
out
.
println
(
"this_eig_vals"
);
...
...
@@ -2820,7 +2834,7 @@ public class TilePlanes {
Matrix
other_covar
=
other_eig_vectors
.
times
(
other_eig_vals
.
times
(
other_eig_vectors
.
transpose
()));
Matrix
this_covar
=
this_eig_vectors
.
times
(
this_eig_vals
.
times
(
this_eig_vectors
.
transpose
()));
Matrix
covar
=
(
new
Matrix
(
acovar
)).
times
(
other_fraction
*(
1.0
-
other_fraction
));
// only centers with all masses
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"other_covar"
);
other_covar
.
print
(
8
,
6
);
System
.
out
.
println
(
"this_covar"
);
...
...
@@ -2830,12 +2844,12 @@ public class TilePlanes {
}
covar
.
plusEquals
(
other_covar
.
times
(
other_fraction
));
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"covar with other_covar"
);
covar
.
print
(
8
,
6
);
}
covar
.
plusEquals
(
this_covar
.
times
(
1.0
-
other_fraction
));
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"covar with other_covar and this_covar"
);
covar
.
print
(
8
,
6
);
}
...
...
@@ -2847,7 +2861,7 @@ public class TilePlanes {
EigenvalueDecomposition
eig
=
covar
.
eig
();
// verify NaN - it gets stuck
// eig.getD().getArray(),
// eig.getV().getArray(),
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"eig.getV()"
);
eig
.
getV
().
print
(
8
,
6
);
System
.
out
.
println
(
"eig.getD()"
);
...
...
@@ -2985,7 +2999,7 @@ public class TilePlanes {
System
.
out
.
println
(
"Zero eigenvalue"
);
debugLevel
=
10
;
}
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"other_eig_vals"
);
other_eig_vals
.
print
(
8
,
6
);
System
.
out
.
println
(
"this_eig_vals"
);
...
...
@@ -3013,7 +3027,7 @@ public class TilePlanes {
Matrix
other_covar
=
other_eig_vectors
.
times
(
other_eig_vals
.
times
(
other_eig_vectors
.
transpose
()));
Matrix
this_covar
=
this_eig_vectors
.
times
(
this_eig_vals
.
times
(
this_eig_vectors
.
transpose
()));
Matrix
covar
=
(
new
Matrix
(
acovar
)).
times
(
other_fraction
*(
1.0
-
other_fraction
));
// only centers with all masses
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"other_covar"
);
other_covar
.
print
(
8
,
6
);
System
.
out
.
println
(
"this_covar"
);
...
...
@@ -3023,12 +3037,12 @@ public class TilePlanes {
}
covar
.
plusEquals
(
other_covar
.
times
(
other_fraction
));
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"covar with other_covar"
);
covar
.
print
(
8
,
6
);
}
covar
.
plusEquals
(
this_covar
.
times
(
1.0
-
other_fraction
));
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"covar with other_covar and this_covar"
);
covar
.
print
(
8
,
6
);
}
...
...
@@ -3040,7 +3054,7 @@ public class TilePlanes {
EigenvalueDecomposition
eig
=
covar
.
eig
();
// verify NaN - it gets stuck
// eig.getD().getArray(),
// eig.getV().getArray(),
if
(
debugLevel
>
0
)
{
if
(
debugLevel
>
1
)
{
System
.
out
.
println
(
"eig.getV()"
);
eig
.
getV
().
print
(
8
,
6
);
System
.
out
.
println
(
"eig.getD()"
);
...
...
@@ -3093,9 +3107,6 @@ public class TilePlanes {
for
(
int
i
=
0
;
i
<
3
;
i
++)
plane
[
2
][
i
]
=
-
plane
[
2
][
i
];
}
// PlaneData pd = this.clone(); // will copy selections too
// pd.invalidateCalculated(); // real world vectors
pd_partial
.
setWValues
(
eig_val
[
oindx
][
oindx
],
eig_val
[
vindx
][
vindx
],
eig_val
[
hindx
][
hindx
]);
// eigenvalues [0] - thickness, 2 other to detect skinny (poles)
pd_partial
.
setWVectors
(
plane
);
...
...
@@ -3114,6 +3125,20 @@ public class TilePlanes {
}
pd_partial
.
setWeight
(
new_weight
);
}
if
(
debugLevel
>
2
)
{
double
L1
=
getWValue
();
double
L2
=
otherPd
.
getWValue
();
double
W1
=
1.0
-
other_fraction
;
double
W2
=
other_fraction
;
double
Lav
=
(
L1
*
W1
+
L2
*
W2
)/(
W1
+
W2
);
double
L
=
pd_partial
.
getWValue
();
if
((
L
*
1.000001
<
Lav
)
||
(
debugLevel
>
0
)){
System
.
out
.
println
(
"========== mergePlaneToThisWorld(): L1="
+
L1
+
", L2 = "
+
L2
+
", W1="
+
W1
+
", W2="
+
W2
+
", Lav = "
+
Lav
+
", L="
+
L
+
", L-Lav="
+(
L
-
Lav
)+
", scale_other="
+
scale_other
+
", other_fraction="
+
other_fraction
);
System
.
out
.
println
();
}
}
return
pd_partial
;
}
...
...
@@ -4140,12 +4165,12 @@ public class TilePlanes {
}
}
mask
[
np
]
=
prev_used
[
np
].
clone
();
if
(
plDiscrGrown
>
0
)
{
if
(
plDiscrGrown
>
100
)
{
// >0
tileNeibs
.
growSelection
(
plDiscrGrown
,
// int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
mask
[
np
],
// boolean [] tiles,
null
);
// boolean [] prohibit)
}
else
if
(
plDiscrGrown
<
0
){
}
else
if
(
plDiscrGrown
<
100
){
//< 0
for
(
int
indx
=
0
;
indx
<
size2
;
indx
++)
mask
[
np
][
indx
]
=
true
;
}
...
...
@@ -4162,7 +4187,7 @@ public class TilePlanes {
}
}
}
if
(
plDiscrSteal
>
0
){
if
(
0
*
plDiscrSteal
>
0
){
// 0*
for
(
int
np
=
0
;
np
<
num_planes
;
np
++){
for
(
int
np1
=
0
;
np1
<
num_planes
;
np1
++)
if
(
np1
!=
np
){
for
(
int
indx
=
0
;
indx
<
size2
;
indx
++){
...
...
This diff is collapsed.
Click to expand it.
src/main/java/TileProcessor.java
View file @
18306caa
...
...
@@ -3307,6 +3307,7 @@ public class TileProcessor {
merge_candidates
,
// final int [][][] merge_candidates,
plane_nooverlaps
,
// final boolean [][][] valid_candidates, // will be updated
true
,
// final boolean merge_low_eigen, here it should be true
true
,
// final boolean useNonExcl, // consider only directions available for non-exclusive merges
2
,
// -1, // debugLevel, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
...
...
@@ -3766,7 +3767,7 @@ public class TileProcessor {
clt_parameters
.
plNormPow
,
// 0.0: 8 neighbors pull 8 times as 1, 1.0 - same as 1
Math
.
pow
(
10.0
,
-
clt_parameters
.
plPrecision
),
// final double maxDiff, // maximal change in any of the disparity values
clt_parameters
.
plPreferDisparity
,
1
,
// 0, // final int debugLevel)
0
,
//
1,// 0, // final int debugLevel)
clt_parameters
.
tileX
,
clt_parameters
.
tileY
);
}
else
{
...
...
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