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
9833be98
Commit
9833be98
authored
Feb 22, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on dual-modal calibration
parent
7b892871
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
450 additions
and
133 deletions
+450
-133
Aberration_Calibration.java
...com/elphel/imagej/calibration/Aberration_Calibration.java
+79
-25
DistortionCalibrationData.java
.../elphel/imagej/calibration/DistortionCalibrationData.java
+131
-19
Distortions.java
src/main/java/com/elphel/imagej/calibration/Distortions.java
+212
-79
FittingStrategy.java
...n/java/com/elphel/imagej/calibration/FittingStrategy.java
+16
-3
MatchSimulatedPattern.java
.../com/elphel/imagej/calibration/MatchSimulatedPattern.java
+11
-6
PatternParameters.java
...java/com/elphel/imagej/calibration/PatternParameters.java
+1
-1
No files found.
src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java
View file @
9833be98
...
@@ -6015,7 +6015,7 @@ if (MORE_BUTTONS) {
...
@@ -6015,7 +6015,7 @@ if (MORE_BUTTONS) {
LASER_POINTERS, // MatchSimulatedPattern.LaserPointer laserPointer, // LaserPointer object that specifies actual laser poiners on the target
LASER_POINTERS, // MatchSimulatedPattern.LaserPointer laserPointer, // LaserPointer object that specifies actual laser poiners on the target
DISTORTION_PROCESS_CONFIGURATION.removeOutOfGridPointers, // boolean removeOutOfGridPointers,
DISTORTION_PROCESS_CONFIGURATION.removeOutOfGridPointers, // boolean removeOutOfGridPointers,
(useHintTolerance?hintGridTolerance:0.0), //double hintGridTolerance, // alllowed mismatch (fraction of period) or 0 - orientation only
(useHintTolerance?hintGridTolerance:0.0), //double hintGridTolerance, // alllowed mismatch (fraction of period) or 0 - orientation only
processAll, //boolean processAll, // if true - process all images, false - only disab
el
d
processAll, //boolean processAll, // if true - process all images, false - only disab
le
d
ignoreLaserPointers,
ignoreLaserPointers,
processBlind,
processBlind,
imageNumber,
imageNumber,
...
@@ -9546,7 +9546,7 @@ if (MORE_BUTTONS) {
...
@@ -9546,7 +9546,7 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
/* ======================================================================== */
if (label.equals("Grid offset")) {
if (label.equals("Grid offset")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
offsetGrids(0, 0, null);
offsetGrids(0, 0, null
, null
);
return;
return;
}
}
/* ======================================================================== */
/* ======================================================================== */
...
@@ -9590,14 +9590,17 @@ if (MORE_BUTTONS) {
...
@@ -9590,14 +9590,17 @@ if (MORE_BUTTONS) {
boolean use_lma = true;
boolean use_lma = true;
GenericDialog gd = new GenericDialog("Initial alignment of the secondary camera to the reference one");
GenericDialog gd = new GenericDialog("Initial alignment of the secondary camera to the reference one");
gd.addMessage("This command used Fitting Strategy[0] that should be set with all parameters but\n"+
// gd.addMessage("This command used Fitting Strategy[last] that should be set with all parameters but\n"+
"GXYZ0 and GXYZ1 are set to 'fixed', and GXYZ0 and GXYZ1 are set to 'individual'.\n"+
// "GXYZ0 and GXYZ1 are set to 'fixed', and GXYZ0 and GXYZ1 are set to 'individual'.\n"+
// "Each selected set should already have GXYZ set correctly (e.g. by reference cameras)");
gd.addMessage("This command uses Fitting Strategy[last] and set parameters but\n"+
"GXYZ0 and GXYZ1 to 'individual', all others - to 'fixed'.\n"+
"Each selected set should already have GXYZ set correctly (e.g. by reference cameras)");
"Each selected set should already have GXYZ set correctly (e.g. by reference cameras)");
gd.addNumericField("Image set start", min_set, 0);
gd.addNumericField("Image set start", min_set, 0);
gd.addNumericField("Image set last", max_set, 0);
gd.addNumericField("Image set last", max_set, 0);
gd.addCheckbox("Adjust EO (reference) sensors", adjust_eo);
gd.addCheckbox("Adjust EO (reference) sensors", adjust_eo);
gd.addCheckbox("Adjust LWIR (target) sensors", adjust_lwir);
gd.addCheckbox("Adjust LWIR (target) sensors", adjust_lwir);
gd.addCheckbox("Use LMA (unchecked - initial approximate grid set
um
by correlation)", use_lma);
gd.addCheckbox("Use LMA (unchecked - initial approximate grid set by correlation)", use_lma);
gd.showDialog();
gd.showDialog();
if (gd.wasCanceled()) return false;
if (gd.wasCanceled()) return false;
min_set = (int) gd.getNextNumber();
min_set = (int) gd.getNextNumber();
...
@@ -9626,10 +9629,14 @@ if (MORE_BUTTONS) {
...
@@ -9626,10 +9629,14 @@ if (MORE_BUTTONS) {
continue;
continue;
}
}
}
}
double [] stats = new double [3];
int [] uvr = LENS_DISTORTIONS. findImageGridOffset(
int [] uvr = LENS_DISTORTIONS. findImageGridOffset(
num_img,
num_img, // image num
-1, // use last series int ser_num, // number of series to reprogram
false, // boolean adjust_attitude, // true for eo, false for lwir (uses exact attitude from eo)
true, // boolean even, For first time - use parameter and parity of uv_rot
true, // boolean even, For first time - use parameter and parity of uv_rot
PATTERN_PARAMETERS);
PATTERN_PARAMETERS,
stats); // rms, dU, dV
if ((uvr != null) && ((uvr[0] != 0) || (uvr[1] != 0))) {
if ((uvr != null) && ((uvr[0] != 0) || (uvr[1] != 0))) {
int [] uv_shift_rot = {uvr[0],uvr[1],0};
int [] uv_shift_rot = {uvr[0],uvr[1],0};
// int [] new_uv_shift_rots =
// int [] new_uv_shift_rots =
...
@@ -9639,6 +9646,8 @@ if (MORE_BUTTONS) {
...
@@ -9639,6 +9646,8 @@ if (MORE_BUTTONS) {
PATTERN_PARAMETERS);
PATTERN_PARAMETERS);
if (DEBUG_LEVEL > 0) {
if (DEBUG_LEVEL > 0) {
System.out.println(num_img+ "("+num_set+"."+nc+"): uv_shift = "+uvr[0]+":"+uvr[1]);
System.out.println(num_img+ "("+num_set+"."+nc+"): uv_shift = "+uvr[0]+":"+uvr[1]);
System.out.println(num_img+ "("+num_set+"."+nc+"): errors: rms= "+stats[0]+", dU="+stats[1]+", dV="+stats[2]);
}
}
}
}
}
}
...
@@ -9666,7 +9675,7 @@ if (MORE_BUTTONS) {
...
@@ -9666,7 +9675,7 @@ if (MORE_BUTTONS) {
return true;
return true;
}
}
public boolean offsetGrids(int ichoice, int inum, int [] uv_shift_rot) {
public boolean offsetGrids(int ichoice, int inum, int [] uv_shift_rot
, String msg
) {
if (LENS_DISTORTIONS == null) {
if (LENS_DISTORTIONS == null) {
System.out.println("LENS_DISTORTIONS is null");
System.out.println("LENS_DISTORTIONS is null");
return false;
return false;
...
@@ -9695,8 +9704,16 @@ if (MORE_BUTTONS) {
...
@@ -9695,8 +9704,16 @@ if (MORE_BUTTONS) {
String [] choices_nolwir = {"-- please select --","Image number","Image set number"};
String [] choices_nolwir = {"-- please select --","Image number","Image set number"};
String [] choices_lwir = {"-- please select --","Image number","Image set number (all images)", "Image set (EO only)","Image set (LWIR only)"};
String [] choices_lwir = {"-- please select --","Image number","Image set number (all images)", "Image set (EO only)","Image set (LWIR only)"};
String [] choices = has_lwir ? choices_lwir : choices_nolwir;
String [] choices = has_lwir ? choices_lwir : choices_nolwir;
boolean readjust = true;
GenericDialog gd = new GenericDialog("Manually offset single grid or multiple grids in a set");
GenericDialog gd = new GenericDialog("Manually offset single grid or multiple grids in a set");
if (msg != null) {
gd.addMessage(msg);
}
if (auto) {
gd.addMessage("In 'auto' mode this command uses Fitting Strategy[last] and set parameters but\n"+
"GXYZ0, GXYZ1, goniometerHorizontal, and goniometerAxial to 'individual', all others - to 'fixed'.\n"+
"Each selected set should already have GXYZ set correctly (e.g. by reference cameras)");
}
gd. addChoice("Next number is: ",
gd. addChoice("Next number is: ",
choices,
choices,
choices[ichoice]);
choices[ichoice]);
...
@@ -9705,6 +9722,10 @@ if (MORE_BUTTONS) {
...
@@ -9705,6 +9722,10 @@ if (MORE_BUTTONS) {
if (has_lwir) {
if (has_lwir) {
gd.addCheckbox ("Auto from EO grid (calculatre from EO even if the requested image is LWIR)", false); //true
gd.addCheckbox ("Auto from EO grid (calculatre from EO even if the requested image is LWIR)", false); //true
}
}
if (!auto) {
gd.addCheckbox("Run LMA to re-adjust goniometerHorizontal and goniometerAxial", readjust);
readjust = gd.getNextBoolean();
}
gd.addNumericField("Grid offset U", uv_shift_rot[0], 0);
gd.addNumericField("Grid offset U", uv_shift_rot[0], 0);
gd.addNumericField("Grid offset V", uv_shift_rot[1], 0);
gd.addNumericField("Grid offset V", uv_shift_rot[1], 0);
gd.addNumericField("Grid offset Rot", uv_shift_rot[2], 0);
gd.addNumericField("Grid offset Rot", uv_shift_rot[2], 0);
...
@@ -9712,17 +9733,24 @@ if (MORE_BUTTONS) {
...
@@ -9712,17 +9733,24 @@ if (MORE_BUTTONS) {
if (gd.wasCanceled()) return false;
if (gd.wasCanceled()) return false;
ichoice = gd.getNextChoiceIndex();
ichoice = gd.getNextChoiceIndex();
inum = (int) gd.getNextNumber();
inum = (int) gd.getNextNumber();
boolean was_auto = auto;
auto = gd.getNextBoolean();
auto = gd.getNextBoolean();
boolean auto_from_EO=false;
boolean auto_from_EO=false;
if (has_lwir) {
if (has_lwir) {
auto_from_EO = gd.getNextBoolean();
auto_from_EO = gd.getNextBoolean();
}
}
readjust = false;
if (!was_auto) {
readjust = gd.getNextBoolean();
}
uv_shift_rot[0] = (int) gd.getNextNumber();
uv_shift_rot[0] = (int) gd.getNextNumber();
uv_shift_rot[1] = (int) gd.getNextNumber();
uv_shift_rot[1] = (int) gd.getNextNumber();
uv_shift_rot[2] = (int) gd.getNextNumber();
uv_shift_rot[2] = (int) gd.getNextNumber();
if (ichoice == 0) {
if (ichoice == 0) {
return offsetGrids(ichoice, inum, uv_shift_rot);
return offsetGrids(ichoice, inum, uv_shift_rot
, msg
);
}
}
int ichoicemod = ichoice;
int ichoicemod = ichoice;
if (auto && auto_from_EO) {
if (auto && auto_from_EO) {
...
@@ -9766,21 +9794,24 @@ if (MORE_BUTTONS) {
...
@@ -9766,21 +9794,24 @@ if (MORE_BUTTONS) {
// find first enabled image
// find first enabled image
for (int n:img_nums) {
for (int n:img_nums) {
if (n >= 0) {
if (n >= 0) {
double [] stats = new double[3]; // rms and 2 errors, null OK
int [] auto_uvr = LENS_DISTORTIONS.findImageGridOffset( // null for now
int [] auto_uvr = LENS_DISTORTIONS.findImageGridOffset( // null for now
n,
n, // image number to use for fitting (only one)
true, // boolean even,
-1, // use last series int ser_num, // number of series to reprogram
PATTERN_PARAMETERS); // PatternParameters patternParameters)
true, // boolean adjust_attitude, // true for eo, false for lwir (uses exact attitude from eo)
true, // boolean even, For first time - use parameter and parity of uv_rot
// int [] auto_uvr = dcd. suggestOffset (
PATTERN_PARAMETERS,
// n, // int num_img,
stats);
// true, // boolean non_estimated,
if (auto_uvr != null) {
// true, // boolean even,
String stats_msg = String.format("Fitting errors: LMA RMS = %7.4f, dU = %6.3f, dV = %6.3f", stats[0], stats[1], stats[2]);
// PATTERN_PARAMETERS); // PatternParameters patternParameters)
return offsetGrids(ichoice, inum, auto_uvr, stats_msg);
return offsetGrids(ichoice, inum, auto_uvr);
} else {
System.out.println("**** LMA FAILED - trying next image");
}
}
}
}
}
}
return offsetGrids(ichoice, inum, null, "All images failed LMA !");
}
int [][] new_uv_shift_rots = new int [img_nums.length][];
int [][] new_uv_shift_rots = new int [img_nums.length][];
for (int i = 0; i < img_nums.length; i++) if (img_nums[i] >=0) {
for (int i = 0; i < img_nums.length; i++) if (img_nums[i] >=0) {
...
@@ -9798,6 +9829,20 @@ if (MORE_BUTTONS) {
...
@@ -9798,6 +9829,20 @@ if (MORE_BUTTONS) {
System.out.println("<null>");
System.out.println("<null>");
}
}
}
}
if (readjust) {
for (int n:img_nums) {
if (n >= 0) {
if (LENS_DISTORTIONS.adjustAttitudeAfterOffset(
n, // int num_img,
-1, // int ser_num, // number of series to reprogram
PATTERN_PARAMETERS)) {
break; // only one image
} else {
System.out.println("***** LMA FAILED - trying next image");
}
}
}
}
return true;
return true;
}
}
...
@@ -9821,8 +9866,10 @@ if (MORE_BUTTONS) {
...
@@ -9821,8 +9866,10 @@ if (MORE_BUTTONS) {
gd.showDialog();
gd.showDialog();
if (gd.wasCanceled()) return false;
if (gd.wasCanceled()) return false;
numStations= (int) gd.getNextNumber();
numStations= (int) gd.getNextNumber();
String [] grid_extensions={".tif",".tiff"};
// String [] grid_extensions={".tif",".tiff"};
String [] src_extensions={".tif",".tiff"};
// String [] src_extensions={".tif",".tiff"};
String [] grid_extensions={".tiff"};
String [] src_extensions={".tiff"};
MultipleExtensionsFileFilter gridFilter =
MultipleExtensionsFileFilter gridFilter =
new MultipleExtensionsFileFilter("grid",grid_extensions,"Calibrated grid files");
new MultipleExtensionsFileFilter("grid",grid_extensions,"Calibrated grid files");
MultipleExtensionsFileFilter sourceFilter =
MultipleExtensionsFileFilter sourceFilter =
...
@@ -9859,6 +9906,13 @@ if (MORE_BUTTONS) {
...
@@ -9859,6 +9906,13 @@ if (MORE_BUTTONS) {
int num_match = files[nFile].list(gridFilter).length;
int num_match = files[nFile].list(gridFilter).length;
if (num_match >= min_files) {
if (num_match >= min_files) {
filelist.add(files[nFile]);
filelist.add(files[nFile]);
} else {
// System.out.println("nFile="+nFile+" files[nFile]="+files[nFile]+": num_match="+num_match);
// String[] matched=files[nFile].list(gridFilter);
// for (String s:matched) {
// System.out.println(s);
// }
// System.out.println("");
}
}
}
}
src/main/java/com/elphel/imagej/calibration/DistortionCalibrationData.java
View file @
9833be98
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/calibration/Distortions.java
View file @
9833be98
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/calibration/FittingStrategy.java
View file @
9833be98
...
@@ -2470,9 +2470,22 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -2470,9 +2470,22 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
if
(
useImages
)
{
if
(
useImages
)
{
fromToImages
[
0
]=
(
int
)
gd
.
getNextNumber
();
fromToImages
[
0
]=
(
int
)
gd
.
getNextNumber
();
fromToImages
[
1
]=
(
int
)
gd
.
getNextNumber
();
fromToImages
[
1
]=
(
int
)
gd
.
getNextNumber
();
for
(
int
i
=
0
;
i
<
this
.
distortionCalibrationData
.
getNumImages
();
i
++)
for
(
int
i
=
0
;
i
<
this
.
distortionCalibrationData
.
getNumImages
();
i
++)
{
if
((
allImages
||
this
.
distortionCalibrationData
.
gIP
[
i
].
enabled
)
&&
(
i
>=
fromToImages
[
0
])
&&
(
i
<=
fromToImages
[
1
])){
// if ((allImages || this.distortionCalibrationData.gIP[i].enabled) && (i>=fromToImages[0]) && (i<=fromToImages[1])){
// this.selectedImages[numSeries][i]=gd.getNextBoolean();
// }
if
((
i
>=
fromToImages
[
0
])
&&
(
i
<=
fromToImages
[
1
])){
if
(
allImages
||
this
.
distortionCalibrationData
.
gIP
[
i
].
enabled
)
{
this
.
selectedImages
[
numSeries
][
i
]=
gd
.
getNextBoolean
();
this
.
selectedImages
[
numSeries
][
i
]=
gd
.
getNextBoolean
();
}
else
{
this
.
selectedImages
[
numSeries
][
i
]=
false
;
// unselect stray non-shown images
}
}
}
}
if
(
allImages
)
enableDisableSelected
=
gd
.
getNextBoolean
();
if
(
allImages
)
enableDisableSelected
=
gd
.
getNextBoolean
();
this
.
masterImages
[
numSeries
]=(
int
)
gd
.
getNextNumber
();
this
.
masterImages
[
numSeries
]=(
int
)
gd
.
getNextNumber
();
...
...
src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java
View file @
9833be98
...
@@ -7074,6 +7074,10 @@ public class MatchSimulatedPattern {
...
@@ -7074,6 +7074,10 @@ public class MatchSimulatedPattern {
coeff
[
0
][
2
]=
SMU
;
coeff
[
0
][
2
]=
SMU
;
coeff
[
1
][
2
]=
SMV
;
coeff
[
1
][
2
]=
SMV
;
}
else
{
if
(
this
.
debugLevel
>
0
)
{
System
.
out
.
println
(
"coeff == null"
);
}
}
}
return
coeff
;
return
coeff
;
}
}
...
@@ -7589,7 +7593,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
...
@@ -7589,7 +7593,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
double
[][]
pointersXYUV
,
double
[][]
pointersXYUV
,
boolean
removeOutOfGridPointers
,
//
boolean
removeOutOfGridPointers
,
//
double
[][][]
hintGrid
,
// predicted grid array (or null)
double
[][][]
hintGrid
,
// predicted grid array (or null)
double
hintGridTolerance
,
// all
l
owed mismatch (fraction of period) or 0 - orientation only
double
hintGridTolerance
,
// allowed mismatch (fraction of period) or 0 - orientation only
int
global_debug_level
,
// DEBUG_LEVEL
int
global_debug_level
,
// DEBUG_LEVEL
boolean
noMessageBoxes
boolean
noMessageBoxes
){
){
...
@@ -7602,7 +7606,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
...
@@ -7602,7 +7606,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
}
}
int
acalibrated
=
0
;
int
acalibrated
=
0
;
double
[][]
gridMatchCoeff
=
null
;
double
[][]
gridMatchCoeff
=
null
;
double
searchAround
=
20.0
;
// how far to look for the grid node
double
searchAround
=
50
;
//
20.0; // how far to look for the grid node
int
gridRotation
=-
1
;
//undefined
int
gridRotation
=-
1
;
//undefined
int
[]
iGridTranslateUV
=
null
;
// translate UV grid by these integer numbers
int
[]
iGridTranslateUV
=
null
;
// translate UV grid by these integer numbers
if
(
hintGrid
!=
null
){
if
(
hintGrid
!=
null
){
...
@@ -7612,7 +7616,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
...
@@ -7612,7 +7616,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
gridRotation
=
matrixToRot
(
gridMatchCoeff
);
gridRotation
=
matrixToRot
(
gridMatchCoeff
);
this
.
debugLevel
=
global_debug_level
;
this
.
debugLevel
=
global_debug_level
;
int
[][]
iGridMatchCoeff
=
gridMatrixApproximate
(
gridMatchCoeff
);
int
[][]
iGridMatchCoeff
=
gridMatrixApproximate
(
gridMatchCoeff
);
if
(
global_debug_level
>
1
){
if
(
global_debug_level
>
0
){
System
.
out
.
println
(
"gridMatchCoeff[0]={"
+
IJ
.
d2s
(
gridMatchCoeff
[
0
][
0
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
0
][
1
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
0
][
2
],
5
)+
"}"
);
System
.
out
.
println
(
"gridMatchCoeff[0]={"
+
IJ
.
d2s
(
gridMatchCoeff
[
0
][
0
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
0
][
1
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
0
][
2
],
5
)+
"}"
);
System
.
out
.
println
(
"gridMatchCoeff[1]={"
+
IJ
.
d2s
(
gridMatchCoeff
[
1
][
0
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
1
][
1
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
1
][
2
],
5
)+
"}"
);
System
.
out
.
println
(
"gridMatchCoeff[1]={"
+
IJ
.
d2s
(
gridMatchCoeff
[
1
][
0
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
1
][
1
],
5
)+
", "
+
IJ
.
d2s
(
gridMatchCoeff
[
1
][
2
],
5
)+
"}"
);
System
.
out
.
println
(
"gridRotation="
+
gridRotation
);
System
.
out
.
println
(
"gridRotation="
+
gridRotation
);
...
@@ -7624,12 +7628,13 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
...
@@ -7624,12 +7628,13 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
// hintGridTolerance==0 - do not try to determine shift from the hint (not reliable yet)
// hintGridTolerance==0 - do not try to determine shift from the hint (not reliable yet)
if
(
hintGridTolerance
>
0
)
{
if
(
hintGridTolerance
>
0
)
{
if
(
worstGridMatchTranslate
(
gridMatchCoeff
)<=
hintGridTolerance
){
// convert to pixels from halfperiods (or just chnage definition of hintGridTolerance)
if
(
worstGridMatchTranslate
(
gridMatchCoeff
)<=
hintGridTolerance
){
// convert to pixels from halfperiods (or just chnage definition of hintGridTolerance)
if
(
global_debug_level
>
1
)
System
.
out
.
println
(
"worstGridMatchTranslate(gridMatchCoeff)= "
+
worstGridMatchTranslate
(
gridMatchCoeff
)+
", hintGridTolerance="
+
hintGridTolerance
);
if
(
global_debug_level
>
0
)
System
.
out
.
println
(
"worstGridMatchTranslate(gridMatchCoeff)= "
+
worstGridMatchTranslate
(
gridMatchCoeff
)+
", hintGridTolerance="
+
hintGridTolerance
);
iGridTranslateUV
=
new
int
[
2
];
iGridTranslateUV
=
new
int
[
2
];
iGridTranslateUV
[
0
]=
iGridMatchCoeff
[
0
][
2
];
iGridTranslateUV
[
0
]=
iGridMatchCoeff
[
0
][
2
];
iGridTranslateUV
[
1
]=
iGridMatchCoeff
[
1
][
2
];
iGridTranslateUV
[
1
]=
iGridMatchCoeff
[
1
][
2
];
}
else
{
}
else
{
if
(
global_debug_level
>
1
)
System
.
out
.
println
(
"*** Warning: combineGridCalibration() failed, worstGridMatchTranslate(gridMatchCoeff)= "
+
worstGridMatchTranslate
(
gridMatchCoeff
)+
", hintGridTolerance="
+
hintGridTolerance
);
if
(
global_debug_level
>
0
)
System
.
out
.
println
(
"*** Warning: combineGridCalibration() failed, worstGridMatchTranslate(gridMatchCoeff)= "
+
worstGridMatchTranslate
(
gridMatchCoeff
)+
", hintGridTolerance="
+
hintGridTolerance
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -8720,7 +8725,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
...
@@ -8720,7 +8725,7 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1])
distUV
[
0
]=
reReMap
[
0
][
0
]*
uv
[
i
][
0
]+
reReMap
[
0
][
1
]*
uv
[
i
][
1
]+
reReMap
[
0
][
2
]-
xyuv
[
i
][
2
];
distUV
[
0
]=
reReMap
[
0
][
0
]*
uv
[
i
][
0
]+
reReMap
[
0
][
1
]*
uv
[
i
][
1
]+
reReMap
[
0
][
2
]-
xyuv
[
i
][
2
];
distUV
[
1
]=
reReMap
[
1
][
0
]*
uv
[
i
][
0
]+
reReMap
[
1
][
1
]*
uv
[
i
][
1
]+
reReMap
[
1
][
2
]-
xyuv
[
i
][
3
];
distUV
[
1
]=
reReMap
[
1
][
0
]*
uv
[
i
][
0
]+
reReMap
[
1
][
1
]*
uv
[
i
][
1
]+
reReMap
[
1
][
2
]-
xyuv
[
i
][
3
];
dist
=
Math
.
sqrt
(
distUV
[
0
]*
distUV
[
0
]+
distUV
[
1
]*
distUV
[
1
]);
dist
=
Math
.
sqrt
(
distUV
[
0
]*
distUV
[
0
]+
distUV
[
1
]*
distUV
[
1
]);
if
(
debugLevel
>
1
)
{
if
(
debugLevel
>
0
){
// 1)
{
System
.
out
.
println
(
"Laser spot #"
+
i
+
", distance from predicted ="
+
IJ
.
d2s
(
dist
,
3
)+
" ("
+
IJ
.
d2s
(
200
*
dist
,
3
)+
System
.
out
.
println
(
"Laser spot #"
+
i
+
", distance from predicted ="
+
IJ
.
d2s
(
dist
,
3
)+
" ("
+
IJ
.
d2s
(
200
*
dist
,
3
)+
"% of cell radius), du="
+
IJ
.
d2s
(
distUV
[
0
],
3
)+
", dv="
+
IJ
.
d2s
(
distUV
[
1
],
3
));
"% of cell radius), du="
+
IJ
.
d2s
(
distUV
[
0
],
3
)+
", dv="
+
IJ
.
d2s
(
distUV
[
1
],
3
));
}
}
...
...
src/main/java/com/elphel/imagej/calibration/PatternParameters.java
View file @
9833be98
...
@@ -776,7 +776,7 @@ import ij.io.Opener;
...
@@ -776,7 +776,7 @@ import ij.io.Opener;
corn
[
2
]
=
getXYZM
(
iu
,
iv
+
1
,
verbose
,
station
);
corn
[
2
]
=
getXYZM
(
iu
,
iv
+
1
,
verbose
,
station
);
corn
[
3
]
=
getXYZM
(
iu
+
1
,
iv
+
1
,
verbose
,
station
);
corn
[
3
]
=
getXYZM
(
iu
+
1
,
iv
+
1
,
verbose
,
station
);
if
((
corn
[
0
]
==
null
)
||
(
corn
[
1
]
==
null
)
||
(
corn
[
2
]
==
null
)
||
(
corn
[
3
]
==
null
))
{
if
((
corn
[
0
]
==
null
)
||
(
corn
[
1
]
==
null
)
||
(
corn
[
2
]
==
null
)
||
(
corn
[
3
]
==
null
))
{
System
.
out
.
println
(
"Optical axis outside of te grid: TODO: modify getXYZM() to handle!"
);
System
.
out
.
println
(
"Optical axis outside of t
h
e grid: TODO: modify getXYZM() to handle!"
);
return
null
;
return
null
;
}
}
double
[]
rslt_xyz
=
new
double
[
3
];
double
[]
rslt_xyz
=
new
double
[
3
];
...
...
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