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
c500f3ad
Commit
c500f3ad
authored
Aug 29, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added per-set infinity offset
parent
5764ddb9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
15 deletions
+106
-15
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+62
-1
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+7
-0
ImageDtt.java
src/main/java/ImageDtt.java
+1
-1
QuadCLT.java
src/main/java/QuadCLT.java
+36
-13
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
c500f3ad
...
...
@@ -30,7 +30,11 @@ import ij.Prefs;
import
ij.gui.GenericDialog
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Properties
;
import
java.util.Set
;
public
class
EyesisCorrectionParameters
{
...
...
@@ -602,6 +606,8 @@ public class EyesisCorrectionParameters {
return
true
;
}
// TODO: extract timestamnp from JP4 or, at least combine movie timestamp+frame into a single filename string
public
String
[]
getSourcePaths
(){
String
[]
empty
={};
...
...
@@ -2720,6 +2726,10 @@ public class EyesisCorrectionParameters {
public
boolean
show_planes
=
false
;
// show planes
public
double
[]
vertical_xyz
=
{
0.0
,
1.0
,
0.0
};
// real world up unit vector in camera CS (x - right, y - up, z - to camera};
public
HashMap
<
String
,
Double
>
z_corr_map
=
new
HashMap
<
String
,
Double
>();
public
static
String
Z_CORR_PREFIX
=
"z_corr."
;
public
CLTParameters
(){}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
properties
.
setProperty
(
prefix
+
"transform_size"
,
this
.
transform_size
+
""
);
...
...
@@ -3324,7 +3334,13 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"vertical_xyz.x"
,
this
.
vertical_xyz
[
0
]+
""
);
properties
.
setProperty
(
prefix
+
"vertical_xyz.y"
,
this
.
vertical_xyz
[
1
]+
""
);
properties
.
setProperty
(
prefix
+
"vertical_xyz.z"
,
this
.
vertical_xyz
[
2
]+
""
);
}
if
(
z_corr_map
!=
null
)
{
for
(
HashMap
.
Entry
<
String
,
Double
>
entry
:
z_corr_map
.
entrySet
()){
properties
.
setProperty
(
prefix
+
Z_CORR_PREFIX
+
entry
.
getKey
(),
entry
.
getValue
().
toString
());
}
}
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"transform_size"
)!=
null
)
this
.
transform_size
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"transform_size"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_window"
)!=
null
)
this
.
clt_window
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"clt_window"
));
...
...
@@ -3929,6 +3945,14 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"vertical_xyz.y"
)!=
null
)
this
.
vertical_xyz
[
1
]=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"vertical_xyz.y"
));
if
(
properties
.
getProperty
(
prefix
+
"vertical_xyz.z"
)!=
null
)
this
.
vertical_xyz
[
2
]=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"vertical_xyz.z"
));
Set
<
String
>
ss
=
properties
.
stringPropertyNames
();
String
full_prefix
=
prefix
+
Z_CORR_PREFIX
;
int
li
=
full_prefix
.
length
();
for
(
String
s:
ss
){
if
(
s
.
indexOf
(
full_prefix
)
==
0
){
z_corr_map
.
put
(
s
.
substring
(
li
),
Double
.
parseDouble
(
properties
.
getProperty
(
s
)));
}
}
}
public
boolean
showDialog
()
{
...
...
@@ -5353,6 +5377,43 @@ public class EyesisCorrectionParameters {
return
true
;
}
public
boolean
modifyZCorr
(
String
title
)
{
if
(
z_corr_map
==
null
){
z_corr_map
=
new
HashMap
<
String
,
Double
>();
}
GenericDialog
gd
=
new
GenericDialog
(
title
);
if
(
z_corr_map
.
size
()
>
0
)
{
gd
.
addMessage
(
"Edit infinity disparity correction (in 1/m), set >= 1.0 to remove for the following"
);
for
(
HashMap
.
Entry
<
String
,
Double
>
entry
:
z_corr_map
.
entrySet
()){
gd
.
addNumericField
(
entry
.
getKey
(),
entry
.
getValue
(),
8
);
}
}
gd
.
addMessage
(
"Add new infinity correction"
);
gd
.
addStringField
(
"Timestamp string (seconds_microseconds):"
,
""
,
40
);
gd
.
addNumericField
(
"Infinity correction (in 1/m)"
,
0
,
8
);
gd
.
addCheckbox
(
"Clear list"
,
false
);
WindowTools
.
addScrollBars
(
gd
);
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
HashMap
<
String
,
Double
>
new_map
=
new
HashMap
<
String
,
Double
>();
for
(
HashMap
.
Entry
<
String
,
Double
>
entry
:
z_corr_map
.
entrySet
()){
double
d
=
gd
.
getNextNumber
();
if
(
d
<
1.0
)
{
new_map
.
put
(
entry
.
getKey
(),
d
);
}
}
String
new_ts
=
gd
.
getNextString
();
double
d
=
gd
.
getNextNumber
();
if
(
gd
.
getNextBoolean
()){
z_corr_map
=
new
HashMap
<
String
,
Double
>();
}
else
{
z_corr_map
=
new_map
;
}
if
(
new_ts
.
length
()
>
0
){
z_corr_map
.
put
(
new_ts
,
d
);
}
return
true
;
}
}
public
static
class
DCTParameters
{
...
...
src/main/java/Eyesis_Correction.java
View file @
c500f3ad
...
...
@@ -543,6 +543,7 @@ private Panel panel1,
panelClt3
=
new
Panel
();
panelClt3
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
// rows, columns, vgap, hgap
addButton
(
"Setup CLT parameters"
,
panelClt3
,
color_configure
);
addButton
(
"Infinity offset"
,
panelClt3
,
color_configure
);
addButton
(
"Setup CLT Batch parameters"
,
panelClt3
,
color_configure
);
addButton
(
"CLT batch process"
,
panelClt3
,
color_process
);
add
(
panelClt3
);
...
...
@@ -3678,6 +3679,12 @@ private Panel panel1,
}
else
if
(
label
.
equals
(
"Setup CLT parameters"
))
{
CLT_PARAMETERS
.
showDialog
();
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Infinity offset"
))
{
while
(
true
)
{
if
(!
CLT_PARAMETERS
.
modifyZCorr
(
"Modify infinity per image set disparity corrections"
))
break
;
}
return
;
/* ======================================================================== */
// public ImagePlus DBG_IMP = null;
}
else
if
(
label
.
equals
(
"Select CLT image"
))
{
...
...
src/main/java/ImageDtt.java
View file @
c500f3ad
...
...
@@ -1053,7 +1053,7 @@ public class ImageDtt {
final
int
corr_size
=
transform_size
*
2
-
1
;
final
int
[][]
transpose_indices
=
new
int
[
corr_size
*(
corr_size
-
1
)/
2
][
2
];
int
indx
=
0
;
if
((
globalDebugLevel
>
-
1
)
&&
(
disparity_corr
!=
0.0
)){
if
((
globalDebugLevel
>
-
1
0
)
&&
(
disparity_corr
!=
0.0
)){
System
.
out
.
println
(
String
.
format
(
"Using manual infinity disparity correction of %8.5f pixels"
,
disparity_corr
));
}
for
(
int
i
=
0
;
i
<
corr_size
-
1
;
i
++){
...
...
src/main/java/QuadCLT.java
View file @
c500f3ad
...
...
@@ -3606,8 +3606,12 @@ public class QuadCLT {
{
clt_parameters
.
fine_corr_x_3
,
clt_parameters
.
fine_corr_y_3
}};
shiftXY
=
shiftXY0
;
}
final
double
disparity_corr
=
(
clt_parameters
.
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
clt_parameters
.
z_correction
);
// final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
double
z_correction
=
clt_parameters
.
z_correction
;
if
(
clt_parameters
.
z_corr_map
.
containsKey
(
name
)){
z_correction
+=
clt_parameters
.
z_corr_map
.
get
(
name
);
}
final
double
disparity_corr
=
(
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
z_correction
);
double
[][][][][][]
clt_data
=
image_dtt
.
clt_aberrations_quad_corr
(
1
,
// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op
,
// per-tile operation bit codes
...
...
@@ -4672,8 +4676,13 @@ public class QuadCLT {
shiftXY
=
shiftXY0
;
}
final
double
disparity_corr
=
(
clt_parameters
.
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
clt_parameters
.
z_correction
);
// final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
double
z_correction
=
clt_parameters
.
z_correction
;
if
(
clt_parameters
.
z_corr_map
.
containsKey
(
image_name
)){
z_correction
+=
clt_parameters
.
z_corr_map
.
get
(
image_name
);
}
final
double
disparity_corr
=
(
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
z_correction
);
image_dtt
.
clt_aberrations_quad_corr
(
1
,
// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op
,
// per-tile operation bit codes
...
...
@@ -6272,7 +6281,7 @@ public class QuadCLT {
final
boolean
batch_mode
,
final
int
debugLevel
)
{
final
int
debugLevelInner
=
batch_mode
?
-
5
:
debugLevel
;
final
int
debugLevelInner
=
batch_mode
?
-
3
:
debugLevel
;
// final int tilesX = tp.getTilesX();
// final int tilesY = tp.getTilesY();
...
...
@@ -6440,7 +6449,7 @@ public class QuadCLT {
dbg_x
,
dbg_y
,
// final int dbg_y,
debugLevelInner
+
1
);
// final int debugLevel)
debugLevelInner
+
2
);
// final int debugLevel)
if
(
last_pass
)
{
break
;
...
...
@@ -7728,12 +7737,13 @@ public class QuadCLT {
//linearStackToColor
public
CLTPass3d
CLTBackgroundMeas
(
// measure background
final
double
[][][]
image_data
,
// first index - number of image in a quad
final
boolean
[][]
saturation_imp
,
// (near) saturated pixels or null
// final String image_name,
final
double
[][][]
image_data
,
// first index - number of image in a quad
final
boolean
[][]
saturation_imp
,
// (near) saturated pixels or null
EyesisCorrectionParameters
.
CLTParameters
clt_parameters
,
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
int
debugLevel
)
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
int
debugLevel
)
{
final
int
tilesX
=
tp
.
getTilesX
();
final
int
tilesY
=
tp
.
getTilesY
();
...
...
@@ -7764,7 +7774,13 @@ public class QuadCLT {
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
// ["RGBA".length()][];
ImageDtt
image_dtt
=
new
ImageDtt
();
final
double
disparity_corr
=
(
clt_parameters
.
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
clt_parameters
.
z_correction
);
// final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
double
z_correction
=
clt_parameters
.
z_correction
;
if
(
clt_parameters
.
z_corr_map
.
containsKey
(
image_name
)){
z_correction
+=
clt_parameters
.
z_corr_map
.
get
(
image_name
);
}
final
double
disparity_corr
=
(
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
z_correction
);
image_dtt
.
clt_aberrations_quad_corr
(
1
,
// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op
,
// per-tile operation bit codes
...
...
@@ -7922,6 +7938,7 @@ public class QuadCLT {
}
public
CLTPass3d
CLTMeasure
(
// perform single pass according to prepared tiles operations and disparity
// final String image_name,
final
double
[][][]
image_data
,
// first index - number of image in a quad
final
boolean
[][]
saturation_imp
,
// (near) saturated pixels or null
final
EyesisCorrectionParameters
.
CLTParameters
clt_parameters
,
...
...
@@ -7970,7 +7987,13 @@ public class QuadCLT {
double
[][][][]
texture_tiles
=
save_textures
?
new
double
[
tilesY
][
tilesX
][][]
:
null
;
// ["RGBA".length()][];
ImageDtt
image_dtt
=
new
ImageDtt
();
final
double
disparity_corr
=
(
clt_parameters
.
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
clt_parameters
.
z_correction
);
// final double disparity_corr = (clt_parameters.z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/clt_parameters.z_correction);
double
z_correction
=
clt_parameters
.
z_correction
;
if
(
clt_parameters
.
z_corr_map
.
containsKey
(
image_name
)){
z_correction
+=
clt_parameters
.
z_corr_map
.
get
(
image_name
);
}
final
double
disparity_corr
=
(
z_correction
==
0
)
?
0.0
:
geometryCorrection
.
getDisparityFromZ
(
1.0
/
z_correction
);
image_dtt
.
clt_aberrations_quad_corr
(
1
,
// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op
,
// per-tile operation bit codes
...
...
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