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, ...@@ -7255,6 +7255,7 @@ private Panel panel1,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters, EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES, // Properties properties, PROPERTIES, // Properties properties,
bayer_artifacts_debug, // boolean bayer_artifacts_debug 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 THREADS_MAX, // final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, // final boolean updateStatus, UPDATE_STATUS, // final boolean updateStatus,
DEBUG_LEVEL); DEBUG_LEVEL);
......
...@@ -3168,8 +3168,7 @@ public class OpticalFlow { ...@@ -3168,8 +3168,7 @@ public class OpticalFlow {
ColorProcParameters colorProcParameters, ColorProcParameters colorProcParameters,
QuadCLT.SetChannels [] set_channels, QuadCLT.SetChannels [] set_channels,
QuadCLT ref_scene, // ordered by increasing timestamps QuadCLT ref_scene, // ordered by increasing timestamps
// double [] NoiseParameters noise_sigma_level, // only comes with no-noise here
NoiseParameters noise_sigma_level,
int debug_level int debug_level
) )
{ {
...@@ -3197,7 +3196,8 @@ public class OpticalFlow { ...@@ -3197,7 +3196,8 @@ public class OpticalFlow {
scene_names[i], scene_names[i],
clt_parameters, clt_parameters,
colorProcParameters, // 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 ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax, threadsMax,
-1); // debug_level); -1); // debug_level);
...@@ -3774,6 +3774,7 @@ public class OpticalFlow { ...@@ -3774,6 +3774,7 @@ public class OpticalFlow {
QuadCLT ref_scene, // ordered by increasing timestamps QuadCLT ref_scene, // ordered by increasing timestamps
// double [] // double []
NoiseParameters noise_sigma_level, NoiseParameters noise_sigma_level,
int noise_variant, // <0 - no-variants, compatible with old code
int debug_level int debug_level
) )
{ {
...@@ -3792,6 +3793,7 @@ public class OpticalFlow { ...@@ -3792,6 +3793,7 @@ public class OpticalFlow {
clt_parameters, clt_parameters,
colorProcParameters, // colorProcParameters, //
noise_sigma_level, // double [] noise_sigma_level, 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 ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax, threadsMax,
-1); // debug_level); -1); // debug_level);
...@@ -3832,7 +3834,7 @@ public class OpticalFlow { ...@@ -3832,7 +3834,7 @@ public class OpticalFlow {
} }
} else { } 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, "-results-nonoise" + (read_nonoise_lma?"-lma":"-nolma"), // String suffix,
combo_dsn_titles.length - 1, // 4 combo_dsn_titles.length - 1, // 4
null); // int [] wh); null); // int [] wh);
...@@ -3845,7 +3847,7 @@ public class OpticalFlow { ...@@ -3845,7 +3847,7 @@ public class OpticalFlow {
final int margin = 8; final int margin = 8;
final int tilesX = ref_scene.getTileProcessor().getTilesX(); final int tilesX = ref_scene.getTileProcessor().getTilesX();
final int tilesY = ref_scene.getTileProcessor().getTilesY(); final int tilesY = ref_scene.getTileProcessor().getTilesY();
if (debug_level > -1) { if (debug_level > 0) {
int extra = 10; // pixels around largest outline int extra = 10; // pixels around largest outline
int scale = 4; int scale = 4;
...@@ -4011,6 +4013,12 @@ public class OpticalFlow { ...@@ -4011,6 +4013,12 @@ public class OpticalFlow {
//rslt_suffix +="-mask"+clt_parameters.img_dtt.dbg_pair_mask; //rslt_suffix +="-mask"+clt_parameters.img_dtt.dbg_pair_mask;
} }
rslt_suffix += (clt_parameters.correlate_lma?"-lma":"-nolma"); 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( ref_scene.saveDoubleArrayInModelDirectory(
rslt_suffix, // String suffix, rslt_suffix, // String suffix,
refine_titles, // null, // String [] labels, // or null refine_titles, // null, // String [] labels, // or null
......
...@@ -224,6 +224,7 @@ public class QuadCLTCPU { ...@@ -224,6 +224,7 @@ public class QuadCLTCPU {
double [][][][][][] getCltKernels() { double [][][][][][] getCltKernels() {
return clt_kernels; return clt_kernels;
} }
@Deprecated
public QuadCLT spawnQuadCLTWithNoise( public QuadCLT spawnQuadCLTWithNoise(
String set_name, String set_name,
CLTParameters clt_parameters, CLTParameters clt_parameters,
...@@ -239,6 +240,7 @@ public class QuadCLTCPU { ...@@ -239,6 +240,7 @@ public class QuadCLTCPU {
clt_parameters, clt_parameters,
colorProcParameters, colorProcParameters,
noise_sigma_level, // double [] noise_sigma_level, 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 ref_scene, // QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
threadsMax, threadsMax,
debugLevel); debugLevel);
...@@ -246,6 +248,32 @@ public class QuadCLTCPU { ...@@ -246,6 +248,32 @@ public class QuadCLTCPU {
return quadCLT; 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( public QuadCLT spawnQuadCLT(
String set_name, String set_name,
...@@ -285,7 +313,8 @@ public class QuadCLTCPU { ...@@ -285,7 +313,8 @@ public class QuadCLTCPU {
clt_parameters, clt_parameters,
colorProcParameters, colorProcParameters,
null, // double [] noise_sigma_level, 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, threadsMax,
debugLevel); debugLevel);
...@@ -611,14 +640,11 @@ public class QuadCLTCPU { ...@@ -611,14 +640,11 @@ public class QuadCLTCPU {
return rgba; return rgba;
} }
public QuadCLTCPU restoreFromModel( public QuadCLTCPU restoreFromModel(
CLTParameters clt_parameters, CLTParameters clt_parameters,
ColorProcParameters colorProcParameters, ColorProcParameters colorProcParameters,
// double []
NoiseParameters noise_sigma_level, NoiseParameters noise_sigma_level,
int noise_variant, // <0 - no-variants, compatible with old code
QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0 QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
int threadsMax, int threadsMax,
int debugLevel) int debugLevel)
...@@ -661,6 +687,7 @@ public class QuadCLTCPU { ...@@ -661,6 +687,7 @@ public class QuadCLTCPU {
"-NOISE", "-NOISE",
ref_scene, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0 ref_scene, // final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
noise_sigma_level, noise_sigma_level,
noise_variant, //final int noise_variant, // <0 - no-variants, compatible with old code
threadsMax, threadsMax,
1); // debugLevel); // final int debug_level) 1); // debugLevel); // final int debug_level)
} }
...@@ -691,16 +718,17 @@ public class QuadCLTCPU { ...@@ -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 // 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( public void generateAddNoise(
final String suffix, final String suffix_novar,
final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0 final QuadCLTCPU ref_scene, // may be null if scale_fpn <= 0
// final double []
final NoiseParameters noise_sigma_level, final NoiseParameters noise_sigma_level,
final int noise_variant, // <0 - no-variants, compatible with old code
final int threadsMax, final int threadsMax,
final int debug_level) final int debug_level)
{ {
final double scale_random = noise_sigma_level.scale_random; // _sigma_level[0]; 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 scale_fpn = noise_sigma_level.scale_fpn; // noise_sigma_level[0];
final double sigma = noise_sigma_level.sigma; // [1]; final double sigma = noise_sigma_level.sigma; // [1];
final String suffix = suffix_novar + ((noise_variant >= 0) ? ("-"+noise_variant+"-"):"");
ImagePlus imp = generateAddNoise( ImagePlus imp = generateAddNoise(
suffix, // final String suffix, suffix, // final String suffix,
sigma, // final double sigma, sigma, // final double sigma,
......
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