Commit 1e773119 authored by Andrey Filippov's avatar Andrey Filippov

Implementing multiple variant of the same noise for intra

parent 05e7dbd3
......@@ -7255,6 +7255,7 @@ private Panel panel1,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES, // Properties properties,
bayer_artifacts_debug, // boolean bayer_artifacts_debug
-1, // int noise_variant, // <0 - no-variants, compatible with old code
THREADS_MAX, // final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, // final boolean updateStatus,
DEBUG_LEVEL);
......
......@@ -52,13 +52,14 @@ public class InterIntraLMA {
boolean [] inter_file,
boolean [][] good_file_tile,
double min_inter16_noise_level,
int min_modes)
int min_modes,
boolean zero_all_bad, // set noise_level to zero if all noise levels result in bad tiles
boolean all_inter, // tile has to be defined for all inter
boolean need_same_inter, // = true; // do not use intra sample if same inter is bad for all noise levels
int dbg_tile)
{
int dbg_tile = 1222;
// boolean remove_non_monotonic = false; // true;
boolean zero_all_bad = true; // set noise_level to zero if all noise levels result in bad tiles
boolean all_inter = true; // tile has to be defined for all inter
boolean need_same_inter = true; // do not use intra sample if same inter is bad for all noise levels
// int dbg_tile = 828; // 1222;
int num_sensor_modes = 0;
int num_tiles = good_file_tile[0].length;
for (int i = 0; i < sensor_mode_file.length; i++) {
......@@ -167,6 +168,221 @@ public class InterIntraLMA {
}
return rslt;
}
// trying multi-threshold good_file_tile_range
public static double [][] getNoiseThreshold(
double [] noise_file, // = new double [noise_files.length];
int [] sensor_mode_file,
boolean [] inter_file,
int outliers, // may need do modify algorithm to avoid bias - removing same side (densier) outliers
int min_keep, // remove less outliers if needed to keep this remain
boolean [][][] good_file_tile_range,
double min_inter16_noise_level,
int min_modes,
boolean zero_all_bad, // set noise_level to zero if all noise levels result in bad tiles
boolean all_inter, // tile has to be defined for all inter
boolean need_same_inter, // = true; // do not use intra sample if same inter is bad for all noise levels
int dbg_tile)
{
//int dbg_tile = 828;
int num_sensor_modes = 00;
int num_tiles = good_file_tile_range[0].length;
for (int i = 0; i < sensor_mode_file.length; i++) {
if (sensor_mode_file[i] > num_sensor_modes) {
num_sensor_modes = sensor_mode_file[i];
}
}
num_sensor_modes ++;
int num_modes = 2 * num_sensor_modes;
double [][] rslt = new double [num_tiles][]; // number of tiles
double [][][][] noise_intervals = new double[num_modes][num_tiles][][]; // [2]; // [modes][tiles] {max_good, min_bad}
double [][] lowest_all_bad = new double[num_modes][num_tiles]; // // lowest all bad (or NaN)
for (int i = 0; i < num_modes; i++) {
for (int j= 0; j < num_tiles; j++) {
lowest_all_bad[i][j] =Double.NaN;
}
}
for (int nf = 0; nf < noise_file.length; nf++) {
double noise = noise_file[nf];
int mode = sensor_mode_file[nf] + (inter_file[nf] ? 0: num_sensor_modes);
for (int ntile = 0; ntile < num_tiles; ntile++) {
if (ntile == dbg_tile) {
System.out.println("ntile = "+ntile+", nf ="+nf);
}
// double lowest_all_bad = Double.NaN;
if (good_file_tile_range[nf][ntile] != null) {
if (noise_intervals[mode][ntile] == null) {
noise_intervals[mode][ntile] = new double [good_file_tile_range[nf][ntile].length][2];
for (int stp = 0; stp < noise_intervals[mode][ntile].length; stp++) {
noise_intervals[mode][ntile][stp][0] = Double.NaN;
noise_intervals[mode][ntile][stp][1] = Double.NaN;
}
}
for (int stp = 0; stp < noise_intervals[mode][ntile].length; stp++) {
if (good_file_tile_range[nf][ntile][stp]) { // good tile
if (!(noise <= noise_intervals[mode][ntile][stp][0])){ // including Double.isNaN(noise_interval[mode][ntile][0]
noise_intervals[mode][ntile][stp][0] = noise;
}
} else { // bad tile
if (!(noise >= noise_intervals[mode][ntile][stp][1])){ // including Double.isNaN(noise_interval[mode][ntile][1]
noise_intervals[mode][ntile][stp][1] = noise;
}
}
}
} else { // all bad files
if (!(noise >= lowest_all_bad[mode][ntile])) {
lowest_all_bad[mode][ntile] = noise;
}
}
}
}
// apply lowest_all_bad
for (int mode = 0; mode < num_modes; mode++) {
for (int ntile= 0; ntile < num_tiles; ntile++) {
double noise = lowest_all_bad[mode][ntile];
if (!Double.isNaN(noise) && (noise_intervals[mode][ntile] != null)) {
for (int stp = 0; stp < noise_intervals[mode][ntile].length; stp++) {
if (!(noise >= noise_intervals[mode][ntile][stp][1])){ // including Double.isNaN(noise_interval[mode][ntile][1]
noise_intervals[mode][ntile][stp][1] = noise;
}
}
}
}
}
for (int ntile = 0; ntile < num_tiles; ntile++){
if (ntile == dbg_tile) {
System.out.println("ntile = "+ntile);
}
int num_defined = 00;
int num_defined_inter = 0;
for (int mode = 0; mode < num_modes; mode++) {
if (noise_intervals[mode][ntile] != null) {
boolean defined = false;
for (double [] nd:noise_intervals[mode][ntile]) {
if (!Double.isNaN(nd[0]) && !Double.isNaN(nd[1])) {
defined = true;
break;
}
}
if (defined) {
num_defined++;
if (mode < 4) {
num_defined_inter++;
}
}
}
}
//all_inter
if ((num_defined >= min_modes) && (!all_inter || (num_defined_inter >= 4))) {
rslt[ntile] = new double [num_modes];
for (int mode = 0; mode < num_modes; mode++){
if (noise_intervals[mode][ntile] != null) {
double [] pre_rslt = new double [noise_intervals[mode][ntile].length]; //null pointer
int num_def = 0;
for (int stp = 0; stp < pre_rslt.length; stp++) {
if (need_same_inter && Double.isNaN(noise_intervals[mode & 3][ntile][stp][0])) { // no good for same sensors inter
pre_rslt[stp] = Double.NaN;
} else if (!Double.isNaN(noise_intervals[mode][ntile][stp][0]) && !Double.isNaN(noise_intervals[mode][ntile][stp][1])) {
pre_rslt[stp] = noise_intervals[mode][ntile][stp][1]; // lowest noise for bad
} else if (zero_all_bad && Double.isNaN(noise_intervals[mode][ntile][stp][0])) {
pre_rslt[stp] = 0.0;
} else {
pre_rslt[stp] = Double.NaN;
}
if (!Double.isNaN(pre_rslt[stp])) {
num_def++;
}
}
if (num_def > 0) {
for (int num_outlier = 0; num_outlier <= outliers; num_outlier++) { // will break
double s0=0, sx=0, sx2=0, sy=0, sxy=0;
double x0 = 0.5 * (pre_rslt.length -1);
for (int stp = 0; stp < pre_rslt.length; stp++) {
double y = pre_rslt[stp];
if (!Double.isNaN(y)) {
double x = stp - x0;
s0+= 1.0;
sx += x;
sx2 += x*x;
sy += y;
sxy += x*y;
}
}
double a = 0.0;
double b = sy;
if (num_def > 1) {
double dn = (s0*sx2 - sx*sx);
a = (sxy*s0 - sy*sx)/dn;
b = (sy*sx2 - sxy*sx)/dn;
}
if ((num_outlier == outliers) || (num_def <= min_keep)) {
rslt[ntile][mode] = b;
break;
}
// find and remove the worst outlier
int worst_indx = -1;
double worst_err2 = -1.0;
for (int stp = 0; stp < pre_rslt.length; stp++) {
double y = pre_rslt[stp];
if (!Double.isNaN(y)) {
double err2 = y - a * (stp - x0) -b;
err2 *= err2;
if (err2 > worst_err2) {
worst_err2 = err2;
worst_indx = stp;
}
}
}
pre_rslt[worst_indx] = Double.NaN; // remove worst result
num_def--;
}
} else {
rslt[ntile][mode] = Double.NaN;
}
} else {
rslt[ntile][mode] = zero_all_bad ? 0.0 : Double.NaN; // no good in any stp
}
}
}
if ((rslt[ntile] != null) && (min_inter16_noise_level >0)){ // filter by to weak inter-16 (mode 0)
if (!(rslt[ntile][0] >= min_inter16_noise_level)){
rslt[ntile] = null;
}
}
if (rslt[ntile] != null) {
boolean all_nan = true;
boolean has_nan = false;
boolean has_inter_nan = false;
for (int mode = 0; mode < rslt[ntile].length; mode++) {
if (Double.isNaN(rslt[ntile][mode])) {
has_nan = true;
if (mode < 4) {
has_inter_nan = true;
}
} else {
all_nan = false;
}
}
if (all_nan) {
System.out.println("All NaN for tile = "+ntile);
}
if (has_nan) {
System.out.println("Has NaN for tile = "+ntile);
}
if (has_inter_nan) {
System.out.println("Has has_inter_nan for tile = "+ntile);
}
}
}
return rslt;
}
//Monotonic function
public int debug_level = 0;
public double offset;
......@@ -178,14 +394,19 @@ public class InterIntraLMA {
public double [] vector; // N0, g[1]... [g7], St[i]
public int [][] sample_indx; // pairs of {tile_index, mode}
public double [] gi;
public double [] gi2;
public double [][] last_jt;// this.last_jt = new double [num_pars][num_points];
public double N0;
public boolean useLinear = true; // use linear instead of squared for N0, St and Gi in a vector
public double N0; // trying linear N2 instead of N0*N0
public double N02; // squared N0 (may be negative)
public double [] Y;
public double [] K; // scale noise levels to make them near-relative
public int [] tile_index;
public double [] St;
public double [] St2;
public double [] weights;
public double [] fx;
public double last_rms = Double.NaN;
......@@ -201,12 +422,15 @@ public class InterIntraLMA {
int dbgTilesY = 64;
public InterIntraLMA(
boolean useLinear,
double [][] noise_thresh,
double offset, // initial value for N0
double offset, // for "relative" noise
double n0, // initial value for N0 0.02
int tilesX, // debug images only
int debug_level)
{
boolean debug_img = (debug_level > -1);
this.useLinear = useLinear;
// this.gi = g0.clone();
this.offset = offset;
this.debug_level = debug_level;
......@@ -224,7 +448,8 @@ public class InterIntraLMA {
this.gi[0] = 1.0; // all, inter - ga1n= 1.0
sample_indx = new int [num_samples][2];
tile_index = new int[num_tiles];
N0 = 0.03; // offset; // .01; // offset;
this.N0 = n0; // 0.03; // offset; // .01; // offset;
N02 = N0*N0; // offset; // .01; // offset;
Y = new double[num_samples];
K = new double[num_samples];
weights = new double[num_samples];
......@@ -257,7 +482,7 @@ public class InterIntraLMA {
weights[nsample] = 1.0/num_samples;
}
// initial approximation
double N0 = offset;
double N0 = n0; // offset;
double N02 = N0*N0;
// set St for tiles that are defined for mode==0 (inter16)
for (int nsample = 0; nsample < num_samples; nsample++) if (sample_indx[nsample][1] == 0){
......@@ -374,6 +599,20 @@ public class InterIntraLMA {
}
}
if (useLinear) {
St2 = new double [St.length];
for (int i = 0; i < St.length; i++) {
St2[i] = St[i]*St[i];
}
gi2 = new double [gi.length];
for (int i = 0; i < gi.length; i++) {
gi2[i] = gi[i]*gi[i];
}
for (int i = 0; i < Y.length; i++) {
Y[i] *= Y[i];
K[i] *= K[i];
}
}
if (dbg_img != null) {
(new ShowDoubleFloatArrays()).showArrays(
dbg_img,
......@@ -396,27 +635,42 @@ public class InterIntraLMA {
this.adjust_St = adjust_St;
double [] v = new double [(adjust_N0 ? 1 : 0) + (adjust_Gi ? (gi.length - 1) : 0) + (adjust_St ? st.length : 0)];
if (adjust_N0) {
v[0] = n0;
v[0] = useLinear ? (n0 * n0) : n0;
}
if (adjust_Gi) {
System.arraycopy(gi, 1, v, (adjust_N0 ? 1 : 0), gi.length-1);
if (useLinear) {
int indx = adjust_N0 ? 1 : 0;
for (int i = 1; i < gi.length; i++) {
v[indx++] = gi[i];
}
} else {
System.arraycopy(gi, 1, v, (adjust_N0 ? 1 : 0), gi.length-1);
}
}
if (adjust_St) {
System.arraycopy(st, 0, v, (adjust_N0 ? 1 : 0) + (adjust_Gi ? (gi.length - 1) : 0), st.length);
if (useLinear) {
int indx = (adjust_N0 ? 1 : 0) + (adjust_Gi ? (gi.length - 1) : 0);
for (int i = 0; i < st.length; i++) {
v[indx++] = st[i];
}
} else {
System.arraycopy(st, 0, v, (adjust_N0 ? 1 : 0) + (adjust_Gi ? (gi.length - 1) : 0), st.length);
}
}
return v;
}
private double getN0(double [] v) {
return adjust_N0 ? v[0] : N0;
private double getN0(double [] v) { // returns squared in linear mode
return adjust_N0 ? v[0] : (useLinear ? N02 : N0);
}
private double [] getGi(double [] v) {
double [] gi = new double [this.gi.length];
gi[0] = 1.0;
if (adjust_Gi) {
System.arraycopy(v, (adjust_N0 ? 1 : 0), gi, 1, gi.length-1);
} else if (useLinear) {
System.arraycopy(this.gi2, 1, gi, 1, gi2.length-1);
} else {
System.arraycopy(this.gi, 1, gi, 1, gi.length-1);
}
......@@ -429,6 +683,8 @@ public class InterIntraLMA {
st = new double [this.St.length]; // .length - this.gi.length];
System.arraycopy(v, (adjust_N0 ? 1 : 0) + (adjust_Gi ? (gi.length - 1) : 0), st, 0, st.length);
return st;
} else if (useLinear) {
return St2.clone();
} else {
return St.clone();
}
......@@ -460,35 +716,57 @@ public class InterIntraLMA {
Arrays.fill(jt[i],0.0);
}
}
for (int i = 0; i < fx.length; i++) {
int itile = sample_indx[i][0];
int mode = sample_indx[i][1];
double nv2 = st[itile]*gi[mode];
nv2 *= nv2;
nv2 -= n0*n0;
if (nv2 > 0) { // if <=0 - keep 0.0
double sqrt = Math.sqrt(nv2);
fx[i] = K[i] * sqrt;
if (useLinear) {
for (int i = 0; i < fx.length; i++) {
int itile = sample_indx[i][0];
int mode = sample_indx[i][1];
double nv = st[itile]*gi[mode] - n0;
fx[i] = K[i] * nv;
if (jt != null) {
double Amti = K[i]/sqrt;
int indx = 0;
if (adjust_N0) {
jt[indx++][i] = - Amti * n0;
jt[indx++][i] = - K[i];
}
double asg = Amti*st[itile]*gi[mode];
if (adjust_Gi && (mode > 0)) {
jt[indx + mode -1][i] = asg *st[itile];
jt[indx + mode -1][i] = K[i] *st[itile];
indx += gi.length -1;
}
if (adjust_St) {
jt[indx + itile][i] = asg * gi[mode];
jt[indx + itile][i] = K[i] * gi[mode];
}
}
}
} else {
for (int i = 0; i < fx.length; i++) {
int itile = sample_indx[i][0];
int mode = sample_indx[i][1];
double nv2 = st[itile]*gi[mode];
nv2 *= nv2;
nv2 -= n0*n0;
if (nv2 > 0) { // if <=0 - keep 0.0
double sqrt = Math.sqrt(nv2);
fx[i] = K[i] * sqrt;
if (jt != null) {
double Amti = K[i]/sqrt;
int indx = 0;
if (adjust_N0) {
jt[indx++][i] = - Amti * n0;
}
double asg = Amti*st[itile]*gi[mode];
if (adjust_Gi && (mode > 0)) {
jt[indx + mode -1][i] = asg *st[itile];
indx += gi.length -1;
}
if (adjust_St) {
jt[indx + itile][i] = asg * gi[mode];
}
}
}
}
}
return fx;
}
public double [][] getYDbg() {
double [][] dbg_Y = new double [gi.length][dbgTilesX*dbgTilesY];
for (int mode = 0; mode < dbg_Y.length; mode++) {
......@@ -520,6 +798,40 @@ public class InterIntraLMA {
return dbg_Fx;
}
public double [][] getNmDbg() {
double [][] dbg_Nm = new double [gi.length][dbgTilesX*dbgTilesY];
for (int mode = 0; mode < dbg_Nm.length; mode++) {
Arrays.fill(dbg_Nm[mode], Double.NaN);
}
for (int i = 0; i < Y.length; i++) {
int itile = sample_indx[i][0];
int mode = sample_indx[i][1];
int tile = tile_index[itile];
dbg_Nm[mode][tile] = Y[i]/K[i];
}
return dbg_Nm;
}
public double [][] getNvDbg() {
double [][] dbg_Nv = new double [gi.length][dbgTilesX*dbgTilesY];
for (int mode = 0; mode < dbg_Nv.length; mode++) {
Arrays.fill(dbg_Nv[mode], Double.NaN);
}
double [] fx = getFxJt(
vector, // double [] vector,
null); // double [][] jt)
for (int i = 0; i < Y.length; i++) {
int itile = sample_indx[i][0];
int mode = sample_indx[i][1];
int tile = tile_index[itile];
dbg_Nv[mode][tile] = fx[i]/K[i];
}
return dbg_Nv;
}
private double [] getWYMinusFx(
double [] vector,
......@@ -639,10 +951,10 @@ public class InterIntraLMA {
N0, // double n0,
gi, // double [] gi,
St); // double [] st) {
boolean dbg_img = debug_level > 0;
boolean [] rslt = {false,false};
this.last_rms = Double.NaN;
int iter = 0;
int iter = 00;
for (iter = 0; iter < num_iter; iter++) {
rslt = lmaStep(
lambda,
......@@ -686,17 +998,69 @@ public class InterIntraLMA {
System.out.println("LMA: full RMS="+last_rms+" ("+initial_rms+"), lambda="+lambda);
}
if (rslt[0]) { // success
if (adjust_N0) {
N0 = getN0(vector);
}
if (adjust_Gi) {
gi = getGi(vector);
if (useLinear) {
if (adjust_N0) {
N02 = getN0(vector);
N0 = (N02 >= 0.0)? Math.sqrt(N02) : Double.NaN;
}
if (adjust_Gi) {
gi2 = getGi(vector);
for (int i = 0; i < gi2.length; i++) {
gi[i] = (gi2[i] >= 0.0) ? Math.sqrt(gi2[i]): Double.NaN;
}
}
if (adjust_St) {
St2 = getSt(vector);
for (int i = 0; i < St2.length; i++) {
St[i] = (St2[i] >= 0.0) ? Math.sqrt(St2[i]): Double.NaN;
}
}
} else {
if (adjust_N0) {
N0 = getN0(vector);
}
if (adjust_Gi) {
gi = getGi(vector);
}
if (adjust_St) {
St = getSt(vector);
}
}
if (adjust_St) {
St = getSt(vector);
if (dbg_img) {
double [][] dbg_Y = getYDbg();
(new ShowDoubleFloatArrays()).showArrays(
dbg_Y,
dbgTilesX,
dbgTilesY,
true,
"dbg_Y");
double [][] dbg_Fx = getFxDbg();
(new ShowDoubleFloatArrays()).showArrays(
dbg_Fx,
dbgTilesX,
dbgTilesY,
true,
"dbg_Fx");
double [][] dbg_Nm = getNmDbg(); // for linear - extract sqrt
(new ShowDoubleFloatArrays()).showArrays(
dbg_Nm,
dbgTilesX,
dbgTilesY,
true,
"dbg_Nm");
double [][] dbg_Nv = getNvDbg(); // for linear - extract sqrt
(new ShowDoubleFloatArrays()).showArrays(
dbg_Nv,
dbgTilesX,
dbgTilesY,
true,
"dbg_Nv");
}
}
return rslt[0];
}
......@@ -709,7 +1073,7 @@ public class InterIntraLMA {
int num_points = this.weights.length; // includes 2 extra for regularization
int num_pars = vector.length;
boolean [] rslt = {false,false};
boolean dbg_img = debug_level > 2;
boolean dbg_img = debug_level > 2+0;
if (Double.isNaN(last_rms)) { //first time, need to calculate all (vector is valid)
last_jt = new double [num_pars][num_points];
double [] fx = getFxJt(
......@@ -766,7 +1130,7 @@ public class InterIntraLMA {
}
return rslt;
}
if (debug_level>2) {
if (debug_level > 2) {
System.out.println("(JtJ + lambda*diag(JtJ)).inv()");
jtjl_inv.print(18, 6);
}
......
......@@ -3168,8 +3168,7 @@ public class OpticalFlow {
ColorProcParameters colorProcParameters,
QuadCLT.SetChannels [] set_channels,
QuadCLT ref_scene, // ordered by increasing timestamps
// double []
NoiseParameters noise_sigma_level,
NoiseParameters noise_sigma_level, // only comes with no-noise here
int debug_level
)
{
......@@ -3197,7 +3196,8 @@ public class OpticalFlow {
scene_names[i],
clt_parameters,
colorProcParameters, //
noise_sigma_level, // double [] noise_sigma_level,
noise_sigma_level, // double [] noise_sigma_level,only comes with non-noise here, so noise_variant is not needed
-1, // int noise_variant, // <0 - no-variants, compatible with old code
ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
-1); // debug_level);
......@@ -3774,6 +3774,7 @@ public class OpticalFlow {
QuadCLT ref_scene, // ordered by increasing timestamps
// double []
NoiseParameters noise_sigma_level,
int noise_variant, // <0 - no-variants, compatible with old code
int debug_level
)
{
......@@ -3792,6 +3793,7 @@ public class OpticalFlow {
clt_parameters,
colorProcParameters, //
noise_sigma_level, // double [] noise_sigma_level,
noise_variant, // int noise_variant, // <0 - no-variants, compatible with old code
ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
-1); // debug_level);
......@@ -3832,7 +3834,7 @@ public class OpticalFlow {
}
} else {
combo_dsn = ref_scene. readDoubleArrayFromModelDirectory( //"disp", "strength","disp_lma","num_valid"
combo_dsn = ref_scene.readDoubleArrayFromModelDirectory( //"disp", "strength","disp_lma","num_valid"
"-results-nonoise" + (read_nonoise_lma?"-lma":"-nolma"), // String suffix,
combo_dsn_titles.length - 1, // 4
null); // int [] wh);
......@@ -3845,7 +3847,7 @@ public class OpticalFlow {
final int margin = 8;
final int tilesX = ref_scene.getTileProcessor().getTilesX();
final int tilesY = ref_scene.getTileProcessor().getTilesY();
if (debug_level > -1) {
if (debug_level > 0) {
int extra = 10; // pixels around largest outline
int scale = 4;
......@@ -4011,6 +4013,12 @@ public class OpticalFlow {
//rslt_suffix +="-mask"+clt_parameters.img_dtt.dbg_pair_mask;
}
rslt_suffix += (clt_parameters.correlate_lma?"-lma":"-nolma");
if (noise_variant >= 0) {
rslt_suffix +="-variant"+noise_variant;
}
// int noise_variant, // <0 - no-variants, compatible with old code
ref_scene.saveDoubleArrayInModelDirectory(
rslt_suffix, // String suffix,
refine_titles, // null, // String [] labels, // or null
......
......@@ -224,6 +224,7 @@ public class QuadCLTCPU {
double [][][][][][] getCltKernels() {
return clt_kernels;
}
@Deprecated
public QuadCLT spawnQuadCLTWithNoise(
String set_name,
CLTParameters clt_parameters,
......@@ -239,6 +240,7 @@ public class QuadCLTCPU {
clt_parameters,
colorProcParameters,
noise_sigma_level, // double [] noise_sigma_level,
-1, // int noise_variant, // <0 - no-variants, compatible with old code
ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
debugLevel);
......@@ -246,6 +248,32 @@ public class QuadCLTCPU {
return quadCLT;
}
public QuadCLT spawnQuadCLTWithNoise(
String set_name,
CLTParameters clt_parameters,
ColorProcParameters colorProcParameters,
NoiseParameters noise_sigma_level,
int noise_variant, // <0 - no-variants, compatible with old code
QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
int threadsMax,
int debugLevel)
{
QuadCLT quadCLT = new QuadCLT(this, set_name);
quadCLT.restoreFromModel(
clt_parameters,
colorProcParameters,
noise_sigma_level, // double [] noise_sigma_level,
noise_variant, //int noise_variant, // <0 - no-variants, compatible with old code
ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
debugLevel);
return quadCLT;
}
/*
public QuadCLT spawnQuadCLT(
String set_name,
......@@ -285,7 +313,8 @@ public class QuadCLTCPU {
clt_parameters,
colorProcParameters,
null, // double [] noise_sigma_level,
null, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
-1, // noise_variant, // <0 - no-variants, compatible with old code
null, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
debugLevel);
......@@ -611,14 +640,11 @@ public class QuadCLTCPU {
return rgba;
}
public QuadCLTCPU restoreFromModel(
CLTParameters clt_parameters,
ColorProcParameters colorProcParameters,
// double []
NoiseParameters noise_sigma_level,
int noise_variant, // <0 - no-variants, compatible with old code
QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
int threadsMax,
int debugLevel)
......@@ -661,6 +687,7 @@ public class QuadCLTCPU {
"-NOISE",
ref_scene, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
noise_sigma_level,
noise_variant, //final int noise_variant, // <0 - no-variants, compatible with old code
threadsMax,
1); // debugLevel); // final int debug_level)
}
......@@ -691,16 +718,17 @@ public class QuadCLTCPU {
// If file with the same sigma already exists in the model directory - just use it, multiply by noise_sigma_level[0] and add to the non-zero Bayer
public void generateAddNoise(
final String suffix,
final String suffix_novar,
final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
// final double []
final NoiseParameters noise_sigma_level,
final int noise_variant, // <0 - no-variants, compatible with old code
final int threadsMax,
final int debug_level)
{
final double scale_random = noise_sigma_level.scale_random; // _sigma_level[0];
final double scale_fpn = noise_sigma_level.scale_fpn; // noise_sigma_level[0];
final double sigma = noise_sigma_level.sigma; // [1];
final String suffix = suffix_novar + ((noise_variant >= 0) ? ("-"+noise_variant+"-"):"");
ImagePlus imp = generateAddNoise(
suffix, // final String suffix,
sigma, // final double sigma,
......
......@@ -8642,7 +8642,7 @@ if (debugLevel > -100) return true; // temporarily !
colorProcParameters, // ColorProcParameters colorProcParameters,
set_channels, // QuadCLT.SetChannels [] set_channels
ref_quadCLT, // QuadCLT [] scenes, // ordered by increasing timestamps
null, // noise_sigma_level, // double [] noise_sigma_level,
null, // noise_sigma_level, // double [] noise_sigma_level,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
System.out.println("End of intersceneAccumulate()");
......@@ -8713,8 +8713,14 @@ if (debugLevel > -100) return true; // temporarily !
final int debugLevel) throws Exception
{
// 1626032208_613623-results-rnd_0.003-fpn_0.0-sigma_1.5-offset1.0-sensors16-inter.tiff
// manual restrictions on the hard-wired list of files
boolean process_inter = true; // false;
boolean process_intra = true;
int num_noise_var_inter = 0;
int num_noise_var_intra = 17;
double [][] noise_task = {
/*
{0.00, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.00, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.00, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
......@@ -8722,25 +8728,26 @@ if (debugLevel > -100) return true; // temporarily !
{0.00, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.00, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.00, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.00, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.003,0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.00, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra */
/*
{0.003,0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.003,0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.003,0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.003,0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.003,0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.003,0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.003,0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.003,0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.003,0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra */
/*{0.01, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
/* {0.01, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.01, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.01, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.01, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.01, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.01, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.01, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.01, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.01, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
{0.02, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.02, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
......@@ -8751,23 +8758,23 @@ if (debugLevel > -100) return true; // temporarily !
{0.02, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.02, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.03, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.03, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.03, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.03, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.03, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.03, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.03, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.03, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.03, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.03, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.04, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.04, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.04, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.04, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.04, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.04, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.04, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.04, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.04, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.04, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
{0.05, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.05, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
......@@ -8779,70 +8786,70 @@ if (debugLevel > -100) return true; // temporarily !
{0.05, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.06, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.06, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.06, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.06, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.06, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.06, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.06, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.06, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.06, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.06, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.08, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.08, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.08, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.08, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.08, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.08, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.08, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.08, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.08, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.08, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.1, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.1, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.1, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.1, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.1, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.1, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.1, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.1, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.1, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.1, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.13, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.13, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.13, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.13, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.13, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.13, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.13, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.13, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.13, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.13, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.16, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.16, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.16, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.16, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.16, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.16, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.16, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.16, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.16, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.16, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.2, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.2, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.2, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.2, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.2, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.2, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.2, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.2, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.2, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.2, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.25, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.25, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.25, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.25, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.25, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.25, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.25, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.25, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.25, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.25, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.3, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.3, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.3, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.3, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.3, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
......@@ -8885,16 +8892,16 @@ if (debugLevel > -100) return true; // temporarily !
{0.7, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.7, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.7, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.7, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.7, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
/*{0.8, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.8, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.8, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{0.8, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{0.8, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{0.8, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{0.8, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{0.8, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{0.8, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra*/
{0.8, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
{0.9, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{0.9, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
......@@ -8913,6 +8920,43 @@ if (debugLevel > -100) return true; // temporarily !
{1.0, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{1.0, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{1.0, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
*/
{1.3, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{1.3, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{1.3, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{1.3, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{1.3, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{1.3, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{1.3, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{1.3, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
{1.6, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{1.6, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{1.6, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{1.6, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{1.6, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{1.6, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{1.6, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{1.6, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
{2.0, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{2.0, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{2.0, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{2.0, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{2.0, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{2.0, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{2.0, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{2.0, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
{2.5, 0.0, 1.5, 1.4142, 0.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, inter
{2.5, 0.0, 1.5, 1.4142, 0.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors16, intra
{2.5, 0.0, 1.5, 1.4142, 3.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, inter
{2.5, 0.0, 1.5, 1.4142, 3.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors8, intra
{2.5, 0.0, 1.5, 1.4142, 2.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, inter
{2.5, 0.0, 1.5, 1.4142, 2.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors4, intra
{2.5, 0.0, 1.5, 1.4142, 1.0, 1.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, inter
{2.5, 0.0, 1.5, 1.4142, 1.0, 0.0}, // rnad = 0.06, fpn = 0.0, sigma = 1.5, offset = 1.0, sensors2, intra
};
System.out.println ("\n\n\n");
......@@ -8925,7 +8969,16 @@ if (debugLevel > -100) return true; // temporarily !
double offset = noise_task[numset][3];
int sensor_mode = (int) noise_task[numset][4];
boolean inter = noise_task[numset][5] > 0;
if (inter && !process_inter) {
System.out.println("Skipping set "+numset+" as it is inter and process_inter==false");
continue;
}
if (!inter && !process_intra) {
System.out.println("Skipping set "+numset+" as it is intra and process_intra==false");
continue;
}
int num_noise_variants = inter? num_noise_var_inter : num_noise_var_intra;
clt_parameters.img_dtt.mcorr_limit_sensors = sensor_mode;
clt_parameters.img_dtt.mcorr_all_multi = always_all_pairs || (sensor_mode != 0); // add "all pairs" for 2,4,8 sensors , but not for all 16 (mode 0)
clt_parameters.inp.noise.scale_random = noise_rnd;
......@@ -8953,30 +9006,63 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println ("\n\n\n");
System.out.println("\n******** Running with simulated noise, run "+(numset +1)+" of "+noise_task.length);
System.out.println ("sensor_mode = "+sensor_mode);
System.out.println ("all_pairs = "+clt_parameters.img_dtt.mcorr_all_multi);
System.out.println ("used_sensors = "+clt_parameters.inp.noise.used_sensors);
System.out.println ("noise_rnd = "+noise_rnd);
System.out.println ("noise_fpn = "+noise_fpn);
System.out.println ("sigma = "+ sigma);
System.out.println ("initial_offset = "+offset);
System.out.println ("inter = "+inter);
System.out.println ("sensor_mode = "+sensor_mode);
System.out.println ("all_pairs = "+clt_parameters.img_dtt.mcorr_all_multi);
System.out.println ("used_sensors = "+clt_parameters.inp.noise.used_sensors);
System.out.println ("noise_rnd = "+noise_rnd);
System.out.println ("noise_fpn = "+noise_fpn);
System.out.println ("sigma = "+ sigma);
System.out.println ("initial_offset = "+offset);
System.out.println ("inter = "+inter);
System.out.println ("num_noise_variants = "+num_noise_variants);
System.out.println ("\n\n\n");
intersceneNoise(
quadCLT_main, // QuadCLT quadCLT_main, // tiles should be set
clt_parameters, // CLTParameters clt_parameters,
debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
colorProcParameters, // ColorProcParameters colorProcParameters,
channelGainParameters, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters,
equirectangularParameters, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
properties, // Properties properties,
bayer_artifacts_debug, // boolean bayer_artifacts_debug,
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
debugLevel); // final int debugLevel)
if ((num_noise_variants <= 0) || ((noise_rnd == 0.0) && (noise_fpn == 0.0))) { // no need to generate multiple zero-noise
intersceneNoise(
quadCLT_main, // QuadCLT quadCLT_main, // tiles should be set
clt_parameters, // CLTParameters clt_parameters,
debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
colorProcParameters, // ColorProcParameters colorProcParameters,
channelGainParameters, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters,
equirectangularParameters, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
properties, // Properties properties,
bayer_artifacts_debug, // boolean bayer_artifacts_debug,
-1, // int noise_variant, // <0 - no-variants, compatible with old code
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
debugLevel); // final int debugLevel)
} else {
for (int noise_variant = 0; noise_variant < num_noise_variants; noise_variant++) {
System.out.println ("\n\n\n");
System.out.println("\n******** Running with simulated noise, run "+(numset +1)+" of "+noise_task.length+
", noise variant "+noise_variant+" (of "+num_noise_variants+")");
System.out.println ("sensor_mode = "+sensor_mode);
System.out.println ("all_pairs = "+clt_parameters.img_dtt.mcorr_all_multi);
System.out.println ("used_sensors = "+clt_parameters.inp.noise.used_sensors);
System.out.println ("noise_rnd = "+noise_rnd);
System.out.println ("noise_fpn = "+noise_fpn);
System.out.println ("sigma = "+ sigma);
System.out.println ("initial_offset = "+offset);
System.out.println ("inter = "+inter);
System.out.println ("\n\n\n");
intersceneNoise(
quadCLT_main, // QuadCLT quadCLT_main, // tiles should be set
clt_parameters, // CLTParameters clt_parameters,
debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
colorProcParameters, // ColorProcParameters colorProcParameters,
channelGainParameters, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters,
equirectangularParameters, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
properties, // Properties properties,
bayer_artifacts_debug, // boolean bayer_artifacts_debug,
noise_variant, // int noise_variant, // <0 - no-variants, compatible with old code
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
debugLevel); // final int debugLevel)
}
}
}
}
......@@ -8990,16 +9076,11 @@ if (debugLevel > -100) return true; // temporarily !
EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
Properties properties,
boolean bayer_artifacts_debug,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel) throws Exception
int noise_variant, // <0 - no-variants, compatible with old code
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel) throws Exception
{
// double [] noise_sigma_level = {0.01, 1.5, 1.0}; // amount, sigma, offset
// double [] noise_sigma_level = {0.1, 1.5, 1.0}; // amount, sigma, offset
// double [] noise_sigma_level = {1.0, 1.5, 1.0}; // amount, sigma, offset
// double [] noise_sigma_level = {3.0, 1.5, 1.0}; // amount, sigma, offset
// double [] noise_sigma_level = {5.0, 1.5, 1.0}; // amount, sigma, offset
// double [] noise_sigma_level = null;
NoiseParameters noise_sigma_level = null;
if ((clt_parameters.inp.noise.scale_random >= 0.0) || (clt_parameters.inp.noise.scale_fpn >= 0.0)) {// <0 - will generate no-noise data
if (quadCLT_main.getNumSensors() == 16) {
......@@ -9020,12 +9101,7 @@ if (debugLevel > -100) return true; // temporarily !
System.out.println ("Using "+clt_parameters.inp.noise.used_sensors+" of "+quadCLT_main.getNumSensors()+" sensors.");
}
noise_sigma_level = clt_parameters.inp.noise.clone();
/*
noise_sigma_level = new double[] {
clt_parameters.inp.noise_scale,
clt_parameters.inp.noise_sigma,
clt_parameters.inp.initial_offset}; // amount, sigma, offset\
*/
}
boolean ref_only = clt_parameters.inp.ref_only; // true; // process only reference frame (false - inter-scene)
if ((quadCLT_main != null) && (quadCLT_main.getGPU() != null)) {
......@@ -9047,6 +9123,7 @@ if (debugLevel > -100) return true; // temporarily !
clt_parameters,
colorProcParameters, //
noise_sigma_level, // double [] noise_sigma_level,
noise_variant, // int noise_variant, // <0 - no-variants, compatible with old code
null, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax,
clt_parameters.inp.noise_debug_level); // debugLevel);
......@@ -9062,6 +9139,9 @@ if (debugLevel > -100) return true; // temporarily !
"-noise-random_"+ noise_sigma_level.scale_random+
"-noise-fpn_"+ noise_sigma_level.scale_fpn+
"-sigma_"+noise_sigma_level.sigma;
if (noise_variant >=0) {
noisy_4slice_suffix += "-variant_"+noise_variant;
}
ref_quadCLT.genSave4sliceImage(
clt_parameters, // CLTParameters clt_parameters,
noisy_4slice_suffix, // String suffix,
......@@ -9104,6 +9184,7 @@ if (debugLevel > -100) return true; // temporarily !
colorProcParameters, // ColorProcParameters colorProcParameters,
ref_quadCLT, // QuadCLT [] scenes, // ordered by increasing timestamps
noise_sigma_level, // double [] noise_sigma_level,
noise_variant, // int noise_variant, // <0 - no-variants, compatible with old code
clt_parameters.inp.noise_debug_level); // clt_parameters.ofp.debug_level_optical - 1); // 1); // -1); // int debug_level);
}
System.out.println("End of intersceneNoise()");
......@@ -9311,6 +9392,45 @@ if (debugLevel > -100) return true; // temporarily !
"-results-rnd_1.0-fpn_0.0-sigma_1.5-offset1.4142-sensors4-nointer-nolma",
"-results-rnd_1.0-fpn_0.0-sigma_1.5-offset1.4142-sensors8-inter-nolma",
"-results-rnd_1.0-fpn_0.0-sigma_1.5-offset1.4142-sensors8-nointer-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors16-inter-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors16-nointer-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors2-inter-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors2-nointer-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors4-inter-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors4-nointer-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors8-inter-nolma",
"-results-rnd_1.3-fpn_0.0-sigma_1.5-offset1.4142-sensors8-nointer-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors16-inter-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors16-nointer-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors2-inter-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors2-nointer-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors4-inter-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors4-nointer-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors8-inter-nolma",
"-results-rnd_1.6-fpn_0.0-sigma_1.5-offset1.4142-sensors8-nointer-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors16-inter-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors16-nointer-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors2-inter-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors2-nointer-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors4-inter-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors4-nointer-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors8-inter-nolma",
"-results-rnd_2.0-fpn_0.0-sigma_1.5-offset1.4142-sensors8-nointer-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors16-inter-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors16-nointer-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors2-inter-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors2-nointer-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors4-inter-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors4-nointer-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors8-inter-nolma",
"-results-rnd_2.5-fpn_0.0-sigma_1.5-offset1.4142-sensors8-nointer-nolma",
/*
"-results-rnd_0.0-fpn_0.0-sigma_1.5-offset1.0-sensors16-inter",
"-results-rnd_0.0-fpn_0.0-sigma_1.5-offset1.0-sensors16-nointer",
......@@ -9627,7 +9747,7 @@ if (debugLevel > -100) return true; // temporarily !
String [] noise_files,
int debug_level)
{
int dbg_tile = 1222; // 737;
int dbg_tile = 829; // 828; // 1222; // 737;
/*
"disp-last",
......@@ -9652,19 +9772,41 @@ if (debugLevel > -100) return true; // temporarily !
double max_disparity = 30.0; // for max_err1
// double disp_rel_min = 0.5;
double disp_near_rel = 2.5;
double disp_max_rel = 0.25;
double disp_max_inter = 0.8;
double disp_far_abs = 1.0;
double disp_max_abs = 0.4;
double min_scenes_used = 0.5;
boolean use_edges = false; // true; // false; // do not filter out edges
boolean all_converge = false; // true; // false; // use only tiles that converge for all variants (intra, inter, used sensors)
boolean all_max_err = false; // true; // false; // use only tiles that have limited error for all variants (intra, inter, used sensors)
double disp_near_rel = 2.5;
double disp_max_rel = 0.25;
double disp_max_inter = 0.8;
double disp_far_abs = 1.0;
double disp_max_abs = 0.4;
double min_scenes_used = 0.5;
boolean use_edges = false; // true; // false; // do not filter out edges
boolean all_converge = false; // true; // false; // use only tiles that converge for all variants (intra, inter, used sensors)
boolean all_max_err = false; // true; // false; // use only tiles that have limited error for all variants (intra, inter, used sensors)
boolean same_num_sensors = true; // false; // true; // compare performance to same number of sensors, inter, no-noise
int min_modes = 4; // 5; // 6; // 5; // 4;//at least half are meaningfull
int min_modes = 4; // 5; // 6; // 5; // 4;//at least half are meaningfull
// LMA parameters
boolean useLinear = true;
double noise_offset = 0.05; // 0.1; // 0.03; // 0.10; // 0.03; // 50;
double n0 = 0.03;
boolean adjust_N0 = true;
boolean adjust_Gi = true;
boolean adjust_St = true; // false;
double min_inter16_noise_level = 0.10; // 0.3; // tile should have at least this noise level for 1nter16 (mode 0)
boolean zero_all_bad = true; // false; // true; // set noise_level to zero if all noise levels result in bad tiles
boolean all_inter = true; // tile has to be defined for all inter
boolean need_same_inter = true; // do not use intra sample if same inter is bad for all noise levels
double max_diff_from_ref = 0.20; // 0.06; // 5; // 0.1; // max_err1; // 0.25 pix
boolean use_fpn = false;
double max_diff_from_ref_range = 0.25*max_diff_from_ref; // trying to stay in linear
int max_diff_from_ref_steps = 21;
int range_outliers = 2;
int range_min_keep = 1; // emove less outliers if needed to keep this remain
double min_inter16_noise_level = 0.1; // 0.3; // tile should have at least this noise level for 1nter16 (mode 0)
if (use_edges) {
disp_max_rel = 100.0;
......@@ -9863,10 +10005,10 @@ if (debugLevel > -100) return true; // temporarily !
}
}
// For each file find boolean good/bad, comparing to zero noise of the same number of sensors, itnerscene
// For each file find boolean good/bad, comparing to zero noise of the same number of sensors, interscene
boolean [][] good_file_tile = new boolean[noise_files.length][]; // [good_tiles.length];
boolean [][][] good_file_tile_range = new boolean[noise_files.length][][]; // [good_tiles.length];
// double max_err1 =0.25; // pix
double max_diff_from_ref = 0.2; // 0.06; // 5; // 0.1; // max_err1; // 0.25 pix
for (int nf = 0; nf < noise_files.length; nf++) {
// common or per number of sensors reference data
String fn = noise_files[nf];
......@@ -9878,6 +10020,7 @@ if (debugLevel > -100) return true; // temporarily !
null); // int [] wh);
// boolean [] good_ref = good_tiles_mode[sensor_mode]; // good tile without noise for this number of sensors
good_file_tile[nf] = good_tiles_mode[sensor_mode].clone();
good_file_tile_range[nf] = new boolean [good_tiles_mode[sensor_mode].length][];
for (int ntile = 0; ntile < good_file_tile[nf].length; ntile++) if (good_file_tile[nf][ntile]) {
if (ntile == dbg_tile) {
System.out.println("Finding good tiles: ntile = "+ntile+", nf="+nf+" ("+fn+")");
......@@ -9891,16 +10034,30 @@ if (debugLevel > -100) return true; // temporarily !
good_file_tile[nf][ntile] = false;
continue;
}
good_file_tile[nf][ntile] = (Math.abs(noise_dsn[indx_last][ntile] - ref_var[indx_last][ntile]) < max_diff_from_ref);
good_file_tile_range[nf][ntile] = new boolean[max_diff_from_ref_steps];
boolean has_good = false;
for (int stp = 0; stp < max_diff_from_ref_steps; stp++) {
double thresh = max_diff_from_ref + max_diff_from_ref_range * (2 *stp - max_diff_from_ref_steps + 1)/(max_diff_from_ref_steps-1);
boolean is_good = (Math.abs(noise_dsn[indx_last][ntile] - ref_var[indx_last][ntile]) < thresh);
good_file_tile_range[nf][ntile][stp] = is_good;
has_good |= is_good;
}
if (!has_good) {
good_file_tile_range[nf][ntile] = null; // all bad
}
/*
boolean good_tiles_this = (Math.abs(noise_dsn[indx_last][ntile] - ref_var[indx_last][ntile]) < max_diff_from_ref);
if (!good_tiles_this) {
good_file_tile[nf][ntile] = false;
continue;
}
*/
}
}
// show number of noise values for each tile, num sensors and intra/inter, discarding tiles that are good/bad for all noise levels
{
boolean use_fpn = false;
// show number of noise values for each tile, num sensors and intra/inter, discarding tiles that are good/bad for all noise levels
double [][] dbg_num_noise_val = new double [good_tiles_mode.length*2][good_tiles.length];
String [] dbg_num_noise_titles = new String [dbg_num_noise_val.length];
for (int i = 0; i < good_tiles_mode.length; i++) {
......@@ -9914,7 +10071,7 @@ if (debugLevel > -100) return true; // temporarily !
if (ntile == dbg_tile) {
System.out.println("Finding good tiles: ntile = "+ntile);
}
if (good_tiles[ntile]) { // do not bother with obviously bad
int [] num_good = new int [dbg_num_noise_val.length];
boolean [] has_bad = new boolean [dbg_num_noise_val.length];
......@@ -9948,21 +10105,77 @@ if (debugLevel > -100) return true; // temporarily !
true,
"num_noise_levels",
dbg_num_noise_titles);
for (int i = 00; i < dbg_num_noise_val.length; i++) {
Arrays.fill(dbg_num_noise_val[i], Double.NaN);
}
for (int ntile = 0; ntile < good_tiles.length; ntile++) {
if (ntile == dbg_tile) {
System.out.println("Finding good tiles: ntile = "+ntile);
}
if (good_tiles[ntile]) { // do not bother with obviously bad
int [] num_good = new int [dbg_num_noise_val.length];
boolean [] has_bad = new boolean [dbg_num_noise_val.length];
for (int nf = 0; nf < noise_files.length; nf++) {
int results_index = sensor_mode_file[nf] + (inter_file[nf]? 0 : 4); // inter; // ? 0 : (intra? 1 : 2);
if (good_file_tile_range[nf][ntile] != null) {
for (int stp = 0; stp < good_file_tile_range[nf][ntile].length; stp++) {
if (good_file_tile_range[nf][ntile][stp]) {
num_good[results_index]++;
} else {
has_bad[results_index] = true;
}
}
} else {
has_bad[results_index] = true;
}
}
// only keep tiles that have noise threshold for all modalities
int num_full = 0;
for (int i = 0; i < dbg_num_noise_val.length; i++) {
if (has_bad[i] && (num_good[i] > 0)) {
num_full++;
}
}
if (num_full < min_modes) {
continue;
}
for (int i = 0; i < dbg_num_noise_val.length; i++) if (has_bad[i]) {
dbg_num_noise_val[i][ntile] = num_good[i];
}
}
}
(new ShowDoubleFloatArrays()).showArrays(
dbg_num_noise_val,
tilesX,
good_tiles.length/ tilesX,
true,
"num_noise_levels_range",
dbg_num_noise_titles);
double [] noise_file = use_fpn ? noise_fpn_file : noise_rnd_file;
double [][] noise_levels = InterIntraLMA.getNoiseThreshold(
double [][] noise_levels0 = InterIntraLMA.getNoiseThreshold(
noise_file, // double [] noise_file, // = new double [noise_files.length];
sensor_mode_file, // int [] sensor_mode_file,
inter_file, // boolean [] inter_file,
good_file_tile, // boolean [][] good_file_tile,
min_inter16_noise_level, // double min_inter16_noise_level,
min_modes); // int min_modes,
min_modes, // int min_modes,
zero_all_bad, // boolean zero_all_bad = true; // set noise_level to zero if all noise levels result in bad tiles
all_inter, // boolean all_inter = true; // tile has to be defined for all inter
need_same_inter, // boolean need_same_inter = true; // do not use intra sample if same inter is bad for all noise levels
dbg_tile); // int dbg_tile);
double [][] dbg_noise_levels = new double [dbg_num_noise_titles.length][good_tiles.length];
for (int i = 0; i < dbg_noise_levels.length; i++) {
Arrays.fill(dbg_noise_levels[i], Double.NaN);
}
for (int ntile = 0; ntile <noise_levels.length; ntile++) if (noise_levels[ntile] != null){
for (int i = 0; i < noise_levels[ntile].length; i++) {
dbg_noise_levels[i][ntile] = noise_levels[ntile][i];
for (int ntile = 0; ntile <noise_levels0.length; ntile++) if (noise_levels0[ntile] != null){
for (int i = 0; i < noise_levels0[ntile].length; i++) {
dbg_noise_levels[i][ntile] = noise_levels0[ntile][i];
}
}
(new ShowDoubleFloatArrays()).showArrays(
......@@ -9972,16 +10185,70 @@ if (debugLevel > -100) return true; // temporarily !
true,
"noise_levels",
dbg_num_noise_titles);
double noise_offset = 0.03; // 0.10; // 0.03; // 50;
{
// int dbg_tile = 828;
for (int mode = 0; mode < 8; mode++) {
for (int nf = 0; nf < noise_files.length; nf++) if(good_file_tile_range[nf] !=null){ // always
int mode_file = sensor_mode_file[nf] + (inter_file[nf]? 0 : 4); // inter; // ? 0 : (intra? 1 : 2);
if (mode_file == mode) {
double noise_rnd = noise_rnd_file[nf];
if (good_file_tile_range[nf][dbg_tile] != null) {
String s = "";
for (int i = 0; i < good_file_tile_range[nf][dbg_tile].length; i++) {
s += good_file_tile_range[nf][dbg_tile][i]? " + ": " - ";
}
System.out.println(String.format("%1d:%3d %6.4f %s", mode, nf, noise_rnd, s));
} else {
System.out.println(String.format("%1d:%3d %6.4f", mode, nf, noise_rnd));
}
}
}
}
}
double [][] noise_levels = InterIntraLMA.getNoiseThreshold(
noise_file, // double [] noise_file, // = new double [noise_files.length];
sensor_mode_file, // int [] sensor_mode_file,
inter_file, // boolean [] inter_file,
range_outliers, // int outliers, // may need do modify algorithm to avoid bias - removing same side (densier) outliers
range_min_keep, // int min_keep, // remove less outliers if needed to keep this remain
good_file_tile_range, // boolean [][][] good_file_tile_range,
min_inter16_noise_level, // double min_inter16_noise_level,
min_modes+0, // int min_modes,
zero_all_bad, // boolean zero_all_bad = true; // set noise_level to zero if all noise levels result in bad tiles
all_inter, // boolean all_inter = true; // tile has to be defined for all inter
need_same_inter, // boolean need_same_inter = true; // do not use intra sample if same inter is bad for all noise levels
dbg_tile); // int dbg_tile);
double [][] dbg_noise_levels_range = new double [dbg_num_noise_titles.length][good_tiles.length];
for (int i = 0; i < dbg_noise_levels_range.length; i++) {
Arrays.fill(dbg_noise_levels_range[i], Double.NaN);
}
for (int ntile = 0; ntile <noise_levels.length; ntile++) if (noise_levels[ntile] != null){
for (int i = 0; i < noise_levels[ntile].length; i++) {
dbg_noise_levels_range[i][ntile] = noise_levels[ntile][i];
}
}
(new ShowDoubleFloatArrays()).showArrays(
dbg_noise_levels_range,
tilesX,
good_tiles.length/ tilesX,
true,
"noise_levels_range",
dbg_num_noise_titles);
InterIntraLMA interIntraLMA = new InterIntraLMA(
useLinear, // boolean useLinear,
noise_levels, // double [][] noise_thresh,
noise_offset, // double offset, // initial value for N0
noise_offset, // double offset // for "relative" noise
n0 , // double n0, // initial value for N0
tilesX, // int tilesX, // debug images only
1); // int debug_level)
boolean adjust_N0 = true;
boolean adjust_Gi = true;
boolean adjust_St = true; // false;
boolean LMA_OK = interIntraLMA.runLma(
adjust_N0, // boolean adjust_N0,
......@@ -9992,7 +10259,7 @@ if (debugLevel > -100) return true; // temporarily !
8.0, // double lambda_scale_bad, // 8.0
100, // double lambda_max, // 100
0.001, // double rms_diff, // 0.001
20, // int num_iter, // 20
30, // int num_iter, // 20
2); // 0); // int debug_level)
System.out.println("LMA_OK = "+LMA_OK);
......
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