Commit 7a17cbe2 authored by Luc Deschenaux's avatar Luc Deschenaux

Merge branch 'master' of https://github.com/Elphel/imagej-elphel

parents b8af8a1c d14a3970
...@@ -11,14 +11,18 @@ ...@@ -11,14 +11,18 @@
<version>1.135</version> <version>1.135</version>
<relativePath /> <relativePath />
</parent> </parent>
<!--
<properties>
<imagej.app.directory>/data/ImageJ/ImageJ</imagej.app.directory>
</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</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> -->
<description>A Maven project implementing imagej-elphel plugin</description> <description>A Maven project implementing imagej-elphel plugin</description>
...@@ -74,9 +78,8 @@ ...@@ -74,9 +78,8 @@
<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>
...@@ -85,6 +88,7 @@ ...@@ -85,6 +88,7 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12398,7 +12398,7 @@ Which parameters affect which matrices ...@@ -12398,7 +12398,7 @@ Which parameters affect which matrices
public int getGoniometerHorizontalIndex(){return 6;} public int getGoniometerHorizontalIndex(){return 6;}
public int getGoniometerAxialIndex(){return 7;} public int getGoniometerAxialIndex(){return 7;}
public int getSensorWidth() { return this.sensorWidth;} public int getSensorWidth() { return this.sensorWidth;}
public int getSensorHeight() { return this.sensorWidth;} 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
public int getSensorHeight(int subCam) { return this.sensorHeight;}// for the future? different sensors public int getSensorHeight(int subCam) { return this.sensorHeight;}// for the future? different sensors
public double getPixelSize(int subCamNumber){return this.eyesisSubCameras[0][subCamNumber].pixelSize;} // use station 0's pixel size public double getPixelSize(int subCamNumber){return this.eyesisSubCameras[0][subCamNumber].pixelSize;} // use station 0's pixel size
...@@ -13952,6 +13952,33 @@ Which parameters affect which matrices ...@@ -13952,6 +13952,33 @@ Which parameters affect which matrices
this.flipVertical=flipVertical; this.flipVertical=flipVertical;
recalcCommons(); recalcCommons();
} }
public void setIntrincicFromSubcamera(EyesisSubCameraParameters pars){
setLensDistortionParameters(
pars.focalLength,
pars.pixelSize, //um
pars.distortionRadius, // mm
pars.distortionA8, // r^7
pars.distortionA7, // r^6
pars.distortionA6, // r^5
pars.distortionA5, // r^4
pars.distortionA, // r^4
pars.distortionB, // r^3
pars.distortionC, // r^2
// orientation/position parameters
this.yaw, // (keep) angle in degrees from perpendicular to the pattern, 0 - towards wall, positive - clockwise from top
this.pitch, // (keep) angle in degrees from perpendicular to the pattern, 0 - towards wall, positive - up
this.roll, // (keep) angle in degrees rotation around camera optical axis (perpendicular to pattern if yaw==0, pitch==0), positive - clockwise
this.x0, // (keep) lens axis from pattern center, mm (to the right)
this.y0, // (keep) lens axis from pattern center, mm (down)
this.z0, // (keep) lens axis from pattern center, mm (away)
this.distance, // (keep) distance from the lens input pupil to the pattern plane along the camera axis, mm
pars.px0, // center of the lens on the sensor, pixels
pars.py0, // center of the lens on the sensor, pixels
this.flipVertical // (keep) acquired image is mirrored vertically (mirror used)
);
}
public void setLensDistortionParameters(LensDistortionParameters ldp public void setLensDistortionParameters(LensDistortionParameters ldp
){ ){
this.focalLength=ldp.focalLength; this.focalLength=ldp.focalLength;
This diff is collapsed.
This diff is collapsed.
...@@ -5332,6 +5332,7 @@ java.lang.ArrayIndexOutOfBoundsException: -3566 ...@@ -5332,6 +5332,7 @@ java.lang.ArrayIndexOutOfBoundsException: -3566
if (mask[i]<maskCutOff) mask[i]=0.0; if (mask[i]<maskCutOff) mask[i]=0.0;
int size = (int) Math.sqrt(psf.length); int size = (int) Math.sqrt(psf.length);
int hsize=size/2; int hsize=size/2;
// int nn=0;
double S0=0.0, SR=0.0, ST=0.0,SR2=0.0,ST2=0.0; //,SRT=0.0; double S0=0.0, SR=0.0, ST=0.0,SR2=0.0,ST2=0.0; //,SRT=0.0;
for (int i=0;i<mask.length;i++) if (mask[i]>0.0) { for (int i=0;i<mask.length;i++) if (mask[i]>0.0) {
double x=(i % size) - hsize; double x=(i % size) - hsize;
...@@ -5344,13 +5345,62 @@ java.lang.ArrayIndexOutOfBoundsException: -3566 ...@@ -5344,13 +5345,62 @@ java.lang.ArrayIndexOutOfBoundsException: -3566
ST+=d*tc; ST+=d*tc;
SR2+=d*rc*rc; SR2+=d*rc*rc;
ST2+=d*tc*tc; ST2+=d*tc*tc;
// SRT+=d*rc*tc; // nn++;
} }
if (S0==0.0) return null; // make sure it is OK if (S0==0.0) return null; // make sure it is OK
double [] result={ Math.sqrt(ST2*S0 - ST*ST)/S0, Math.sqrt(SR2*S0 - SR*SR)/S0}; double [] result={ Math.sqrt(ST2*S0 - ST*ST)/S0, Math.sqrt(SR2*S0 - SR*SR)/S0};
// System.out.println(" mask.length="+mask.length+" nn="+nn+" S0="+S0+" SR="+SR+" ST="+ST+" SR2="+SR2+" ST2="+ST2+
// " result={"+result[0]+","+result[1]+"}");
return result; return result;
} }
//====================================================
public double [] x2y2xySizes(
double [] psf, // PSF function, square array, nominally positive
double cutoffEnergy, // fraction of energy in the pixels to be used
double cutoffLevel, // minimal level as a fraction of maximal
int minArea, // minimal selected area in pixels
double blurSigma, // optionally blur the selection
double maskCutOff,
int debugLevel, // debug level
String title) { // prefix used for debug images
double [] mask=findClusterOnPSF(
psf,
cutoffEnergy,
cutoffLevel,
minArea,
blurSigma,
debugLevel,
title);
for (int i=0;i<mask.length;i++)
if (mask[i]<maskCutOff) mask[i]=0.0;
int size = (int) Math.sqrt(psf.length);
int hsize=size/2;
// int nn=0;
double S0=0.0, SX=0.0, SY=0.0,SX2=0.0,SY2=0.0,SXY=0.0;
for (int i=0;i<mask.length;i++) if (mask[i]>0.0) {
double x=(i % size) - hsize;
double y=(i / size) - hsize;
double d=psf[i]*mask[i];
S0+=d;
SX+=d*x;
SY+=d*y;
SX2+=d*x*x;
SY2+=d*y*y;
SXY+=d*x*y;
// nn++;
}
if (S0==0.0) return null; // make sure it is OK
double [] result={
(SX2*S0 - SX*SX)/S0/S0,
(SY2*S0 - SY*SY)/S0/S0,
(SXY*S0 - SX*SY)/S0/S0}; // this may be negative
// System.out.println(" mask.length="+mask.length+" nn="+nn+" S0="+S0+" SX="+SX+" SY="+SY+" SX2="+SXR2+" SY2="+SY2+" SXY="+SXY+
// " result={"+result[0]+","+result[1]+","+result[2]+"}");
return result;
}
//==================================================== //====================================================
public double [] findClusterOnPSF( public double [] findClusterOnPSF(
...@@ -5382,7 +5432,8 @@ java.lang.ArrayIndexOutOfBoundsException: -3566 ...@@ -5382,7 +5432,8 @@ java.lang.ArrayIndexOutOfBoundsException: -3566
} }
if (maxValue<=0.0){ if (maxValue<=0.0){
String msg="psf array does not contain any positive values"; String msg="psf array does not contain any positive values";
IJ.showMessage("Error",msg); // IJ.showMessage("Error",msg);
System.out.println("Error "+msg);
throw new IllegalArgumentException (msg); throw new IllegalArgumentException (msg);
} }
ix=Index % size; ix=Index % size;
...@@ -8506,6 +8557,7 @@ d()/dy=C*x+2*B*y+E=0 ...@@ -8506,6 +8557,7 @@ d()/dy=C*x+2*B*y+E=0
IJ.showMessage("Error",msg); IJ.showMessage("Error",msg);
throw new IllegalArgumentException (msg); throw new IllegalArgumentException (msg);
} }
if (this.PATTERN_GRID.length==0) return null;
double x1=x0,y1=y0; double x1=x0,y1=y0;
double x2=x1+size; double x2=x1+size;
double y2=y1+size; double y2=y1+size;
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
# #
# If something like ("<arg>") is appended to the class name, the setup() method # If something like ("<arg>") is appended to the class name, the setup() method
# will get that as arg parameter; otherwise arg is simply the empty string. # will get that as arg parameter; otherwise arg is simply the empty string.
Process, "Process Pixels", Process_Pixels #Process, "Process Pixels", Process_Pixels
Process, "Aberration Calibration", Aberration_Calibration Process, "Aberration Calibration", Aberration_Calibration
#Plugins, "Aberration Calibration", Aberration_Calibration #Plugins, "Aberration Calibration", Aberration_Calibration
#Process, "Aberration Correction", Aberration_Correction #Process, "Aberration Correction", Aberration_Correction
Process, "Eyesis Correction", Eyesis_Correction Process, "Eyesis Correction", Eyesis_Correction
#Process, "JP46 Reader camera", JP46_Reader_camera Process, "JP46 Reader camera", JP46_Reader_camera
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