Loading src/main/java/com/elphel/imagej/orthomosaic/OrthoAltitudeMatch.java +212 −28 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ public class OrthoAltitudeMatch { String log_path, String log_path, String orthoMapsCollection_path, String orthoMapsCollection_path, int debugLevel) { int debugLevel) { boolean y_down_ccw = true; int [] indices = orthoMapsCollection.getScenesFromPairs( // may be shorter, each element - absolute scene number used in pairs int [] indices = orthoMapsCollection.getScenesFromPairs( // may be shorter, each element - absolute scene number used in pairs available_pairs, // pairs_defined_abs,// int [][] pairs, available_pairs, // pairs_defined_abs,// int [][] pairs, null); // int [] indices_in) // preselected indices or null null); // int [] indices_in) // preselected indices or null Loading Loading @@ -128,30 +129,6 @@ public class OrthoAltitudeMatch { if (updateStatus) { if (updateStatus) { IJ.showStatus("Processing pair "+npair+" of "+condensed_pairs.length+" "+ipair[0]+"->"+ipair[1]); IJ.showStatus("Processing pair "+npair+" of "+condensed_pairs.length+" "+ipair[0]+"->"+ipair[1]); } } /* PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true).clone(); // ? double [][] daffine = null; if (pairwiseOrthoMatch != null) { double [] enuOffset = ortho_maps[ipair[1]].enuOffsetTo(ortho_maps[ipair[0]]); double [] rd = {enuOffset[0], -enuOffset[1]}; // {right,down} of the image daffine = pairwiseOrthoMatch.getAffine(); if ((daffine != null) && alt_pairwise) { } else { // combine differential affine from individual double [][] aff0 = ortho_maps[ipair[0]].getAffine(); double [][] aff1 = ortho_maps[ipair[1]].getAffine(); PairwiseOrthoMatch aff_match = new PairwiseOrthoMatch ( aff0, // double [][] affine0, aff1, // double [][] affine1, rd); // double [] rd); daffine = aff_match.getAffine(); pairwiseOrthoMatch.setAffine(daffine); } } else { System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] "); continue; } */ PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true); // ? PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true); // ? if (pairwiseOrthoMatch == null) { if (pairwiseOrthoMatch == null) { System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] "); System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] "); Loading Loading @@ -217,11 +194,218 @@ public class OrthoAltitudeMatch { break; break; } } } } double [] alt_data = {alt_data5[0]/pix_size_meters, alt_data5[1]/pix_size_meters,alt_data5[2]}; boolean test_quat = true; if (test_quat) { System.out.println(">>>>>>>>>>>>>>>>> npair="+npair+": "+ipair[0]+" -> "+ipair[1]); boolean [][] masks = new boolean[2][]; double [][] alt_data5s = new double[2][]; double [][] data_overlap = new double[2][]; double [][] alt_datas = new double[3][]; double [] quat_diff = QuatUtils.tiltToQuaternion( alt_data, y_down_ccw); // boolean y_down_ccw) double [][] quats01 = new double [alt_datas.length][]; for (int ns = 0; ns < cpair.length; ns++) { data_overlap[ns] = OrthoMap.extractWoi( alt_multi[cpair[ns]], // final double [] data0, width, // final int width, woi_overlap); // Rectangle woi_in); for (int ntry = 0; ntry <= alt_refine; ntry++) { alt_data5s[ns] = OrthoMap.getPlane( data_overlap[ns], // final double [] data, masks[ns], // final boolean [] mask, weight, // final double [] weight, woi_overlap.width, // final int width, xy0); // final double [] xy0) { if ((alt_outliers > 0) && (ntry < alt_refine)){ // not the last pass masks[ns] = OrthoMap.removeRelativeLowHigh ( data_overlap[ns], // final double [] data, null, // mask, // final boolean [] mask_in, // new mask for all data and latest plane alt_abs_outliers, // final double abs_diff, alt_outliers, // final double rel_frac, alt_data5s[ns], // final double [] ground_plane, // tiltx,tilty, offs, x0(pix), y0(pix) or null woi_overlap.width,// final int width, // only used with ground_plane != null; num_bins); // final int num_bins) } else { break; } } alt_datas[ns] = new double [] {alt_data5s[ns][0]/pix_size_meters, alt_data5s[ns][1]/pix_size_meters,alt_data5s[ns][2]}; } alt_datas[2] = new double [3]; for (int i = 0; i < alt_datas[2].length; i++) { alt_datas[2][i] = alt_datas[0][i]+alt_data[i]; } for (int ns = 0; ns < quats01.length; ns++) { quats01[ns] = QuatUtils.tiltToQuaternion( alt_datas[ns], y_down_ccw); // boolean y_down_ccw) } double [] quat_rdiff = QuatUtils.invert(quat_diff); double [] quat2a = QuatUtils.multiply(quats01[0], quat_diff); double [] quat2b = QuatUtils.multiply(quat_diff, quats01[0]); double [] quat2ap = QuatUtils.pureTilt(quat2a); double [] quat2bp = QuatUtils.pureTilt(quat2b); double [] quat2an = QuatUtils.normalize(quat2a); double [] quat2bn = QuatUtils.normalize(quat2b); double [] quat2apn = QuatUtils.normalize(quat2ap); double [] quat2bpn = QuatUtils.normalize(quat2bp); double [] quat1ar = QuatUtils.multiply(quats01[1], quat_rdiff); double [] quat1br = QuatUtils.multiply(quat_rdiff, quats01[1]); double [] quat1cr = QuatUtils.multiply(quats01[2], quat_rdiff); double [] quat1dr = QuatUtils.multiply(quat_rdiff, quats01[2]); double [] quat1apr = QuatUtils.pureTilt(quat1ar); double [] quat1bpr = QuatUtils.pureTilt(quat1br); double [] quat1cpr = QuatUtils.pureTilt(quat1cr); double [] quat1dpr = QuatUtils.pureTilt(quat1dr); double [] quat1aprn = QuatUtils.normalize(quat1apr); double [] quat1bprn = QuatUtils.normalize(quat1bpr); double [] quat1cprn = QuatUtils.normalize(quat1cpr); double [] quat1dprn = QuatUtils.normalize(quat1dpr); double [] quat1arn = QuatUtils.normalize(quat1ar); double [] quat1brn = QuatUtils.normalize(quat1br); double [] quat1crn = QuatUtils.normalize(quat1cr); double [] quat1drn = QuatUtils.normalize(quat1dr); //pureTilt System.out.println("alt_data= ["+alt_data[0]+","+alt_data[1]+","+alt_data[2]+"]"); System.out.println("alt_datas[0]=["+alt_datas[0][0]+","+alt_datas[0][1]+","+alt_datas[0][2]+"]"); System.out.println("alt_datas[1]=["+alt_datas[1][0]+","+alt_datas[1][1]+","+alt_datas[1][2]+"]"); System.out.println("alt_datas[2]=["+alt_datas[2][0]+","+alt_datas[2][1]+","+alt_datas[2][2]+"]"); /* System.out.println("quat_diff= ["+quat_diff[0]+","+quat_diff[1]+","+quat_diff[2]+","+quat_diff[3]+"] "+QuatUtils.norm(quat_diff)); System.out.println("quats01[0]= ["+quats01[0][0]+","+quats01[0][1]+","+quats01[0][2]+","+quats01[0][3]+"] "+QuatUtils.norm(quats01[0])); System.out.println("quats01[1]= ["+quats01[1][0]+","+quats01[1][1]+","+quats01[1][2]+","+quats01[1][3]+"] "+QuatUtils.norm(quats01[1])); System.out.println("quats01[2]= ["+quats01[2][0]+","+quats01[2][1]+","+quats01[2][2]+","+quats01[2][3]+"] "+QuatUtils.norm(quats01[2])); */ System.out.println("quat2a= ["+quat2a[0]+","+quat2a[1]+","+quat2a[2]+","+quat2a[3]+"] "+QuatUtils.norm(quat2a)); System.out.println("quat2b= ["+quat2b[0]+","+quat2b[1]+","+quat2b[2]+","+quat2b[3]+"] "+QuatUtils.norm(quat2b)); System.out.println("quat2ap= ["+quat2ap[0]+","+quat2ap[1]+","+quat2ap[2]+","+quat2ap[3]+"] "+QuatUtils.norm(quat2ap)); System.out.println("quat2bp= ["+quat2bp[0]+","+quat2bp[1]+","+quat2bp[2]+","+quat2bp[3]+"] "+QuatUtils.norm(quat2bp)); /* System.out.println("quat2an= ["+quat2an[0]+","+quat2an[1]+","+quat2an[2]+","+quat2an[3]+"] "+QuatUtils.norm(quat2an)); System.out.println("quat2bn= ["+quat2bn[0]+","+quat2bn[1]+","+quat2bn[2]+","+quat2bn[3]+"] "+QuatUtils.norm(quat2bn)); System.out.println("quat2apn= ["+quat2apn[0]+","+quat2apn[1]+","+quat2apn[2]+","+quat2apn[3]+"] "+QuatUtils.norm(quat2apn)); System.out.println("quat2bpn= ["+quat2bpn[0]+","+quat2bpn[1]+","+quat2bpn[2]+","+quat2bpn[3]+"] "+QuatUtils.norm(quat2bpn)); System.out.println("quat1apr= ["+quat1apr[0]+","+quat1apr[1]+","+quat1apr[2]+","+quat1apr[3]+"] "+QuatUtils.norm(quat1apr)); // + System.out.println("quat1bpr= ["+quat1bpr[0]+","+quat1bpr[1]+","+quat1bpr[2]+","+quat1bpr[3]+"] "+QuatUtils.norm(quat1bpr)); // ++ System.out.println("quat1cpr= ["+quat1cpr[0]+","+quat1cpr[1]+","+quat1cpr[2]+","+quat1cpr[3]+"] "+QuatUtils.norm(quat1cpr)); // +++ System.out.println("quat1dpr= ["+quat1dpr[0]+","+quat1dpr[1]+","+quat1dpr[2]+","+quat1dpr[3]+"] "+QuatUtils.norm(quat1dpr)); // +++ System.out.println("quat1aprn= ["+quat1aprn[0]+","+quat1aprn[1]+","+quat1aprn[2]+","+quat1aprn[3]+"] "+QuatUtils.norm(quat1aprn)); // + System.out.println("quat1bprn= ["+quat1bprn[0]+","+quat1bprn[1]+","+quat1bprn[2]+","+quat1bprn[3]+"] "+QuatUtils.norm(quat1bprn)); // ++ System.out.println("quat1cprn= ["+quat1cprn[0]+","+quat1cprn[1]+","+quat1cprn[2]+","+quat1cprn[3]+"] "+QuatUtils.norm(quat1cprn)); // +++ System.out.println("quat1dprn= ["+quat1dprn[0]+","+quat1dprn[1]+","+quat1dprn[2]+","+quat1dprn[3]+"] "+QuatUtils.norm(quat1dprn)); // +++ System.out.println("quat1arn= ["+quat1arn[0]+","+quat1arn[1]+","+quat1arn[2]+","+quat1arn[3]+"] "+QuatUtils.norm(quat1arn)); // + System.out.println("quat1brn= ["+quat1brn[0]+","+quat1brn[1]+","+quat1brn[2]+","+quat1brn[3]+"] "+QuatUtils.norm(quat1brn)); // ++ System.out.println("quat1crn= ["+quat1crn[0]+","+quat1crn[1]+","+quat1crn[2]+","+quat1crn[3]+"] "+QuatUtils.norm(quat1crn)); // +++ System.out.println("quat1drn= ["+quat1drn[0]+","+quat1drn[1]+","+quat1drn[2]+","+quat1drn[3]+"] "+QuatUtils.norm(quat1drn)); // +++ */ double [][] affine_pair = pairwiseOrthoMatch.getAffine(); double [][][] affines = new double [][][] {ortho_maps[ipair[0]].getAffine(),ortho_maps[ipair[1]].getAffine()}; boolean make__pure_tilt = false; double [][] aff1_stretch = QuatUtils.quatToAffine( quats01[0], // double [] quat, true, // boolean stretch, make__pure_tilt, // boolean make__pure_tilt) y_down_ccw); // boolean y_down_ccw); double [][] aff2_shrink = QuatUtils.quatToAffine( quats01[2], // double [] quat, false, // boolean stretch, make__pure_tilt, // boolean make__pure_tilt) y_down_ccw); // boolean y_down_ccw); double [][] aff2_stretch = QuatUtils.quatToAffine( quats01[2], // double [] quat, true, // boolean stretch, make__pure_tilt, // boolean make__pure_tilt) y_down_ccw); // boolean y_down_ccw); double [][] qaffd_pm = QuatUtils.affineToQuatScaled(affine_pair, y_down_ccw); double [] sqaffd_pm = {QuatUtils.normalizeInPlace(qaffd_pm[0]),QuatUtils.normalizeInPlace(qaffd_pm[1])}; // normalizes System.out.println("qaffd_pm[0]= ["+qaffd_pm[0][0]+ ","+qaffd_pm[0][1]+ ","+qaffd_pm[0][2]+ ","+qaffd_pm[0][3]+ "] scale="+sqaffd_pm[0]); System.out.println("qaffd_pm[1]= ["+qaffd_pm[1][0]+ ","+qaffd_pm[1][1]+ ","+qaffd_pm[1][2]+ ","+qaffd_pm[1][3]+ "] scale="+sqaffd_pm[1]); double [][] qaff1_pm = QuatUtils.affineToQuatScaled(aff1_stretch, y_down_ccw); double [] sqaff1_pm = {QuatUtils.normalizeInPlace(qaffd_pm[0]),QuatUtils.normalizeInPlace(qaff1_pm[1])}; // normalizes System.out.println("qaff1_pm[0]= ["+qaff1_pm[0][0]+ ","+qaff1_pm[0][1]+ ","+qaff1_pm[0][2]+ ","+qaff1_pm[0][3]+ "] scale="+sqaff1_pm[0]); System.out.println("qaff1_pm[1]= ["+qaff1_pm[1][0]+ ","+qaff1_pm[1][1]+ ","+qaff1_pm[1][2]+ ","+qaff1_pm[1][3]+ "] scale="+sqaff1_pm[1]); double [][] qaff2a_pm = QuatUtils.affineToQuatScaled(aff2_shrink, y_down_ccw); double [] sqaff2a_pm = {QuatUtils.normalizeInPlace(qaff2a_pm[0]),QuatUtils.normalizeInPlace(qaff2a_pm[1])}; // normalizes System.out.println("qaff2a_pm[0]= ["+qaff2a_pm[0][0]+","+qaff2a_pm[0][1]+","+qaff2a_pm[0][2]+","+qaff2a_pm[0][3]+"] scale="+sqaff2a_pm[0]); System.out.println("qaff2a_pm[1]= ["+qaff2a_pm[1][0]+","+qaff2a_pm[1][1]+","+qaff2a_pm[1][2]+","+qaff2a_pm[1][3]+"] scale="+sqaff2a_pm[1]); double [][] qaff2_pm = QuatUtils.affineToQuatScaled(aff2_stretch, y_down_ccw); double [] sqaff2_pm = {QuatUtils.normalizeInPlace(qaff2_pm[0]),QuatUtils.normalizeInPlace(qaff2_pm[1])}; // normalizes System.out.println("qaff2_pm[0]= ["+qaff2_pm[0][0]+ ","+qaff2_pm[0][1]+ ","+qaff2_pm[0][2]+ ","+qaff2_pm[0][3]+ "] scale="+sqaff2_pm[0]); System.out.println("qaff2_pm[1]= ["+qaff2_pm[1][0]+ ","+qaff2_pm[1][1]+ ","+qaff2_pm[1][2]+ ","+qaff2_pm[1][3]+ "] scale="+sqaff2_pm[1]); double [][] qaffine0_pm = QuatUtils.affineToQuatScaled(affines[0], y_down_ccw); double [] sqaffine0_pm ={QuatUtils.normalizeInPlace(qaffine0_pm[0]),QuatUtils.normalizeInPlace(qaffine0_pm[1])}; // normalizes System.out.println("qaffine0_pm[0]=["+qaffine0_pm[0][0]+ ","+qaffine0_pm[0][1]+ ","+qaffine0_pm[0][2]+ ","+qaffine0_pm[0][3]+ "] scale="+sqaffine0_pm[0]); System.out.println("qaffine0_pm[1]=["+qaffine0_pm[1][0]+ ","+qaffine0_pm[1][1]+ ","+qaffine0_pm[1][2]+ ","+qaffine0_pm[1][3]+ "] scale="+sqaffine0_pm[1]); double [][] qaffine1_pm = QuatUtils.affineToQuatScaled(affines[1], y_down_ccw); double [] sqaffine1_pm ={QuatUtils.normalizeInPlace(qaffine1_pm[0]),QuatUtils.normalizeInPlace(qaffine1_pm[1])}; // normalizes System.out.println("qaffine1_pm[0]=["+qaffine1_pm[0][0]+ ","+qaffine1_pm[0][1]+ ","+qaffine1_pm[0][2]+ ","+qaffine1_pm[0][3]+ "] scale="+sqaffine1_pm[0]); System.out.println("qaffine1_pm[1]=["+qaffine1_pm[1][0]+ ","+qaffine1_pm[1][1]+ ","+qaffine1_pm[1][2]+ ","+qaffine1_pm[1][3]+ "] scale="+sqaffine1_pm[1]); double [][] aff_combo = QuatUtils.matMult(aff2_shrink,aff1_stretch); System.out.println("affine_pair= [["+affine_pair[0][0]+","+affine_pair[0][1]+","+affine_pair[0][2]+"]"); System.out.println(" ["+affine_pair[1][0]+","+affine_pair[1][1]+","+affine_pair[1][2]+"]]"); System.out.println("affines[0]= [["+affines[0][0][0]+ ","+affines[0][0][1]+ ","+affines[0][0][2]+"]"); System.out.println(" ["+affines[0][1][0]+ ","+affines[0][1][1]+ ","+affines[0][1][2]+"]]"); System.out.println("affines[1]= [["+affines[1][0][0]+ ","+affines[1][0][1]+ ","+affines[1][0][2]+"]"); System.out.println(" ["+affines[1][1][0]+ ","+affines[1][1][1]+ ","+affines[1][1][2]+"]]"); System.out.println("aff1_stretch= [["+aff1_stretch[0][0]+ ","+aff1_stretch[0][1]+"]"); System.out.println(" ["+aff1_stretch[1][0]+ ","+aff1_stretch[1][1]+"]]"); System.out.println("aff2_shrink= [["+aff2_shrink[0][0]+ ","+aff2_shrink[0][1]+ "]"); System.out.println(" ["+aff2_shrink[1][0]+ ","+aff2_shrink[1][1]+ "]]"); System.out.println("aff2_stretch= [["+aff2_stretch[0][0]+ ","+aff2_stretch[0][1]+"]"); System.out.println(" ["+aff2_stretch[1][0]+ ","+aff2_stretch[1][1]+"]]"); System.out.println("aff_combo= [["+aff_combo[0][0]+ ","+aff_combo[0][1]+ "]"); System.out.println(" ["+aff_combo[1][0]+ ","+aff_combo[1][1]+ "]]"); /* double [] svd_affine_pair = OrthoMap.singularValueDecomposeScaleTilt(affine_pair, y_down_ccw); // boolean y_down_ccw) double [][] svd_affines = {OrthoMap.singularValueDecomposeScaleTilt(affines[0], y_down_ccw), OrthoMap.singularValueDecomposeScaleTilt(affines[1], y_down_ccw)}; double [] svd_aff1_stretch = OrthoMap.singularValueDecomposeScaleTilt(aff1_stretch, y_down_ccw); double [] svd_aff2_shrink = OrthoMap.singularValueDecomposeScaleTilt(aff2_shrink, y_down_ccw); double [] svd_aff2_stretch = OrthoMap.singularValueDecomposeScaleTilt(aff2_stretch, y_down_ccw); double [] svd_aff_combo = OrthoMap.singularValueDecomposeScaleTilt(aff_combo, y_down_ccw); */ SingularValueDecomposition svd_affine_pair = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affine_pair, y_down_ccw); // boolean y_down_ccw) SingularValueDecomposition[] svd_affines = {SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affines[0], y_down_ccw), SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affines[1], y_down_ccw)}; SingularValueDecomposition svd_aff1_stretch = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff1_stretch, y_down_ccw); SingularValueDecomposition svd_aff2_shrink = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff2_shrink, y_down_ccw); SingularValueDecomposition svd_aff2_stretch = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff2_stretch, y_down_ccw); SingularValueDecomposition svd_aff_combo = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff_combo, y_down_ccw); System.out.println("scale,tilt_rad,gamma,rot"); System.out.println("svd_affine_pair= ["+svd_affine_pair.scale+ ","+svd_affine_pair.getTiltAngle()+ ","+svd_affine_pair.gamma+ ","+svd_affine_pair.rot+ "] tilt="+(svd_affine_pair.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_affine_pair.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_affines[0]= ["+svd_affines[0].scale+ ","+ svd_affines[0].getTiltAngle()+ ","+svd_affines[0].gamma+ ","+svd_affines[0].rot+ "] tilt="+(svd_affines[0].getTiltAngle()* 180/Math.PI)+ "\u00B0, dir="+(svd_affines[0].gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_affines[1]= ["+svd_affines[1].scale+ ","+ svd_affines[1].getTiltAngle()+ ","+svd_affines[1].gamma+ ","+svd_affines[1].rot+ "] tilt="+(svd_affines[1].getTiltAngle()* 180/Math.PI)+ "\u00B0, dir="+(svd_affines[1].gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff1_stretch= ["+svd_aff1_stretch.scale+","+ svd_aff1_stretch.getTiltAngle()+","+svd_aff1_stretch.gamma+","+svd_aff1_stretch.rot+"] tilt="+(svd_aff1_stretch.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff1_stretch.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff2_shrink= ["+svd_aff2_shrink.scale+ ","+ svd_aff2_shrink.getTiltAngle()+ ","+svd_aff2_shrink.gamma+ ","+svd_aff2_shrink.rot+ "] tilt="+(svd_aff2_shrink.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff2_shrink.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff2_stretch= ["+svd_aff2_stretch.scale+","+ svd_aff2_stretch.getTiltAngle()+","+svd_aff2_stretch.gamma+","+svd_aff2_stretch.rot+"] tilt="+(svd_aff2_stretch.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff2_stretch.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff_combo= ["+svd_aff_combo.scale+ ","+ svd_aff_combo.getTiltAngle()+ ","+svd_aff_combo.gamma+ ","+svd_aff_combo.rot+ "] tilt="+(svd_aff_combo.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff_combo.gamma*180/Math.PI)+"\u00B0"); System.out.println("quat_diff= ["+quat_diff[0]+ ","+quat_diff[1]+ ","+quat_diff[2]+ ","+quat_diff[3]+ "] tilt="+2*Math.acos(quat_diff[0])+ " dir="+Math.atan2(quat_diff[2],quat_diff[1])+", tilt="+(2*Math.acos(quat_diff[0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quat_diff[2],quat_diff[1])*180/Math.PI)+"\u00B0"); System.out.println("quats01[0]= ["+quats01[0][0]+","+quats01[0][1]+","+quats01[0][2]+","+quats01[0][3]+"] tilt="+2*Math.acos(quats01[0][0])+" dir="+Math.atan2(quats01[0][2],quats01[0][1])+", tilt="+(2*Math.acos(quats01[0][0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quats01[0][2],quats01[0][1])*180/Math.PI)+"\u00B0"); System.out.println("quats01[1]= ["+quats01[1][0]+","+quats01[1][1]+","+quats01[1][2]+","+quats01[1][3]+"] tilt="+2*Math.acos(quats01[1][0])+" dir="+Math.atan2(quats01[1][2],quats01[1][1])+", tilt="+(2*Math.acos(quats01[1][0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quats01[1][2],quats01[1][1])*180/Math.PI)+"\u00B0"); System.out.println("quats01[2]= ["+quats01[2][0]+","+quats01[2][1]+","+quats01[2][2]+","+quats01[2][3]+"] tilt="+2*Math.acos(quats01[2][0])+" dir="+Math.atan2(quats01[2][2],quats01[2][1])+", tilt="+(2*Math.acos(quats01[2][0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quats01[2][2],quats01[2][1])*180/Math.PI)+"\u00B0"); /* System.out.println("quat_diff_tilt= "+2*Math.acos(quat_diff[0])); System.out.println("quats01_0_tilt= "+2*Math.acos(quats01[0][0])); System.out.println("quats01_1_tilt= "+2*Math.acos(quats01[1][0])); System.out.println("quats01_2_tilt= "+2*Math.acos(quats01[2][0])); */ } // double [] alt_data = new double[3]; // double [] alt_data = new double[3]; // System.arraycopy(alt_data5, 0, alt_data, 0, alt_data.length); // System.arraycopy(alt_data5, 0, alt_data, 0, alt_data.length); double [] alt_data = {alt_data5[0]/pix_size_meters, alt_data5[1]/pix_size_meters,alt_data5[2]}; pairwiseOrthoMatch.setAltData(alt_data); pairwiseOrthoMatch.setAltData(alt_data); if (log_append && (log_path != null)) { // assuming directory exists if (log_append && (log_path != null)) { // assuming directory exists Loading Loading
src/main/java/com/elphel/imagej/orthomosaic/OrthoAltitudeMatch.java +212 −28 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ public class OrthoAltitudeMatch { String log_path, String log_path, String orthoMapsCollection_path, String orthoMapsCollection_path, int debugLevel) { int debugLevel) { boolean y_down_ccw = true; int [] indices = orthoMapsCollection.getScenesFromPairs( // may be shorter, each element - absolute scene number used in pairs int [] indices = orthoMapsCollection.getScenesFromPairs( // may be shorter, each element - absolute scene number used in pairs available_pairs, // pairs_defined_abs,// int [][] pairs, available_pairs, // pairs_defined_abs,// int [][] pairs, null); // int [] indices_in) // preselected indices or null null); // int [] indices_in) // preselected indices or null Loading Loading @@ -128,30 +129,6 @@ public class OrthoAltitudeMatch { if (updateStatus) { if (updateStatus) { IJ.showStatus("Processing pair "+npair+" of "+condensed_pairs.length+" "+ipair[0]+"->"+ipair[1]); IJ.showStatus("Processing pair "+npair+" of "+condensed_pairs.length+" "+ipair[0]+"->"+ipair[1]); } } /* PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true).clone(); // ? double [][] daffine = null; if (pairwiseOrthoMatch != null) { double [] enuOffset = ortho_maps[ipair[1]].enuOffsetTo(ortho_maps[ipair[0]]); double [] rd = {enuOffset[0], -enuOffset[1]}; // {right,down} of the image daffine = pairwiseOrthoMatch.getAffine(); if ((daffine != null) && alt_pairwise) { } else { // combine differential affine from individual double [][] aff0 = ortho_maps[ipair[0]].getAffine(); double [][] aff1 = ortho_maps[ipair[1]].getAffine(); PairwiseOrthoMatch aff_match = new PairwiseOrthoMatch ( aff0, // double [][] affine0, aff1, // double [][] affine1, rd); // double [] rd); daffine = aff_match.getAffine(); pairwiseOrthoMatch.setAffine(daffine); } } else { System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] "); continue; } */ PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true); // ? PairwiseOrthoMatch pairwiseOrthoMatch = ortho_maps[ipair[0]].getMatch(ortho_maps[ipair[1]].getName(), true); // ? if (pairwiseOrthoMatch == null) { if (pairwiseOrthoMatch == null) { System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] "); System.out.println("BUG: Missing pair for ["+ipair[0]+", "+ipair[1]+"] "); Loading Loading @@ -217,11 +194,218 @@ public class OrthoAltitudeMatch { break; break; } } } } double [] alt_data = {alt_data5[0]/pix_size_meters, alt_data5[1]/pix_size_meters,alt_data5[2]}; boolean test_quat = true; if (test_quat) { System.out.println(">>>>>>>>>>>>>>>>> npair="+npair+": "+ipair[0]+" -> "+ipair[1]); boolean [][] masks = new boolean[2][]; double [][] alt_data5s = new double[2][]; double [][] data_overlap = new double[2][]; double [][] alt_datas = new double[3][]; double [] quat_diff = QuatUtils.tiltToQuaternion( alt_data, y_down_ccw); // boolean y_down_ccw) double [][] quats01 = new double [alt_datas.length][]; for (int ns = 0; ns < cpair.length; ns++) { data_overlap[ns] = OrthoMap.extractWoi( alt_multi[cpair[ns]], // final double [] data0, width, // final int width, woi_overlap); // Rectangle woi_in); for (int ntry = 0; ntry <= alt_refine; ntry++) { alt_data5s[ns] = OrthoMap.getPlane( data_overlap[ns], // final double [] data, masks[ns], // final boolean [] mask, weight, // final double [] weight, woi_overlap.width, // final int width, xy0); // final double [] xy0) { if ((alt_outliers > 0) && (ntry < alt_refine)){ // not the last pass masks[ns] = OrthoMap.removeRelativeLowHigh ( data_overlap[ns], // final double [] data, null, // mask, // final boolean [] mask_in, // new mask for all data and latest plane alt_abs_outliers, // final double abs_diff, alt_outliers, // final double rel_frac, alt_data5s[ns], // final double [] ground_plane, // tiltx,tilty, offs, x0(pix), y0(pix) or null woi_overlap.width,// final int width, // only used with ground_plane != null; num_bins); // final int num_bins) } else { break; } } alt_datas[ns] = new double [] {alt_data5s[ns][0]/pix_size_meters, alt_data5s[ns][1]/pix_size_meters,alt_data5s[ns][2]}; } alt_datas[2] = new double [3]; for (int i = 0; i < alt_datas[2].length; i++) { alt_datas[2][i] = alt_datas[0][i]+alt_data[i]; } for (int ns = 0; ns < quats01.length; ns++) { quats01[ns] = QuatUtils.tiltToQuaternion( alt_datas[ns], y_down_ccw); // boolean y_down_ccw) } double [] quat_rdiff = QuatUtils.invert(quat_diff); double [] quat2a = QuatUtils.multiply(quats01[0], quat_diff); double [] quat2b = QuatUtils.multiply(quat_diff, quats01[0]); double [] quat2ap = QuatUtils.pureTilt(quat2a); double [] quat2bp = QuatUtils.pureTilt(quat2b); double [] quat2an = QuatUtils.normalize(quat2a); double [] quat2bn = QuatUtils.normalize(quat2b); double [] quat2apn = QuatUtils.normalize(quat2ap); double [] quat2bpn = QuatUtils.normalize(quat2bp); double [] quat1ar = QuatUtils.multiply(quats01[1], quat_rdiff); double [] quat1br = QuatUtils.multiply(quat_rdiff, quats01[1]); double [] quat1cr = QuatUtils.multiply(quats01[2], quat_rdiff); double [] quat1dr = QuatUtils.multiply(quat_rdiff, quats01[2]); double [] quat1apr = QuatUtils.pureTilt(quat1ar); double [] quat1bpr = QuatUtils.pureTilt(quat1br); double [] quat1cpr = QuatUtils.pureTilt(quat1cr); double [] quat1dpr = QuatUtils.pureTilt(quat1dr); double [] quat1aprn = QuatUtils.normalize(quat1apr); double [] quat1bprn = QuatUtils.normalize(quat1bpr); double [] quat1cprn = QuatUtils.normalize(quat1cpr); double [] quat1dprn = QuatUtils.normalize(quat1dpr); double [] quat1arn = QuatUtils.normalize(quat1ar); double [] quat1brn = QuatUtils.normalize(quat1br); double [] quat1crn = QuatUtils.normalize(quat1cr); double [] quat1drn = QuatUtils.normalize(quat1dr); //pureTilt System.out.println("alt_data= ["+alt_data[0]+","+alt_data[1]+","+alt_data[2]+"]"); System.out.println("alt_datas[0]=["+alt_datas[0][0]+","+alt_datas[0][1]+","+alt_datas[0][2]+"]"); System.out.println("alt_datas[1]=["+alt_datas[1][0]+","+alt_datas[1][1]+","+alt_datas[1][2]+"]"); System.out.println("alt_datas[2]=["+alt_datas[2][0]+","+alt_datas[2][1]+","+alt_datas[2][2]+"]"); /* System.out.println("quat_diff= ["+quat_diff[0]+","+quat_diff[1]+","+quat_diff[2]+","+quat_diff[3]+"] "+QuatUtils.norm(quat_diff)); System.out.println("quats01[0]= ["+quats01[0][0]+","+quats01[0][1]+","+quats01[0][2]+","+quats01[0][3]+"] "+QuatUtils.norm(quats01[0])); System.out.println("quats01[1]= ["+quats01[1][0]+","+quats01[1][1]+","+quats01[1][2]+","+quats01[1][3]+"] "+QuatUtils.norm(quats01[1])); System.out.println("quats01[2]= ["+quats01[2][0]+","+quats01[2][1]+","+quats01[2][2]+","+quats01[2][3]+"] "+QuatUtils.norm(quats01[2])); */ System.out.println("quat2a= ["+quat2a[0]+","+quat2a[1]+","+quat2a[2]+","+quat2a[3]+"] "+QuatUtils.norm(quat2a)); System.out.println("quat2b= ["+quat2b[0]+","+quat2b[1]+","+quat2b[2]+","+quat2b[3]+"] "+QuatUtils.norm(quat2b)); System.out.println("quat2ap= ["+quat2ap[0]+","+quat2ap[1]+","+quat2ap[2]+","+quat2ap[3]+"] "+QuatUtils.norm(quat2ap)); System.out.println("quat2bp= ["+quat2bp[0]+","+quat2bp[1]+","+quat2bp[2]+","+quat2bp[3]+"] "+QuatUtils.norm(quat2bp)); /* System.out.println("quat2an= ["+quat2an[0]+","+quat2an[1]+","+quat2an[2]+","+quat2an[3]+"] "+QuatUtils.norm(quat2an)); System.out.println("quat2bn= ["+quat2bn[0]+","+quat2bn[1]+","+quat2bn[2]+","+quat2bn[3]+"] "+QuatUtils.norm(quat2bn)); System.out.println("quat2apn= ["+quat2apn[0]+","+quat2apn[1]+","+quat2apn[2]+","+quat2apn[3]+"] "+QuatUtils.norm(quat2apn)); System.out.println("quat2bpn= ["+quat2bpn[0]+","+quat2bpn[1]+","+quat2bpn[2]+","+quat2bpn[3]+"] "+QuatUtils.norm(quat2bpn)); System.out.println("quat1apr= ["+quat1apr[0]+","+quat1apr[1]+","+quat1apr[2]+","+quat1apr[3]+"] "+QuatUtils.norm(quat1apr)); // + System.out.println("quat1bpr= ["+quat1bpr[0]+","+quat1bpr[1]+","+quat1bpr[2]+","+quat1bpr[3]+"] "+QuatUtils.norm(quat1bpr)); // ++ System.out.println("quat1cpr= ["+quat1cpr[0]+","+quat1cpr[1]+","+quat1cpr[2]+","+quat1cpr[3]+"] "+QuatUtils.norm(quat1cpr)); // +++ System.out.println("quat1dpr= ["+quat1dpr[0]+","+quat1dpr[1]+","+quat1dpr[2]+","+quat1dpr[3]+"] "+QuatUtils.norm(quat1dpr)); // +++ System.out.println("quat1aprn= ["+quat1aprn[0]+","+quat1aprn[1]+","+quat1aprn[2]+","+quat1aprn[3]+"] "+QuatUtils.norm(quat1aprn)); // + System.out.println("quat1bprn= ["+quat1bprn[0]+","+quat1bprn[1]+","+quat1bprn[2]+","+quat1bprn[3]+"] "+QuatUtils.norm(quat1bprn)); // ++ System.out.println("quat1cprn= ["+quat1cprn[0]+","+quat1cprn[1]+","+quat1cprn[2]+","+quat1cprn[3]+"] "+QuatUtils.norm(quat1cprn)); // +++ System.out.println("quat1dprn= ["+quat1dprn[0]+","+quat1dprn[1]+","+quat1dprn[2]+","+quat1dprn[3]+"] "+QuatUtils.norm(quat1dprn)); // +++ System.out.println("quat1arn= ["+quat1arn[0]+","+quat1arn[1]+","+quat1arn[2]+","+quat1arn[3]+"] "+QuatUtils.norm(quat1arn)); // + System.out.println("quat1brn= ["+quat1brn[0]+","+quat1brn[1]+","+quat1brn[2]+","+quat1brn[3]+"] "+QuatUtils.norm(quat1brn)); // ++ System.out.println("quat1crn= ["+quat1crn[0]+","+quat1crn[1]+","+quat1crn[2]+","+quat1crn[3]+"] "+QuatUtils.norm(quat1crn)); // +++ System.out.println("quat1drn= ["+quat1drn[0]+","+quat1drn[1]+","+quat1drn[2]+","+quat1drn[3]+"] "+QuatUtils.norm(quat1drn)); // +++ */ double [][] affine_pair = pairwiseOrthoMatch.getAffine(); double [][][] affines = new double [][][] {ortho_maps[ipair[0]].getAffine(),ortho_maps[ipair[1]].getAffine()}; boolean make__pure_tilt = false; double [][] aff1_stretch = QuatUtils.quatToAffine( quats01[0], // double [] quat, true, // boolean stretch, make__pure_tilt, // boolean make__pure_tilt) y_down_ccw); // boolean y_down_ccw); double [][] aff2_shrink = QuatUtils.quatToAffine( quats01[2], // double [] quat, false, // boolean stretch, make__pure_tilt, // boolean make__pure_tilt) y_down_ccw); // boolean y_down_ccw); double [][] aff2_stretch = QuatUtils.quatToAffine( quats01[2], // double [] quat, true, // boolean stretch, make__pure_tilt, // boolean make__pure_tilt) y_down_ccw); // boolean y_down_ccw); double [][] qaffd_pm = QuatUtils.affineToQuatScaled(affine_pair, y_down_ccw); double [] sqaffd_pm = {QuatUtils.normalizeInPlace(qaffd_pm[0]),QuatUtils.normalizeInPlace(qaffd_pm[1])}; // normalizes System.out.println("qaffd_pm[0]= ["+qaffd_pm[0][0]+ ","+qaffd_pm[0][1]+ ","+qaffd_pm[0][2]+ ","+qaffd_pm[0][3]+ "] scale="+sqaffd_pm[0]); System.out.println("qaffd_pm[1]= ["+qaffd_pm[1][0]+ ","+qaffd_pm[1][1]+ ","+qaffd_pm[1][2]+ ","+qaffd_pm[1][3]+ "] scale="+sqaffd_pm[1]); double [][] qaff1_pm = QuatUtils.affineToQuatScaled(aff1_stretch, y_down_ccw); double [] sqaff1_pm = {QuatUtils.normalizeInPlace(qaffd_pm[0]),QuatUtils.normalizeInPlace(qaff1_pm[1])}; // normalizes System.out.println("qaff1_pm[0]= ["+qaff1_pm[0][0]+ ","+qaff1_pm[0][1]+ ","+qaff1_pm[0][2]+ ","+qaff1_pm[0][3]+ "] scale="+sqaff1_pm[0]); System.out.println("qaff1_pm[1]= ["+qaff1_pm[1][0]+ ","+qaff1_pm[1][1]+ ","+qaff1_pm[1][2]+ ","+qaff1_pm[1][3]+ "] scale="+sqaff1_pm[1]); double [][] qaff2a_pm = QuatUtils.affineToQuatScaled(aff2_shrink, y_down_ccw); double [] sqaff2a_pm = {QuatUtils.normalizeInPlace(qaff2a_pm[0]),QuatUtils.normalizeInPlace(qaff2a_pm[1])}; // normalizes System.out.println("qaff2a_pm[0]= ["+qaff2a_pm[0][0]+","+qaff2a_pm[0][1]+","+qaff2a_pm[0][2]+","+qaff2a_pm[0][3]+"] scale="+sqaff2a_pm[0]); System.out.println("qaff2a_pm[1]= ["+qaff2a_pm[1][0]+","+qaff2a_pm[1][1]+","+qaff2a_pm[1][2]+","+qaff2a_pm[1][3]+"] scale="+sqaff2a_pm[1]); double [][] qaff2_pm = QuatUtils.affineToQuatScaled(aff2_stretch, y_down_ccw); double [] sqaff2_pm = {QuatUtils.normalizeInPlace(qaff2_pm[0]),QuatUtils.normalizeInPlace(qaff2_pm[1])}; // normalizes System.out.println("qaff2_pm[0]= ["+qaff2_pm[0][0]+ ","+qaff2_pm[0][1]+ ","+qaff2_pm[0][2]+ ","+qaff2_pm[0][3]+ "] scale="+sqaff2_pm[0]); System.out.println("qaff2_pm[1]= ["+qaff2_pm[1][0]+ ","+qaff2_pm[1][1]+ ","+qaff2_pm[1][2]+ ","+qaff2_pm[1][3]+ "] scale="+sqaff2_pm[1]); double [][] qaffine0_pm = QuatUtils.affineToQuatScaled(affines[0], y_down_ccw); double [] sqaffine0_pm ={QuatUtils.normalizeInPlace(qaffine0_pm[0]),QuatUtils.normalizeInPlace(qaffine0_pm[1])}; // normalizes System.out.println("qaffine0_pm[0]=["+qaffine0_pm[0][0]+ ","+qaffine0_pm[0][1]+ ","+qaffine0_pm[0][2]+ ","+qaffine0_pm[0][3]+ "] scale="+sqaffine0_pm[0]); System.out.println("qaffine0_pm[1]=["+qaffine0_pm[1][0]+ ","+qaffine0_pm[1][1]+ ","+qaffine0_pm[1][2]+ ","+qaffine0_pm[1][3]+ "] scale="+sqaffine0_pm[1]); double [][] qaffine1_pm = QuatUtils.affineToQuatScaled(affines[1], y_down_ccw); double [] sqaffine1_pm ={QuatUtils.normalizeInPlace(qaffine1_pm[0]),QuatUtils.normalizeInPlace(qaffine1_pm[1])}; // normalizes System.out.println("qaffine1_pm[0]=["+qaffine1_pm[0][0]+ ","+qaffine1_pm[0][1]+ ","+qaffine1_pm[0][2]+ ","+qaffine1_pm[0][3]+ "] scale="+sqaffine1_pm[0]); System.out.println("qaffine1_pm[1]=["+qaffine1_pm[1][0]+ ","+qaffine1_pm[1][1]+ ","+qaffine1_pm[1][2]+ ","+qaffine1_pm[1][3]+ "] scale="+sqaffine1_pm[1]); double [][] aff_combo = QuatUtils.matMult(aff2_shrink,aff1_stretch); System.out.println("affine_pair= [["+affine_pair[0][0]+","+affine_pair[0][1]+","+affine_pair[0][2]+"]"); System.out.println(" ["+affine_pair[1][0]+","+affine_pair[1][1]+","+affine_pair[1][2]+"]]"); System.out.println("affines[0]= [["+affines[0][0][0]+ ","+affines[0][0][1]+ ","+affines[0][0][2]+"]"); System.out.println(" ["+affines[0][1][0]+ ","+affines[0][1][1]+ ","+affines[0][1][2]+"]]"); System.out.println("affines[1]= [["+affines[1][0][0]+ ","+affines[1][0][1]+ ","+affines[1][0][2]+"]"); System.out.println(" ["+affines[1][1][0]+ ","+affines[1][1][1]+ ","+affines[1][1][2]+"]]"); System.out.println("aff1_stretch= [["+aff1_stretch[0][0]+ ","+aff1_stretch[0][1]+"]"); System.out.println(" ["+aff1_stretch[1][0]+ ","+aff1_stretch[1][1]+"]]"); System.out.println("aff2_shrink= [["+aff2_shrink[0][0]+ ","+aff2_shrink[0][1]+ "]"); System.out.println(" ["+aff2_shrink[1][0]+ ","+aff2_shrink[1][1]+ "]]"); System.out.println("aff2_stretch= [["+aff2_stretch[0][0]+ ","+aff2_stretch[0][1]+"]"); System.out.println(" ["+aff2_stretch[1][0]+ ","+aff2_stretch[1][1]+"]]"); System.out.println("aff_combo= [["+aff_combo[0][0]+ ","+aff_combo[0][1]+ "]"); System.out.println(" ["+aff_combo[1][0]+ ","+aff_combo[1][1]+ "]]"); /* double [] svd_affine_pair = OrthoMap.singularValueDecomposeScaleTilt(affine_pair, y_down_ccw); // boolean y_down_ccw) double [][] svd_affines = {OrthoMap.singularValueDecomposeScaleTilt(affines[0], y_down_ccw), OrthoMap.singularValueDecomposeScaleTilt(affines[1], y_down_ccw)}; double [] svd_aff1_stretch = OrthoMap.singularValueDecomposeScaleTilt(aff1_stretch, y_down_ccw); double [] svd_aff2_shrink = OrthoMap.singularValueDecomposeScaleTilt(aff2_shrink, y_down_ccw); double [] svd_aff2_stretch = OrthoMap.singularValueDecomposeScaleTilt(aff2_stretch, y_down_ccw); double [] svd_aff_combo = OrthoMap.singularValueDecomposeScaleTilt(aff_combo, y_down_ccw); */ SingularValueDecomposition svd_affine_pair = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affine_pair, y_down_ccw); // boolean y_down_ccw) SingularValueDecomposition[] svd_affines = {SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affines[0], y_down_ccw), SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affines[1], y_down_ccw)}; SingularValueDecomposition svd_aff1_stretch = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff1_stretch, y_down_ccw); SingularValueDecomposition svd_aff2_shrink = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff2_shrink, y_down_ccw); SingularValueDecomposition svd_aff2_stretch = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff2_stretch, y_down_ccw); SingularValueDecomposition svd_aff_combo = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(aff_combo, y_down_ccw); System.out.println("scale,tilt_rad,gamma,rot"); System.out.println("svd_affine_pair= ["+svd_affine_pair.scale+ ","+svd_affine_pair.getTiltAngle()+ ","+svd_affine_pair.gamma+ ","+svd_affine_pair.rot+ "] tilt="+(svd_affine_pair.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_affine_pair.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_affines[0]= ["+svd_affines[0].scale+ ","+ svd_affines[0].getTiltAngle()+ ","+svd_affines[0].gamma+ ","+svd_affines[0].rot+ "] tilt="+(svd_affines[0].getTiltAngle()* 180/Math.PI)+ "\u00B0, dir="+(svd_affines[0].gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_affines[1]= ["+svd_affines[1].scale+ ","+ svd_affines[1].getTiltAngle()+ ","+svd_affines[1].gamma+ ","+svd_affines[1].rot+ "] tilt="+(svd_affines[1].getTiltAngle()* 180/Math.PI)+ "\u00B0, dir="+(svd_affines[1].gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff1_stretch= ["+svd_aff1_stretch.scale+","+ svd_aff1_stretch.getTiltAngle()+","+svd_aff1_stretch.gamma+","+svd_aff1_stretch.rot+"] tilt="+(svd_aff1_stretch.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff1_stretch.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff2_shrink= ["+svd_aff2_shrink.scale+ ","+ svd_aff2_shrink.getTiltAngle()+ ","+svd_aff2_shrink.gamma+ ","+svd_aff2_shrink.rot+ "] tilt="+(svd_aff2_shrink.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff2_shrink.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff2_stretch= ["+svd_aff2_stretch.scale+","+ svd_aff2_stretch.getTiltAngle()+","+svd_aff2_stretch.gamma+","+svd_aff2_stretch.rot+"] tilt="+(svd_aff2_stretch.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff2_stretch.gamma*180/Math.PI)+"\u00B0"); System.out.println("svd_aff_combo= ["+svd_aff_combo.scale+ ","+ svd_aff_combo.getTiltAngle()+ ","+svd_aff_combo.gamma+ ","+svd_aff_combo.rot+ "] tilt="+(svd_aff_combo.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_aff_combo.gamma*180/Math.PI)+"\u00B0"); System.out.println("quat_diff= ["+quat_diff[0]+ ","+quat_diff[1]+ ","+quat_diff[2]+ ","+quat_diff[3]+ "] tilt="+2*Math.acos(quat_diff[0])+ " dir="+Math.atan2(quat_diff[2],quat_diff[1])+", tilt="+(2*Math.acos(quat_diff[0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quat_diff[2],quat_diff[1])*180/Math.PI)+"\u00B0"); System.out.println("quats01[0]= ["+quats01[0][0]+","+quats01[0][1]+","+quats01[0][2]+","+quats01[0][3]+"] tilt="+2*Math.acos(quats01[0][0])+" dir="+Math.atan2(quats01[0][2],quats01[0][1])+", tilt="+(2*Math.acos(quats01[0][0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quats01[0][2],quats01[0][1])*180/Math.PI)+"\u00B0"); System.out.println("quats01[1]= ["+quats01[1][0]+","+quats01[1][1]+","+quats01[1][2]+","+quats01[1][3]+"] tilt="+2*Math.acos(quats01[1][0])+" dir="+Math.atan2(quats01[1][2],quats01[1][1])+", tilt="+(2*Math.acos(quats01[1][0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quats01[1][2],quats01[1][1])*180/Math.PI)+"\u00B0"); System.out.println("quats01[2]= ["+quats01[2][0]+","+quats01[2][1]+","+quats01[2][2]+","+quats01[2][3]+"] tilt="+2*Math.acos(quats01[2][0])+" dir="+Math.atan2(quats01[2][2],quats01[2][1])+", tilt="+(2*Math.acos(quats01[2][0])*180/Math.PI)+ "\u00B0, dir="+(Math.atan2(quats01[2][2],quats01[2][1])*180/Math.PI)+"\u00B0"); /* System.out.println("quat_diff_tilt= "+2*Math.acos(quat_diff[0])); System.out.println("quats01_0_tilt= "+2*Math.acos(quats01[0][0])); System.out.println("quats01_1_tilt= "+2*Math.acos(quats01[1][0])); System.out.println("quats01_2_tilt= "+2*Math.acos(quats01[2][0])); */ } // double [] alt_data = new double[3]; // double [] alt_data = new double[3]; // System.arraycopy(alt_data5, 0, alt_data, 0, alt_data.length); // System.arraycopy(alt_data5, 0, alt_data, 0, alt_data.length); double [] alt_data = {alt_data5[0]/pix_size_meters, alt_data5[1]/pix_size_meters,alt_data5[2]}; pairwiseOrthoMatch.setAltData(alt_data); pairwiseOrthoMatch.setAltData(alt_data); if (log_append && (log_path != null)) { // assuming directory exists if (log_append && (log_path != null)) { // assuming directory exists Loading