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
21cc4033
Commit
21cc4033
authored
Jul 05, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed lazy eye correction
parent
f2fa612b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1246 additions
and
69 deletions
+1246
-69
AlignmentCorrection.java
src/main/java/AlignmentCorrection.java
+1036
-47
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+109
-4
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+6
-0
ImageDtt.java
src/main/java/ImageDtt.java
+3
-2
QuadCLT.java
src/main/java/QuadCLT.java
+92
-16
No files found.
src/main/java/AlignmentCorrection.java
View file @
21cc4033
This diff is collapsed.
Click to expand it.
src/main/java/EyesisCorrectionParameters.java
View file @
21cc4033
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
21cc4033
...
...
@@ -4609,10 +4609,16 @@ private Panel panel1,
System
.
out
.
println
(
"Created new QuadCLT instance, will need to read CLT kernels"
);
}
}
/*
QUAD_CLT.process_fine_corr(
dry_run, // boolean dry_run
CLT_PARAMETERS,
DEBUG_LEVEL);
*/
QUAD_CLT
.
processLazyEye
(
CLT_PARAMETERS
,
DEBUG_LEVEL
);
return
;
}
else
if
(
label
.
equals
(
"CLT ext infinity corr"
))
{
...
...
src/main/java/ImageDtt.java
View file @
21cc4033
...
...
@@ -964,6 +964,7 @@ public class ImageDtt {
final
double
[][][][][]
clt_corr_partial
,
// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// [tilesY][tilesX] should be set by caller
final
double
[][]
clt_mismatch
,
// [12][tilesY * tilesX] // transpose unapplied. null - do not calculate
// values in the "main" directions have disparity (*_CM) subtracted, in the perpendicular - as is
final
double
[][]
disparity_map
,
// [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
// last 2 - contrast, avg/ "geometric average)
...
...
@@ -1606,11 +1607,11 @@ public class ImageDtt {
double
yp
,
xp
;
if
(
corr_pairs
[
pair
][
2
]
>
0
){
// transpose - switch x <-> y
yp
=
transform_size
-
1
-
corr_max_XYmp
[
0
]
-
disparity_map
[
DISPARITY_INDEX_CM
][
tIndex
];
xp
=
transform_size
-
1
-
corr_max_XYmp
[
1
];
// do not c
a
mpare to average - it should be 0 anyway
xp
=
transform_size
-
1
-
corr_max_XYmp
[
1
];
// do not c
o
mpare to average - it should be 0 anyway
}
else
{
xp
=
transform_size
-
1
-
corr_max_XYmp
[
0
]
-
disparity_map
[
DISPARITY_INDEX_CM
][
tIndex
];
yp
=
transform_size
-
1
-
corr_max_XYmp
[
1
];
// do not c
a
mpare to average - it should be 0 anyway
yp
=
transform_size
-
1
-
corr_max_XYmp
[
1
];
// do not c
o
mpare to average - it should be 0 anyway
}
double
strength
=
tcorr_partial
[
pair
][
numcol
][
max_index
];
// using the new location than for combined
clt_mismatch
[
3
*
pair
+
0
][
tIndex
]
=
xp
;
...
...
src/main/java/QuadCLT.java
View file @
21cc4033
...
...
@@ -5236,23 +5236,23 @@ public class QuadCLT {
// includes both infinity correction and mismatch correction for the same infinity tiles
double
[][][]
new_corr
=
ac
.
infinityCorrection
(
clt_parameters
.
fcorr_inf_strength
,
// final double min_strenth,
clt_parameters
.
fcorr_inf_diff
,
// final double max_diff,
20
,
// 0, // final int max_iterations,
0.0001
,
// final double max_coeff_diff,
0.0
,
// 0.25, // final double far_pull, // = 0.2; // 1; // 0.5;
1.0
,
// final double strength_pow,
3
,
// final int smplSide, // = 2; // Sample size (side of a square)
5
,
// final int smplNum,
// = 3; // Number after removing worst (should be >1)
0.1
,
// 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
clt_parameters
.
fcorr_inf_diff
,
// final double max_diff,
clt_parameters
.
inf_iters
,
//
20, // 0, // final int max_iterations,
clt_parameters
.
inf_final_diff
,
//
0.0001, // final double max_coeff_diff,
clt_parameters
.
inf_far_pull
,
//
0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5;
clt_parameters
.
inf_str_pow
,
//
1.0, // final double strength_pow,
clt_parameters
.
inf_smpl_side
,
//
3, // final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters
.
inf_smpl_num
,
// 5, // final int smplNum,
// = 3; // Number after removing worst (should be >1)
clt_parameters
.
inf_smpl_rms
,
//
0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// histogram parameters
8
,
// final int hist_smpl_side, // 8 x8 masked, 16x16 sampled
-
1.0
,
// final double hist_disp_min,
0.05
,
// final double hist_disp_step,
40
,
// final int hist_num_bins,
0.1
,
// final double hist_sigma,
0.1
,
// final double hist_max_diff,
10
,
// final int hist_min_samples,
true
,
// final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with
clt_parameters
.
ih_smpl_step
,
//
8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled
clt_parameters
.
ih_disp_min
,
//
-1.0, // final double hist_disp_min,
clt_parameters
.
ih_disp_step
,
//
0.05, // final double hist_disp_step,
clt_parameters
.
ih_num_bins
,
//
40, // final int hist_num_bins,
clt_parameters
.
ih_sigma
,
//
0.1, // final double hist_sigma,
clt_parameters
.
ih_max_diff
,
//
0.1, // final double hist_max_diff,
clt_parameters
.
ih_min_samples
,
//
10, // final int hist_min_samples,
clt_parameters
.
ih_norm_center
,
//
true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
inf_disp_strength
,
// double [][] disp_strength,
tilesX
,
// int tilesX,
...
...
@@ -5260,6 +5260,8 @@ public class QuadCLT {
debugLevel
+
1
);
// int debugLevel)
if
(
debugLevel
>
-
1
){
System
.
out
.
println
(
"process_infinity_corr(): ready to apply infinity correction"
);
show_fine_corr
(
...
...
@@ -5273,12 +5275,86 @@ public class QuadCLT {
new_corr
,
debugLevel
+
2
);
}
}
public
void
processLazyEye
(
EyesisCorrectionParameters
.
CLTParameters
clt_parameters
,
int
debugLevel
)
{
ImagePlus
imp_src
=
WindowManager
.
getCurrentImage
();
if
(
imp_src
==
null
){
IJ
.
showMessage
(
"Error"
,
"2*n-layer file with disparities/strengthspairs measured at infinity is required"
);
return
;
}
ImageStack
disp_strength_stack
=
imp_src
.
getStack
();
final
int
tilesX
=
disp_strength_stack
.
getWidth
();
// tp.getTilesX();
final
int
tilesY
=
disp_strength_stack
.
getHeight
();
// tp.getTilesY();
final
int
nTiles
=
tilesX
*
tilesY
;
AlignmentCorrection
ac
=
new
AlignmentCorrection
(
this
);
double
[][]
scans
=
ac
.
getFineCorrFromImage
(
imp_src
,
// 0.2, // double min_comp_strength, // 0.2
debugLevel
);
double
[][][]
new_corr
=
ac
.
lazyEyeCorrection
(
clt_parameters
.
fcorr_inf_strength
,
// final double min_strenth,
clt_parameters
.
fcorr_inf_diff
,
// final double max_diff,
1.3
,
// final double comp_strength_var,
clt_parameters
.
inf_iters
,
// 20, // 0, // final int max_iterations,
clt_parameters
.
inf_final_diff
,
// 0.0001, // final double max_coeff_diff,
clt_parameters
.
inf_far_pull
,
// 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5;
clt_parameters
.
inf_str_pow
,
// 1.0, // final double strength_pow,
1.5
,
// final double lazyEyeCompDiff, // clt_parameters.fcorr_disp_diff
clt_parameters
.
inf_smpl_side
,
// final int lazyEyeSmplSide, // = 2; // Sample size (side of a square)
clt_parameters
.
inf_smpl_num
,
// final int lazyEyeSmplNum, // = 3; // Number after removing worst (should be >1)
0.1
,
// final double lazyEyeSmplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
0.2
,
// final double lazyEyeDispVariation, // 0.2, maximal full disparity difference between tgh tile and 8 neighborxs
clt_parameters
.
inf_smpl_side
,
// 3, // final int smplSide, // = 2; // Sample size (side of a square)
clt_parameters
.
inf_smpl_num
,
// 5, // final int smplNum, // = 3; // Number after removing worst (should be >1)
clt_parameters
.
inf_smpl_rms
,
// 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample
// histogram parameters
clt_parameters
.
ih_smpl_step
,
// 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled
clt_parameters
.
ih_disp_min
,
// -1.0, // final double hist_disp_min,
clt_parameters
.
ih_disp_step
,
// 0.05, // final double hist_disp_step,
clt_parameters
.
ih_num_bins
,
// 40, // final int hist_num_bins,
clt_parameters
.
ih_sigma
,
// 0.1, // final double hist_sigma,
clt_parameters
.
ih_max_diff
,
// 0.1, // final double hist_max_diff,
clt_parameters
.
ih_min_samples
,
// 10, // final int hist_min_samples,
clt_parameters
.
ih_norm_center
,
// true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with
0.5
,
// final double inf_fraction, // fraction of the weight for the infinity tiles
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
scans
,
// double [][] disp_strength,
tilesX
,
// int tilesX,
clt_parameters
.
corr_magic_scale
,
// double magic_coeff, // still not understood coefficent that reduces reported disparity value. Seems to be around 8.5
debugLevel
+
1
);
// int debugLevel)
if
(
debugLevel
>
-
100
){
apply_fine_corr
(
new_corr
,
debugLevel
+
2
);
}
}
public
void
process_fine_corr
(
boolean
dry_run
,
EyesisCorrectionParameters
.
CLTParameters
clt_parameters
,
int
debugLevel
)
{
if
(
dry_run
)
{
AlignmentCorrection
ac
=
new
AlignmentCorrection
(
this
);
ac
.
process_fine_corr
(
dry_run
,
// boolean dry_run,
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
debugLevel
);
// int debugLevel
return
;
}
ImagePlus
imp_src
=
WindowManager
.
getCurrentImage
();
if
(
imp_src
==
null
){
IJ
.
showMessage
(
"Error"
,
"12*n-layer file clt_mismatches is required"
);
...
...
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