Commit 5f0e3426 authored by Andrey Filippov's avatar Andrey Filippov

more on 2-sensor focusing machine

parent 76bf54e4
This diff is collapsed.
......@@ -161,6 +161,8 @@ public class CalibrationHardwareInterface {
private int [][] channelMap1={ // ip index, channel number
// {0,-1}}; // negative channel - single camera
{0,0}}; // Try with 0
private int [][] channelMap2={ // ip index, channel number
{0,0},{0,1}};
private int [][] channelMap3={ // ip index, channel number
// {0,-1}}; // negative channel - single camera
{0,0},{1,0},{2,0}};
......@@ -260,9 +262,15 @@ public class CalibrationHardwareInterface {
private void initDefaultMap(int size){
this.channelMap=new int [size][];
this.flipImages=new boolean[size];
if (size==1) {
if (size==1) { // single camera - old lens focusing
this.channelMap[0]=channelMap1[0].clone();
this.flipImages[0]=true;
} else if (size==2){ // New lens focusing machine
this.channelMap[0]=channelMap2[0].clone();
this.flipImages[0]=true; // main sensor under test
this.channelMap[1]=channelMap2[1].clone();
this.flipImages[1]=false; // extra sensor for location
} else if (size==3){
for (int i=0;i<size;i++){
this.flipImages[i]=false;
......@@ -1829,7 +1837,7 @@ public class CalibrationHardwareInterface {
public String [] groups={"heater","fan","light","light1","light2"};
public int debugLevel=1;
private String powerIP="192.168.0.80";
private double lightsDelay=5.0;
private double lightsDelay=1.0;
private final String urlFormat="http://%s/insteon/index.php?cmd=%s&group=%s&timestamp=%d";
private final String rootElement="Document";
public boolean powerConrtolEnabled=false;
......
......@@ -3123,6 +3123,67 @@ import org.apache.commons.configuration.XMLConfiguration;
}
return this.sensorMasks;
}
/**
* Create round mask inside the actual one, with the provided center. Blur result with the same sigma as original
* @param chn sensor number
* @param xCenter X of the center (before decimation)
* @param yCenter Y of the center (before decimation)
* @return this channel mask, also sets the round mask instead of the original
*/
public double [] roundOffMask(int chn, double xCenter, double yCenter){
int dWidth= (eyesisCameraParameters.sensorWidth -1)/eyesisCameraParameters.decimateMasks+1;
int dHeight= (eyesisCameraParameters.sensorHeight-1)/eyesisCameraParameters.decimateMasks+1;
DoubleGaussianBlur gb=new DoubleGaussianBlur();
int iXC=(int) Math.round(xCenter/eyesisCameraParameters.decimateMasks);
int iYC=(int) Math.round(yCenter/eyesisCameraParameters.decimateMasks);
// int dcW=eyesisCameraParameters.sensorWidth/eyesisCameraParameters.decimateMasks;
// int dcH=eyesisCameraParameters.sensorHeight/eyesisCameraParameters.decimateMasks;
double r0=iXC;
r0 = Math.min(r0, iYC);
r0 = Math.min(r0, dWidth - iXC);
r0 = Math.min(r0, dHeight - iYC);
int ir02=(int) Math.round(r0*r0);
System.out.println("iXC="+iXC);
System.out.println("iYC="+iYC);
System.out.println("initial ir02="+ir02+ "("+Math.sqrt(ir02)+")");
for (int i = 0; i < this.sensorMasks[chn].length; i++) if (this.sensorMasks[chn][i]<0.5) {
int ix = (i % dWidth) - iXC;
int iy = (i / dWidth) - iYC;
int ir2=ix*ix + iy*iy;
if (ir2 < ir02) ir02 = ir2;
}
System.out.println("second ir02="+ir02+ "("+Math.sqrt(ir02)+")");
double [] mask= new double[this.sensorMasks[chn].length];
for (int i = 0; i < mask.length; i++) {
int ix = (i % dWidth) - iXC;
int iy = (i / dWidth) - iYC;
mask[i]=((ix*ix + iy*iy) > ir02)?0.0:1.0;
}
// blur result
double [][] preMask=preCalculateSingleImageMask(chn,
eyesisCameraParameters.decimateMasks,
eyesisCameraParameters.sensorWidth,
eyesisCameraParameters.sensorHeight,
eyesisCameraParameters.shrinkGridForMask);
if (preMask==null) return null; //nothing in this channel
double rAverage=preMask[0][0];
double rAverageNum=preMask[0][1];
if (rAverageNum==0.0) return null; // nothing to blur/process for this channel
rAverage/=rAverageNum; // average distance to the fartherst node from the current
double sigma = eyesisCameraParameters.maskBlurSigma;
if(sigma<0) sigma*=-rAverage;
gb.blurDouble(mask, dWidth, dHeight, sigma/eyesisCameraParameters.decimateMasks, sigma/eyesisCameraParameters.decimateMasks, 0.01);
for (int i=0;i < mask.length;i++){
this.sensorMasks[chn][i] = Math.min(this.sensorMasks[chn][i],mask[i]);
}
return this.sensorMasks[chn];
}
public double [] calculateImageGridMask(int imgNum) {
return calculateImageGridMask(
imgNum,
......
This diff is collapsed.
......@@ -888,14 +888,20 @@ import java.util.Properties;
if (nView>=this.photometricByView[station].length){ // OOB 1// NUll pointer - need to run F-field first? (oob1 when grid had less than now
nView=this.photometricByView.length-1;
}
if (index > this.photometricByView[station][nView][0].length){
System.out.println("getXYZMPE ("+u+","+v+","+station+","+channel+")");
System.out.println("this.photometricByView[station][nView][0].length="+this.photometricByView[station][nView][0].length);
System.out.println("index="+index+" vView="+nView);
System.out.println();
}
double [] result= { // null
double [] result= { // null
this.gridGeometry[v1][u1][0],
this.gridGeometry[v1][u1][1],
// this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][station]:0.0), // per-station correction
this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][useStation]:0.0), // per-station correction
this.gridGeometry[v1][u1][3],
this.photometricByView[station][nView][0][index],
this.photometricByView[station][nView][0][index], // java.lang.ArrayIndexOutOfBoundsException: 14215
this.photometricByView[station][nView][1][index],
this.photometricByView[station][nView][2][index],
this.photometricByView[station][nView][3][index],
......
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