Commit 7c17ebab authored by Andrey Filippov's avatar Andrey Filippov

Fixed FPN mitigation - using farthest scene if perfect is not available

parent 590d3aba
......@@ -1389,6 +1389,8 @@ public class Interscene {
// find closest but farther than fpn_mitigate_dist;
fpn_pairs[ipair][0] = fpn_index;
fpn_pairs[ipair][1] = -1;
double max_dist = 0.0;
int best_cond_pair = -1;
double best_dist = Double.NaN;
for (int i = latest_scene; i >= earliest_scene; i--) {
double fpn_dist = quadCLTs[latest_scene].estimateAverageShift(
......@@ -1397,6 +1399,7 @@ public class Interscene {
avg_z, // double average_z,
false, // boolean use_rot,
rectilinear); // boolean rectilinear)
if (fpn_dist < fpn_mitigate_dist) {
fpn_dist = quadCLTs[i].estimateAverageShift(
scenes_xyzatr[i], // double [][] xyzatr0,
......@@ -1411,7 +1414,16 @@ public class Interscene {
fpn_pairs[ipair][1] = i;
need_fpn_mitigate[fpn_pairs[ipair][0]] = false;
}
} else if (fpn_dist > max_dist) {
max_dist = fpn_dist;
best_cond_pair = i;
}
}
if (fpn_pairs[ipair][1] < 0) {
System.out.print("Failed to find a good pair for scene #"+fpn_pairs[ipair][0]+". ");
System.out.println("Using #"+best_cond_pair+" with distance = "+max_dist+" pix.");
fpn_pairs[ipair][1] = best_cond_pair;
need_fpn_mitigate[fpn_pairs[ipair][0]] = false;
}
}
return fpn_pairs;
......
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