Commit 4aec6d1f authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Before trying to fix GEO output

parent bc9e1a60
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1609,6 +1609,7 @@ public class EyesisCorrectionParameters {
    			e.printStackTrace();
    			return null;
    		}
    		System.out.println("First line: "+lines.get(0)+"\n");
    		Path base_path = seq_path.getParent();
    		// first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory
    		HashMap<String,String> dir_map = new HashMap<String,String>();
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ public class ComboMatch {
		
		
		boolean use_saved_collection = true; // false;
		boolean save_collection =     false; // true;
		boolean save_collection =      true;
		boolean process_correlation = true; // use false to save new version of data
		int     num_tries_fit =       10;
		boolean update_match =        true; // use false to save new version of data
+17 −0
Original line number Diff line number Diff line
@@ -26,6 +26,23 @@ public class FloatImageData {
		this.data = data;
	}

	public double [] getDData() {
		final double [] ddata = new double [data.length];
		final Thread[] threads = ImageDtt.newThreadArray();
		final AtomicInteger ai = new AtomicInteger(0);
        for (int ithread = 0; ithread < threads.length; ithread++) {
            threads[ithread] = new Thread() {
                public void run() {
                    for (int ipix = ai.getAndIncrement(); ipix < data.length; ipix = ai.getAndIncrement()) {
                    	ddata[ipix] = data[ipix];
                    }
                }
            };
        }		      
        ImageDtt.startAndJoin(threads);
		return ddata;
	}
	
	public static int getZoomLevel(
			double pix_in_meters) {
		return getZoomLevel (pix_in_meters, null, null);
+10 −1
Original line number Diff line number Diff line
@@ -52,6 +52,15 @@ public class OrientationSceneLMA {
	public int                debug_width =     12;
	public int                debug_decimals =  9;

	public double [][] getOrientationQuaternions(){
		double [][] qorient = new double [num_scenes][4];
		for (int nscene = 0; nscene < num_scenes; nscene++) {
			for (int i = 0; i < 4; i++) {
				qorient[nscene][i] = parameters_vector[4*nscene + i];
			}
		}
		return qorient;
	}
	
	public int prepareLMA(
			int    []     indices, // should all be used
@@ -81,7 +90,7 @@ public class OrientationSceneLMA {
		double [] pull4 =    {pull_scales,  pull_tilts/2,  pull_tilts/2,  pull_rots};
		
		double sum_pull4 = 0;
		for (double w: weights4) sum_pull4+= w;
		for (double w: pull4) sum_pull4+= w;
		if (sum_pull4 <= 0) {
			pull = 0;
		}
+17 −18
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class OrthoAltitudeMatch {
		boolean invert_y =    true; // only for tilts->affines
        boolean show_details =false;
        
        boolean do_not_save = true;
        boolean do_not_save = false;

//        OrientationSceneLMA.testGetPairErrQuaternion ();
//        OrientationSceneLMA.testGetPairPairScaleDirError();
@@ -890,7 +890,7 @@ public class OrthoAltitudeMatch {
		}
//		double tilt_err_threshold = 0.01; // reduce weight if larger
//overlop_pow = 2.0		

        /*
		for (int npair = 0; npair <quat_pairs.length; npair++ ) {
			System.out.println("quat_pairs["+npair+"]="+QuatUtils.toString(quat_pairs[npair],use_degrees));
		}
@@ -923,7 +923,7 @@ public class OrthoAltitudeMatch {
		    SingularValueDecomposition svd =  SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affine_pairs[npair], y_down_ccw); // boolean y_down_ccw)
		    System.out.println("svd_affine["+npair+"]=" + svd.toString(use_degrees));
		}
		
		*/
		
		double max_flat_err = 0; // tilt_err_threshold
		for (int npair = 0; npair < num_pairs; npair++) {
@@ -964,17 +964,23 @@ public class OrthoAltitudeMatch {
				last_run,         // boolean last_run,
				null, // String dbg_prefix,
				debugLevel);      // int    debug_level)
		System.out.println("LMA -> "+lma_rslt);
		if (lma_rslt >= 0) {
			if (debugLevel > -3) {
				//ersTiltLMA.printSceneResults(use_degrees, use_percents);
				//ersTiltLMA.printPairsResults(use_degrees, use_percents);				
			System.out.println("LMA -> "+lma_rslt);
			double [][] qorients = orientationSceneLMA.getOrientationQuaternions();
			for (int nscene = 0; nscene < indices.length; nscene++) {
				ortho_maps[indices[nscene]].setQOrient(qorients[nscene]);
				
			}
			for (int npair = 0; npair < quat_pairs.length; npair++) {
				int [] cpair = condensed_pairs[npair]; // index alt_multi
				int [] ipair = {indices[cpair[0]], indices[cpair[1]]};
				PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true); // ?
				pairwiseOrthoMatch.setQuaternion(quat_pairs[npair]);
			}
		}
		System.out.println();
		
		
		
		/*
		
		ERSTiltLMA ersTiltLMA = new  ERSTiltLMA();
		ersTiltLMA.prepareLMA(
@@ -986,15 +992,6 @@ public class OrthoAltitudeMatch {
				scene_tilts_pairs, // double [][][] tilts,      // [pair][scene(2)][tilt(2)]
				affine_pairs,      // double [][][] affine_pairs,
				debugLevel);       // int           debug_level)
		/*
		double  lambda =            0.1;
		double  lambda_scale_good = 0.5;
		double  lambda_scale_bad =  8.0;
		double  lambda_max =      1000;
		boolean last_run =       false;
		double  rms_diff =          0.0001;
		int     num_iter = 100;
		*/
		lma_rslt=ersTiltLMA.runLma( // <0 - failed, >=0 iteration number (1 - immediately)
				lambda, // double lambda,           // 0.1
				lambda_scale_good,// double lambda_scale_good,// 0.5
@@ -1027,6 +1024,8 @@ public class OrthoAltitudeMatch {

		}
		
		*/
		
		//printResults(boolean degrees)
		if (orthoMapsCollection_path != null) {
        	try {
Loading