Commit df71e1d0 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Before removing hardwired conditionInitialDS

parent 33b2b603
Loading
Loading
Loading
Loading
+18 −14
Original line number Original line Diff line number Diff line
@@ -1569,6 +1569,7 @@ public class EyesisCorrectionParameters {
    		// 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>();
            for (String line:lines){
            for (String line:lines){
                if (line.split("#").length > 0) {
                String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
                String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
                if ((tokens.length > 2) && (tokens[0].toUpperCase().equals("SET"))) {
                if ((tokens.length > 2) && (tokens[0].toUpperCase().equals("SET"))) {
                	parse_set:
                	parse_set:
@@ -1582,6 +1583,7 @@ public class EyesisCorrectionParameters {
                	}
                	}
                }
                }
                }
                }
            }
            if (dir_map.containsKey("rootDirectory")) {
            if (dir_map.containsKey("rootDirectory")) {
            	base_path=base_path.resolve(Paths.get(dir_map.get("rootDirectory")));
            	base_path=base_path.resolve(Paths.get(dir_map.get("rootDirectory")));
    			File base_dir = new File(base_path.toString());
    			File base_dir = new File(base_path.toString());
@@ -1635,6 +1637,7 @@ public class EyesisCorrectionParameters {
			// process source sequence directories
			// process source sequence directories
    		ArrayList<PathFirstLast> path_list= new ArrayList<PathFirstLast>();
    		ArrayList<PathFirstLast> path_list= new ArrayList<PathFirstLast>();
    		for (String line:lines){
    		for (String line:lines){
    			if (line.split("#").length > 0) {
    				String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
    				String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
    				if ((tokens.length > 0) &&
    				if ((tokens.length > 0) &&
    						(tokens[0].length() > 0) &&
    						(tokens[0].length() > 0) &&
@@ -1648,6 +1651,7 @@ public class EyesisCorrectionParameters {
    							((tokens.length > 3)? Integer.parseInt(tokens[3]):-1)));
    							((tokens.length > 3)? Integer.parseInt(tokens[3]):-1)));
    				}
    				}
    			}
    			}
    		}
            return path_list.toArray(new PathFirstLast[0]);
            return path_list.toArray(new PathFirstLast[0]);
    	}
    	}


