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);
......
......@@ -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,
......
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