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

Before trying to fix GEO output

parent bc9e1a60
...@@ -1609,6 +1609,7 @@ public class EyesisCorrectionParameters { ...@@ -1609,6 +1609,7 @@ public class EyesisCorrectionParameters {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
System.out.println("First line: "+lines.get(0)+"\n");
Path base_path = seq_path.getParent(); Path base_path = seq_path.getParent();
// first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory // first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory
HashMap<String,String> dir_map = new HashMap<String,String>(); HashMap<String,String> dir_map = new HashMap<String,String>();
......
...@@ -177,7 +177,7 @@ public class ComboMatch { ...@@ -177,7 +177,7 @@ public class ComboMatch {
boolean use_saved_collection = true; // false; 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 boolean process_correlation = true; // use false to save new version of data
int num_tries_fit = 10; int num_tries_fit = 10;
boolean update_match = true; // use false to save new version of data boolean update_match = true; // use false to save new version of data
......
...@@ -26,6 +26,23 @@ public class FloatImageData { ...@@ -26,6 +26,23 @@ public class FloatImageData {
this.data = data; 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( public static int getZoomLevel(
double pix_in_meters) { double pix_in_meters) {
return getZoomLevel (pix_in_meters, null, null); return getZoomLevel (pix_in_meters, null, null);
......
...@@ -52,6 +52,15 @@ public class OrientationSceneLMA { ...@@ -52,6 +52,15 @@ public class OrientationSceneLMA {
public int debug_width = 12; public int debug_width = 12;
public int debug_decimals = 9; 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( public int prepareLMA(
int [] indices, // should all be used int [] indices, // should all be used
...@@ -81,7 +90,7 @@ public class OrientationSceneLMA { ...@@ -81,7 +90,7 @@ public class OrientationSceneLMA {
double [] pull4 = {pull_scales, pull_tilts/2, pull_tilts/2, pull_rots}; double [] pull4 = {pull_scales, pull_tilts/2, pull_tilts/2, pull_rots};
double sum_pull4 = 0; double sum_pull4 = 0;
for (double w: weights4) sum_pull4+= w; for (double w: pull4) sum_pull4+= w;
if (sum_pull4 <= 0) { if (sum_pull4 <= 0) {
pull = 0; pull = 0;
} }
......
...@@ -76,7 +76,7 @@ public class OrthoAltitudeMatch { ...@@ -76,7 +76,7 @@ public class OrthoAltitudeMatch {
boolean invert_y = true; // only for tilts->affines boolean invert_y = true; // only for tilts->affines
boolean show_details =false; boolean show_details =false;
boolean do_not_save = true; boolean do_not_save = false;
// OrientationSceneLMA.testGetPairErrQuaternion (); // OrientationSceneLMA.testGetPairErrQuaternion ();
// OrientationSceneLMA.testGetPairPairScaleDirError(); // OrientationSceneLMA.testGetPairPairScaleDirError();
...@@ -890,7 +890,7 @@ public class OrthoAltitudeMatch { ...@@ -890,7 +890,7 @@ public class OrthoAltitudeMatch {
} }
// double tilt_err_threshold = 0.01; // reduce weight if larger // double tilt_err_threshold = 0.01; // reduce weight if larger
//overlop_pow = 2.0 //overlop_pow = 2.0
/*
for (int npair = 0; npair <quat_pairs.length; npair++ ) { for (int npair = 0; npair <quat_pairs.length; npair++ ) {
System.out.println("quat_pairs["+npair+"]="+QuatUtils.toString(quat_pairs[npair],use_degrees)); System.out.println("quat_pairs["+npair+"]="+QuatUtils.toString(quat_pairs[npair],use_degrees));
} }
...@@ -923,7 +923,7 @@ public class OrthoAltitudeMatch { ...@@ -923,7 +923,7 @@ public class OrthoAltitudeMatch {
SingularValueDecomposition svd = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affine_pairs[npair], y_down_ccw); // boolean y_down_ccw) SingularValueDecomposition svd = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affine_pairs[npair], y_down_ccw); // boolean y_down_ccw)
System.out.println("svd_affine["+npair+"]=" + svd.toString(use_degrees)); System.out.println("svd_affine["+npair+"]=" + svd.toString(use_degrees));
} }
*/
double max_flat_err = 0; // tilt_err_threshold double max_flat_err = 0; // tilt_err_threshold
for (int npair = 0; npair < num_pairs; npair++) { for (int npair = 0; npair < num_pairs; npair++) {
...@@ -964,17 +964,23 @@ public class OrthoAltitudeMatch { ...@@ -964,17 +964,23 @@ public class OrthoAltitudeMatch {
last_run, // boolean last_run, last_run, // boolean last_run,
null, // String dbg_prefix, null, // String dbg_prefix,
debugLevel); // int debug_level) debugLevel); // int debug_level)
System.out.println("LMA -> "+lma_rslt);
if (lma_rslt >= 0) { if (lma_rslt >= 0) {
if (debugLevel > -3) { System.out.println("LMA -> "+lma_rslt);
//ersTiltLMA.printSceneResults(use_degrees, use_percents); double [][] qorients = orientationSceneLMA.getOrientationQuaternions();
//ersTiltLMA.printPairsResults(use_degrees, use_percents); 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 ersTiltLMA = new ERSTiltLMA();
ersTiltLMA.prepareLMA( ersTiltLMA.prepareLMA(
...@@ -986,15 +992,6 @@ public class OrthoAltitudeMatch { ...@@ -986,15 +992,6 @@ public class OrthoAltitudeMatch {
scene_tilts_pairs, // double [][][] tilts, // [pair][scene(2)][tilt(2)] scene_tilts_pairs, // double [][][] tilts, // [pair][scene(2)][tilt(2)]
affine_pairs, // double [][][] affine_pairs, affine_pairs, // double [][][] affine_pairs,
debugLevel); // int debug_level) 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) lma_rslt=ersTiltLMA.runLma( // <0 - failed, >=0 iteration number (1 - immediately)
lambda, // double lambda, // 0.1 lambda, // double lambda, // 0.1
lambda_scale_good,// double lambda_scale_good,// 0.5 lambda_scale_good,// double lambda_scale_good,// 0.5
...@@ -1027,6 +1024,8 @@ public class OrthoAltitudeMatch { ...@@ -1027,6 +1024,8 @@ public class OrthoAltitudeMatch {
} }
*/
//printResults(boolean degrees) //printResults(boolean degrees)
if (orthoMapsCollection_path != null) { if (orthoMapsCollection_path != null) {
try { try {
......
...@@ -135,7 +135,7 @@ public class OrthoEqualizeLMA { ...@@ -135,7 +135,7 @@ public class OrthoEqualizeLMA {
int [] indices = maps_collection.getScenesSelection( int [] indices = maps_collection.getScenesSelection(
null, // boolean select_all, clt_parameters, // CLTParameters clt_parameters,
" to build a map"); // String purpose) " to build a map"); // String purpose)
OrthoEqualizeLMA oel = new OrthoEqualizeLMA(); OrthoEqualizeLMA oel = new OrthoEqualizeLMA();
oel.prepareLMA ( oel.prepareLMA (
......
...@@ -160,6 +160,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{ ...@@ -160,6 +160,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
oos.writeObject(num_scenes); oos.writeObject(num_scenes);
oos.writeObject(sfm_gain); oos.writeObject(sfm_gain);
oos.writeObject(equalize); oos.writeObject(equalize);
oos.writeObject(qorient);
} }
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
...@@ -185,6 +186,11 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{ ...@@ -185,6 +186,11 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
sfm_gain = (double) ois.readObject(); sfm_gain = (double) ois.readObject();
// equalize = new double[] {1,0}; // equalize = new double[] {1,0};
equalize = (double []) ois.readObject(); equalize = (double []) ois.readObject();
if (OrthoMapsCollection.CURRENT_VERSION >= OrthoMapsCollection.VERSION_POST_ORIENT) {
qorient = (double[]) ois.readObject();
}
images = new HashMap <Integer, FloatImageData>(); // field images was not saved images = new HashMap <Integer, FloatImageData>(); // field images was not saved
averageImagePixel = Double.NaN; // average image pixel value (to combine with raw) averageImagePixel = Double.NaN; // average image pixel value (to combine with raw)
......
...@@ -308,6 +308,8 @@ public class PairwiseOrthoMatch implements Serializable { ...@@ -308,6 +308,8 @@ public class PairwiseOrthoMatch implements Serializable {
oos.writeObject(overlap); oos.writeObject(overlap);
oos.writeObject(equalize1to0); oos.writeObject(equalize1to0);
oos.writeObject(alt_data); oos.writeObject(alt_data);
oos.writeObject(quat);
oos.writeObject(qaffine);
} }
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
...@@ -327,6 +329,11 @@ public class PairwiseOrthoMatch implements Serializable { ...@@ -327,6 +329,11 @@ public class PairwiseOrthoMatch implements Serializable {
if (!READ_NO_ALT) { if (!READ_NO_ALT) {
alt_data = (double[]) ois.readObject(); alt_data = (double[]) ois.readObject();
} }
if (OrthoMapsCollection.CURRENT_VERSION >= OrthoMapsCollection.VERSION_POST_ORIENT) {
quat= (double[]) ois.readObject();
qaffine = (double[][]) ois.readObject();
}
} }
//private void readObjectNoData() throws ObjectStreamException; // used to modify default values //private void readObjectNoData() throws ObjectStreamException; // used to modify default values
} }
...@@ -1840,5 +1840,43 @@ q11 - q22 = c3 ...@@ -1840,5 +1840,43 @@ q11 - q22 = c3
return; return;
} }
public static void applyTo(
final double [] q,
final double [] in,
final double [] out) {
final double q0= q[0];
final double q1= q[1];
final double q2= q[2];
final double q3= q[3];
final double x = in[0];
final double y = in[1];
final double z = in[2];
final double s = q1 * x + q2 * y + q3 * z;
out[0] = 2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x;
out[1] = 2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y;
out[2] = 2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z;
}
public static void applyTo(
final double k, // scale
final double [] q,
final double [] in,
final double [] out) {
final double q0= q[0];
final double q1= q[1];
final double q2= q[2];
final double q3= q[3];
final double x = in[0];
final double y = in[1];
final double z = in[2];
final double s = q1 * x + q2 * y + q3 * z;
out[0] = k * (2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x);
out[1] = k * (2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y);
out[2] = k * (2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z);
}
} }
...@@ -35,6 +35,7 @@ public class IntersceneMatchParameters { ...@@ -35,6 +35,7 @@ public class IntersceneMatchParameters {
public static String [] MODES3D = {"RAW", "INF", "FG", "BG"}; // RAW:-1 public static String [] MODES3D = {"RAW", "INF", "FG", "BG"}; // RAW:-1
public static String [] MODES_AVI = {"RAW", "JPEG", "PNG"}; public static String [] MODES_AVI = {"RAW", "JPEG", "PNG"};
public static String [] FLT_ALT_MODES = {"--- (no ALT filter)", "ALT only", "no ALT only"}; public static String [] FLT_ALT_MODES = {"--- (no ALT filter)", "ALT only", "no ALT only"};
public static String [] FLT_ORIENT_MODES = {"--- (no ORIENT filter)", "ORIENT only", "no ORIENT only"};
// Maybe add parameters to make sure there is enough data? Enough in each zone? Enough spread? // Maybe add parameters to make sure there is enough data? Enough in each zone? Enough spread?
public boolean ims_use = true; // use IMS data public boolean ims_use = true; // use IMS data
...@@ -223,6 +224,7 @@ public class IntersceneMatchParameters { ...@@ -223,6 +224,7 @@ public class IntersceneMatchParameters {
public double flt_min_sfm = 0.0; // minimal minimal SfM gain of a pair public double flt_min_sfm = 0.0; // minimal minimal SfM gain of a pair
public double flt_max_sfm = 1000.0; // maximal minimal SfM gain of a pair public double flt_max_sfm = 1000.0; // maximal minimal SfM gain of a pair
public int flt_alt = 0; // 0 - do not filter, 1 - keep only with alt data, 2 - keep only without alt data public int flt_alt = 0; // 0 - do not filter, 1 - keep only with alt data, 2 - keep only without alt data
public int flt_orient = 0; // 0 - do not filter, 1 - keep only with orientation data, 2 - keep only without orientation data
public boolean flt_show_names = true; public boolean flt_show_names = true;
public boolean flt_show_overlaps = true; public boolean flt_show_overlaps = true;
...@@ -987,6 +989,7 @@ min_str_neib_fpn 0.35 ...@@ -987,6 +989,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("Minimal SfM gain", this.flt_min_sfm, 3,7,"","Minimal SfM gain of the minimum in the scene pair."); gd.addNumericField("Minimal SfM gain", this.flt_min_sfm, 3,7,"","Minimal SfM gain of the minimum in the scene pair.");
gd.addNumericField("Maximal SfM gain", this.flt_max_sfm, 3,7,"","Maximal SfM gain of the minimum in the scene pair."); gd.addNumericField("Maximal SfM gain", this.flt_max_sfm, 3,7,"","Maximal SfM gain of the minimum in the scene pair.");
gd. addChoice("Filter by pairwise ALT availability",FLT_ALT_MODES, FLT_ALT_MODES[this.flt_alt],"Filter by pairwise ALT availability."); gd. addChoice("Filter by pairwise ALT availability",FLT_ALT_MODES, FLT_ALT_MODES[this.flt_alt],"Filter by pairwise ALT availability.");
gd. addChoice("Filter by orientation availability",FLT_ORIENT_MODES, FLT_ORIENT_MODES[this.flt_orient],"Filter by the scene orientation availability.");
gd.addCheckbox ("Show scene names", this.flt_show_names, "Show scene full names (timestamps) in selection drop-down list."); gd.addCheckbox ("Show scene names", this.flt_show_names, "Show scene full names (timestamps) in selection drop-down list.");
gd.addCheckbox ("Show scene overlaps", this.flt_show_overlaps, "Show scene overlaps (in percents) in selection drop-down list."); gd.addCheckbox ("Show scene overlaps", this.flt_show_overlaps, "Show scene overlaps (in percents) in selection drop-down list.");
...@@ -1997,6 +2000,7 @@ min_str_neib_fpn 0.35 ...@@ -1997,6 +2000,7 @@ min_str_neib_fpn 0.35
this.flt_max_sfm = gd.getNextNumber(); this.flt_max_sfm = gd.getNextNumber();
this.flt_alt = gd.getNextChoiceIndex(); this.flt_alt = gd.getNextChoiceIndex();
this.flt_orient = gd.getNextChoiceIndex();
this.flt_show_names = gd.getNextBoolean(); this.flt_show_names = gd.getNextBoolean();
this.flt_show_overlaps = gd.getNextBoolean(); this.flt_show_overlaps = gd.getNextBoolean();
this.flt_show_rms = gd.getNextBoolean(); this.flt_show_rms = gd.getNextBoolean();
...@@ -2598,6 +2602,7 @@ min_str_neib_fpn 0.35 ...@@ -2598,6 +2602,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"flt_min_sfm", this.flt_min_sfm + ""); // double properties.setProperty(prefix+"flt_min_sfm", this.flt_min_sfm + ""); // double
properties.setProperty(prefix+"flt_max_sfm", this.flt_max_sfm + ""); // double properties.setProperty(prefix+"flt_max_sfm", this.flt_max_sfm + ""); // double
properties.setProperty(prefix+"flt_alt", this.flt_alt + ""); // int properties.setProperty(prefix+"flt_alt", this.flt_alt + ""); // int
properties.setProperty(prefix+"flt_orient", this.flt_orient + ""); // int
properties.setProperty(prefix+"flt_show_names", this.flt_show_names + ""); // boolean properties.setProperty(prefix+"flt_show_names", this.flt_show_names + ""); // boolean
properties.setProperty(prefix+"flt_show_overlaps", this.flt_show_overlaps + ""); // boolean properties.setProperty(prefix+"flt_show_overlaps", this.flt_show_overlaps + ""); // boolean
properties.setProperty(prefix+"flt_show_rms", this.flt_show_rms + ""); // boolean properties.setProperty(prefix+"flt_show_rms", this.flt_show_rms + ""); // boolean
...@@ -3165,6 +3170,7 @@ min_str_neib_fpn 0.35 ...@@ -3165,6 +3170,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"flt_min_sfm")!= null) this.flt_min_sfm= Double.parseDouble(properties.getProperty(prefix+ "flt_min_sfm")); if (properties.getProperty(prefix+"flt_min_sfm")!= null) this.flt_min_sfm= Double.parseDouble(properties.getProperty(prefix+ "flt_min_sfm"));
if (properties.getProperty(prefix+"flt_max_sfm")!= null) this.flt_max_sfm= Double.parseDouble(properties.getProperty(prefix+ "flt_max_sfm")); if (properties.getProperty(prefix+"flt_max_sfm")!= null) this.flt_max_sfm= Double.parseDouble(properties.getProperty(prefix+ "flt_max_sfm"));
if (properties.getProperty(prefix+"flt_alt")!= null) this.flt_alt= Integer.parseInt(properties.getProperty(prefix+ "flt_alt")); if (properties.getProperty(prefix+"flt_alt")!= null) this.flt_alt= Integer.parseInt(properties.getProperty(prefix+ "flt_alt"));
if (properties.getProperty(prefix+"flt_orient")!= null) this.flt_orient= Integer.parseInt(properties.getProperty(prefix+ "flt_orient"));
if (properties.getProperty(prefix+"flt_show_names")!= null) this.flt_show_names= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_names")); if (properties.getProperty(prefix+"flt_show_names")!= null) this.flt_show_names= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_names"));
if (properties.getProperty(prefix+"flt_show_overlaps")!=null) this.flt_show_overlaps=Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_overlaps")); if (properties.getProperty(prefix+"flt_show_overlaps")!=null) this.flt_show_overlaps=Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_overlaps"));
if (properties.getProperty(prefix+"flt_show_rms")!= null) this.flt_show_rms= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_rms")); if (properties.getProperty(prefix+"flt_show_rms")!= null) this.flt_show_rms= Boolean.parseBoolean(properties.getProperty(prefix+"flt_show_rms"));
...@@ -3753,9 +3759,8 @@ min_str_neib_fpn 0.35 ...@@ -3753,9 +3759,8 @@ min_str_neib_fpn 0.35
imp.flt_min_sfm = this.flt_min_sfm; imp.flt_min_sfm = this.flt_min_sfm;
imp.flt_max_sfm = this.flt_max_sfm; imp.flt_max_sfm = this.flt_max_sfm;
imp.flt_alt = this.flt_alt; imp.flt_alt = this.flt_alt;
imp.flt_orient = this.flt_orient;
imp.flt_show_names = this.flt_show_names; imp.flt_show_names = this.flt_show_names;
imp.flt_show_overlaps = this.flt_show_overlaps; imp.flt_show_overlaps = this.flt_show_overlaps;
imp.flt_show_rms = this.flt_show_rms; imp.flt_show_rms = this.flt_show_rms;
......
...@@ -8556,6 +8556,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8556,6 +8556,7 @@ if (debugLevel > -100) return true; // temporarily !
EyesisCorrectionParameters.CorrectionParameters.PathFirstLast[] pathFirstLast = null; EyesisCorrectionParameters.CorrectionParameters.PathFirstLast[] pathFirstLast = null;
int num_seq = 1; int num_seq = 1;
if (quadCLT_main.correctionsParameters.useSourceList) { if (quadCLT_main.correctionsParameters.useSourceList) {
System.out.println("\nReading source list from file: "+quadCLT_main.correctionsParameters.sourceSequencesList);
pathFirstLast = quadCLT_main.correctionsParameters.getSourceSets( pathFirstLast = quadCLT_main.correctionsParameters.getSourceSets(
quadCLT_main.correctionsParameters.sourceSequencesList); quadCLT_main.correctionsParameters.sourceSequencesList);
if (pathFirstLast != null) { if (pathFirstLast != null) {
......
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