Commit 8f20656c authored by Andrey Filippov's avatar Andrey Filippov
Browse files

bug fixes, added remembering more parameters for manual hint

parent 65338490
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ public class Distortions {
    public AtomicInteger stopRequested=null; // 1 - stop now, 2 - when convenient

    public String [] status ={"",""};

    public double [] lastUsedManualGridHint_UV = {0.5, 0.5};

    public int getSensorWidth(int subCam) { return fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(subCam);} // for the future? different sensors
    public int getSensorHeight(int subCam) { return fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(subCam);}// for the future? different sensors
@@ -3756,8 +3756,8 @@ For each point in the image
			for (int i =0; i < markers.length; i++) {
				xyuv[i][0] = markers[i][0];
				xyuv[i][1] = markers[i][1];
				xyuv[i][2]=0.5;
				xyuv[i][3]=0.5;
				xyuv[i][2] = lastUsedManualGridHint_UV[0]; // 16.5; // 15.5; // 0.5;
				xyuv[i][3] = lastUsedManualGridHint_UV[1]; //  0.5; // -8.5;//0.5;
			}
			GenericDialog gd=new GenericDialog("Specify U,V coordinates of the marker(s)");
			gd.addMessage("Center white (LWIR black) cell U=0.5, V=0.5");
@@ -3773,6 +3773,10 @@ For each point in the image
				xyuv[i][3] = gd.getNextNumber();
			}

		    lastUsedManualGridHint_UV[0] = xyuv[0][2];
		    lastUsedManualGridHint_UV[1] = xyuv[0][3];
			
			
			// read grid image

			String grid_path=fittingStrategy.distortionCalibrationData.gIP[imgNumber].path;
+17 −8
Original line number Diff line number Diff line
@@ -404,21 +404,28 @@ import ij.io.Opener;
            	/// TODO: Fix me!
            	return; //
        	}
        	if (numZCorr>0) {
        		if (numZCorr==getNumStations()) {
        	if (numZCorr > 0) { // repeat last/trim
        		if (numZCorr >= getNumStations()) {
        			if (this.debugLevel>0){
        				if (numZCorr == getNumStations()) {
        					System.out.println("Loading zCorr data: "+getNumStations()+" slices");
        				} else {
        					System.out.println("Loading zCorr data, first "+getNumStations()+" slices of "+ numZCorr+" read from the file");
        				}
        			this.stationZCorr=new double [height][width][numZCorr];
        			for (int v=0;v<height;v++) for (int u=0;u<width;u++) for (int n=0;n<numZCorr;n++){
        			}
        			this.stationZCorr=new double [height][width][getNumStations()];
        			for (int v=0;v<height;v++) for (int u=0;u<width;u++) for (int n=0;n<getNumStations();n++){
        				this.stationZCorr[v][u][n]=pixels[n+getNumGeometricChannels()][v*width+u];
        			}
        		} else {
            		System.out.println("File has "+numZCorr+" ZCorr slices, current number of stations is "+getNumStations()+
            				", skipping loading zCorr data (per-station pattern Z-correction from the average Z)");

            				", repeating last zCorr data (per-station pattern Z-correction from the average Z)");
        			this.stationZCorr=new double [height][width][getNumStations()];
        			for (int v=0;v<height;v++) for (int u=0;u<width;u++) for (int n0=0;n0<getNumStations();n0++){
        				int n = (n0 < numZCorr)? n0 : (numZCorr - 1);
        				this.stationZCorr[v][u][n]=pixels[n+getNumGeometricChannels()][v*width+u];
        			}
        		}

        	}

        	if (this.debugLevel>0){
@@ -1005,6 +1012,7 @@ import ij.io.Opener;
        	if (getNumStations()<=station) updateNumStations(station+1);
        	int nView=this.viewMap[channel];
        	int useStation=(this.stationZCorr!=null)?((this.stationZCorr[v1][u1].length>station)?station:(this.stationZCorr[v1][u1].length-1)):0;
        	
        	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;
			}
@@ -1014,6 +1022,7 @@ import ij.io.Opener;
        		System.out.println("index="+index+" vView="+nView);
        		System.out.println();
        	}
        	// using last station in grid if there are more now than saved 

        	double [] result= { // null
        			this.gridGeometry[v1][u1][0],
+3 −2
Original line number Diff line number Diff line
@@ -1144,8 +1144,9 @@ Cv=(Cy*x-Cx*y)+(-Cy*Dx+Cx*Dy)
				if (iy < 0) iy = 0;
				else if (iy >= full_height) iy = full_height - 1;
				if (ix < 0) ix = 0;
				else if (ix >= full_width) iy = full_width - 1;
				result[index] = pattern_sign * spixels[ser][iy * full_width + ix];
//				else if (ix >= full_width) iy = full_width - 1;
				else if (ix >= full_width) ix = full_width - 1; // was bug here, causing fatal in the next line
				result[index] = pattern_sign * spixels[ser][iy * full_width + ix]; // java.lang.ArrayIndexOutOfBoundsException: Index 26873856 out of bounds for length 20072448
			}
		}
		return result;