Commit cc9dbf30 authored by Andrey Filippov's avatar Andrey Filippov

Cleaning up, improving results

parent 99126b30
......@@ -327,7 +327,29 @@ public class ComboMatch {
"patterns_r20.0_e25.0_ir10.0_ie8.0_is0.0_or45.0_oe20.0_os-1.0_h8_w0.6_s-60.0_200x200.tif",
"patterns_r20.0_e25.0_ir10.0_ie8.0_is0.0_or40.0_oe20.0_os-1.0_h8_w0.6_s-60.0_200x200.tif",
"patterns_r20.0_e25.0_ir10.0_ie8.0_is0.0_or35.0_oe15.0_os-1.0_h8_w0.6_s-60.0_200x200.tif",
"patterns_r20.0_e20.0_ir10.0_ie8.0_is0.0_or35.0_oe15.0_os-1.0_h8_w0.6_s-60.0_200x200.tif"
"patterns_r20.0_e20.0_ir10.0_ie8.0_is0.0_or35.0_oe15.0_os-1.0_h8_w0.6_s-60.0_200x200.tif",
"patterns_r30.0_e15.0_ir15.0ie8.0_is-0.05_h8_w0.6_s-200.0_200x200.tiff", // morning used
"--- 30, 28 edge 10 --",
"patterns_r30.0_e10.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r30.0_e10.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r28.0_e10.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r28.0_e10.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"--- 26, 32 edge 10 --",
"patterns_r26.0_e10.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r26.0_e10.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
// "patterns_r32.0_e10.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-170.0_200x200.tif",
"patterns_r32.0_e10.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r32.0_e10.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"---- 30, 26 edge 6 ---",
"patterns_r30.0_e6.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r30.0_e6.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r26.0_e6.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r26.0_e6.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"---- 30, 26 edge 8 ---",
"patterns_r30.0_e8.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r30.0_e8.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r26.0_e8.0_ir15.0_ie8.0_is-0.05_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif",
"patterns_r26.0_e8.0_ir15.0_ie8.0_is-0.3_or42.0_oe6.0_os0.0_h8_w0.6_s-200.0_200x200.tif"
};
......@@ -399,9 +421,39 @@ public class ComboMatch {
for (ObjectLocation ol: object_list) {
System.out.println(ol.name+": "+ol.xy_meters[0]+"/"+ol.xy_meters[1]);
}
int [] indices = null;
int [][] bounds = maps_collection.getBoundsPixels( // should be for rectified, {-bounds[0][0], -bounds[0][1]} - exact center
zool_lev_objects,
indices);
int width = bounds[0][1] - bounds[0][0]; // bounds[x][0] - negative
int height = bounds[1][1] - bounds[1][0];
if ((width != imp_sel.getWidth()) || (height != imp_sel.getHeight())) {
System.out.println("Marked image ("+imp_sel.getWidth()+"x"+imp_sel.getHeight()+") does not match the full map size ("+
width+"x"+height+"), will try just for a pair of the first two slices");
String [] labels = imp_sel.getStack().getSliceLabels();
indices = new int [2];
for (int i = 0; i < indices.length; i++) {
indices[i] = maps_collection.getIndex(labels[i].substring(0, 17));
}
bounds = maps_collection.getBoundsPixels( // should be for rectified, {-bounds[0][0], -bounds[0][1]} - exact center
zool_lev_objects,
indices);
width = bounds[0][1] - bounds[0][0]; // bounds[x][0] - negative
height = bounds[1][1] - bounds[1][0];
if ((width != imp_sel.getWidth()) || (height != imp_sel.getHeight())) {
System.out.println("Marked image ("+imp_sel.getWidth()+"x"+imp_sel.getHeight()+") does not match the 2-image map size ("+
width+"x"+height+") either.Giving up");
return false;
} else {
System.out.println("Marked image ("+imp_sel.getWidth()+"x"+imp_sel.getHeight()+") does match the 2-image map size ("+
width+"x"+height+"). Using it.");
}
}
maps_collection.reverseRender(
object_list, // ArrayList<ObjectLocation> objects,
zool_lev_objects); // int zoom_level){
zool_lev_objects, // int zoom_level){
indices); // int [] indices){ // null or selected image indices
System.out.println("Object coordinates in source images: ");
for (ObjectLocation ol: object_list) {
System.out.println(ol.name+": "+ol.getPixels()[0]+"/"+ol.getPixels()[1]);
......@@ -416,11 +468,14 @@ public class ComboMatch {
extr_size);
}
ImagePlus imp_obj = ShowDoubleFloatArrays.makeArrays(
object_stack,
extr_size,
extr_size,
OrthoMap.removeKnownExtension(imp_sel.getTitle())+"-OBJECT_"+extr_size+"x"+extr_size+".tiff",
OrthoMap.removeKnownExtension(imp_sel.getTitle())+
OrthoMap.removeKnownExtension(pattern_file)+":"+sub_pattern_index+
"-OBJECT_"+extr_size+"x"+extr_size+".tiff",
object_titles); // test_titles,
imp_obj.show();
......@@ -448,8 +503,10 @@ public class ComboMatch {
}
double [] kernel = OrthoMap.getConvolutionKernel(default_kernel);
double [][] centers = new double [object_stack.length][];
double [][] corr_ret = new double [object_stack.length][corr_size*corr_size];
for (int i = 0; i < object_stack.length; i++) {
String dbg_prefix = "corr_patt_"+i;
String dbg_prefix = "corr_patt_"+i+"-"+OrthoMap.removeKnownExtension(pattern_file)+":"+sub_pattern_index;
ObjectLocation ol = object_list.get(i);
centers[i] = ObjectLocation.getPatternCenter(
object_stack[i], // double [] data,
......@@ -460,6 +517,7 @@ public class ComboMatch {
min_corr, // double min_corr,
radius_search, // int radius_search,
radius_centroid, // int radius_centroid,
corr_ret[i], //double [] corr_ret, // null or double[corr_size*corr_size]
dbg_prefix, // String dbg_prefix,
debugLevel); // int debugLevel)
System.out.println(i+": center at "+centers[i][0]+"/"+centers[i][1]+", strength="+centers[i][2]);
......@@ -470,6 +528,35 @@ public class ComboMatch {
roi.addPoint(centers[i][0]+extr_size/2, centers[i][1]+extr_size/2, i+1); // ,1);
}
imp_obj.setRoi(roi);
// calculate statistics for cor_ret[i]
double [][] stats = new double [object_stack.length][];
double search_rad = 15.0;
double frac_max = 0.5;
double other_rad = 25;
for (int i = 0; i < object_stack.length; i++) {
double [] a_cent= {corr_size/2+centers[i][0],corr_size/2+centers[i][1]};
stats[i]=ObjectLocation.getMaxLocArea(
corr_ret[i], // double [] data, // square data
a_cent, // centers[i], // double [] cent_xy, // if null, use center of the square
search_rad, // double radius, // search for maximum within this radius
frac_max, // double frac_max,
other_rad,
0); // int debugLevel)
}
System.out.println("\nUsing pattern file: "+pattern_path+", subpattern="+sub_pattern_index);
System.out.println(String.format("%2s (%9s): %7s %7s %7s %7s %7s %7s %17s",
"#"," X/Y ","strengh", "radius", " elong ", " dist ", " dx "," dy ",
"image timestamp"));
for (int i = 0; i < object_stack.length; i++) {
ObjectLocation ol = object_list.get(i);
System.out.println(String.format("%2d (%4d/%4d): %7.5f %7.3f %7.3f %7.3f %7.3f %7.3f %17s",
i, ol.getPixels()[0], ol.getPixels()[1],
stats[i][0],stats[i][1],stats[i][2],stats[i][3],stats[i][4]+centers[i][0],stats[i][5]+centers[i][1],
ol.getName()));
}
System.out.println();
if (only_correlate) {
System.out.println("testPatternCorrelate(): correlation DONE, only_correlate is set to true, exiting");
return true;
......@@ -797,7 +884,8 @@ public class ComboMatch {
}
if (render_match) {
ImagePlus imp_img_pair = maps_collection.renderMulti (
"multi_"+gpu_spair[0]+"-"+gpu_spair[1]+"-zoom_"+min_zoom_lev+"_"+zoom_lev, // String title,
//_zoom<integer> is needed for opening with "Extract Objects" command
"multi_"+gpu_spair[0]+"-"+gpu_spair[1]+"_zoom"+min_zoom_lev+"_"+zoom_lev, // String title,
false, // boolean use_alt,
gpu_pair, // int [] indices, // null or which indices to use (normally just 2 for pairwise comparison)
bounds_to_indices, // boolean bounds_to_indices,
......@@ -824,6 +912,11 @@ public class ComboMatch {
return true;
}
public void printSceneStats() {
}
/*
double [][] affine1 = {
{1,0,0},
......@@ -1056,7 +1149,10 @@ adjusted affines[1] for a pair: 1694564291_293695/1694564778_589341
int nSlices = stack_scenes.getSize();
String [] scene_names = new String [nSlices];
for (int n = 0; n < scene_names.length; n++) {
scene_names[n] = stack_scenes.getSliceLabel(n+1).substring(0,17);
scene_names[n] = stack_scenes.getSliceLabel(n+1);
if (scene_names[n].length() >= 17) {
scene_names[n] = scene_names[n].substring(0,17);
}
}
PointRoi pRoi = (PointRoi) imp.getRoi();
FloatPolygon fp = pRoi.getContainedFloatPoints();
......
......@@ -125,6 +125,7 @@ public class ObjectLocation {
* @param cent_xy offset from the square center to search
* @param radius search for maximum within this radius
* @param frac_max fraction of maximum to measure area
* @param other_radius measure maximal disconnected pixel fraction of the maximum within this radius
* @return {maximum, area, dist, x, y}. No interpolation yet, each returned value is integer.
* Returns null if no local maximum within area. x,y are offsets from the (provided) center
*/
......@@ -133,12 +134,14 @@ public class ObjectLocation {
double [] cent_xy, // if null, use center of the square
double radius, // search for maximum within this radius
double frac_max,
double other_radius,
int debugLevel) {
double [] rslt = getMaxLocArea(
data, // square data
cent_xy, // if null, use center of the square
radius, // search for maximum within this radius
frac_max,
other_radius,
debugLevel);
if (rslt != null) {
return rslt;
......@@ -152,6 +155,7 @@ public class ObjectLocation {
double [] cent_xy, // if null, use center of the square
double radius, // search for maximum within this radius
double frac_max,
double other_radius,
int debugLevel) {
boolean debug = debugLevel > 1;
int size = (int) Math.sqrt(data.length);
......@@ -201,8 +205,11 @@ public class ObjectLocation {
false); // boolean ordered)
int center_cluster = clusters[best_indx];
double xc = best_indx % size - cent_xy[0];
double yc = best_indx / size - cent_xy[1];
int best_x = best_indx % size;
int best_y = best_indx / size;
double xc = best_x - cent_xy[0];
double yc = best_y - cent_xy[1];
double s0=0, sx=0, sy=0, sx2 = 0, sy2=0, sxy = 0;
for (int i = 0; i < clusters.length; i++) {
......@@ -233,6 +240,35 @@ public class ObjectLocation {
double elong = Math.sqrt(eigval[1]/eigval[0]);
double eff_rad = Math.sqrt(Math.sqrt(eigval[1]*eigval[0]));
double dist = Math.sqrt(cent_offs[0]*cent_offs[0] + cent_offs[1]*cent_offs[1]);
double max_other = 0.0;
if (other_radius > 0) { // only calculate if asked for
double or2 = other_radius*other_radius;
min_x = Math.max(1, (int) Math.floor(best_x-other_radius));
min_y = Math.max(1, (int) Math.floor(best_y-other_radius));
max_x = Math.min(size-2, (int) Math.ceil(best_x+other_radius));
max_y = Math.min(size-2, (int) Math.ceil(best_y+other_radius));
for (int y = min_y; y <= max_y; y++) { // do not search on very edges
double dy = (y-best_y);
double y2 = dy*dy;
if (y2 < or2) {
for (int x = min_x; x <= max_x; x++) {
double dx = x - best_x;
double r2 = y2 + dx*dx;
if (r2 < or2) {
int indx = y * size + x;
if (clusters[indx] != center_cluster) { // only disconnected from the central area
double d = data[indx];
if (d > max_other) {
max_other = d;
}
}
}
}
}
}
max_other /= best_d;
}
if (debug) {
System.out.println("\ncenter offset ["+(sx/s0)+","+(sy/s0)+"] , from center: ["+cent_offs[0]+","+cent_offs[1]+"]");
System.out.println("Covariance matrix:");
......@@ -241,11 +277,11 @@ public class ObjectLocation {
eig.getV().print(8, 6);
System.out.println("eig.getD()");
eig.getD().print(8, 6);
System.out.println(String.format("best_d=%7.5f, rad=%6.3f, elong=%6.3f, dist=%6.3f, dx=%6.3f, dy=%6.3f",
best_d, eff_rad, elong, dist, cent_offs[0], cent_offs[1]));
System.out.println(String.format("best_d=%7.5f, rad=%6.3f, elong=%6.3f, dist=%6.3f, dx=%6.3f, dy=%6.3f, mo=%5.3f",
best_d, eff_rad, elong, dist, cent_offs[0], cent_offs[1], max_other));
}
return new double [] {best_d, eff_rad, elong, dist, cent_offs[0], cent_offs[1]} ;
return new double [] {best_d, eff_rad, elong, dist, cent_offs[0], cent_offs[1], max_other} ;
}
......@@ -326,6 +362,7 @@ public class ObjectLocation {
double min_corr,
int radius_search,
int radius_centroid,
double [] corr_ret, // null or double[corr_size*corr_size]
String dbg_prefix,
int debugLevel){
int refine = 1;
......@@ -393,6 +430,9 @@ public class ObjectLocation {
false, // final boolean convolve, // convolve, not correlate
phaseCoeff, // final double phaseCoeff,
debugLevel); // final int debugLevel)
if (corr_ret != null) {
System.arraycopy(corr_out, 0, corr_ret, 0, corr_out.length);
}
int data_width = 2 *radius_search + 1;
int offs = corr_size/2 - radius_search;
......
......@@ -3841,7 +3841,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
if (ipix1 >= 0) {
bestcorr[ipix1] = corrs[patt][ipix1];
if (combine_full) {
bestcorr[ipix1] *= corrs[full_patt_indx][ipix1]/corrs[full_patt_indx][ipix];
bestcorr[ipix1] *= Math.max(0, corrs[full_patt_indx][ipix1]/corrs[full_patt_indx][ipix]);
}
bestpatt[ipix1] = patt;
}
......
......@@ -407,10 +407,11 @@ public class OrthoMapsCollection implements Serializable{
*/
public void reverseRender(
ArrayList<ObjectLocation> objects,
int zoom_level){
int zoom_level,
int [] indices){ // null or selected image indices
int [][] bounds = getBoundsPixels( // should be for rectified, {-bounds[0][0], -bounds[0][1]} - exact center
zoom_level,
null);
indices);
int width = bounds[0][1] - bounds[0][0]; // bounds[x][0] - negative
int height = bounds[1][1] - bounds[1][0];
/*
......@@ -419,7 +420,7 @@ public class OrthoMapsCollection implements Serializable{
indices[i] = i;
}
*/
final int reference_index = 0;
final int reference_index = (indices == null)?0:indices[0];
for (ObjectLocation ol: objects) {
int nmap =getIndex(ol.getName());
final double scale = 1.0/OrthoMap.getPixelSizeMeters(zoom_level);
......@@ -1442,6 +1443,23 @@ public class OrthoMapsCollection implements Serializable{
return -agl * offs_par / l1 ;
}
/**
* Calculate (negative) pixel offset parallel to the scene offset corresponding to object height
* @param height
* @param scene_offset
* @param zoom_level
* @param agl
* @return
*/
public static double elevationToParallelOffset(
double height,
double [] scene_offset,
int zoom_level,
double agl) {
double l1 = Math.sqrt(scene_offset[0]*scene_offset[0] + scene_offset[1]*scene_offset[1]);
return -height/agl * l1 ;
}
public static Rectangle scaleRectangle(
......@@ -1694,14 +1712,15 @@ public class OrthoMapsCollection implements Serializable{
double [][][] affines, // null or [indices.length][2][3]
FineXYCorr warp) { // use for a single pair only
double [] min_corrs = {0.008, 0.0035}; // morning/evening
// double [] max_area = {60.0, 65.0}; // one per obsolete
// double frac_max = 0.5; // measure are at fraction of max
// double [] min_corrs = {0.008, 0.0035}; // morning/evening
// double [] min_corrs = {0.0095, 0.0035}; // morning/evening
double [] min_corrs = {0.0085, 0.0036}; // 0.0035}; // morning/evening
double [] phaseCoeff = {0.98,0.5};
double min_corr_full_rel = 0.75;
// double min_corr_full_rel = 0.75; // try 0.85
double min_corr_full_rel = 0.85; // try 0.85
double full_preference = 1.4;
double max_min_ratio = 3.0;
boolean combine_full = true;
boolean[] combine_full = {true, true}; // try for other olso?
int corr_size = 128; // pix
double adv_radius = 30.0; // cm
double search_radius = 15; // look for other scene max within this distance from main
......@@ -1713,10 +1732,17 @@ public class OrthoMapsCollection implements Serializable{
// filters
boolean filt_keep = false; // list filtered out, but actually keep them
boolean filt_atonce = false; // apply main/second together, false - first filter main only
double filt_frac_max = 0.5; // measure are at fraction of max
double [][] filt_max_radius = {{1.0,1.0},{1.0,1.0}}; // [second/main][full/half] - inactive now
double [][] filt_elongation = {{1.5,1.5},{1.7,1.7}}; // [second/main][full/half] ellipse axis ratio
double [] filt_dist = {8.0,3.0}; // full offset and perpendicular to images offsets
double filt_frac_max = 0.6; // 0.5; // measure are at fraction of max
double [][] filt_max_radius = {{1.0,1.0},{1.2,1.2}}; // {1.0,1.0}}; // [second/main][full/half] - inactive now
// double [][] filt_elongation = {{1.5,1.5},{1.7,1.7}}; // [second/main][full/half] ellipse axis ratio
double [][] filt_elongation = {{1.7,1.7},{1.7,1.7}}; // [second/main][full/half] ellipse axis ratio
double filt_other_rad = 25; // should be no disconnected high peaks in this radius (only for halves multiplied)
double [] filt_other_frac = {0.8,0.8}; // no pixels around max at filt_other_rad should be higher than this fraction of max
// double [] filt_dist = {8.0,5.0}; // full offset and perpendicular to images offsets
// make conditional distance - decrease if small offset (increase for large to accommodate +30/-10cm
double [] filt_dist = {10.0,5.0}; // full offset and perpendicular to images offsets
double filt_height = 0.2; // allow extra negative offset parallel to image offset, corresponding to object above ground
int debugLevel = 1;
......@@ -1731,7 +1757,8 @@ public class OrthoMapsCollection implements Serializable{
gd.addNumericField("Minimal relative full correlation", min_corr_full_rel, 5,7,"","Minimal relative correlation value with full circular pattern to keep.");
gd.addNumericField("Prefer full pattern", full_preference, 3,7,"","Prefer full pattern to partial; scale by this value.");
gd.addNumericField("Max/min halves ratio", max_min_ratio, 3,7,"","Ratio of halves best/worst to use half-pattern.");
gd.addCheckbox ("Combine with full pattern", combine_full, "Multiply by normalized full pattern correlation maximum.");
gd.addCheckbox ("Combine with full pattern, main", combine_full[0], "Multiply by normalized full pattern correlation maximum.");
gd.addCheckbox ("Combine with full pattern, other", combine_full[1], "Multiply by normalized full pattern correlation maximum.");
gd.addNumericField("Correlation size", corr_size, 0,4,"pix", "Should be power of 2.");
gd.addNumericField("Adversarial distance", adv_radius, 1,6,"pix", "Suppress weaker if they have closer strong ones.");
gd.addNumericField("Search other scene max", search_radius, 1,6,"pix", "Search for other scene max from the main one.");
......@@ -1751,8 +1778,15 @@ public class OrthoMapsCollection implements Serializable{
gd.addNumericField("Max elongation, main, halves", filt_elongation[0][1], 5,7,"","Maximal peak ellipse axis ratio at certain height.");
gd.addNumericField("Max elongation, other, full", filt_elongation[1][0], 5,7,"","Maximal peak ellipse axis ratio at certain height.");
gd.addNumericField("Max elongation, other, halves", filt_elongation[1][1], 5,7,"","Maximal peak ellipse axis ratio at certain height.");
gd.addNumericField("Other peak distance", filt_other_rad, 5,7,"pix","Should be no disconnected peaks within this radius from the used one. Set to 0 to disable.");
gd.addNumericField("Other peak fraction, main scene", filt_other_frac[0], 5,7,"","Maximal near peak fraction of the used maximum. Only for halves.");
gd.addNumericField("Other peak fraction, other scene", filt_other_frac[1], 5,7,"","Maximal near peak fraction of the used maximum. Only for halves.");
gd.addNumericField("Maximal offset", filt_dist[0], 5,7,"pix","Maximal other scene offset from the main.");
gd.addNumericField("Maximal offset perpendicular", filt_dist[1], 5,7,"pix","Maximal other scene offset perpendicular to offset between scenes.");
gd.addNumericField("Maximal object height", filt_height, 5,7,"m", "Maximal object height to allow extra offset.");
//
gd.addNumericField("Debug level", debugLevel, 0,4,"", "Debug level.");
gd.showDialog();
......@@ -1768,7 +1802,8 @@ public class OrthoMapsCollection implements Serializable{
min_corr_full_rel= gd.getNextNumber();
full_preference= gd.getNextNumber();
max_min_ratio= gd.getNextNumber();
combine_full = gd.getNextBoolean();
combine_full[0] = gd.getNextBoolean();
combine_full[1] = gd.getNextBoolean();
corr_size= (int) gd.getNextNumber();
adv_radius= gd.getNextNumber();
search_radius= gd.getNextNumber();
......@@ -1788,8 +1823,14 @@ public class OrthoMapsCollection implements Serializable{
filt_elongation[0][1]=gd.getNextNumber();
filt_elongation[1][0]=gd.getNextNumber();
filt_elongation[1][1]=gd.getNextNumber();
filt_other_rad= gd.getNextNumber();
filt_other_frac[0]= gd.getNextNumber();
filt_other_frac[1]= gd.getNextNumber();
filt_dist[0] = gd.getNextNumber();
filt_dist[1] = gd.getNextNumber();
filt_height = gd.getNextNumber();
debugLevel= (int) gd.getNextNumber();
return patternMatchDual (
......@@ -1801,7 +1842,7 @@ public class OrthoMapsCollection implements Serializable{
min_corr_full_rel, // double min_corr_full_rel,
full_preference, // double full_preference,
max_min_ratio, // double max_min_ratio,
combine_full, // boolean combine_full,
combine_full, // boolean[] combine_full,
corr_size, // int corr_size,
adv_radius, // double adv_radius, //
search_radius, // double search_radius, //
......@@ -1814,7 +1855,10 @@ public class OrthoMapsCollection implements Serializable{
filt_frac_max, // double frac_max, // measure are at fraction of max
filt_max_radius, // double [][] filt_max_radius,
filt_elongation, // double [][] filt_elongation,
filt_other_rad, // double filt_other_rad, // should be no disconnected high peaks in this radius (only for halves multiplied)
filt_other_frac, // double [] filt_other_frac, // no pixels around max at filt_other_rad should be higher than this fraction of max
filt_dist, // double [] filt_dist,
filt_height, // double filt_height,
debugLevel); // int debugLevel)
}
......@@ -1827,7 +1871,7 @@ public class OrthoMapsCollection implements Serializable{
double min_corr_full_rel,
double full_preference,
double max_min_ratio,
boolean combine_full,
boolean[] combine_full,
int corr_size,
double adv_radius, //
double search_radius, // look for other scene max within this distance from main
......@@ -1840,7 +1884,10 @@ public class OrthoMapsCollection implements Serializable{
double frac_max, // measure are at fraction of max
double [][] filt_max_radius,
double [][] filt_elongation,
double filt_other_rad, // should be no disconnected high peaks in this radius (only for halves multiplied)
double [] filt_other_frac, // no pixels around max at filt_other_rad should be higher than this fraction of max
double [] filt_dist,
double filt_height,
int debugLevel) {
warp.scale_warp = scale_warp;
......@@ -1900,15 +1947,20 @@ public class OrthoMapsCollection implements Serializable{
ArrayList <ItemMatch> matches_list = new ArrayList <ItemMatch>();
double [][][] extracted_objects = new double [indices.length][][];
double [][][] extr_corr = new double [indices.length][][];
// double [][][] extr_corr_best = new double [indices.length][][]; // only for main - already combined
double [][][] extr_corr_half = new double [indices.length][][];
double [][][][] filter_data = new double [indices.length][][][]; // [scene][max][0-full, 1 - half][0- max, 1 - area, 2 - distance]
int [] best_patt_indx;
for (int scene_num = 0; scene_num < indices.length; scene_num++) { // will probably just use first one, second - derivative
gops[scene_num] = GroundObjectPattern.getPattern(
object_type, // String object_type,
ortho_maps[indices[scene_num]].getLocalDateTime(), // LocalDateTime utcDateTime,
patterns); // ArrayList<GroundObjectPattern> patterns)
if (gops[scene_num] == null) {
System.out.println("Failed to find a pattern for object \""+object_type+"\", aborting operation.");
return null;
}
ImagePlus imp_pattern = new ImagePlus(gops[scene_num].getPatternPath());
pattern_sizes[scene_num] = imp_pattern.getWidth();
if (pattern_sizes[scene_num] == 0) {
......@@ -2015,7 +2067,7 @@ public class OrthoMapsCollection implements Serializable{
min_corrs_full[scene_num], // final double min_corr_full,
full_preference, // final double full_preference,
max_min_ratio, // final double max_min_ratio,
combine_full, // final boolean combine_full, // multiply by normalized full pattern correlation maximum
combine_full[0], // final boolean combine_full, // multiply by normalized full pattern correlation maximum
adv_radius, // final double adv_radius,
corr_radius); // final int corr_radius)
// GroundObjectPattern gop = gops[scene_num];
......@@ -2059,6 +2111,45 @@ public class OrthoMapsCollection implements Serializable{
break;
}
}
}
// near the edge - check both images
for (int i = match_sort.size()-1; i >=0; i--) {
int indx =match_sort.get(i);
ItemMatch match = matches_list.get(indx);
int [] icenter_xy = match.getIntXY();
boolean has_NaN = true;
seach_NaN: {
int half_size=corr_size/2;
if ((icenter_xy[0] < half_size) || (icenter_xy[1] < half_size) ||
(icenter_xy[0] > (width - half_size)) || (icenter_xy[1] > (height - half_size))) {
break seach_NaN;
}
for (int y = (icenter_xy[1] - half_size); y < (icenter_xy[1] + half_size); y++) {
int indx0 = y * width;
for (int dy =- half_size; dy < half_size; dy++) {
for (int x = (icenter_xy[0] - half_size); x < (icenter_xy[0] + half_size); x++) {
int indx1 = indx0 + x;
for (int sn = 0; sn < indices.length; sn++) {
if (Double.isNaN(dmulti[sn][indx1])) {
break seach_NaN;
}
}
}
}
}
has_NaN = false;
}
if (has_NaN) {
match_sort.remove(i);
if (debugLevel > -1) {
System.out.println("Removed object at x="+icenter_xy[0]+", y="+icenter_xy[1]+
" as it is near the edge of one of the images");
}
num_non_overlap++;
}
}
if (num_non_overlap > 0) {
System.out.println("Removed "+num_non_overlap+" objects outside of the scenes overlap, "+match_sort.size()+" remain");
......@@ -2099,37 +2190,54 @@ public class OrthoMapsCollection implements Serializable{
filter_data[scene_num] = new double[match_sort.size()][2][]; // [scene][max][0-full, 1 - half][0- max, 1 - area, 2 - distance]
extr_corr[scene_num] = new double [match_sort.size()][]; // extracted_objects[scene_num].length][];
extr_corr_half[scene_num] = new double [match_sort.size()][]; // extracted_objects[scene_num].length][];
// extr_corr_best[scene_num] = new double [match_sort.size()][]; // combined full with halves
best_patt_indx = new int [match_sort.size()];
for (int mn=0; mn < match_sort.size(); mn++) {
// best_patt_indx[mn] =
int indx =match_sort.get(mn);
ItemMatch match = matches_list.get(indx);
int best_patt = match.getPatternMatch(gops[scene_num]).getBestSub() - 1;
best_patt_indx[mn] = best_patt;
double [] center_xy = match.getXY();
extr_corr[scene_num][mn] = ObjectLocation.extractObjectImage(
center_xy, // double [] center_xy,
extr_size, // int size,
corrs_out[scene_num][0], // double [] src_img,
width); // int width)
extr_corr_half[scene_num][mn] = ObjectLocation.extractObjectImage(
center_xy, // double [] center_xy,
extr_size, // int size,
corrs_out[scene_num][best_patt], // double [] src_img,
width); // int width)
filter_data[scene_num][mn][0] = ObjectLocation.getMaxLocAreaNaN(
extr_corr[scene_num][mn], // double [] data, // square data
null, // double [] cent_xy, // if null, use center of the square
search_radius, // double radius, // search for maximum within this radius. Should radius be 0 here?
frac_max, // double frac_max)
filt_other_rad, // double other_radius,
debugLevel); // final int debugLevel) {
extr_corr_half[scene_num][mn] = ObjectLocation.extractObjectImage(
center_xy, // double [] center_xy,
extr_size, // int size,
corrs_out[scene_num][best_patt], // double [] src_img,
// bestcorr[scene_num], // double [] src_img,
width); // int width)
// combine from scratch, best[] uses thresholding inside
if (combine_full[0]) {
double full_max_value = filter_data[scene_num][mn][0][0];
if (!Double.isNaN(full_max_value)) {
// multiply by full correlation, delete by full correlation maximum
for (int i = 0; i < extr_corr_half[scene_num][mn].length; i++){
extr_corr_half[scene_num][mn][i] *= Math.max(0, extr_corr[scene_num][mn][i]/full_max_value);
}
}
}
filter_data[scene_num][mn][1] = ObjectLocation.getMaxLocAreaNaN(
extr_corr_half[scene_num][mn], // double [] data, // square data
null, // double [] cent_xy, // if null, use center of the square
search_radius, // double radius, // search for maximum within this radius. Should radius be 0 here?
frac_max, // double frac_max)
filt_other_rad, // double other_radius,
debugLevel); // final int debugLevel) {
}
double [] scene_xy_offset = {centers[1][0]-centers[0][0],centers[1][1]-centers[0][1]};
boolean [] removed = null;
double scene_agl = gops[1].getAGL(); // second scene agl
if (!filt_atonce) {
boolean[] filt_main_other = {true,false};
//int num_removed =
......@@ -2141,7 +2249,12 @@ public class OrthoMapsCollection implements Serializable{
filt_max_radius, // double [][] filt_max_radius,
filt_elongation, // double [][] filt_elongation,
filt_dist, // double [] filt_dist,
filt_height, // double filt_height,
best_patt_indx, // int [] best_patt_indx,
filt_other_frac, //double [] filt_other_frac, // null - disable, for all full (round) patterns.
filter_data, // double [][][][] filter_data,
zoom_level, // int zoom_level,
scene_agl, // double scene_agl,
scene_xy_offset, // double [] scene_xy_offset, //second scene vertical projection offset from the first scene
matches_list, // ArrayList <ItemMatch> matches_list,
match_sort, // ArrayList<Integer> match_sort,
......@@ -2153,6 +2266,7 @@ public class OrthoMapsCollection implements Serializable{
extr_corr[sn] = removeFilteredOut (extr_corr[sn], removed);
extr_corr_half[sn] = removeFilteredOut (extr_corr_half[sn], removed);
}
best_patt_indx = removeFilteredOut(best_patt_indx, removed);
removed = new boolean [match_sort.size()];
}
......@@ -2211,6 +2325,13 @@ public class OrthoMapsCollection implements Serializable{
false, // final boolean convolve, // convolve, not correlate
phaseCoeff[scene_other], // final double phaseCoeff,
debugLevel); // final int debugLevel) {
filter_data[scene_other][mn][0] = ObjectLocation.getMaxLocAreaNaN(
extr_corr[scene_other][mn], // double [] data, // square data
null, // double [] cent_xy, // if null, use center of the square
search_radius, // double radius, // search for maximum within this radius. Should radius be 0 here?
frac_max, // double frac_max)
filt_other_rad, // double other_radius,
debugLevel); // final int debugLevel) {
if (best_patt > 0) { // not full match
extr_corr_half[scene_other][mn] =OrthoMap.correlateWithPattern(
extr_data[mn], // final double [] data,
......@@ -2220,22 +2341,27 @@ public class OrthoMapsCollection implements Serializable{
false, // final boolean convolve, // convolve, not correlate
phaseCoeff[scene_other], // final double phaseCoeff,
debugLevel); // final int debugLevel) {
if (combine_full[1]) {
double full_max_value = filter_data[scene_other][mn][0][0];
if (!Double.isNaN(full_max_value)) {
// multiply by full correlation, delete by full correlation maximum
for (int i = 0; i < extr_corr_half[scene_other][mn].length; i++){
extr_corr_half[scene_other][mn][i] *= Math.max(0, extr_corr[scene_other][mn][i]/full_max_value);
}
}
}
} else {
// Maybe correlate with all and make sure the best is +/- 1 from the main scene
extr_corr_half[scene_other][mn] = extr_corr[scene_other][mn];
}
filter_data[scene_other][mn][0] = ObjectLocation.getMaxLocAreaNaN(
extr_corr[scene_other][mn], // double [] data, // square data
null, // double [] cent_xy, // if null, use center of the square
search_radius, // double radius, // search for maximum within this radius. Should radius be 0 here?
frac_max, // double frac_max)
debugLevel); // final int debugLevel) {
filter_data[scene_other][mn][1] = ObjectLocation.getMaxLocAreaNaN(
extr_corr_half[scene_other][mn], // double [] data, // square data
null, // double [] cent_xy, // if null, use center of the square
search_radius, // double radius, // search for maximum within this radius. Should radius be 0 here?
frac_max, // double frac_max)
filt_other_rad, // double other_radius,
debugLevel); // final int debugLevel) {
}
......@@ -2264,7 +2390,12 @@ public class OrthoMapsCollection implements Serializable{
filt_max_radius, // double [][] filt_max_radius,
filt_elongation, // double [][] filt_elongation,
filt_dist, // double [] filt_dist,
filt_height, // double filt_height,
best_patt_indx, // int [] best_patt_indx,
filt_other_frac, //double [] filt_other_frac, // null - disable, for all full (round) patterns.
filter_data, // double [][][][] filter_data,
zoom_level, // int zoom_level,
scene_agl, // double scene_agl,
scene_xy_offset, // double [] scene_xy_offset, //second scene vertical projection offset from the first scene
matches_list, // ArrayList <ItemMatch> matches_list,
match_sort, // ArrayList<Integer> match_sort,
......@@ -2277,11 +2408,10 @@ public class OrthoMapsCollection implements Serializable{
extr_corr[sn] = removeFilteredOut (extr_corr[sn], removed);
extr_corr_half[sn] = removeFilteredOut (extr_corr_half[sn], removed);
}
best_patt_indx = removeFilteredOut(best_patt_indx, removed);
removed = new boolean [match_sort.size()];
}
ImagePlus [] imps_extracted_final = new ImagePlus[indices.length];
ImagePlus [] imps_extracted_corr_final = new ImagePlus[indices.length];
ImagePlus [] imps_extracted_corr_half_final = new ImagePlus[indices.length];
......@@ -2318,11 +2448,20 @@ public class OrthoMapsCollection implements Serializable{
}
}
// TODO: add filtering list by areas and distances
double scene_agl = gops[1].getAGL(); // second scene agl
System.out.println("TODO: add filtering list by areas and distances for both scenes");
// display updated list with areas for the main scene, and maximums areas, distances for the second
// double scene_agl = gops[1].getAGL(); // second scene agl
System.out.println(String.format("Main scene: (%03d) %17s",indices[0],ortho_maps[indices[0]].getName()));
System.out.println(String.format("Other scene: (%03d) %17s",indices[1],ortho_maps[indices[1]].getName()));
System.out.println("Searching for object type="+object_type+", found "+match_sort.size()+" of them."+
" PhaseCoeff=["+phaseCoeff[0]+","+phaseCoeff[1]+"], min_corrs=["+min_corrs[0]+","+min_corrs[1]+
"], min_corr_full_rel="+min_corr_full_rel+", frac_max="+frac_max);
System.out.println("filt_max_radius main =["+filt_max_radius[0][0]+","+filt_max_radius[0][1]+"], "+
"filt_max_radius other=["+filt_max_radius[1][0]+","+filt_max_radius[1][1]+"], "+
"filt_elongation main=["+filt_elongation[0][0]+","+filt_elongation[0][1]+"], "+
"filt_elongation other=["+filt_elongation[1][0]+","+filt_elongation[1][1]+"]");
System.out.println("filt_dist=["+filt_dist[0]+", "+filt_dist[1]+"] "+
"(First value is the total offset in pixels, second accounts for parallax.) "+
" filt_height="+filt_height+ " meters.");
System.out.println("filt_other_rad="+filt_other_rad+"pix, filt_other_frac=["+filt_other_frac[0]+", "+filt_other_frac[1]+"].");
System.out.println("Second image is offset by dx="+scene_xy_offset[0]+", dy="+scene_xy_offset[1]+", dist="+
Math.sqrt(scene_xy_offset[0]*scene_xy_offset[0]+scene_xy_offset[1]*scene_xy_offset[1])+" pix");
System.out.println("Updated object list with main scene peak areas and secondary scene maximums, areas and maximum distances from the main");
......@@ -2330,12 +2469,10 @@ public class OrthoMapsCollection implements Serializable{
for (int j = 0; j < (corrs_out[scene_num].length + 1); j++) if (j != sort_pattern_index) {
System.out.print(String.format(" %8s ","match_"+j));
}
// System.out.print(String.format("%8s %8s | %8s %8s %8s %8s %8s %8s",
// "mf-area","mh-area", "of-max", "of-area", "of-dist", "oh-max", "oh-area", "oh-dist"));
System.out.print(String.format("%6s %6s %6s %6s | %8s %6s %6s %6s %7s %7s %7s %7s %7s | %8s %6s %6s %6s %7s %7s %7s",
"mf-rad","mf-eln","mh-rad","mh-eln", // main: full radius, full elongation, half radius, half elongation
System.out.print(String.format("%6s %6s %6s %6s %6s | %8s %6s %6s %6s %7s %7s %7s %7s %7s | %8s %6s %6s %6s %6s %7s %7s %7s",
"mf-rad","mf-eln","mh-rad","mh-eln", "mh-ofr", // main: full radius, full elongation, half radius, half elongation
"of-corr","of-rad","of-eln","of-dst","of-dx","of-dy","of-par","of-prp","elevat",
"oh-corr","oh-rad","oh-eln","oh-dst","oh-dx","oh-dy","removed"));
"oh-corr","oh-rad","oh-eln", "oh-ofr", "oh-dst","oh-dx","oh-dy","removed"));
System.out.println();
for (int i = 0; i < match_sort.size(); i++) {
......@@ -2371,20 +2508,23 @@ public class OrthoMapsCollection implements Serializable{
// System.out.println(String.format("best_d=%7.5f, rad=%6.3f, elong=%6.3f, dist=%6.3f, dx=%6.3f, dy=%6.3f",
String sremoved = removed[i]?" removed":"";
System.out.print(String.format(
"%6.3f %6.3f %6.3f %6.3f | %8.5f %6.3f %6.3f %6.3f %7.3f %7.3f %7.3f %7.3f %7.3f | %8.5f %6.3f %6.3f %6.3f %7.3f %7.3f %7s",
"%6.3f %6.3f %6.3f %6.3f %6.3f | %8.5f %6.3f %6.3f %6.3f %7.3f %7.3f %7.3f %7.3f %7.3f | %8.5f %6.3f %6.3f %6.3f %6.3f %7.3f %7.3f %7s",
// main full and best half areas only, radius and elongation
filter_data[0][i][0][1], filter_data[0][i][0][2], // main full: radius and elongation
filter_data[0][i][1][1], filter_data[0][i][1][2], // main best half: radius and elongation
filter_data[0][i][1][6], // other max fraction of the main one
// for second full - everything and parallel/perpendicular+elevation
filter_data[1][i][0][0], filter_data[1][i][0][1], filter_data[1][i][0][2], // full: corr, radius, elongation
filter_data[1][i][0][3], filter_data[1][i][0][4], filter_data[1][i][0][5], // full: dist, dx, dy
scnd_xy_proj[0], scnd_xy_proj[1],obj_elev, // full: parallel, perpnd, elevation(m)
filter_data[1][i][1][0], filter_data[1][i][1][1], filter_data[1][i][1][2], // half: corr, radius, elongation
filter_data[1][i][1][6],
filter_data[1][i][1][3], filter_data[1][i][1][4], filter_data[1][i][1][5], // half: dist, dx, dy
sremoved));
System.out.println();
}
System.out.println();
//ortho_maps[indices[0]]
//double [][] dmulti
......@@ -2411,10 +2551,10 @@ public class OrthoMapsCollection implements Serializable{
String [] final_titles = new String[indices.length];
double [][] final_map = new double [indices.length][];
for (int i = 0; i < final_map.length; i++) {
final_titles[i] = ortho_maps[indices[0]].getName();
final_titles[i] = ortho_maps[indices[i]].getName();
final_map[i] = dmulti[i];
}
String final_title = final_titles[0]+"-"+final_titles[0]+"-MARKED_"+match_sort.size()+"_OBJECTS";
String final_title = final_titles[0]+"-"+final_titles[0]+"-MARKED_"+object_type+"_"+match_sort.size()+"_OBJECTS";
ImagePlus img_final = ShowDoubleFloatArrays.makeArrays(
final_map,
......@@ -2569,6 +2709,28 @@ public class OrthoMapsCollection implements Serializable{
return new_data;
}
public static int [] removeFilteredOut(
int [] data,
boolean [] remove){
if (data == null) {
return null;
}
int num_left = data.length;
for (int i = 0; i < remove.length; i++) {
if (remove[i]) {
num_left--;
}
}
int [] new_data = new int[num_left];
int indx = 0;
for (int i = 0; i < remove.length; i++) if (!remove[i]) {
new_data[indx++] = data[i];
}
return new_data;
}
/**
* Returns boolean array of original length
* @param filt_keep
......@@ -2578,6 +2740,7 @@ public class OrthoMapsCollection implements Serializable{
* @param filt_max_radius
* @param filt_elongation
* @param filt_dist
* @param filt_height
* @param filter_data
* @param scene_xy_offset
* @param matches_list
......@@ -2593,7 +2756,12 @@ public class OrthoMapsCollection implements Serializable{
double [][] filt_max_radius,
double [][] filt_elongation,
double [] filt_dist,
double filt_height,
int [] best_patt_indx,
double [] filt_other_frac, // null - disable, for all full (round) patterns.
double [][][][] filter_data,
int zoom_level,
double scene_agl,
double [] scene_xy_offset, //second scene vertical projection offset from the first scene
ArrayList <ItemMatch> matches_list,
ArrayList<Integer> match_sort,
......@@ -2602,12 +2770,18 @@ public class OrthoMapsCollection implements Serializable{
boolean [] remove = new boolean [match_sort.size()];
int num_removed = 0;
double [] min_corrs_other = {min_corrs[1]*min_corr_full_rel, min_corrs[1]};
double offset_from_height = elevationToParallelOffset( // will be negative
filt_height, // double height,
scene_xy_offset, // double [] scene_offset,
zoom_level, // int zoom_level,
scene_agl) ;// double agl)
for (int mn=0; mn < match_sort.size(); mn++) {
for (int hf = 0; hf < 2; hf++) {
int indx =match_sort.get(mn);
ItemMatch match = matches_list.get(indx);
int [] ixy = match.getIntXY();
String name = ixy[0]+"/"+ixy[1];
boolean is_partial = best_patt_indx[mn] != 0; // only apply to combined full/halv correlations, just full may have nearby maximums near the same size
for (int scene_num = 0; scene_num < 2; scene_num++) if (filt_main_other[scene_num]){
if (Double.isNaN(filter_data[scene_num][mn][hf][0])) {
System.out.println(name+": filtered out by "+NAME_MO[scene_num]+"/"+NAME_FH[hf]+
......@@ -2620,11 +2794,12 @@ public class OrthoMapsCollection implements Serializable{
double elong = filter_data[scene_num][mn][hf][2];
double corr_val = filter_data[scene_num][mn][hf][0];
double dist = filter_data[scene_num][mn][hf][3];
double near_max_frac = filter_data[scene_num][mn][hf][6];
double [] second_xy_offsets = {filter_data[scene_num][mn][hf][4],filter_data[scene_num][mn][hf][5]};
// calculate projection
double scnd_xy_proj_perp = projectOffsetOnVector(
double [] scnd_xy_proj = projectOffsetOnVector(
second_xy_offsets, // double [] object_offset,
scene_xy_offset)[1]; // double [] scene_offset)
scene_xy_offset); // double [] scene_offset)
if (scene_num > 0) { // other scene
// {best_d, eff_rad, elong, dist, cent_offs[0], cent_offs[1]} ;
if (corr_val < min_corrs_other[hf]) {
......@@ -2640,9 +2815,27 @@ public class OrthoMapsCollection implements Serializable{
remove[mn] = true;
}
// distance for main only or both?
if (scnd_xy_proj_perp > filt_dist[1]) {
if (Math.abs(scnd_xy_proj[1]) > filt_dist[1]) {
System.out.println(name+": filtered out by "+NAME_MO[scene_num]+" distance from the main scene peak perpendicular to the scene offset vector "+
NAME_FH[hf]+ " = "+scnd_xy_proj_perp+" > "+filt_dist[1]);
NAME_FH[hf]+ " = "+scnd_xy_proj[1]+", abs() > "+filt_dist[1]);
if (!remove[mn]) num_removed++;
remove[mn] = true;
}
// offset_from_height
if (scnd_xy_proj[0] > filt_dist[1]) {
System.out.println(name+": filtered out by "+NAME_MO[scene_num]+
" distance from the main scene peak parallel to the scene offset vector "+
NAME_FH[hf]+ " = "+scnd_xy_proj[0]+" > "+filt_dist[1]+
" it could happen if the object is deep below average ground surface.");
if (!remove[mn]) num_removed++;
remove[mn] = true;
}
if (scnd_xy_proj[0] < (-filt_dist[1]+offset_from_height)) {
System.out.println(name+": filtered out by "+NAME_MO[scene_num]+
" distance from the main scene peak parallel to the scene offset vector "+
NAME_FH[hf]+ " = "+scnd_xy_proj[0]+" < "+(-filt_dist[1]+offset_from_height)+
".\n This limit accounts for objects above ground up to "+filt_height+" meters ("+
offset_from_height+" pix.");
if (!remove[mn]) num_removed++;
remove[mn] = true;
}
......@@ -2654,11 +2847,18 @@ public class OrthoMapsCollection implements Serializable{
remove[mn] = true;
}
if (elong > filt_elongation[scene_num][hf]) {
System.out.println(name+": filtered out by "+NAME_MO[0]+" scene peak cros-section elongation for "+
System.out.println(name+": filtered out by "+NAME_MO[scene_num]+" scene peak cros-section elongation for "+
NAME_FH[hf]+ " pattern: "+elong+" > "+ filt_elongation[scene_num][hf]);
if (!remove[mn]) num_removed++;
remove[mn] = true;
}
if ((filt_other_frac != null) && (hf > 0) && (near_max_frac > filt_other_frac[scene_num])) {
System.out.println(name+": filtered out by "+NAME_MO[scene_num]+
" because it matches partial pattern and combined full/partial correlation has a near peak "+
near_max_frac+" > "+ filt_other_frac[scene_num]+" of the used peak.");
if (!remove[mn]) num_removed++;
remove[mn] = true;
}
}
}
}
......@@ -2675,7 +2875,7 @@ public class OrthoMapsCollection implements Serializable{
} else {
System.out.println("No scenes were filtered out by the filter");
}
System.out.println(match_sort.size()+" candidates remain");
System.out.println(match_sort.size()+" candidate(s) remain");
}
return remove;
}
......@@ -2748,7 +2948,8 @@ public class OrthoMapsCollection implements Serializable{
int indx =match_sort.get(mn);
ItemMatch match = matches_list.get(indx);
int [] ixy = match.getIntXY();
extr_titles[mn] = ixy[0]+"/"+ ixy[1]+" "+match.getMatchValue(gop,sort_pattern_index);
extr_titles[mn] = ixy[0]+"/"+ ixy[1]+":"+String.format("%7.5f",
match.getMatchValue(gop,sort_pattern_index));
}
imps_extracted[scene_num] = ShowDoubleFloatArrays.makeArrays(
extract_display[scene_num],
......@@ -2792,7 +2993,7 @@ public class OrthoMapsCollection implements Serializable{
int [] ixy = match.getIntXY();
int best_patt = match.getPatternMatch(gop).getBestSub() - 1;
extr_titles_full[mn] = ixy[0]+"/"+ ixy[1];
extr_titles_half[mn] = extr_titles_full[mn]+best_patt;
extr_titles_half[mn] = extr_titles_full[mn]+":"+best_patt;
}
if ((extr_corr != null) && (extr_corr[scene_num] != null) &&(imps_extracted_corr != null)) {
imps_extracted_corr[scene_num] = ShowDoubleFloatArrays.makeArrays(
......
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