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
c8348852
Commit
c8348852
authored
Jun 30, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correcting extrinsics after being changed
parent
79689dc1
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
885 additions
and
72 deletions
+885
-72
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+80
-8
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+93
-32
ImageDtt.java
src/main/java/ImageDtt.java
+2
-2
LinkPlanes.java
src/main/java/LinkPlanes.java
+1
-1
QuadCLT.java
src/main/java/QuadCLT.java
+605
-12
TileAssignment.java
src/main/java/TileAssignment.java
+97
-14
TileProcessor.java
src/main/java/TileProcessor.java
+7
-3
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
c8348852
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
c8348852
This diff is collapsed.
Click to expand it.
src/main/java/ImageDtt.java
View file @
c8348852
...
@@ -1002,7 +1002,7 @@ public class ImageDtt {
...
@@ -1002,7 +1002,7 @@ public class ImageDtt {
final
int
window_type
,
final
int
window_type
,
final
double
[][]
shiftXY
,
// [port]{shiftX,shiftY}
final
double
[][]
shiftXY
,
// [port]{shiftX,shiftY}
final
double
[][][]
fine_corr
,
// quadratic cofficients for fine correction (or null)
final
double
[][][]
fine_corr
,
// quadratic cofficients for fine correction (or null)
final
double
corr_magic_scale
,
// stil
not understood coefficent that reduces reported disparity value. Seems to be around 8.
5
final
double
corr_magic_scale
,
// stil
l not understood coefficient that reduces reported disparity value. Seems to be around 0.8
5
final
double
shiftX
,
// shift image horizontally (positive - right) - just for testing
final
double
shiftX
,
// shift image horizontally (positive - right) - just for testing
final
double
shiftY
,
// shift image vertically (positive - down)
final
double
shiftY
,
// shift image vertically (positive - down)
final
int
debug_tileX
,
final
int
debug_tileX
,
...
@@ -1595,7 +1595,7 @@ public class ImageDtt {
...
@@ -1595,7 +1595,7 @@ public class ImageDtt {
clt_mismatch
[
3
*
pair
+
1
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
pair
+
1
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
pair
+
2
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
pair
+
2
][
tIndex
]
=
Double
.
NaN
;
}
else
{
}
else
{
double
[]
corr_max_XYmp
=
getMaxXYCm
(
// get fractiona center as a "center of mass" inside circle/square from the integer max
double
[]
corr_max_XYmp
=
getMaxXYCm
(
// get fractiona
l
center as a "center of mass" inside circle/square from the integer max
tcorr_partial
[
pair
][
numcol
],
// [data_size * data_size]
tcorr_partial
[
pair
][
numcol
],
// [data_size * data_size]
corr_size
,
corr_size
,
icorr_max
,
// integer center coordinates (relative to top left)
icorr_max
,
// integer center coordinates (relative to top left)
...
...
src/main/java/LinkPlanes.java
View file @
c8348852
...
@@ -2412,7 +2412,7 @@ public class LinkPlanes {
...
@@ -2412,7 +2412,7 @@ public class LinkPlanes {
if
(
dl
>
2
){
if
(
dl
>
2
){
System
.
out
.
println
(
"weakForeground(): nsTile="
+
nsTile
);
System
.
out
.
println
(
"weakForeground(): nsTile="
+
nsTile
);
}
}
int
n_planes
=
planes
[
nsTile
].
length
;
//
int n_planes = planes[nsTile].length;
weak_fgnd
[
nsTile
]
=
new
boolean
[
merge_candidates
[
nsTile
].
length
];
weak_fgnd
[
nsTile
]
=
new
boolean
[
merge_candidates
[
nsTile
].
length
];
for
(
int
nPair
=
0
;
nPair
<
merge_candidates
[
nsTile
].
length
;
nPair
++)
{
for
(
int
nPair
=
0
;
nPair
<
merge_candidates
[
nsTile
].
length
;
nPair
++)
{
int
[]
pair
=
merge_candidates
[
nsTile
][
nPair
];
int
[]
pair
=
merge_candidates
[
nsTile
][
nPair
];
...
...
src/main/java/QuadCLT.java
View file @
c8348852
This diff is collapsed.
Click to expand it.
src/main/java/TileAssignment.java
View file @
c8348852
...
@@ -60,6 +60,9 @@ public class TileAssignment {
...
@@ -60,6 +60,9 @@ public class TileAssignment {
private
double
strengthDiffPwr
;
// = 0.25; // Strength power when calculating disparity error
private
double
strengthDiffPwr
;
// = 0.25; // Strength power when calculating disparity error
private
double
strengthBestPwr
;
// = 0.0; // Strength power when calculating disparity error over best
private
double
strengthBestPwr
;
// = 0.0; // Strength power when calculating disparity error over best
private
double
strengthDiff9Pwr
;
// = 0.5; // Strength power when calculating disparity error for group of 9
private
double
strengthDiff9Pwr
;
// = 0.5; // Strength power when calculating disparity error for group of 9
private
double
taColSigma
;
// = 1.5; // Gaussian sigma to blur color difference between tiles along each direction
private
double
taColFraction
;
// = 0.3; // Relative amount of the blurred color difference in the mixture
private
double
shrinkWeakFgnd
=
0.5
;
// 0.5; //reduce cost of multiple weak_fgnd links of the same tile
private
double
shrinkWeakFgnd
=
0.5
;
// 0.5; //reduce cost of multiple weak_fgnd links of the same tile
private
double
shrinkColor
=
0.5
;
// 0.0; //reduce cost of surface transitions w/o color change
private
double
shrinkColor
=
0.5
;
// 0.0; //reduce cost of surface transitions w/o color change
...
@@ -91,11 +94,11 @@ public class TileAssignment {
...
@@ -91,11 +94,11 @@ public class TileAssignment {
this
.
empty
=
1.0
/
0.35833
;
// 0.71715;
this
.
empty
=
1.0
/
0.35833
;
// 0.71715;
this
.
nolink
=
1.0
/
0.83739
;
// 0.95952; // 1.50705;
this
.
nolink
=
1.0
/
0.83739
;
// 0.95952; // 1.50705;
this
.
swtch
=
1.0
/
0.07604
;
// 0.05172; // 0.59474;
this
.
swtch
=
1.0
/
0.07604
;
// 0.05172; // 0.59474;
this
.
color
=
1.0
/
3.34968
;
// 0.21458; // 0.19294; // 2.25763;
this
.
color
=
1.0
/
6.69936
;
//
3.34968; // 0.21458; // 0.19294; // 2.25763;
this
.
diff
=
1.0
/
0.11879
;
// 0.11039; // 1.94213;
this
.
diff
=
1.0
/
0.11879
;
// 0.11039; // 1.94213;
this
.
diff_best
=
1.0
/
0.02831
;
// 0.00628; // 0.06731;
this
.
diff_best
=
1.0
/
0.02831
;
// 0.00628; // 0.06731;
this
.
diff9
=
1.0
/
0.04064
;
// 0.01350; // 1.09087;
this
.
diff9
=
1.0
/
0.04064
;
// 0.01350; // 1.09087;
this
.
weak_fgnd
=
1.0
/
1.177746
;
// 0.02172; // 0.01726; // 0.22250;
this
.
weak_fgnd
=
1.0
/
2.355492
;
//
1.177746; // 0.02172; // 0.01726; // 0.22250;
this
.
flaps
=
1.0
/
0.1
;
// 0.00056; // 0.07229;
this
.
flaps
=
1.0
/
0.1
;
// 0.00056; // 0.07229;
this
.
ml_mismatch
=
1.0
;
this
.
ml_mismatch
=
1.0
;
// ml_mismatch not yet implemented - is it needed - maybe some see-through data appears on one layer only
// ml_mismatch not yet implemented - is it needed - maybe some see-through data appears on one layer only
...
@@ -281,12 +284,12 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
...
@@ -281,12 +284,12 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
this
.
strengthBestPwr
=
clt_parameters
.
taBestPwr
;
this
.
strengthBestPwr
=
clt_parameters
.
taBestPwr
;
this
.
strengthDiff9Pwr
=
clt_parameters
.
taDiff9Pwr
;
this
.
strengthDiff9Pwr
=
clt_parameters
.
taDiff9Pwr
;
this
.
taColSigma
=
clt_parameters
.
taColSigma
;
this
.
taColFraction
=
clt_parameters
.
taColFraction
;
this
.
cost_coeff
=
new
TACosts
(
clt_parameters
);
this
.
cost_coeff
=
new
TACosts
(
clt_parameters
);
this
.
cost_coeff
.
mul
(
new
TACosts
(
0
));
// make average ~=1.0 for each used component
this
.
cost_coeff
.
mul
(
new
TACosts
(
0
));
// make average ~=1.0 for each used component
}
}
public
void
setDispStrength
(
public
void
setDispStrength
(
double
[][][]
ds
)
double
[][][]
ds
)
...
@@ -351,8 +354,82 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
...
@@ -351,8 +354,82 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
}
}
ImageDtt
.
startAndJoin
(
threads
);
ImageDtt
.
startAndJoin
(
threads
);
}
}
public
void
blurMixTones
(
final
boolean
use_sqrt
,
final
boolean
weighted
)
// blur weighted
{
this
.
tone_diff_weight
=
blurMixTones
(
this
.
tone_diff_weight
,
// final double [][][] tone_diffs,
this
.
taColSigma
,
// final double sigma,
this
.
taColFraction
,
// final double fraction,
use_sqrt
,
weighted
);
// final boolean weighted)
}
public
double
[][][]
blurMixTones
(
final
double
[][][]
tone_diffs
,
final
double
sigma
,
final
double
fraction
,
final
boolean
use_sqrt
,
final
boolean
weighted
)
// blur weighted
{
final
int
num_tiles
=
surfTilesX
*
surfTilesY
;
final
double
[][]
dir_blur
=
new
double
[
4
][
num_tiles
];
final
double
[][]
dir_weight
=
new
double
[
4
][
num_tiles
];
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
(
ts
.
getThreadsMax
());
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
double
[][][]
mixed_diff_weight
=
new
double
[
surfTilesX
*
surfTilesY
][
8
][
2
];
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
for
(
int
dir
=
ai
.
getAndIncrement
();
dir
<
4
;
dir
=
ai
.
getAndIncrement
())
{
for
(
int
nSurfTile
=
0
;
nSurfTile
<
num_tiles
;
nSurfTile
++){
double
w
=
tone_diffs
[
nSurfTile
][
dir
][
1
];
double
dw
=
tone_diffs
[
nSurfTile
][
dir
][
0
]
;
if
(
use_sqrt
)
dw
=
Math
.
sqrt
(
dw
);
if
(
weighted
)
dw
*=
w
;
dir_blur
[
dir
][
nSurfTile
]
=
dw
;
dir_weight
[
dir
][
nSurfTile
]
=
w
;
}
DoubleGaussianBlur
gb
=
new
DoubleGaussianBlur
();
gb
.
blurDouble
(
dir_blur
[
dir
],
surfTilesX
,
surfTilesY
,
sigma
,
sigma
,
0.01
);
gb
.
blurDouble
(
dir_weight
[
dir
],
surfTilesX
,
surfTilesY
,
sigma
,
sigma
,
0.01
);
if
(
weighted
){
for
(
int
nSurfTile
=
0
;
nSurfTile
<
num_tiles
;
nSurfTile
++){
if
(
dir_weight
[
dir
][
nSurfTile
]
!=
0.0
)
dir_blur
[
dir
][
nSurfTile
]
/=
dir_weight
[
dir
][
nSurfTile
];
}
}
int
rdir
=
(
dir
+
4
)
%
8
;
double
rfract
=
1.0
-
fraction
;
for
(
int
nSurfTile
=
0
;
nSurfTile
<
num_tiles
;
nSurfTile
++){
int
nSurfTile1
=
tnSurface
.
getNeibIndex
(
nSurfTile
,
dir
);
if
(
nSurfTile1
>=
0
){
double
d
;
if
(
use_sqrt
){
d
=
rfract
*
Math
.
sqrt
(
tone_diffs
[
nSurfTile
][
dir
][
0
])
+
fraction
*
dir_blur
[
dir
][
nSurfTile
];
d
*=
d
;
}
else
{
d
=
rfract
*
tone_diffs
[
nSurfTile
][
dir
][
0
]
+
fraction
*
dir_blur
[
dir
][
nSurfTile
];
}
mixed_diff_weight
[
nSurfTile
][
dir
][
0
]
=
d
;
mixed_diff_weight
[
nSurfTile
][
dir
][
1
]
=
rfract
*
tone_diffs
[
nSurfTile
][
dir
][
1
]
+
fraction
*
dir_weight
[
dir
][
nSurfTile
];
mixed_diff_weight
[
nSurfTile1
][
rdir
][
0
]
=
mixed_diff_weight
[
nSurfTile
][
dir
][
0
];
mixed_diff_weight
[
nSurfTile1
][
rdir
][
1
]
=
mixed_diff_weight
[
nSurfTile
][
dir
][
1
];
}
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
mixed_diff_weight
;
}
public
void
showToneDiffWeights3
(){
public
void
showToneDiffWeights3
(
String
prefix
){
String
[]
titles
=
{
"diffs"
,
"sqrt"
,
"centers"
,
"weights"
};
String
[]
titles
=
{
"diffs"
,
"sqrt"
,
"centers"
,
"weights"
};
double
[][]
img_data
=
new
double
[
titles
.
length
][
9
*
surfTilesX
*
surfTilesY
];
double
[][]
img_data
=
new
double
[
titles
.
length
][
9
*
surfTilesX
*
surfTilesY
];
TileNeibs
tnSurface3
=
new
TileNeibs
(
3
*
surfTilesX
,
3
*
surfTilesY
);
TileNeibs
tnSurface3
=
new
TileNeibs
(
3
*
surfTilesX
,
3
*
surfTilesY
);
...
@@ -382,10 +459,10 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
...
@@ -382,10 +459,10 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
img_data
[
2
][
nSurfTile3
]
=
sdw
;
img_data
[
2
][
nSurfTile3
]
=
sdw
;
img_data
[
3
][
nSurfTile3
]
=
sw
;
img_data
[
3
][
nSurfTile3
]
=
sw
;
}
}
(
new
showDoubleFloatArrays
()).
showArrays
(
img_data
,
3
*
surfTilesX
,
3
*
surfTilesY
,
true
,
"T
one_diffs3"
,
titles
);
(
new
showDoubleFloatArrays
()).
showArrays
(
img_data
,
3
*
surfTilesX
,
3
*
surfTilesY
,
true
,
prefix
+
"t
one_diffs3"
,
titles
);
}
}
public
void
showToneDiffWeights1
(){
public
void
showToneDiffWeights1
(
String
prefix
){
double
[][]
img_data
=
new
double
[
2
][
surfTilesX
*
surfTilesY
];
double
[][]
img_data
=
new
double
[
2
][
surfTilesX
*
surfTilesY
];
for
(
int
nSurfTile
=
0
;
nSurfTile
<
tone_diff_weight
.
length
;
nSurfTile
++){
for
(
int
nSurfTile
=
0
;
nSurfTile
<
tone_diff_weight
.
length
;
nSurfTile
++){
double
sdw
=
0.0
,
sw
=
0.0
;
double
sdw
=
0.0
,
sw
=
0.0
;
...
@@ -405,7 +482,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
...
@@ -405,7 +482,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
img_data
[
1
][
nSurfTile
]
=
sw
;
img_data
[
1
][
nSurfTile
]
=
sw
;
}
}
String
[]
titles
=
{
"diffs"
,
"weights"
};
String
[]
titles
=
{
"diffs"
,
"weights"
};
(
new
showDoubleFloatArrays
()).
showArrays
(
img_data
,
surfTilesX
,
surfTilesY
,
true
,
"T
one_diffs1"
,
titles
);
(
new
showDoubleFloatArrays
()).
showArrays
(
img_data
,
surfTilesX
,
surfTilesY
,
true
,
prefix
+
"t
one_diffs1"
,
titles
);
}
}
...
@@ -830,12 +907,13 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
...
@@ -830,12 +907,13 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
}
//for (int ml = 0; ml < around.length; ml++) if ((around[ml] != null) && (around[ml][8] > 0))
}
//for (int ml = 0; ml < around.length; ml++) if ((around[ml] != null) && (around[ml][8] > 0))
// using /4.0 to maintain same value (==1.0) for half neighbors (straight edge)
if
((
num_weak_fgnd
>
0
)
&&
(
shrinkWeakFgnd
>
0.0
)){
if
((
num_weak_fgnd
>
0
)
&&
(
shrinkWeakFgnd
>
0.0
)){
costs
.
weak_fgnd
/=
Math
.
pow
(
num_weak_fgnd
,
shrinkWeakFgnd
);
costs
.
weak_fgnd
/=
Math
.
pow
(
num_weak_fgnd
/
4.0
,
shrinkWeakFgnd
);
}
}
if
((
num_color_sep
>
0
)
&&
(
shrinkColor
>
0.0
)){
if
((
num_color_sep
>
0
)
&&
(
shrinkColor
>
0.0
)){
costs
.
color
/=
Math
.
pow
(
num_color_sep
,
shrinkColor
);
costs
.
color
/=
Math
.
pow
(
num_color_sep
/
4.0
,
shrinkColor
);
}
}
double
disp_diff_lpf
=
0.0
,
disp_diff_weight
=
0.0
;
// calculate LPF of the disparity signed error over all ML and 9 cells
double
disp_diff_lpf
=
0.0
,
disp_diff_weight
=
0.0
;
// calculate LPF of the disparity signed error over all ML and 9 cells
...
@@ -874,9 +952,14 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
...
@@ -874,9 +952,14 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
}
}
// now diff is for the center, weight needs to be re-calculated
// now diff is for the center, weight needs to be re-calculated
if
(
strengthDiffPwr
>
0.0
)
{
if
(
strengthDiffPwr
>
0.0
)
{
weight
=
dispStrength
[
ml
][
nSurfTile
][
1
];
if
((
dispStrength
[
ml
]
==
null
)
||
(
dispStrength
[
ml
][
nSurfTile
]
==
null
)){
if
(
strengthDiffPwr
!=
1.0
)
{
System
.
out
.
println
(
"getTileCosts() nSurfTile = "
+
nSurfTile
+
" ml = "
+
ml
+
" BUG - null pointer"
);
weight
=
Math
.
pow
(
weight
,
strengthDiffPwr
);
weight
=
1.0
;
}
else
{
weight
=
dispStrength
[
ml
][
nSurfTile
][
1
];
// null pointer
if
(
strengthDiffPwr
!=
1.0
)
{
weight
=
Math
.
pow
(
weight
,
strengthDiffPwr
);
}
}
}
}
else
{
}
else
{
weight
=
1.0
;
weight
=
1.0
;
...
...
src/main/java/TileProcessor.java
View file @
c8348852
...
@@ -3252,9 +3252,13 @@ public class TileProcessor {
...
@@ -3252,9 +3252,13 @@ public class TileProcessor {
Double
.
NaN
,
// double kB,
Double
.
NaN
,
// double kB,
Double
.
NaN
);
// double fatZero)
Double
.
NaN
);
// double fatZero)
ta
.
showToneDiffWeights3
();
ta
.
showToneDiffWeights3
(
"Raw_"
);
ta
.
showToneDiffWeights1
();
ta
.
showToneDiffWeights1
(
"Raw_"
);
ta
.
blurMixTones
(
false
,
// final boolean use_sqrt,
true
);
//final boolean weighted) // blur weighted
ta
.
showToneDiffWeights3
(
"Mixed_"
);
ta
.
showToneDiffWeights1
(
"Mixed_"
);
// }
// }
...
...
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