Commit e54061b3 authored by Andrey Filippov's avatar Andrey Filippov

using 'interAxisAngle' to compensate for non-axial 'rotation' of the camera

parent adea6f41
...@@ -8,19 +8,19 @@ ...@@ -8,19 +8,19 @@
<parent> <parent>
<groupId>org.scijava</groupId> <groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId> <artifactId>pom-scijava</artifactId>
<version>1.135</version> <version>3.1</version>
<relativePath /> <relativePath/>
</parent> </parent>
<!--
<properties> <properties>
<imagej.app.directory>/data/ImageJ/ImageJ</imagej.app.directory> <imagej.app.directory>/home/foxel/Desktop/Fiji.app</imagej.app.directory>
</properties> </properties>
-->
<groupId>com.elphel</groupId> <groupId>com.elphel</groupId>
<artifactId>imagej-elphel</artifactId> <artifactId>imagej-elphel</artifactId>
<!-- <artifactId>Aberration_Calibration</artifactId> --> <!-- <artifactId>Aberration_Calibration</artifactId> -->
<version>1.0.0</version> <version>1.0.0-SNAPSHOT</version>
<name>plugins/imagej_elphel.jar</name> <name>plugins/imagej_elphel.jar</name>
<!-- <name>plugins/Aberration_Calibration.jar</name> --> <!-- <name>plugins/Aberration_Calibration.jar</name> -->
...@@ -29,10 +29,11 @@ ...@@ -29,10 +29,11 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>net.imagej</groupId> <groupId>net.imagej</groupId>
<artifactId>ij</artifactId> <artifactId>ij</artifactId>
<version>${imagej1.version}</version> <version>1.49m</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-configuration</groupId> <groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId> <artifactId>commons-configuration</artifactId>
...@@ -73,29 +74,31 @@ ...@@ -73,29 +74,31 @@
</testResource> </testResource>
</testResources> </testResources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId> <artifactId>maven-plugin-plugin</artifactId>
<configuration> <configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 --> <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>mojo-descriptor</id> <id>mojo-descriptor</id>
<goals> <goals>
<goal>descriptor</goal> <goal>descriptor</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase>
<goals> <goals>
<goal>java</goal> <goal>java</goal>
</goals> </goals>
...@@ -106,7 +109,28 @@ ...@@ -106,7 +109,28 @@
<mainClass>Eyesis_Correction</mainClass> <mainClass>Eyesis_Correction</mainClass>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>true</doCheck>
<doUpdate>true</doUpdate>
<format>Build {0,date,yyyy-MM-dd} {0,time,HH:MM:SS} on host {1}</format>
<items>
<item>timestamp</item>
<item>foxel-MRHM7AP</item>
</items>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
...@@ -142,10 +166,22 @@ ...@@ -142,10 +166,22 @@
<scm> <scm>
<connection>scm:git:git://github.com/Elphel/imagej-elphel</connection> <connection>scm:git:git://github.com/Elphel/imagej-elphel</connection>
<developerConnection>sscm:git:https://github.com/Elphel/imagej-elphel</developerConnection> <developerConnection>scm:git:https://github.com/Elphel/imagej-elphel</developerConnection>
<tag>HEAD</tag> <tag>HEAD</tag>
<url>https://github.com/Elphel/imagej-elphel</url> <url>https://github.com/Elphel/imagej-elphel</url>
</scm> </scm>
<packaging>maven-plugin</packaging> <packaging>maven-plugin</packaging>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.14</version>
<configuration>
<configLocation>config/sun_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
</project> </project>
...@@ -6662,8 +6662,9 @@ if (MORE_BUTTONS) { ...@@ -6662,8 +6662,9 @@ if (MORE_BUTTONS) {
gd.addNumericField("Station number (0.."+(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.numStations-1), stationNumber, 0); gd.addNumericField("Station number (0.."+(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.numStations-1), stationNumber, 0);
} }
gd.addNumericField("Number of sub-camera (starting with 0)", 0, 0); gd.addNumericField("Number of sub-camera (starting with 0)", 0, 0);
gd.addNumericField("Camera tilt (0 - vertical, >0 looking above horizon on the target", 0.0, 1,6,"degrees"); gd.addNumericField("Camera tilt (0 - vertical, >0 looking above horizon on the target)", 0.0, 1,6,"degrees");
gd.addNumericField("Camera axial (0 - subcamera 0 looking to the target, >0 - rotated clockwise", 0.0, 1,6,"degrees"); gd.addNumericField("Camera axial (0 - subcamera 0 looking to the target, >0 - rotated clockwise)", 0.0, 1,6,"degrees");
gd.addNumericField("Inter-axis angle (from 90)", 0.0, 1,6,"degrees");
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return; if (gd.wasCanceled()) return;
if (LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.numStations>1){ if (LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.numStations>1){
...@@ -6672,11 +6673,13 @@ if (MORE_BUTTONS) { ...@@ -6672,11 +6673,13 @@ if (MORE_BUTTONS) {
int channelNumber= (int) gd.getNextNumber(); int channelNumber= (int) gd.getNextNumber();
double tilt= gd.getNextNumber(); double tilt= gd.getNextNumber();
double axial= gd.getNextNumber(); double axial= gd.getNextNumber();
double inter= gd.getNextNumber();
ImagePlus imp_simulatePatternOnSensor=LENS_DISTORTIONS.simulatePatternOnSensor( ImagePlus imp_simulatePatternOnSensor=LENS_DISTORTIONS.simulatePatternOnSensor(
stationNumber, stationNumber,
channelNumber, channelNumber,
tilt, tilt,
axial, axial,
inter,
SIMUL, SIMUL,
THREADS_MAX, //int threadsMax, THREADS_MAX, //int threadsMax,
UPDATE_STATUS, // boolean updateStatus, UPDATE_STATUS, // boolean updateStatus,
...@@ -765,7 +765,8 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -765,7 +765,8 @@ import org.apache.commons.configuration.XMLConfiguration;
} }
String header="#\ttimestamp"; String header="#\ttimestamp";
if (this.eyesisCameraParameters.numStations>1) header+="\tStation"; if (this.eyesisCameraParameters.numStations>1) header+="\tStation";
header+="\tAxial\tTilt\thorPhi\thorPsi\tX\tY\tZ\tMotor2\tMotor3"; // header+="\tAxial\tTilt\thorPhi\thorPsi\tX\tY\tZ\tMotor2\tMotor3";
header+="\tAxial\tTilt\tdTilt\tInter\tMotor2\tMotor3";
if (numPoints!=null) header+="\tNumPoints"; if (numPoints!=null) header+="\tNumPoints";
header+="\tEnabled\tMatched"; header+="\tEnabled\tMatched";
if (setRMS!=null) header+="\tRMS\tWeight"; if (setRMS!=null) header+="\tRMS\tWeight";
...@@ -773,51 +774,67 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -773,51 +774,67 @@ import org.apache.commons.configuration.XMLConfiguration;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (int i=0;i<this.gIS.length;i++){ for (int i=0;i<this.gIS.length;i++){
double firstHorAxisErrPhi=Double.NaN; double axial_corr_sign=this.gIS[i].goniometerAxial; // correct sign of rotation beyond +/-180 according to motor steps
double firstHorAxisErrPsi=Double.NaN; if (this.gIS[i].motors != null) {
double firstGXYZ0= Double.NaN; if (this.gIS[i].motors[1] > 0){
double firstGXYZ1= Double.NaN; if (axial_corr_sign < -90.0) {
double firstGXYZ2= Double.NaN; axial_corr_sign += 360.0;
// int index=-1; }
// for (int ni=0;ni<this.gIS[i].imageSet.length;ni++) if (this.gIS[i].imageSet[ni]!=null){ } else {
// index=this.gIS[i].imageSet[ni].imgNumber; if (axial_corr_sign > 90.0) {
// break; axial_corr_sign -= 360.0;
// } }
// int horAxisErrPhiIndex=getParameterIndexByName("horAxisErrPhi");
// int horAxisErrPsiIndex=getParameterIndexByName("horAxisErrPsi"); }
// if ((index>=0) && (horAxisErrPhiIndex>=0)) { }
// firstHorAxisErrPhi=this.pars[index][horAxisErrPhiIndex]; // calculate average tilt for this tilt motor and difference of the current tilt from average
firstHorAxisErrPhi=this.gIS[i].horAxisErrPhi; double dTilt=Double.NaN;
// } if (!Double.isNaN(this.gIS[i].goniometerTilt) && (this.gIS[i].motors != null)){
// if ((index>=0) && (horAxisErrPsiIndex>=0)) { int i_low,i_high;
// firstHorAxisErrPsi=this.pars[index][horAxisErrPsiIndex]; for (i_low=i-1;i_low>=0;i_low--){
firstHorAxisErrPsi=this.gIS[i].horAxisErrPsi; if ((this.gIS[i_low].motors != null) && (this.gIS[i_low].motors[2] != this.gIS[i].motors[2])) break;
// } }
// int GXYZ0Index=getParameterIndexByName("GXYZ0"); i_low++;
// if ((index>=0) && (GXYZ0Index>=0)) { for (i_high=i+1;i_high < this.gIS.length;i_high++){
// firstGXYZ0=this.pars[index][GXYZ0Index]; if ((this.gIS[i_high].motors != null) && (this.gIS[i_high].motors[2] != this.gIS[i].motors[2])) break;
firstGXYZ0=this.gIS[i].GXYZ[0]; }
// } int num_avg=0;
// int GXYZ1Index=getParameterIndexByName("GXYZ1"); double sum_avg=0.0;
// if ((index>=0) && (GXYZ1Index>=0)) { for (int i_avg=i_low;i_avg < i_high; i_avg++){
// firstGXYZ1=this.pars[index][GXYZ1Index]; if (!Double.isNaN(this.gIS[i_avg].goniometerTilt)){
firstGXYZ1=this.gIS[i].GXYZ[1]; num_avg++;
// } sum_avg += this.gIS[i_avg].goniometerTilt;
// int GXYZ2Index=getParameterIndexByName("GXYZ2"); }
// if ((index>=0) && (GXYZ2Index>=0)) { }
// firstGXYZ2=this.pars[index][GXYZ2Index]; if (num_avg>0) dTilt = this.gIS[i].goniometerTilt - (sum_avg/num_avg);
firstGXYZ2=this.gIS[i].GXYZ[2];
// } }
// double firstHorAxisErrPhi=Double.NaN;
// double firstHorAxisErrPsi=Double.NaN;
// double firstGXYZ0= Double.NaN;
// double firstGXYZ1= Double.NaN;
// double firstGXYZ2= Double.NaN;
double firstInterAxisAngle=Double.NaN;
// firstHorAxisErrPhi=this.gIS[i].horAxisErrPhi;
// firstHorAxisErrPsi=this.gIS[i].horAxisErrPsi;
// firstGXYZ0=this.gIS[i].GXYZ[0];
// firstGXYZ1=this.gIS[i].GXYZ[1];
// firstGXYZ2=this.gIS[i].GXYZ[2];
firstInterAxisAngle = this.gIS[i].interAxisAngle;
sb.append(i+"\t"+IJ.d2s(this.gIS[i].timeStamp,6)); sb.append(i+"\t"+IJ.d2s(this.gIS[i].timeStamp,6));
if (this.eyesisCameraParameters.numStations>1) sb.append(i+"\t"+ this.gIS[i].getStationNumber()); if (this.eyesisCameraParameters.numStations>1) sb.append(i+"\t"+ this.gIS[i].getStationNumber());
sb.append("\t"+(Double.isNaN(this.gIS[i].goniometerAxial)?"---":((this.gIS[i].orientationEstimated?"(":"")+IJ.d2s(this.gIS[i].goniometerAxial,3)+(this.gIS[i].orientationEstimated?")":"")))); sb.append("\t"+(Double.isNaN(this.gIS[i].goniometerAxial)?"---":((this.gIS[i].orientationEstimated?"(":"")+IJ.d2s(axial_corr_sign,3)+(this.gIS[i].orientationEstimated?")":""))));
sb.append("\t"+(Double.isNaN(this.gIS[i].goniometerTilt)?"---":((this.gIS[i].orientationEstimated?"(":"")+IJ.d2s(this.gIS[i].goniometerTilt,3)+(this.gIS[i].orientationEstimated?")":"")))); sb.append("\t"+(Double.isNaN(this.gIS[i].goniometerTilt)?"---":((this.gIS[i].orientationEstimated?"(":"")+IJ.d2s(this.gIS[i].goniometerTilt,3)+(this.gIS[i].orientationEstimated?")":""))));
sb.append("\t"+(Double.isNaN(firstHorAxisErrPhi)?"---":IJ.d2s(firstHorAxisErrPhi,3)));
sb.append("\t"+(Double.isNaN(firstHorAxisErrPsi)?"---":IJ.d2s(firstHorAxisErrPsi,3))); // sb.append("\t"+(Double.isNaN(firstHorAxisErrPhi)?"---":IJ.d2s(firstHorAxisErrPhi,3)));
// sb.append("\t"+(Double.isNaN(firstHorAxisErrPsi)?"---":IJ.d2s(firstHorAxisErrPsi,3)));
// sb.append("\t"+(Double.isNaN(firstGXYZ0)?"---":IJ.d2s(firstGXYZ0,3)));
// sb.append("\t"+(Double.isNaN(firstGXYZ1)?"---":IJ.d2s(firstGXYZ1,3)));
// sb.append("\t"+(Double.isNaN(firstGXYZ2)?"---":IJ.d2s(firstGXYZ2,3)));
sb.append("\t"+(Double.isNaN(firstGXYZ0)?"---":IJ.d2s(firstGXYZ0,3))); sb.append("\t"+(Double.isNaN(dTilt)?"---":IJ.d2s(dTilt,3)));
sb.append("\t"+(Double.isNaN(firstGXYZ1)?"---":IJ.d2s(firstGXYZ1,3))); sb.append("\t"+(Double.isNaN(firstInterAxisAngle)?"---":IJ.d2s(firstInterAxisAngle,3)));
sb.append("\t"+(Double.isNaN(firstGXYZ2)?"---":IJ.d2s(firstGXYZ2,3)));
if (this.gIS[i].motors==null) { if (this.gIS[i].motors==null) {
sb.append("\t"+"bug"+"\t"+"bug"); sb.append("\t"+"bug"+"\t"+"bug");
...@@ -1361,6 +1378,7 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1361,6 +1378,7 @@ import org.apache.commons.configuration.XMLConfiguration;
* updateSetOrientation() should be called after LMA or other updates to camera parameters * updateSetOrientation() should be called after LMA or other updates to camera parameters
* @param timeStamp - double timestamp identifying imageset (image does not need to be a part of selected grid files) * @param timeStamp - double timestamp identifying imageset (image does not need to be a part of selected grid files)
* @return null if no images set has the specified timestamp, may contain Double.NaN if the orientation was not set. * @return null if no images set has the specified timestamp, may contain Double.NaN if the orientation was not set.
* Now 3-rd term - interAxisAngle - with goniometerTilt it is used for correction of non-pure axial movement of the camera.
*/ */
public double [] getImagesetTiltAxial(double timeStamp){ public double [] getImagesetTiltAxial(double timeStamp){
int mAxial=1; // m2 int mAxial=1; // m2
...@@ -1372,7 +1390,7 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1372,7 +1390,7 @@ import org.apache.commons.configuration.XMLConfiguration;
for (int i=0;i<this.gIS.length;i++) for (int i=0;i<this.gIS.length;i++)
if (this.gIS[i].timeStamp==timeStamp) { if (this.gIS[i].timeStamp==timeStamp) {
int iBest=i; int iBest=i;
if (Double.isNaN(this.gIS[i].goniometerTilt) || Double.isNaN(this.gIS[i].goniometerAxial)) { if (Double.isNaN(this.gIS[i].goniometerTilt) || Double.isNaN(this.gIS[i].goniometerAxial) || Double.isNaN(this.gIS[i].interAxisAngle)) {
// find the closest one (by motors) // find the closest one (by motors)
if (this.gIS[i].motors==null) { if (this.gIS[i].motors==null) {
if (this.debugLevel>0) System.out.println("getImagesetTiltAxial("+timeStamp+"): No motor data"); if (this.debugLevel>0) System.out.println("getImagesetTiltAxial("+timeStamp+"): No motor data");
...@@ -1396,7 +1414,8 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1396,7 +1414,8 @@ import org.apache.commons.configuration.XMLConfiguration;
(this.gIS[j].getStationNumber()==stationNumber) && (this.gIS[j].getStationNumber()==stationNumber) &&
(this.gIS[j].motors[mHorizontal]==thisMotorHorizontal) && (this.gIS[j].motors[mHorizontal]==thisMotorHorizontal) &&
!Double.isNaN(this.gIS[j].goniometerTilt) && !Double.isNaN(this.gIS[j].goniometerTilt) &&
!Double.isNaN(this.gIS[j].goniometerAxial)){ !Double.isNaN(this.gIS[j].goniometerAxial) &&
!Double.isNaN(this.gIS[j].interAxisAngle)){
setList.add(new Integer(j)); setList.add(new Integer(j));
} }
} }
...@@ -1436,12 +1455,16 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1436,12 +1455,16 @@ import org.apache.commons.configuration.XMLConfiguration;
// now linear interpolate axail between theses two sets: indexClosest and indexSecond. (resolve/ guess crossing 360 // now linear interpolate axail between theses two sets: indexClosest and indexSecond. (resolve/ guess crossing 360
double axialClosest=this.gIS[indexClosest].goniometerAxial; double axialClosest=this.gIS[indexClosest].goniometerAxial;
double axialSecond= this.gIS[indexSecond].goniometerAxial; double axialSecond= this.gIS[indexSecond].goniometerAxial;
double interClosest=this.gIS[indexClosest].interAxisAngle;
double interSecond= this.gIS[indexSecond].interAxisAngle;
axialClosest-=360.0*Math.floor((axialClosest+180.0)/360.0); axialClosest-=360.0*Math.floor((axialClosest+180.0)/360.0);
axialSecond-= 360.0*Math.floor((axialSecond+ 180.0)/360.0); axialSecond-= 360.0*Math.floor((axialSecond+ 180.0)/360.0);
if (this.debugLevel>2) System.out.println("getImagesetTiltAxial("+timeStamp+"):"+ if (this.debugLevel>2) System.out.println("getImagesetTiltAxial("+timeStamp+"):"+
" same tilt - "+setList.size()+ " same tilt - "+setList.size()+
" axialClosest="+axialClosest+ " axialClosest="+axialClosest+
" axialSecond="+axialSecond+ " axialSecond="+axialSecond+
" interClosest="+interClosest+
" interSecond="+interSecond+
" motor closest="+this.gIS[indexClosest].motors[mAxial]+ " motor closest="+this.gIS[indexClosest].motors[mAxial]+
" motor second="+this.gIS[indexSecond].motors[mAxial]); " motor second="+this.gIS[indexSecond].motors[mAxial]);
// axial motor has the same sign/direction as the axial angle // axial motor has the same sign/direction as the axial angle
...@@ -1455,6 +1478,11 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1455,6 +1478,11 @@ import org.apache.commons.configuration.XMLConfiguration;
(axialSecond-axialClosest)* (axialSecond-axialClosest)*
(thisMotorAxial-this.gIS[indexClosest].motors[mAxial])/ (thisMotorAxial-this.gIS[indexClosest].motors[mAxial])/
(this.gIS[indexSecond].motors[mAxial]-this.gIS[indexClosest].motors[mAxial]); (this.gIS[indexSecond].motors[mAxial]-this.gIS[indexClosest].motors[mAxial]);
this.gIS[i].interAxisAngle=
interClosest+
(interSecond-interClosest)*
(thisMotorAxial-this.gIS[indexClosest].motors[mAxial])/
(this.gIS[indexSecond].motors[mAxial]-this.gIS[indexClosest].motors[mAxial]);
this.gIS[i].goniometerTilt= this.gIS[i].goniometerTilt=
this.gIS[indexClosest].goniometerTilt+ this.gIS[indexClosest].goniometerTilt+
(this.gIS[indexSecond].goniometerTilt-this.gIS[indexClosest].goniometerTilt)* (this.gIS[indexSecond].goniometerTilt-this.gIS[indexClosest].goniometerTilt)*
...@@ -1464,7 +1492,7 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1464,7 +1492,7 @@ import org.apache.commons.configuration.XMLConfiguration;
} else { // old way } else { // old way
double d2Min=-1; double d2Min=-1;
for (int j=0;j<this.gIS.length;j++) if ((j!=i) && (this.gIS[j].motors!=null) && for (int j=0;j<this.gIS.length;j++) if ((j!=i) && (this.gIS[j].motors!=null) &&
!Double.isNaN(this.gIS[j].goniometerTilt) && !Double.isNaN(this.gIS[j].goniometerAxial)) { !Double.isNaN(this.gIS[j].goniometerTilt) && !Double.isNaN(this.gIS[j].goniometerAxial ) && !Double.isNaN(this.gIS[j].interAxisAngle)) {
double d2=0; double d2=0;
for (int k=0;k<this.gIS[j].motors.length;k++){ for (int k=0;k<this.gIS[j].motors.length;k++){
d2+=1.0*(this.gIS[j].motors[k]-this.gIS[i].motors[k])* d2+=1.0*(this.gIS[j].motors[k]-this.gIS[i].motors[k])*
...@@ -1479,7 +1507,8 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1479,7 +1507,8 @@ import org.apache.commons.configuration.XMLConfiguration;
} }
double [] result = { double [] result = {
this.gIS[iBest].goniometerTilt, this.gIS[iBest].goniometerTilt,
this.gIS[iBest].goniometerAxial this.gIS[iBest].goniometerAxial,
this.gIS[iBest].interAxisAngle
}; };
if (iBest!=i){ if (iBest!=i){
if (this.debugLevel>0) System.out.println("Orientation for set # "+i+" timestamp "+IJ.d2s(this.gIS[i].timeStamp,6)+ if (this.debugLevel>0) System.out.println("Orientation for set # "+i+" timestamp "+IJ.d2s(this.gIS[i].timeStamp,6)+
...@@ -1487,6 +1516,7 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1487,6 +1516,7 @@ import org.apache.commons.configuration.XMLConfiguration;
this.gIS[i].orientationEstimated=true; this.gIS[i].orientationEstimated=true;
this.gIS[i].goniometerTilt= this.gIS[iBest].goniometerTilt; this.gIS[i].goniometerTilt= this.gIS[iBest].goniometerTilt;
this.gIS[i].goniometerAxial=this.gIS[iBest].goniometerAxial; this.gIS[i].goniometerAxial=this.gIS[iBest].goniometerAxial;
this.gIS[i].interAxisAngle=this.gIS[iBest].interAxisAngle;
} }
return result; // may have Double.NaN return result; // may have Double.NaN
} }
......
...@@ -716,10 +716,11 @@ public class Distortions { ...@@ -716,10 +716,11 @@ public class Distortions {
if (this.debugLevel>2){ if (this.debugLevel>2){
System.out.println("listImageSets() 1: "); System.out.println("listImageSets() 1: ");
for (int is=0;is<this.fittingStrategy.distortionCalibrationData.gIS.length;is++){ for (int is=0;is<this.fittingStrategy.distortionCalibrationData.gIS.length;is++){
System.out.println("listImageSets() 1: "+is+": tilt="+ System.out.println("listImageSets() 1: "+is+
this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerTilt+" axial="+ ": tilt="+ this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerTilt+
this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerAxial+" estimated="+ " axial="+ this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerAxial+
this.fittingStrategy.distortionCalibrationData.gIS[is].orientationEstimated); " interAxis="+this.fittingStrategy.distortionCalibrationData.gIS[is].interAxisAngle+
" estimated="+this.fittingStrategy.distortionCalibrationData.gIS[is].orientationEstimated);
} }
} }
} }
...@@ -731,10 +732,11 @@ public class Distortions { ...@@ -731,10 +732,11 @@ public class Distortions {
if (this.debugLevel>2){ if (this.debugLevel>2){
System.out.println("listImageSets() 2: "); System.out.println("listImageSets() 2: ");
for (int is=0;is<this.fittingStrategy.distortionCalibrationData.gIS.length;is++){ for (int is=0;is<this.fittingStrategy.distortionCalibrationData.gIS.length;is++){
System.out.println("listImageSets() 2: "+is+": tilt="+ System.out.println("listImageSets() 2: "+is+
this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerTilt+" axial="+ ": tilt="+ this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerTilt+
this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerAxial+" estimated="+ " axial="+ this.fittingStrategy.distortionCalibrationData.gIS[is].goniometerAxial+
this.fittingStrategy.distortionCalibrationData.gIS[is].orientationEstimated); " interAxis="+this.fittingStrategy.distortionCalibrationData.gIS[is].interAxisAngle+
" estimated="+this.fittingStrategy.distortionCalibrationData.gIS[is].orientationEstimated);
} }
} }
} }
...@@ -2462,6 +2464,7 @@ For each point in the image ...@@ -2462,6 +2464,7 @@ For each point in the image
int subCam, int subCam,
double goniometerTilt, double goniometerTilt,
double goniometerAxial, double goniometerAxial,
double goniometerInterAxis,
SimulationPattern.SimulParameters simulParametersDefault, SimulationPattern.SimulParameters simulParametersDefault,
int threadsMax, int threadsMax,
boolean updateStatus, boolean updateStatus,
...@@ -2481,6 +2484,7 @@ For each point in the image ...@@ -2481,6 +2484,7 @@ For each point in the image
subCam, subCam,
goniometerTilt, // Tilt, goniometerHorizontal goniometerTilt, // Tilt, goniometerHorizontal
goniometerAxial, // Axial,goniometerAxial goniometerAxial, // Axial,goniometerAxial
goniometerInterAxis, // inter-axis angle
-1, // use camera parameters, not imageSet -1, // use camera parameters, not imageSet
true // filter border true // filter border
); );
...@@ -2662,6 +2666,7 @@ For each point in the image ...@@ -2662,6 +2666,7 @@ For each point in the image
dcd.gIP[numGridImage].channel, dcd.gIP[numGridImage].channel,
goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal
goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial
goniometerTiltAxial[2], // inter-axis angle
setNumber, // -1 or specific image set setNumber, // -1 or specific image set
true // filter border true // filter border
); );
...@@ -2902,19 +2907,22 @@ For each point in the image ...@@ -2902,19 +2907,22 @@ For each point in the image
GenericDialog gd=new GenericDialog("Specify camera orientation (channel"+fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel+")"); GenericDialog gd=new GenericDialog("Specify camera orientation (channel"+fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel+")");
gd.addMessage("No goniometer orientation is available for image # "+numGridImage+" - "+fittingStrategy.distortionCalibrationData.gIP[numGridImage].path+ gd.addMessage("No goniometer orientation is available for image # "+numGridImage+" - "+fittingStrategy.distortionCalibrationData.gIP[numGridImage].path+
", please specify orientation manually"); ", please specify orientation manually");
gd.addNumericField("Camera tilt (0 - vertical, >0 looking above horizon on the target", 0.0, 1,6,"degrees"); gd.addNumericField("Camera tilt (0 - vertical, >0 looking above horizon on the target)", 0.0, 1,6,"degrees");
gd.addNumericField("Camera axial (0 - subcamera 0 looking to the target, >0 - rotated clockwise", 0.0, 1,6,"degrees"); gd.addNumericField("Camera axial (0 - subcamera 0 looking to the target, >0 - rotated clockwise)", 0.0, 1,6,"degrees");
gd.addNumericField("Camera inter-axis angle (from 90) ", 0.0, 1,6,"degrees");
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return; if (gd.wasCanceled()) return;
goniometerTiltAxial=new double[2]; goniometerTiltAxial=new double[3];
goniometerTiltAxial[0]= gd.getNextNumber(); goniometerTiltAxial[0]= gd.getNextNumber();
goniometerTiltAxial[1]= gd.getNextNumber(); goniometerTiltAxial[1]= gd.getNextNumber();
goniometerTiltAxial[2]= gd.getNextNumber();
} }
double [][][] hintGrid=estimateGridOnSensor( double [][][] hintGrid=estimateGridOnSensor(
fittingStrategy.distortionCalibrationData.getImageStation(numGridImage), // station number fittingStrategy.distortionCalibrationData.getImageStation(numGridImage), // station number
fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel,
goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal
goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial
goniometerTiltAxial[2], // inter-axis angle
(useSetData?fittingStrategy.distortionCalibrationData.gIP[numGridImage].getSetNumber():-1), (useSetData?fittingStrategy.distortionCalibrationData.gIP[numGridImage].getSetNumber():-1),
true // filter border true // filter border
); );
...@@ -3107,6 +3115,7 @@ For each point in the image ...@@ -3107,6 +3115,7 @@ For each point in the image
int subCamera, int subCamera,
double goniometerHorizontal, // Tilt double goniometerHorizontal, // Tilt
double goniometerAxial, // Axial double goniometerAxial, // Axial
double goniometerInterAxis, // interAxisAngle
int imageSet, int imageSet,
boolean filterBorder){ boolean filterBorder){
double maxRelativeRadius=this.hintedMaxRelativeRadius; // make adjustable double maxRelativeRadius=this.hintedMaxRelativeRadius; // make adjustable
...@@ -3126,6 +3135,11 @@ For each point in the image ...@@ -3126,6 +3135,11 @@ For each point in the image
int goniometerAxialIndex=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getGoniometerAxialIndex(); int goniometerAxialIndex=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getGoniometerAxialIndex();
parVector[goniometerAxialIndex]= goniometerAxial; parVector[goniometerAxialIndex]= goniometerAxial;
} }
if (!Double.isNaN(goniometerInterAxis)) {
int goniometerInterAxisAngleIndex=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getInterAxisAngleIndex();
parVector[goniometerInterAxisAngleIndex]= goniometerInterAxis;
}
// /interAxis
int sensorWidth=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(subCamera); int sensorWidth=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(subCamera);
int sensorHeight=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(subCamera); int sensorHeight=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(subCamera);
System.out.println("estimateGridOnSensor(): subCamera="+subCamera+", goniometerHorizontal="+goniometerHorizontal+", goniometerAxial="+goniometerAxial); System.out.println("estimateGridOnSensor(): subCamera="+subCamera+", goniometerHorizontal="+goniometerHorizontal+", goniometerAxial="+goniometerAxial);
...@@ -9842,7 +9856,7 @@ M * V = B ...@@ -9842,7 +9856,7 @@ M * V = B
distortionCalibrationData.gIS[numSet].goniometerAxial=Double.NaN; distortionCalibrationData.gIS[numSet].goniometerAxial=Double.NaN;
distortionCalibrationData.gIS[numSet].goniometerTilt= Double.NaN; distortionCalibrationData.gIS[numSet].goniometerTilt= Double.NaN;
// re-estimate orientation // re-estimate orientation
double [] ta=distortionCalibrationData.getImagesetTiltAxial(distortionCalibrationData.gIS[numSet].timeStamp); // updates tilt/axial double [] ta=distortionCalibrationData.getImagesetTiltAxial(distortionCalibrationData.gIS[numSet].timeStamp); // updates tilt/axial (now interAxis too!)
if ((ta==null) || Double.isNaN(ta[0]) || Double.isNaN(ta[1])) return false; if ((ta==null) || Double.isNaN(ta[0]) || Double.isNaN(ta[1])) return false;
return true; return true;
} }
......
...@@ -1254,6 +1254,7 @@ public class EyesisAberrations { ...@@ -1254,6 +1254,7 @@ public class EyesisAberrations {
distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, // subCamera, distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, // subCamera,
Double.NaN, // goniometerHorizontal, - not used Double.NaN, // goniometerHorizontal, - not used
Double.NaN, // goniometerAxial, - not used Double.NaN, // goniometerAxial, - not used
Double.NaN, // inter-axis angle, - not used ?
distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].getSetNumber(), //imageSet, distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].getSetNumber(), //imageSet,
true); //filterBorder) true); //filterBorder)
hintTolerance=5.0; // TODO:set from configurable parameter hintTolerance=5.0; // TODO:set from configurable parameter
......
...@@ -1136,6 +1136,7 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1136,6 +1136,7 @@ import org.apache.commons.configuration.XMLConfiguration;
// public int getNumSubCameras (){return (this.eyesisSubCameras==null)?0:this.eyesisSubCameras.length;} // public int getNumSubCameras (){return (this.eyesisSubCameras==null)?0:this.eyesisSubCameras.length;}
public int getGoniometerHorizontalIndex(){return 6;} public int getGoniometerHorizontalIndex(){return 6;}
public int getGoniometerAxialIndex(){return 7;} public int getGoniometerAxialIndex(){return 7;}
public int getInterAxisAngleIndex(){return 9;}
public int getSensorWidth() { return this.sensorWidth;} public int getSensorWidth() { return this.sensorWidth;}
public int getSensorHeight() { return this.sensorHeight;} public int getSensorHeight() { return this.sensorHeight;}
public int getSensorWidth(int subCam) { return this.sensorWidth;} // for the future? different sensors public int getSensorWidth(int subCam) { return this.sensorWidth;} // for the future? different sensors
......
...@@ -598,6 +598,7 @@ horizontal axis: ...@@ -598,6 +598,7 @@ horizontal axis:
subCam, subCam,
goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal
goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial
goniometerTiltAxial[2], // inter-axis angle
-1, // use camera parameters, not imageSet -1, // use camera parameters, not imageSet
true // filter border true // filter border
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment