Commit 347ad4b0 authored by Andrey Filippov's avatar Andrey Filippov

Added CT scan, fixed average slice

parent 9982a7ba
...@@ -1089,6 +1089,7 @@ public class GroundPlane { ...@@ -1089,6 +1089,7 @@ public class GroundPlane {
final CLTParameters clt_parameters, final CLTParameters clt_parameters,
final QuadCLT ref_Clt, final QuadCLT ref_Clt,
final boolean tilted_plane, // if true, use tilted ground plane. If false - use horizontal plane and apply rotation final boolean tilted_plane, // if true, use tilted ground plane. If false - use horizontal plane and apply rotation
final double offset,
final double test_bottom, final double test_bottom,
final int debugLevel) { final int debugLevel) {
...@@ -1103,7 +1104,7 @@ public class GroundPlane { ...@@ -1103,7 +1104,7 @@ public class GroundPlane {
return null; return null;
} }
double [][] ground_xyzatr = ErsCorrection.invertXYZATR(to_ground_xyzatr); // straight down from the camera, then rotated double [][] ground_xyzatr = ErsCorrection.invertXYZATR(to_ground_xyzatr); // straight down from the camera, then rotated
double altitude = ground_xyzatr[0][2]; double altitude = ground_xyzatr[0][2] - offset; // offset to the ground level (negative)
double true_disparity = ref_Clt.getGeometryCorrection().getDisparityFromZ(-altitude); double true_disparity = ref_Clt.getGeometryCorrection().getDisparityFromZ(-altitude);
double corrected_disparity = true_disparity+ref_Clt.getDispInfinityRef(); double corrected_disparity = true_disparity+ref_Clt.getDispInfinityRef();
int tilesX = ref_Clt.getTilesX(); int tilesX = ref_Clt.getTilesX();
......
...@@ -1068,6 +1068,15 @@ min_str_neib_fpn 0.35 ...@@ -1068,6 +1068,15 @@ min_str_neib_fpn 0.35
public int fgnd_min_macro_tiles = 3; // Minimal number of macrotiles for high outliers. Minimal number of remaining macrotiles before removing high outpliers. public int fgnd_min_macro_tiles = 3; // Minimal number of macrotiles for high outliers. Minimal number of remaining macrotiles before removing high outpliers.
public double fgnd_normal_damping = 0.001; // Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts. public double fgnd_normal_damping = 0.001; // Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts.
public boolean fgnd_gen_optho = true; // generate orthogonal to the ground view
public boolean fgnd_gen_tilted = true; // generate tilted ground disparity view
public boolean fgnd_gen_scan = false; // generate "CT scan" views
public double fgnd_ct_low = -1.0; // lowest CT level relative to the ground
public double fgnd_ct_high = 1.0; // highest CT level relative to the ground
public double fgnd_ct_step = 0.2; // CT step
// TODO: move next parameters elsewhere - they are not the motion blur ones. // TODO: move next parameters elsewhere - they are not the motion blur ones.
public int mb_gain_index_pose = 5; // pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter public int mb_gain_index_pose = 5; // pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter
public int mb_gain_index_depth = 5; // depth map refine pass (SfM) to switch to full mb_max_gain from mb_max_gain_inter public int mb_gain_index_depth = 5; // depth map refine pass (SfM) to switch to full mb_max_gain from mb_max_gain_inter
...@@ -3139,6 +3148,19 @@ min_str_neib_fpn 0.35 ...@@ -3139,6 +3148,19 @@ min_str_neib_fpn 0.35
gd.addMessage ("Common to all plane fitting"); gd.addMessage ("Common to all plane fitting");
gd.addNumericField("Damping parameter for planes", this.fgnd_normal_damping, 5,7,"", gd.addNumericField("Damping parameter for planes", this.fgnd_normal_damping, 5,7,"",
"Pull planes to horizontal when there is not enough data for tilts."); "Pull planes to horizontal when there is not enough data for tilts.");
gd.addMessage ("Output files generation related to ground planes");
gd.addCheckbox ("Generate orthogonal to the ground view", this.fgnd_gen_optho,
"Generate relative to the ground plane view, minimizing anisotropic distortions.");
gd.addCheckbox ("Generate tilted-ground view", this.fgnd_gen_tilted,
"Generate view in the same directionm as the camera reference scene with tilted disparity matchin ground plane.");
gd.addCheckbox ("Generate \"CT scan\" view", this.fgnd_gen_scan,
"Generate multiple views vith varying offset to the ground plane view.");
gd.addNumericField("CT scan low level", this.fgnd_ct_low, 5,7,"m",
"Lowest scan level relative to the ground plane.");
gd.addNumericField("CT scan high level", this.fgnd_ct_high, 5,7,"m",
"Highest scan level relative to the ground plane.");
gd.addNumericField("CT scan step", this.fgnd_ct_step, 5,7,"m",
"CT scan step.");
gd.addTab("LMA sequence","Interscene LMA sequence control"); gd.addTab("LMA sequence","Interscene LMA sequence control");
gd.addMessage("Parameters for control of the LMA pose adjustment sequence"); gd.addMessage("Parameters for control of the LMA pose adjustment sequence");
...@@ -4451,6 +4473,13 @@ min_str_neib_fpn 0.35 ...@@ -4451,6 +4473,13 @@ min_str_neib_fpn 0.35
this.fgnd_min_macro_tiles=(int) gd.getNextNumber(); this.fgnd_min_macro_tiles=(int) gd.getNextNumber();
this.fgnd_normal_damping = gd.getNextNumber(); this.fgnd_normal_damping = gd.getNextNumber();
this.fgnd_gen_optho = gd.getNextBoolean();
this.fgnd_gen_tilted = gd.getNextBoolean();
this.fgnd_gen_scan = gd.getNextBoolean();
this.fgnd_ct_low = gd.getNextNumber();
this.fgnd_ct_high = gd.getNextNumber();
this.fgnd_ct_step = gd.getNextNumber();
this.mb_gain_index_pose = (int) gd.getNextNumber(); this.mb_gain_index_pose = (int) gd.getNextNumber();
this.mb_gain_index_depth =(int) gd.getNextNumber(); this.mb_gain_index_depth =(int) gd.getNextNumber();
...@@ -5654,6 +5683,13 @@ min_str_neib_fpn 0.35 ...@@ -5654,6 +5683,13 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"fgnd_min_macro_tiles", this.fgnd_min_macro_tiles+"");// int properties.setProperty(prefix+"fgnd_min_macro_tiles", this.fgnd_min_macro_tiles+"");// int
properties.setProperty(prefix+"fgnd_normal_damping", this.fgnd_normal_damping+""); // double properties.setProperty(prefix+"fgnd_normal_damping", this.fgnd_normal_damping+""); // double
properties.setProperty(prefix+"fgnd_gen_optho", this.fgnd_gen_optho+""); // boolean
properties.setProperty(prefix+"fgnd_gen_tilted", this.fgnd_gen_tilted+""); // boolean
properties.setProperty(prefix+"fgnd_gen_scan", this.fgnd_gen_scan+""); // boolean
properties.setProperty(prefix+"fgnd_ct_low", this.fgnd_ct_low+""); // double
properties.setProperty(prefix+"fgnd_ct_high", this.fgnd_ct_high+""); // double
properties.setProperty(prefix+"fgnd_ct_step", this.fgnd_ct_step+""); // double
properties.setProperty(prefix+"mb_gain_index_pose", this.mb_gain_index_pose+""); // int properties.setProperty(prefix+"mb_gain_index_pose", this.mb_gain_index_pose+""); // int
properties.setProperty(prefix+"mb_gain_index_depth", this.mb_gain_index_depth+""); // int properties.setProperty(prefix+"mb_gain_index_depth", this.mb_gain_index_depth+""); // int
...@@ -6841,6 +6877,13 @@ min_str_neib_fpn 0.35 ...@@ -6841,6 +6877,13 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"fgnd_min_macro_tiles")!=null) this.fgnd_min_macro_tiles=Integer.parseInt(properties.getProperty(prefix+"fgnd_min_macro_tiles")); if (properties.getProperty(prefix+"fgnd_min_macro_tiles")!=null) this.fgnd_min_macro_tiles=Integer.parseInt(properties.getProperty(prefix+"fgnd_min_macro_tiles"));
if (properties.getProperty(prefix+"fgnd_normal_damping")!=null) this.fgnd_normal_damping=Double.parseDouble(properties.getProperty(prefix+"fgnd_normal_damping")); if (properties.getProperty(prefix+"fgnd_normal_damping")!=null) this.fgnd_normal_damping=Double.parseDouble(properties.getProperty(prefix+"fgnd_normal_damping"));
if (properties.getProperty(prefix+"fgnd_gen_optho")!=null) this.fgnd_gen_optho=Boolean.parseBoolean(properties.getProperty(prefix+"fgnd_gen_optho"));
if (properties.getProperty(prefix+"fgnd_gen_tilted")!=null) this.fgnd_gen_tilted=Boolean.parseBoolean(properties.getProperty(prefix+"fgnd_gen_tilted"));
if (properties.getProperty(prefix+"fgnd_gen_scan")!=null) this.fgnd_gen_scan=Boolean.parseBoolean(properties.getProperty(prefix+"fgnd_gen_scan"));
if (properties.getProperty(prefix+"fgnd_ct_low")!=null) this.fgnd_ct_low=Double.parseDouble(properties.getProperty(prefix+"fgnd_ct_low"));
if (properties.getProperty(prefix+"fgnd_ct_high")!=null) this.fgnd_ct_high=Double.parseDouble(properties.getProperty(prefix+"fgnd_ct_high"));
if (properties.getProperty(prefix+"fgnd_ct_step")!=null) this.fgnd_ct_step=Double.parseDouble(properties.getProperty(prefix+"fgnd_ct_step"));
if (properties.getProperty(prefix+"mb_gain_index_pose")!=null) this.mb_gain_index_pose=Integer.parseInt(properties.getProperty(prefix+"mb_gain_index_pose")); if (properties.getProperty(prefix+"mb_gain_index_pose")!=null) this.mb_gain_index_pose=Integer.parseInt(properties.getProperty(prefix+"mb_gain_index_pose"));
if (properties.getProperty(prefix+"mb_ers_index")!=null) this.mb_ers_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_index")); if (properties.getProperty(prefix+"mb_ers_index")!=null) this.mb_ers_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_index"));
if (properties.getProperty(prefix+"mb_ers_y_index")!=null) this.mb_ers_y_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_y_index")); if (properties.getProperty(prefix+"mb_ers_y_index")!=null) this.mb_ers_y_index=Integer.parseInt(properties.getProperty(prefix+"mb_ers_y_index"));
...@@ -8005,6 +8048,13 @@ min_str_neib_fpn 0.35 ...@@ -8005,6 +8048,13 @@ min_str_neib_fpn 0.35
imp.fgnd_min_macro_tiles = this.fgnd_min_macro_tiles; imp.fgnd_min_macro_tiles = this.fgnd_min_macro_tiles;
imp.fgnd_normal_damping = this.fgnd_normal_damping; imp.fgnd_normal_damping = this.fgnd_normal_damping;
imp.fgnd_gen_optho = this.fgnd_gen_optho;
imp.fgnd_gen_tilted = this.fgnd_gen_tilted;
imp.fgnd_gen_scan = this.fgnd_gen_scan;
imp.fgnd_ct_low = this.fgnd_ct_low;
imp.fgnd_ct_high = this.fgnd_ct_high;
imp.fgnd_ct_step = this.fgnd_ct_step;
imp.mb_gain_index_pose = this.mb_gain_index_pose; imp.mb_gain_index_pose = this.mb_gain_index_pose;
imp.mb_gain_index_depth = this.mb_gain_index_depth; imp.mb_gain_index_depth = this.mb_gain_index_depth;
......
...@@ -7347,12 +7347,63 @@ public class OpticalFlow { ...@@ -7347,12 +7347,63 @@ public class OpticalFlow {
boolean export_terrain_sequence = true; // check master_CLT boolean export_terrain_sequence = true; // check master_CLT
if (export_terrain_sequence && !clt_parameters.imp.lock_position) { if (export_terrain_sequence && !clt_parameters.imp.lock_position) {
final double test_bottom = 0.0; // 0.5; // disable half-tilted final double test_bottom = 0.0; // 0.5; // disable half-tilted
{ if (clt_parameters.imp.fgnd_gen_tilted){
// No rotations orthogonal to ground, using tilted disparity // No rotations orthogonal to ground, using tilted disparity
if (clt_parameters.imp.fgnd_gen_scan){
for (double gnd_offset = clt_parameters.imp.fgnd_ct_low;
gnd_offset <= clt_parameters.imp.fgnd_ct_high;
gnd_offset+=clt_parameters.imp.fgnd_ct_step) {
String extra_suffix= "-GND";
if (gnd_offset >0) {
extra_suffix+="+";
}
extra_suffix+=String.format("%.3fm", gnd_offset);
GroundPlane.prepareTerrainRender(
clt_parameters, // final CLTParameters clt_parameters,
master_CLT, // final QuadCLT ref_Clt,
true, // final boolean tilted_plane,
gnd_offset, // final double offset,
test_bottom, // final double test_bottom,
debugLevel); // final int debugLevel)
combo_dsn_final =master_CLT.restoreComboDSI(true);
if ((combo_dsn_final.length <= COMBO_DSN_INDX_TERRAIN) || (combo_dsn_final[COMBO_DSN_INDX_TERRAIN] == null)) {
System.out.println ("No terrain data available");
} else {
double [] terrain_disparity = combo_dsn_final[COMBO_DSN_INDX_TERRAIN];
String scenes_suffix_disp = master_CLT.getImageName()+"-TERRAIN-DISP"+extra_suffix;
ImagePlus imp_terrain_disp = renderSceneSequence(
clt_parameters, // CLTParameters clt_parameters,
false, // master_CLT.hasCenterClt(), // boolean mode_cuas,
false, // boolean um_mono,
clt_parameters.imp.add_average, // boolean insert_average,
null, // float [] average_slice,
clt_parameters.imp.subtract_average, // boolean subtract_average,
clt_parameters.imp.running_average, // int running_average,
null, // Rectangle fov_tiles,
1, // int mode3d,
false, // boolean toRGB,
ZERO3, // double [] stereo_offset, // offset reference camera {x,y,z}
null, // double [] stereo_atr, // offset reference orientation (cuas)
1, // int sensor_mask,
scenes_suffix_disp, // String suffix,
terrain_disparity, // selected_disparity, // double [] ref_disparity,
quadCLTs, // QuadCLT [] quadCLTs,
master_CLT, // ref_index, // int ref_index,
threadsMax, // int threadsMax,
debugLevel); // int debugLevel);
master_CLT.saveImagePlusInModelDirectory(
null, // "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
imp_terrain_disp); // imp_scenes); // ImagePlus imp)
}
}
} else {
GroundPlane.prepareTerrainRender( GroundPlane.prepareTerrainRender(
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
master_CLT, // final QuadCLT ref_Clt, master_CLT, // final QuadCLT ref_Clt,
true, // final boolean tilted_plane, true, // final boolean tilted_plane,
0.0, // final double offset,
test_bottom, // final double test_bottom, test_bottom, // final double test_bottom,
debugLevel); // final int debugLevel) debugLevel); // final int debugLevel)
...@@ -7387,13 +7438,24 @@ public class OpticalFlow { ...@@ -7387,13 +7438,24 @@ public class OpticalFlow {
imp_terrain_disp); // imp_scenes); // ImagePlus imp) imp_terrain_disp); // imp_scenes); // ImagePlus imp)
} }
} }
}
{ if (clt_parameters.imp.fgnd_gen_optho){
// rotating orthogonal to ground, using constant disparity // rotating orthogonal to ground, using constant disparity
if (clt_parameters.imp.fgnd_gen_scan){
for (double gnd_offset = clt_parameters.imp.fgnd_ct_low;
gnd_offset <= clt_parameters.imp.fgnd_ct_high;
gnd_offset+=clt_parameters.imp.fgnd_ct_step) {
String extra_suffix= "-GND";
if (gnd_offset >0) {
extra_suffix+="+";
}
extra_suffix+=String.format("%.3fm", gnd_offset);
double [][] gnp = GroundPlane.prepareTerrainRender( double [][] gnp = GroundPlane.prepareTerrainRender(
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
master_CLT, // final QuadCLT ref_Clt, master_CLT, // final QuadCLT ref_Clt,
false, // final boolean tilted_plane, false, // final boolean tilted_plane,
gnd_offset, // final double offset,
test_bottom, // final double test_bottom, test_bottom, // final double test_bottom,
debugLevel); // final int debugLevel) debugLevel); // final int debugLevel)
double [][] ignp = null; double [][] ignp = null;
...@@ -7414,7 +7476,7 @@ public class OpticalFlow { ...@@ -7414,7 +7476,7 @@ public class OpticalFlow {
} else { } else {
double [] terrain_disparity = combo_dsn_final[COMBO_DSN_INDX_TERRAIN]; double [] terrain_disparity = combo_dsn_final[COMBO_DSN_INDX_TERRAIN];
String scenes_suffix = master_CLT.getImageName()+"-TERRAIN"; // quadCLTs[quadCLTs.length-1][quadCLTs.length-1].getImageName()+"-TERRAIN"; String scenes_suffix = master_CLT.getImageName()+"-TERRAIN"+extra_suffix; // quadCLTs[quadCLTs.length-1][quadCLTs.length-1].getImageName()+"-TERRAIN";
ImagePlus imp_terrain = renderSceneSequence( ImagePlus imp_terrain = renderSceneSequence(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
false, // master_CLT.hasCenterClt(), // boolean mode_cuas, false, // master_CLT.hasCenterClt(), // boolean mode_cuas,
...@@ -7441,8 +7503,65 @@ public class OpticalFlow { ...@@ -7441,8 +7503,65 @@ public class OpticalFlow {
null, // "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix, null, // "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
imp_terrain); // imp_scenes); // ImagePlus imp) imp_terrain); // imp_scenes); // ImagePlus imp)
} }
} // for (double gnd_offset
} else { // if (clt_parameters.imp.fgnd_gen_scan){
double [][] gnp = GroundPlane.prepareTerrainRender(
clt_parameters, // final CLTParameters clt_parameters,
master_CLT, // final QuadCLT ref_Clt,
false, // final boolean tilted_plane,
0.0, // final double offset,
test_bottom, // final double test_bottom,
debugLevel); // final int debugLevel)
double [][] ignp = null;
if (gnp != null) {
ignp = ErsCorrection.invertXYZATR(gnp);
if (debugLevel > -3) {
System.out.println("Using airplane mode terrane as a single horizontal plane");
System.out.println("stereo_offset = ["+gnp[0][0]+", "+gnp[0][1]+", "+gnp[0][2]+"]");
System.out.println("stereo_atr = ["+gnp[1][0]+", "+gnp[1][1]+", "+gnp[1][2]+ "]");
// TODO add provisions to the non-flat terrain -modify terrain slice, keeping ground_normal_pose as a horizontal plane.
System.out.println("ignp[0] = ["+ignp[0][0]+", "+ignp[0][1]+", "+ignp[0][2]+"]");
System.out.println("ignp[1] = ["+ignp[1][0]+", "+ignp[1][1]+", "+ignp[1][2]+"]");
}
} }
combo_dsn_final =master_CLT.restoreComboDSI(true);
if ((combo_dsn_final.length <= COMBO_DSN_INDX_TERRAIN) || (combo_dsn_final[COMBO_DSN_INDX_TERRAIN] == null)) {
System.out.println ("No terrain data available");
} else {
double [] terrain_disparity = combo_dsn_final[COMBO_DSN_INDX_TERRAIN];
String scenes_suffix = master_CLT.getImageName()+"-TERRAIN"; // quadCLTs[quadCLTs.length-1][quadCLTs.length-1].getImageName()+"-TERRAIN";
ImagePlus imp_terrain = renderSceneSequence(
clt_parameters, // CLTParameters clt_parameters,
false, // master_CLT.hasCenterClt(), // boolean mode_cuas,
false, // boolean um_mono,
clt_parameters.imp.add_average, // boolean insert_average,
null, // float [] average_slice,
clt_parameters.imp.subtract_average, // boolean subtract_average,
clt_parameters.imp.running_average, // int running_average,
null, // Rectangle fov_tiles,
1, // int mode3d,
false, // boolean toRGB,
ignp, // double [][] ground_xyzatr,
ZERO3, //ignp[0], // ZERO3, // stereo_offset, // ZERO3, // stereo_offset, // ZERO3, // double [] stereo_offset, // offset reference camera {x,y,z}
null, //gnp[1], // ZERO3, //stereo_atr, // null, // stereo_atr, // null, // double [] stereo_atr, // offset reference orientation (cuas)
null, // ignp, // new double [][] {stereo_offset,stereo_atr}, //
1, // int sensor_mask,
scenes_suffix, // String suffix,
terrain_disparity, // selected_disparity, // double [] ref_disparity,
quadCLTs, // QuadCLT [] quadCLTs,
master_CLT, // ref_index, // int ref_index,
threadsMax, // int threadsMax,
debugLevel); // int debugLevel);
master_CLT.saveImagePlusInModelDirectory(
null, // "GPU-SHIFTED-D"+clt_parameters.disparity, // String suffix,
imp_terrain); // imp_scenes); // ImagePlus imp)
}
}
}
if ((combo_dsn_final.length <= COMBO_DSN_INDX_TERRAIN) || (combo_dsn_final[COMBO_DSN_INDX_TERRAIN] == null)) { if ((combo_dsn_final.length <= COMBO_DSN_INDX_TERRAIN) || (combo_dsn_final[COMBO_DSN_INDX_TERRAIN] == null)) {
...@@ -8983,7 +9102,7 @@ public class OpticalFlow { ...@@ -8983,7 +9102,7 @@ public class OpticalFlow {
QuadCLT ref_scene, // int ref_index, QuadCLT ref_scene, // int ref_index,
int threadsMax, int threadsMax,
int debugLevel) { int debugLevel) {
boolean insert_average = ((average_slice != null) && ((average_slice[0] != null)) )|| calculate_average; // now only with float pixels boolean insert_average = ((average_slice != null) && ((average_slice[0] != null))) || calculate_average; // now only with float pixels
boolean corr_raw_ers = true; boolean corr_raw_ers = true;
double [] stereo_atr = (stereo_atr_in != null)? stereo_atr_in: ZERO3; // maybe later play with rotated camera double [] stereo_atr = (stereo_atr_in != null)? stereo_atr_in: ZERO3; // maybe later play with rotated camera
/// boolean mode_cuas = (stereo_atr[0] != 0) || (stereo_atr[1] != 0) || (stereo_atr[2] != 0); /// boolean mode_cuas = (stereo_atr[0] != 0) || (stereo_atr[1] != 0) || (stereo_atr[2] != 0);
...@@ -9300,15 +9419,21 @@ public class OpticalFlow { ...@@ -9300,15 +9419,21 @@ public class OpticalFlow {
// single-threaded // single-threaded
for (int nchn = 0; nchn < channels.length; nchn++) { for (int nchn = 0; nchn < channels.length; nchn++) {
float [] avg_slice = (float[]) stack_scenes.getPixels(nchn+1); float [] avg_slice = (float[]) stack_scenes.getPixels(nchn+1);
int [] avg_n = new int[avg_slice.length];
int num_pix = avg_slice.length; int num_pix = avg_slice.length;
for (int nscene = 0; nscene < num_scenes; nscene++) { for (int nscene = 0; nscene < num_scenes; nscene++) {
float [] fpixels = (float[]) stack_scenes.getPixels(nchn + (nscene+1)*channels.length + 1); float [] fpixels = (float[]) stack_scenes.getPixels(nchn + (nscene+1)*channels.length + 1);
for (int npix = 0; npix < num_pix; npix++) { for (int npix = 0; npix < num_pix; npix++) if (!Float.isNaN(fpixels[npix])){
avg_slice[npix] += fpixels[npix]; avg_slice[npix] += fpixels[npix];
avg_n[npix]++;
} }
} }
for (int npix = 0; npix < num_pix; npix++) { for (int npix = 0; npix < num_pix; npix++) {
avg_slice[npix] /= num_scenes; if (avg_n[npix] > 0) {
avg_slice[npix] /= avg_n[npix];
}else {
avg_slice[npix] = Float.NaN;
}
} }
} }
} }
......
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