Commit 4adfcfa1 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Experimenting with refineMotionVectors(), before adding corr_offset

scaling
parent db5c9d75
Loading
Loading
Loading
Loading
+533 −233

File changed.

Preview size limit exceeded, changes collapsed.

+57 −55
Original line number Diff line number Diff line
@@ -71,68 +71,70 @@ public class CuasMotionLMA {
	public static final int RSLT_MAX2A =   9;
	public static final int RSLT_ITERS =  10;
	public static final int RSLT_CENTERED=11; //1: this target was evaluated in centered mode, 0 - was in non-centered, -1 - consumed in non-centered
	
	public static final int RSLT_CENT_X = 12;
	public static final int RSLT_CENT_Y = 13;
	public static final int RSLT_CENT_MX= 14;
	public static final int RSLT_CENT_F = 15;
	
	public static final int RSLT_VX =     16;
	public static final int RSLT_VY =     17;
	public static final int RSLT_VSTR =   18;
	public static final int RSLT_VFRAC =  19;
	
	public static final int RSLT_BX =     20;
	public static final int RSLT_BY =     21; // RSLT_BX+1;
	public static final int RSLT_AX =     22; // RSLT_BX+2;
	public static final int RSLT_AY =     23; // RSLT_BX+3;
	public static final int RSLT_MISMATCH_BEFORE = 24;
	public static final int RSLT_MISMATCH_AFTER =  25; // RSLT_MISMATCH_BEFORE+1;
	public static final int RSLT_MISMATCH_DIRS=    26;
	public static final int RSLT_MATCH_LENGTH=     27; // is one less than the total length (0 - isolated)
	public static final int RSLT_BEFORE_LENGTH=    28; // just for debug
	public static final int RSLT_AFTER_LENGTH=     29; // just for debug
	public static final int RSLT_SEQ_TRAVEL=       30; 
	public static final int RSLT_MSCORE =          31;
	public static final int RSLT_QA =              32;
	public static final int RSLT_QRMS =            33;
	public static final int RSLT_QRMS_A =          34;
	public static final int RSLT_QCENTER =         35;
	public static final int RSLT_QMATCH =          36;
	public static final int RSLT_QMATCH_LEN=       37;
	public static final int RSLT_QTRAVEL=          38;
	public static final int RSLT_QSCORE =          39;
	public static final int RSLT_STRONGER =        40; // index of stronger neighbor (may be more)
	public static final int RSLT_SLOW =            41; // 1 - slow, 0 - fast 
	public static final int RSLT_WHEN =            42;
	public static final int RSLT_FAIL =            43;
	public static final int RSLT_DISPARITY=        44; // disparity from single keyframe sequences
	public static final int RSLT_DISP_DIFF=        45; // disparity difference between what?
	public static final int RSLT_DISP_STR =        46; // disparity strength
	public static final int RSLT_RANGE =           47; // range (meters) found from RSLT_DISPARITY, modified by RSLT_INFINITY
	public static final int RSLT_GLOBAL =          48; // local target ID (1-based)
	public static final int RSLT_GLENGTH =         49; // length (symmetrical around this one) for which disparity and range are provided
	public static final int RSLT_GDISPARITY=       50; // disparity from accumulation of the range (RSLT_GLENGTH)
	public static final int RSLT_GDISP_DIFF=       51; // disparity difference for a range
	public static final int RSLT_GDISP_STR =       52; // disparity strength for a range
	public static final int RSLT_GRANGE =          53; // global range - calculated for long sequences (and its fractions)
	public static final int RSLT_FL_PX =           54; // flight log px
	public static final int RSLT_FL_PY =           55; // flight log py
	public static final int RSLT_FL_DISP =         56; // flight log true disparity
	public static final int RSLT_FL_RANGE =        57; // flight log range (meters)
	public static final int RSLT_INFINITY =        58; // disparity at infinity used for range calculation
	public static final int RSLT_TARGET_ID =       59; // unique target id for the whole sequence of segments. 1 is reserved for the UAS
	public static final int RSLT_VEL_AWAY =        60; // axial velocity (positive - away), range derivative (m/s), calculated from the difference to the previous/next series range 
	public static final int RSLT_VEL_RIGHT =       61; // lateral velocity, right ( calculated from angular and RSLT_GRANGE
	public static final int RSLT_VEL_UP =          62; // lateral velocity, up ( calculated from angular and RSLT_GRANGE
	public static final int RSLT_RANGE_LIN =       63; // range linear interpolated using previous/next series if the same target is present there 
// add	
	public static final int RSLT_BOOST=   12; // target accumulated with boosted "exposure time" (based scaled this) 
	public static final int RSLT_CENT_X = 13;
	public static final int RSLT_CENT_Y = 14;
	public static final int RSLT_CENT_MX= 15;
	public static final int RSLT_CENT_F = 16;
	
	public static final int RSLT_VX =     17;
	public static final int RSLT_VY =     18;
	public static final int RSLT_VSTR =   19;
	public static final int RSLT_VFRAC =  20;
	public static final int RSLT_VBOOST = 21; // motion vector was calculated with boosted number of accumulated scene pairs (based scaled this)
	
	public static final int RSLT_BX =     22;
	public static final int RSLT_BY =     23; // RSLT_BX+1;
	public static final int RSLT_AX =     24; // RSLT_BX+2;
	public static final int RSLT_AY =     25; // RSLT_BX+3;
	public static final int RSLT_MISMATCH_BEFORE = 26;
	public static final int RSLT_MISMATCH_AFTER =  27; // RSLT_MISMATCH_BEFORE+1;
	public static final int RSLT_MISMATCH_DIRS=    28;
	public static final int RSLT_MATCH_LENGTH=     29; // is one less than the total length (0 - isolated)
	public static final int RSLT_BEFORE_LENGTH=    30; // just for debug
	public static final int RSLT_AFTER_LENGTH=     31; // just for debug
	public static final int RSLT_SEQ_TRAVEL=       32; 
	public static final int RSLT_MSCORE =          33;
	public static final int RSLT_QA =              34;
	public static final int RSLT_QRMS =            35;
	public static final int RSLT_QRMS_A =          36;
	public static final int RSLT_QCENTER =         37;
	public static final int RSLT_QMATCH =          38;
	public static final int RSLT_QMATCH_LEN=       39;
	public static final int RSLT_QTRAVEL=          40;
	public static final int RSLT_QSCORE =          41;
	public static final int RSLT_STRONGER =        42; // index of stronger neighbor (may be more)
	public static final int RSLT_SLOW =            43; // 1 - slow, 0 - fast 
	public static final int RSLT_WHEN =            44;
	public static final int RSLT_FAIL =            45;
	public static final int RSLT_DISPARITY=        46; // disparity from single keyframe sequences
	public static final int RSLT_DISP_DIFF=        47; // disparity difference between what?
	public static final int RSLT_DISP_STR =        48; // disparity strength
	public static final int RSLT_RANGE =           49; // range (meters) found from RSLT_DISPARITY, modified by RSLT_INFINITY
	public static final int RSLT_GLOBAL =          50; // local target ID (1-based)
	public static final int RSLT_GLENGTH =         51; // length (symmetrical around this one) for which disparity and range are provided
	public static final int RSLT_GDISPARITY=       52; // disparity from accumulation of the range (RSLT_GLENGTH)
	public static final int RSLT_GDISP_DIFF=       53; // disparity difference for a range
	public static final int RSLT_GDISP_STR =       54; // disparity strength for a range
	public static final int RSLT_GRANGE =          55; // global range - calculated for long sequences (and its fractions)
	public static final int RSLT_FL_PX =           56; // flight log px
	public static final int RSLT_FL_PY =           57; // flight log py
	public static final int RSLT_FL_DISP =         58; // flight log true disparity
	public static final int RSLT_FL_RANGE =        59; // flight log range (meters)
	public static final int RSLT_INFINITY =        60; // disparity at infinity used for range calculation
	public static final int RSLT_TARGET_ID =       61; // unique target id for the whole sequence of segments. 1 is reserved for the UAS
	public static final int RSLT_VEL_AWAY =        62; // axial velocity (positive - away), range derivative (m/s), calculated from the difference to the previous/next series range 
	public static final int RSLT_VEL_RIGHT =       63; // lateral velocity, right ( calculated from angular and RSLT_GRANGE
	public static final int RSLT_VEL_UP =          64; // lateral velocity, up ( calculated from angular and RSLT_GRANGE
	public static final int RSLT_RANGE_LIN =       65; // range linear interpolated using previous/next series if the same target is present there 
	public static final int RSLT_LEN = RSLT_RANGE_LIN + 1;
	
	public static final String [] LMA_TITLES = 
		{"X-OFFS","Y-OFFS", "AMPLITUDE", "RADIUS","RAD_POS", "OVERSHOOT","OFFSET","RMSE","RMSE/A","MAX2A","ITERATIONS",
				"CENTERED",
				"CENTERED", "EXP-BOOST",
				"Centr-X","Centr-Y","Centr-max","Centr-frac",
				"Vx", "Vy", "V-conf","V-frac", // from motion vectors
				"Vx", "Vy", "V-conf","V-frac", "V-boost",// from motion vectors
				"X-before", "Y-before","X-after","Y-after",  // from getHalfBeforeAfterPixXY()
				"ERR-BEFORE", "ERR-AFTER", "BA-DIRS", // before dir + 16*after dir
				"Match-length",
+17 −3
Original line number Diff line number Diff line
@@ -796,6 +796,10 @@ min_str_neib_fpn 0.35
    public double   cuas_boost_slow =      4.0;   // if >1 and the motion vector is below tile_size/cuas_boost_slow, scale corr_pairs
    public double   cuas_boost_mv_lim =    1.8;   // Do not boost if motion vector faster than this (before in code equiv 1.8 pix)
    public double   cuas_boost_accum =     4.0;   // if >1 increase tracking camera exposure (TODO: conditional / compete)
    public boolean  cuas_accum_base =     true;   // Accumulate centered targets with base "exposure"
    public boolean  cuas_accum_boosted =  true;   // Accumulate centered targets with boosted "exposure"
    
    
    public double   cuas_boost_mstr =      0.007; // scale corr_pairs if motion strength is below  
    public double   cuas_boost_xstr =      0.2;   // never scale if stronger  
    public int      cuas_corr_offset =     5;     // offset between motion detection pairs
@@ -2709,6 +2713,10 @@ min_str_neib_fpn 0.35
				"Do not boost if motion vector faster than this (before in code equiv 1.8 pix).");
		gd.addNumericField("Increase tracking camera exposure",      this.cuas_boost_accum, 5,8,"",
				"If >1 increase tracking camera exposure (later - conditional).");
		gd.addCheckbox    ("Accumulate tracking base exposuer",      this.cuas_accum_base,
				"Accumulate centered targets with base \"exposure\".");
		gd.addCheckbox    ("Accumulate tracking boosted exposuer",   this.cuas_accum_boosted,
				"Accumulate centered targets with boosted \"exposure\".");
		gd.addNumericField("Boost pairs for weak targets",           this.cuas_boost_mstr, 5,8,"",
				"Scale corr_pairs if motion strength is below, regardless of speed.");
		gd.addNumericField("Never boost stronger",                   this.cuas_boost_xstr, 5,8,"",
@@ -4392,18 +4400,18 @@ min_str_neib_fpn 0.35
		this.cuas_boost_slow =          gd.getNextNumber();
		this.cuas_boost_mv_lim =        gd.getNextNumber();
		this.cuas_boost_accum =         gd.getNextNumber();
		this.cuas_accum_base =          gd.getNextBoolean();
		this.cuas_accum_boosted =       gd.getNextBoolean();
		this.cuas_boost_mstr =          gd.getNextNumber();
		this.cuas_boost_xstr =          gd.getNextNumber();
		this.cuas_corr_offset =   (int) gd.getNextNumber();
		this.cuas_gaussian_ra =         gd.getNextBoolean();
		this.cuas_temporal_um =   (int) gd.getNextNumber();
		this.cuas_tum_threshold =       gd.getNextNumber();
		
		this.cuas_precorr_ra =    (int) gd.getNextNumber();
		this.cuas_corr_step =     (int) gd.getNextNumber();
		this.cuas_accum_ra =      (int) gd.getNextNumber();
		this.cuas_accum_step =    (int) gd.getNextNumber();
		
		this.cuas_half_step =           gd.getNextBoolean();
		this.cuas_max_range =     (int) gd.getNextNumber();
		this.cuas_fin_range =     (int) gd.getNextNumber();
@@ -5704,6 +5712,8 @@ min_str_neib_fpn 0.35
		properties.setProperty(prefix+"cuas_boost_slow",      this.cuas_boost_slow+"");     // double
		properties.setProperty(prefix+"cuas_boost_mv_lim",    this.cuas_boost_mv_lim+"");   // double
		properties.setProperty(prefix+"cuas_boost_accum",     this.cuas_boost_accum+"");    // double
        properties.setProperty(prefix+"cuas_accum_base",      this.cuas_accum_base+"");     // boolean
        properties.setProperty(prefix+"cuas_accum_boosted",   this.cuas_accum_boosted+"");  // boolean
		properties.setProperty(prefix+"cuas_boost_mstr",      this.cuas_boost_mstr+"");     // double
		properties.setProperty(prefix+"cuas_boost_xstr",      this.cuas_boost_xstr+"");     // double
        properties.setProperty(prefix+"cuas_corr_offset",     this.cuas_corr_offset+"");    // int
@@ -6951,6 +6961,8 @@ min_str_neib_fpn 0.35
		if (properties.getProperty(prefix+"cuas_boost_slow")!=null)      this.cuas_boost_slow=Double.parseDouble(properties.getProperty(prefix+"cuas_boost_slow"));
		if (properties.getProperty(prefix+"cuas_boost_mv_lim")!=null)    this.cuas_boost_mv_lim=Double.parseDouble(properties.getProperty(prefix+"cuas_boost_mv_lim"));
		if (properties.getProperty(prefix+"cuas_boost_accum")!=null)     this.cuas_boost_accum=Double.parseDouble(properties.getProperty(prefix+"cuas_boost_accum"));
		if (properties.getProperty(prefix+"cuas_accum_base")!=null)      this.cuas_accum_base=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_accum_base"));
		if (properties.getProperty(prefix+"cuas_accum_boosted")!=null)    this.cuas_accum_boosted=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_accum_boosted"));
		if (properties.getProperty(prefix+"cuas_boost_mstr")!=null)      this.cuas_boost_mstr=Double.parseDouble(properties.getProperty(prefix+"cuas_boost_mstr"));
		if (properties.getProperty(prefix+"cuas_boost_xstr")!=null)      this.cuas_boost_xstr=Double.parseDouble(properties.getProperty(prefix+"cuas_boost_xstr"));
		if (properties.getProperty(prefix+"cuas_corr_offset")!=null)     this.cuas_corr_offset=Integer.parseInt(properties.getProperty(prefix+"cuas_corr_offset"));
@@ -8215,6 +8227,8 @@ min_str_neib_fpn 0.35
		imp.cuas_boost_slow =       this.cuas_boost_slow;
		imp.cuas_boost_mv_lim =     this.cuas_boost_mv_lim;
		imp.cuas_boost_accum =      this.cuas_boost_accum;
		imp.cuas_accum_base =       this.cuas_accum_base;
		imp.cuas_accum_boosted =    this.cuas_accum_boosted;
		imp.cuas_boost_mstr =       this.cuas_boost_mstr;
		imp.cuas_boost_xstr =       this.cuas_boost_xstr;
		imp.cuas_corr_offset =      this.cuas_corr_offset;