+19 −2
Original line number Original line Diff line number Diff line
@@ -32,10 +32,27 @@ public class EventLogger {
			}
			}
		}
		}
		Arrays.sort(logger_files); // increasing start time stamps
		Arrays.sort(logger_files); // increasing start time stamps
		
		String out_did_gps_path = "/home/elphel/lwir16-proc/office_04/did_gps";
		int gps_mask = 7; // +1 - DID_GPS1_POS, +2 - DID_GPS2_POS, +4 - DID_GPS1_UBX_POS
		for (int nf = 0; nf < logger_files.length; nf++) {
			System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
			try {
				logger_files[nf].listGPS(out_did_gps_path+"-"+String.format("%03d", nf)+".out", gps_mask, false);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		
		
		
		String out_did1_path = "/home/elphel/lwir16-proc/office_04/did_ins1";
		for (int nf = 0; nf < logger_files.length; nf++) {
		for (int nf = 0; nf < logger_files.length; nf++) {
			System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
			System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
			try {
			try {
				logger_files[nf].listDid1(false);
				logger_files[nf].listDid1(out_did1_path+"-"+String.format("%03d", nf)+".out",false);
			} catch (IOException e) {
			} catch (IOException e) {
				// TODO Auto-generated catch block
				// TODO Auto-generated catch block
				e.printStackTrace();
				e.printStackTrace();
+131 −12
Original line number Original line Diff line number Diff line
package com.elphel.imagej.ims;
package com.elphel.imagej.ims;


import java.awt.Point;
import java.awt.Point;
import java.io.FileWriter;
import java.io.IOException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ByteOrder;
@@ -381,12 +382,15 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
		}
		}
	}
	}
	
	
	public void listDid1( boolean keep) throws IOException {
	public void listDid1(String path, boolean keep) throws IOException {
		double max_offset = 1000; // m
		double max_offset = 1000; // m
		open();
		open();
		float [] start_ned = null;
		float [] start_ned = null;
		System.out.println (
		FileWriter writer = null;
		        "record "+
		if (path != null) {
			writer = new FileWriter (path);
		}
		String header = "record "+
		        "     master TS    "+
		        "     master TS    "+
		        "     local TS     "+
		        "     local TS     "+
		        "timeOfWeek " +
		        "timeOfWeek " +
@@ -395,8 +399,12 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
		        "               theta               "+
		        "               theta               "+
		        "           uvw                "+
		        "           uvw                "+
		        "                 lla                      "+
		        "                 lla                      "+
		        "              ned                "
		        "              ned                \n"; 
		        );
		if (writer != null) {
			writer.write(header);
		} else {
			System.out.print(header);
		}


		int type = (EventLoggerFileInfo.REC_TYPE_GPS << 4) | EventLoggerFileInfo.REC_SUBTYPE_IMX5; // 0x18 - first subpacket
		int type = (EventLoggerFileInfo.REC_TYPE_GPS << 4) | EventLoggerFileInfo.REC_SUBTYPE_IMX5; // 0x18 - first subpacket
		for (int nrec = 0; nrec < num_recs; nrec++) {
		for (int nrec = 0; nrec < num_recs; nrec++) {
@@ -413,7 +421,7 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
				bb_payload.order(ByteOrder.LITTLE_ENDIAN);
				bb_payload.order(ByteOrder.LITTLE_ENDIAN);
				Did_ins_1 did_ins_1 = new Did_ins_1(bb_payload);
				Did_ins_1 did_ins_1 = new Did_ins_1(bb_payload);
				if ((did_ins_1.uvw[0] == 0) && (did_ins_1.uvw[1] == 0) && (did_ins_1.uvw[2] == 0)) {
				if ((did_ins_1.uvw[0] == 0) && (did_ins_1.uvw[1] == 0) && (did_ins_1.uvw[2] == 0)) {
//					continue;
					continue;
				}
				}
				if ((start_ned != null) &&
				if ((start_ned != null) &&
						(       (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) ||
						(       (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) ||
@@ -426,9 +434,9 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
					start_ned = did_ins_1.ned.clone();
					start_ned = did_ins_1.ned.clone();
				}
				}
				start_ned = new float[] {0,0,0};
				start_ned = new float[] {0,0,0};
				System.out.println (String.format(
				String line =String.format(
						"%6d %17.6f %17.6f %10.3f %08x %08x [%8.4f, %8.4f, %8.4f] "+
						"%6d %17.6f %17.6f %10.3f %08x %08x [%8.4f, %8.4f, %8.4f] "+
				        "[%8.3f, %8.3f, %8.3f] [%12.7f, %12.7f, %12.7f] [%8.3f, %8.3f, %8.3f]",
				        "[%8.3f, %8.3f, %8.3f] [%12.7f, %12.7f, %12.7f] [%8.3f, %8.3f, %8.3f]\n",
						nrec,
						nrec,
						getMasterTS(nrec),
						getMasterTS(nrec),
						getLocalTS(nrec),
						getLocalTS(nrec),
@@ -439,18 +447,129 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
						did_ins_1.uvw[0], did_ins_1.uvw[1], did_ins_1.uvw[2],       // Velocity U, V, W in meters per second.  Convert to NED velocity using "vectorBodyToReference( uvw, theta, vel_ned )".
						did_ins_1.uvw[0], did_ins_1.uvw[1], did_ins_1.uvw[2],       // Velocity U, V, W in meters per second.  Convert to NED velocity using "vectorBodyToReference( uvw, theta, vel_ned )".
						did_ins_1.lla[0], did_ins_1.lla[1], did_ins_1.lla[2],       //  WGS84 latitude, longitude, height above ellipsoid (degrees,degrees,meters)
						did_ins_1.lla[0], did_ins_1.lla[1], did_ins_1.lla[2],       //  WGS84 latitude, longitude, height above ellipsoid (degrees,degrees,meters)
						did_ins_1.ned[0] - start_ned[0], did_ins_1.ned[1] - start_ned[1], did_ins_1.ned[2] - start_ned[2]        //  North, east and down (meters) offset from reference latitude, longitude, and altitude to current latitude, longitude, and altitude
						did_ins_1.ned[0] - start_ned[0], did_ins_1.ned[1] - start_ned[1], did_ins_1.ned[2] - start_ned[2]        //  North, east and down (meters) offset from reference latitude, longitude, and altitude to current latitude, longitude, and altitude
						));
						);
				if (writer != null) {
					writer.write(line);
				} else {
					System.out.print(line);
				}
			}
		}
		if (writer != null) {
			writer.close();
		}
		if (!keep) {
			close();
		}
	}


	public void listGPS (String path, int gps_mask, boolean keep) throws IOException {
		// +1 - DID_GPS1_POS, +2 - DID_GPS2_POS, +4 - DID_GPS1_UBX_POS
//		double max_offset = 1000; // m
		open();
//		float [] start_ned = null;
		FileWriter writer = null;
		if (path != null) {
			writer = new FileWriter (path);
		}
		String header = "record "+
		        "     master TS    "+
		        "     local TS     "+
		        "timeOfWeek " +
		        "did "+
		        " status  "+
		        "                    ecef                     "+
		        "                    lla                     "+
		        "  hMSL  "+ // 7.2f
		        "  hAcc  "+ // 7.3f
		        "  vAcc  "+ // 7.3f
		        "  pDop  "+ // 7.3f
		        "cnoMean "+ // 7.3f
		        "  towOffset "+ // 11.4f
		        " lS  " + // 3d
		        "sat " + // 3d
		        "sgm " + // 3d
		        "rsv\n";// 3d 
		if (writer != null) {
			writer.write(header);
		} else {
			System.out.print(header);
		}

		int type = (EventLoggerFileInfo.REC_TYPE_GPS << 4) | EventLoggerFileInfo.REC_SUBTYPE_IMX5; // 0x18 - first subpacket
		for (int nrec = 0; nrec < num_recs; nrec++) {
			int [] full_type = getFullType(bb, nrec);
			if ((full_type != null) && (full_type[0] == type) &&
					(
					(((gps_mask & 1) != 0) && (full_type[1] == Imx5.DID_GPS1_POS)) ||
					(((gps_mask & 2) != 0) && (full_type[1] == Imx5.DID_GPS2_POS)) ||
					(((gps_mask & 4) != 0) && (full_type[1] == Imx5.DID_GPS1_UBX_POS))
					)
					) {
				byte [] payload = getDidPayload(
						null, // next_fileinfo, // may be null if payload does not extend beyond single record 
						nrec);
				if (payload == null) {
					System.out.println("EventLoggerFileInfo(): payload == null, nrec="+nrec);
					break;
				}
				}
				ByteBuffer bb_payload = ByteBuffer.wrap(payload);
				bb_payload.order(ByteOrder.LITTLE_ENDIAN);
				
				Did_gps_pos did_gps_pos = new Did_gps_pos(bb_payload);
				if ((did_gps_pos.lla[0] == 0) && (did_gps_pos.lla[1] == 0) && (did_gps_pos.lla[2] == 0)) {
					continue;
				}
				}
				
				
				// replace with GPS fix type?
				/*
				if ((did_ins_1.uvw[0] == 0) && (did_ins_1.uvw[1] == 0) && (did_ins_1.uvw[2] == 0)) {
					continue;
				}
				if ((start_ned != null) &&
						(       (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) ||
								(Math.abs(start_ned[1] - did_ins_1.ned[1]) > max_offset) ||
								(Math.abs(start_ned[2] - did_ins_1.ned[2]) > max_offset)
								)){
					start_ned = null;
				}
				if (start_ned == null) {
					start_ned = did_ins_1.ned.clone();
				}
				start_ned = new float[] {0,0,0};
				*/
				String line =String.format(
						"%6d %17.6f %17.6f %10.3f %3d %08x [%13.4f, %13.4f, %13.4f] "+
				        "[%12.7f, %12.7f, %12.7f] %7.2f %7.3f %7.3f %7.3f %7.3f %11.4f "+
						"%3d %3d %3d %3d\n",
						nrec,
						getMasterTS(nrec),
						getLocalTS(nrec),
						0.001 * did_gps_pos.timeOfWeekMs,
						full_type[1], // DID
						did_gps_pos.status,
						did_gps_pos.ecef[0], did_gps_pos.ecef[1], did_gps_pos.ecef[2], // Position in ECEF {x,y,z} (m)
						did_gps_pos.lla[0], did_gps_pos.lla[1], did_gps_pos.lla[2],       //  WGS84 latitude, longitude, height above ellipsoid (degrees,degrees,meters)
						did_gps_pos.hMSL, did_gps_pos.hAcc, did_gps_pos.vAcc, did_gps_pos.pDop, did_gps_pos.cnoMean,
						did_gps_pos.towOffset,
						did_gps_pos.leapS, did_gps_pos.satsUsed, did_gps_pos.cnoMeanSigma, did_gps_pos.reserved
						);
				if (writer != null) {
					writer.write(line);
				} else {
					System.out.print(line);
				}
			}
		}
		if (writer != null) {
			writer.close();
		}
		if (!keep) {
		if (!keep) {
			close();
			close();
		}
		}
	}
	}
	
	
	
	
	
	byte [] getDidPayload(
	byte [] getDidPayload(
			EventLoggerFileInfo next_fileinfo, // may be null if payload does not extend beyond single record 
			EventLoggerFileInfo next_fileinfo, // may be null if payload does not extend beyond single record 
			int nrec) throws IOException {
			int nrec) throws IOException {
+204 −11

File changed.

Preview size limit exceeded, changes collapsed.

+143 −17
Original line number Original line Diff line number Diff line
@@ -3922,8 +3922,36 @@ public class OpticalFlow {
		double  clouds_fom =         clt_parameters.imp.clouds_fom;       // 30.0; // maximal FOM for clouds (must be <=)         
		double  clouds_fom =         clt_parameters.imp.clouds_fom;       // 30.0; // maximal FOM for clouds (must be <=)         
		double  clouds_spread =      clt_parameters.imp.clouds_spread;    // 60.0; // maximal spread for clouds (must be <=)         
		double  clouds_spread =      clt_parameters.imp.clouds_spread;    // 60.0; // maximal spread for clouds (must be <=)         
		double  clouds_disparity =   clt_parameters.imp.clouds_disparity; //  0.1; // maximal disparity for strong clouds         
		double  clouds_disparity =   clt_parameters.imp.clouds_disparity; //  0.1; // maximal disparity for strong clouds         
		double  clouds_strength =    clt_parameters.imp.clouds_strength;  //    0.3; // maximal strength for near clouds         		
		double  clouds_weak =        clt_parameters.imp.clouds_weak;      //  0.18;// maximal strength for near definite clouds         		
		
		double  clouds_strength =    clt_parameters.imp.clouds_strength;  //  0.25;// minimal strength for far strong clouds (definitely cloud)         		
		double  clouds_not_strength= clt_parameters.imp.clouds_not_strength;//0.4;  // maximal strength for near maybe clouds (if it has strong cloud neighbor)         		
		boolean clouds_strong =      clt_parameters.imp.clouds_strong;    // true;  // allow weak cloud if it has strong (1.5x) cloud neib
		
		// process smooth walls mistaken for sky (disable for natural environments)
		boolean  wall_en =           clt_parameters.imp.wall_en;          // true;  // enable smooth walls detection/processing
		boolean  wall_dflt =         clt_parameters.imp.wall_dflt;        // true;  // default (undetected) is wall (false - sky)
		double   wall_str =          clt_parameters.imp.wall_str;         // 0.1;   // minimal strength of the far object (small - just non-NaN disparity)         
		double   wall_far =          clt_parameters.imp.wall_far;         // 0.2;   // maximal disparity to consider cluster to be sky         
		double   wall_near =         clt_parameters.imp.wall_near;        // 1.0;   // minimal disparity to consider cluster to be wall         
		// processing far treeline that may be confused with clouds. Only behind far objects such as far horizontal surface.
	    boolean  treeline_en =       clt_parameters.imp.treeline_en;   	  //  true;  // look not only under, but diagonal too.
	    boolean  treeline_wide =     clt_parameters.imp.treeline_wide;    //  true;  // enable treeline processing
	    int      treeline_height =   clt_parameters.imp.treeline_height;  //  5;    // maximal height of the treeline (tiles)
	    int      treeline_width =    clt_parameters.imp.treeline_width;   //  3;    // minimal horizontal width of the treeline (tiles)
	    boolean  treeline_lim_high = clt_parameters.imp.treeline_lim_high;//  false; // limit too high treeline (false - delete completely)
	    double   treeline_str =      clt_parameters.imp.treeline_str;     //  0.8;  // treeline minimal strength 
	    double   treeline_far =      clt_parameters.imp.treeline_far;     //  0.04; // treeline min disparity (pix)
	    double   treeline_near =     clt_parameters.imp.treeline_near;    //  0.4;  // treeline max disparity (pix)
	    double   treeline_fg_str =   clt_parameters.imp.treeline_fg_str;  //  0.8;  // pre-treeline FG objects (such as flat ground) minimal strength 
	    double   treeline_fg_far =   clt_parameters.imp.treeline_fg_far;  //  0.2;  // pre-treeline FG objects  min disparity (pix)
	    double   treeline_fg_near =  clt_parameters.imp.treeline_fg_near; //  0.5;  // pre-treeline FG objects  max disparity (pix)
		
		// suspecting indoors (disabling sky)
		boolean indoors_en =         clt_parameters.imp.indoors_en;       // true; // allow weak cloud if it has strong (1.5x) cloud neib
		double  indoors_str =        clt_parameters.imp.indoors_str;      //  0.5; // minimal strength of the far object         
		double  indoors_disp =       clt_parameters.imp.indoors_disp;     //  0.8; // maximal minimal outdoor strong disparity         
		int     indoors_min_out  =   clt_parameters.imp.indoors_min_out; //  10;   // minimal strong far tiles to deny indoors
		QuadCLT   dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
		QuadCLT   dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
@@ -4020,7 +4048,33 @@ public class OpticalFlow {
				clouds_fom,            // maximal FOM for clouds (must be <=)         
				clouds_fom,            // maximal FOM for clouds (must be <=)         
				clouds_spread,         // maximal spread for clouds (must be <=)         
				clouds_spread,         // maximal spread for clouds (must be <=)         
				clouds_disparity,      // maximal disparity for strong clouds         
				clouds_disparity,      // maximal disparity for strong clouds         
				clouds_strength,       // maximal strength for near clouds           			
                clouds_weak,           // maximal strength for near definite clouds         		
                clouds_strength,       // minimal strength for far strong clouds (definitely cloud)         		
                clouds_not_strength,   // maximal strength for near maybe clouds (if it has strong cloud neighbor)         		
				clouds_strong,         // true; // allow weak cloud if it has strong (1.5x) cloud neib
				
				wall_en,               // enable smooth walls detection/processing
				wall_dflt,             // default (undetected) is wall (false - sky)
				wall_str,              // minimal strength of the far object (small - just non-NaN disparity)         
				wall_far,              // maximal disparity to consider cluster to be sky         
				wall_near,             // minimal disparity to consider cluster to be wall         
				
			    treeline_en,           // enable treeline processing
			    treeline_wide,         // look not only under, but diagonal too.
			    treeline_height,       // maximal height of the treeline (tiles)
			    treeline_width,        // minimal horizontal width of the treeline (tiles)
			    treeline_lim_high,     // limit too high treeline (false - delete completely)
			    treeline_str,          // treeline minimal strength 
			    treeline_far,          // treeline min disparity (pix)
			    treeline_near,         // treeline max disparity (pix)
			    treeline_fg_str,       // pre-treeline FG objects (such as flat ground) minimal strength 
			    treeline_fg_far,       // pre-treeline FG objects  min disparity (pix)
			    treeline_fg_near,      // pre-treeline FG objects  max disparity (pix)
				
				indoors_en,            // true; // allow weak cloud if it has strong (1.5x) cloud neib
				indoors_str,           //  0.5; // minimal strength of the far object         
				indoors_disp,          //  0.8; // maximal minimal outdoor strong disparity         
				indoors_min_out,       //  10;   // minimal strong far tiles to deny indoors
				disp_boost_min,        // double disp_boost_min,    //  = 0.5;
				disp_boost_min,        // double disp_boost_min,    //  = 0.5;
				disp_boost_diff,       //double disp_boost_diff,   //  = 0.35;
				disp_boost_diff,       //double disp_boost_diff,   //  = 0.35;
				disp_boost_neibs,   //int    disp_boost_neibs,  //  = 2;
				disp_boost_neibs,   //int    disp_boost_neibs,  //  = 2;
@@ -4125,7 +4179,36 @@ public class OpticalFlow {
		double  clouds_fom =         clt_parameters.imp.clouds_fom;       //   30.0; // maximal FOM for clouds (must be <=)         
		double  clouds_fom =         clt_parameters.imp.clouds_fom;       //   30.0; // maximal FOM for clouds (must be <=)         
		double  clouds_spread =      clt_parameters.imp.clouds_spread;    //   60.0; // maximal spread for clouds (must be <=)         
		double  clouds_spread =      clt_parameters.imp.clouds_spread;    //   60.0; // maximal spread for clouds (must be <=)         
		double  clouds_disparity =   clt_parameters.imp.clouds_disparity; //    0.1; // maximal disparity for strong clouds         
		double  clouds_disparity =   clt_parameters.imp.clouds_disparity; //    0.1; // maximal disparity for strong clouds         
		double  clouds_strength =    clt_parameters.imp.clouds_strength;  //    0.3; // maximal strength for near clouds         		
		double  clouds_weak =        clt_parameters.imp.clouds_weak;      //  0.18;// maximal strength for near definite clouds         		
		double  clouds_strength =    clt_parameters.imp.clouds_strength;  //  0.25;// minimal strength for far strong clouds (definitely cloud)         		
		double  clouds_not_strength= clt_parameters.imp.clouds_not_strength;//0.4;  // maximal strength for near maybe clouds (if it has strong cloud neighbor)         		
		boolean clouds_strong =      clt_parameters.imp.clouds_strong;    // true; // allow weak cloud if it has strong (1.5x) cloud neib
		// process smooth walls mistaken for sky (disable for natural environments)
		boolean  wall_en =           clt_parameters.imp.wall_en;          // true;  // enable smooth walls detection/processing
		boolean  wall_dflt =         clt_parameters.imp.wall_dflt;        // true;  // default (undetected) is wall (false - sky)
		double   wall_str =          clt_parameters.imp.wall_str;         // 0.1;   // minimal strength of the far object (small - just non-NaN disparity)         
		double   wall_far =          clt_parameters.imp.wall_far;         // 0.2;   // maximal disparity to consider cluster to be sky         
		double   wall_near =         clt_parameters.imp.wall_near;        // 1.0;   // minimal disparity to consider cluster to be wall         
		// processing far treeline that may be confused with clouds. Only behind far objects such as far horizontal surface.
	    boolean  treeline_en =       clt_parameters.imp.treeline_en;   	  //  true;  // enable treeline processing
	    boolean  treeline_wide =     clt_parameters.imp.treeline_wide;    //  true;  // enable treeline processing
	    int      treeline_height =   clt_parameters.imp.treeline_height;  //  5;    // maximal height of the treeline (tiles)
	    int      treeline_width =    clt_parameters.imp.treeline_width;   //  3;    // minimal horizontal width of the treeline (tiles)
	    boolean  treeline_lim_high = clt_parameters.imp.treeline_lim_high;//  false; // limit too high treeline (false - delete completely)
	    double   treeline_str =      clt_parameters.imp.treeline_str;     //  0.8;  // treeline minimal strength 
	    double   treeline_far =      clt_parameters.imp.treeline_far;     //  0.04; // treeline min disparity (pix)
	    double   treeline_near =     clt_parameters.imp.treeline_near;    //  0.4;  // treeline max disparity (pix)
	    double   treeline_fg_str =   clt_parameters.imp.treeline_fg_str;  //  0.8;  // pre-treeline FG objects (such as flat ground) minimal strength 
	    double   treeline_fg_far =   clt_parameters.imp.treeline_fg_far;  //  0.2;  // pre-treeline FG objects  min disparity (pix)
	    double   treeline_fg_near =  clt_parameters.imp.treeline_fg_near; //  0.5;  // pre-treeline FG objects  max disparity (pix)
	    //	suspecting indoors (disabling sky)
		boolean indoors_en =         clt_parameters.imp.indoors_en;       // true; // allow weak cloud if it has strong (1.5x) cloud neib
		double  indoors_str =        clt_parameters.imp.indoors_str;      //  0.5; // minimal strength of the far object         
		double  indoors_disp =       clt_parameters.imp.indoors_disp;     //  0.8; // maximal minimal outdoor strong disparity         
		int     indoors_min_out  =   clt_parameters.imp.indoors_min_out; //  10;   // minimal strong far tiles to deny indoors
		QuadCLT   dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
		QuadCLT   dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
		// if (build_ref_dsi) {
		// if (build_ref_dsi) {
@@ -4212,7 +4295,33 @@ public class OpticalFlow {
						clouds_fom,            // maximal FOM for clouds (must be <=)         
						clouds_fom,            // maximal FOM for clouds (must be <=)         
						clouds_spread,         // maximal spread for clouds (must be <=)         
						clouds_spread,         // maximal spread for clouds (must be <=)         
						clouds_disparity,      // maximal disparity for strong clouds         
						clouds_disparity,      // maximal disparity for strong clouds         
						clouds_strength,       // maximal strength for near clouds           			
		                clouds_weak,           // maximal strength for near definite clouds         		
		                clouds_strength,       // minimal strength for far strong clouds (definitely cloud)         		
		                clouds_not_strength,   // maximal strength for near maybe clouds (if it has strong cloud neighbor)         		
						clouds_strong,         // true; // allow weak cloud if it has strong (1.5x) cloud neib
						wall_en,               // enable smooth walls detection/processing
						wall_dflt,             // default (undetected) is wall (false - sky)
						wall_str,              // minimal strength of the far object (small - just non-NaN disparity)         
						wall_far,              // maximal disparity to consider cluster to be sky         
						wall_near,             // minimal disparity to consider cluster to be wall         
					    treeline_en,           // enable treeline processing
					    treeline_wide,         // look not only under, but diagonal too.
					    treeline_height,       // maximal height of the treeline (tiles)
					    treeline_width,        // minimal horizontal width of the treeline (tiles)
					    treeline_lim_high,     // limit too high treeline (false - delete completely)
					    treeline_str,          // treeline minimal strength 
					    treeline_far,          // treeline min disparity (pix)
					    treeline_near,         // treeline max disparity (pix)
					    treeline_fg_str,       // pre-treeline FG objects (such as flat ground) minimal strength 
					    treeline_fg_far,       // pre-treeline FG objects  min disparity (pix)
					    treeline_fg_near,      // pre-treeline FG objects  max disparity (pix)
					    indoors_en,            // true; // allow weak cloud if it has strong (1.5x) cloud neib
						indoors_str,           //  0.5; // minimal strength of the far object         
						indoors_disp,          //  0.8; // maximal minimal outdoor strong disparity         
						indoors_min_out,       //  10;   // minimal strong far tiles to deny indoors
						
						
						disp_boost_min,        // double disp_boost_min,    //  = 0.5;
						disp_boost_min,        // double disp_boost_min,    //  = 0.5;
						disp_boost_diff,       //double disp_boost_diff,   //  = 0.35;
						disp_boost_diff,       //double disp_boost_diff,   //  = 0.35;
@@ -4570,6 +4679,7 @@ public class OpticalFlow {
    	
    	
    	boolean export_images =              clt_parameters.imp.export_images;
    	boolean export_images =              clt_parameters.imp.export_images;
    	boolean export_dsi_image =           clt_parameters.imp.export_ranges;
    	boolean export_dsi_image =           clt_parameters.imp.export_ranges;
    	boolean debug_ranges =               clt_parameters.imp.debug_ranges && !batch_mode;
    	boolean export_ml_files =            clt_parameters.imp.export_ml_files;
    	boolean export_ml_files =            clt_parameters.imp.export_ml_files;
    	boolean  photo_en =                  clt_parameters.photo_en; //          false; // perform photogrammetric calibration to equalize pixel values
    	boolean  photo_en =                  clt_parameters.photo_en; //          false; // perform photogrammetric calibration to equalize pixel values
@@ -4654,6 +4764,7 @@ public class OpticalFlow {
		if (reuse_video) { // disable all other options
		if (reuse_video) { // disable all other options
			generate_mapped = false;
			generate_mapped = false;
			export_images = false;
			export_images = false;
			debug_ranges = false;
			export_dsi_image = false;
			export_dsi_image = false;
			show_dsi_image = false;
			show_dsi_image = false;
			export_ml_files = false;
			export_ml_files = false;
@@ -4858,6 +4969,20 @@ public class OpticalFlow {
						quadCLTs,            // QuadCLT []           scenes,
						quadCLTs,            // QuadCLT []           scenes,
						colorProcParameters, // ColorProcParameters  colorProcParameters,
						colorProcParameters, // ColorProcParameters  colorProcParameters,
						debugLevel);         // int                  debug_level
						debugLevel);         // int                  debug_level
				if (clt_parameters.imp.sky_recalc) { // force blue sky recalculation even if it exists
					reuseRefDSI(
							clt_parameters,      // CLTParameters  clt_parameters,
							colorProcParameters, // ColorProcParameters colorProcParameters,
							quadCLT_main,        // QuadCLT        quadCLT_main, // tiles should be set
							quadCLTs[ref_index], // QuadCLT        quadCLT_ref, // tiles should be set
							batch_mode,			 // final boolean       batch_mode,
							threadsMax, 		 // final int           threadsMax,
							updateStatus,		 // final boolean       updateStatus,
							debugLevel);         // int            debugLevel)
				}
				
				
				
				
				quadCLTs[ref_index].inc_accum();
				quadCLTs[ref_index].inc_accum();
				// save with updated num_accum
				// save with updated num_accum
@@ -5696,12 +5821,13 @@ public class OpticalFlow {
					combo_dsn_final[COMBO_DSN_INDX_LMA],
					combo_dsn_final[COMBO_DSN_INDX_LMA],
					combo_dsn_final[COMBO_DSN_INDX_STRENGTH]
					combo_dsn_final[COMBO_DSN_INDX_STRENGTH]
			};
			};
			double [][] ds = conditionInitialDS(
			int dbg_condition = debug_ranges ? Math.max(1, debugLevel) : debugLevel;
			double [][] ds = conditionInitialDS( // Add debug szxy by providing debugLevel=1
					true,                   // boolean        use_conf,       // use configuration parameters, false - use following  
					true,                   // boolean        use_conf,       // use configuration parameters, false - use following  
					clt_parameters,         // CLTParameters  clt_parameters,
					clt_parameters,         // CLTParameters  clt_parameters,
					dls,                    // double [][]    dls
					dls,                    // double [][]    dls
					quadCLTs[ref_index],    // QuadCLT        scene,
					quadCLTs[ref_index],    // QuadCLT        scene,
					debugLevel);         // int debug_level)
					dbg_condition);         // int debug_level)
			double [] disparity = ds[0];
			double [] disparity = ds[0];
			double [] strength = ds[1];		
			double [] strength = ds[1];		
			double [][]szxy = getSceneSZXY(
			double [][]szxy = getSceneSZXY(
Loading