Commit 3ca96c86 authored by Andrey Filippov's avatar Andrey Filippov

Converte conditioning to multithreaded, started noise comparison

parent 5b919b27
...@@ -720,8 +720,10 @@ private Panel panel1, ...@@ -720,8 +720,10 @@ private Panel panel1,
addButton("Inter Accumulate", panelClt5, color_process); addButton("Inter Accumulate", panelClt5, color_process);
addButton("Aux Inter Accumulate", panelClt5, color_process); addButton("Aux Inter Accumulate", panelClt5, color_process);
addButton("Inter Noise", panelClt5, color_process); addButton("Inter Noise", panelClt5, color_process);
addButton("Inter Noise Aux", panelClt5, color_process);
addButton("Inter Debug Noise", panelClt5, color_report); addButton("Inter Debug Noise", panelClt5, color_report);
addButton("Noise Stats", panelClt5, color_process); addButton("Noise Stats", panelClt5, color_process);
addButton("Noise Stats Aux", panelClt5, color_process);
addButton("Test 1D", panelClt5, color_process); addButton("Test 1D", panelClt5, color_process);
addButton("Colorize Depth", panelClt5, color_process); addButton("Colorize Depth", panelClt5, color_process);
plugInFrame.add(panelClt5); plugInFrame.add(panelClt5);
...@@ -5203,15 +5205,23 @@ private Panel panel1, ...@@ -5203,15 +5205,23 @@ private Panel panel1,
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true; CLT_PARAMETERS.batch_run = true;
intersceneNoise(false); // boolean bayer_artifacts_debug); intersceneNoise(false, false); // boolean bayer_artifacts_debug);
return; return;
/* ======================================================================== */
} else if (label.equals("Inter Noise Aux")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
intersceneNoise(true, false); // boolean bayer_artifacts_debug);
return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Inter Debug Noise")) { } else if (label.equals("Inter Debug Noise")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true; CLT_PARAMETERS.batch_run = true;
intersceneNoise(true); // boolean bayer_artifacts_debug); intersceneNoise(false, true); // boolean bayer_artifacts_debug);
return; return;
/* ======================================================================== */ /* ======================================================================== */
...@@ -5219,8 +5229,17 @@ private Panel panel1, ...@@ -5219,8 +5229,17 @@ private Panel panel1,
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL); EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true; CLT_PARAMETERS.batch_run = true;
intersceneNoiseStats(); intersceneNoiseStats(false);
return;
/* ======================================================================== */
} else if (label.equals("Noise Stats Aux")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
intersceneNoiseStats(true);
return; return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Colorize Depth")) { } else if (label.equals("Colorize Depth")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
...@@ -7095,7 +7114,9 @@ private Panel panel1, ...@@ -7095,7 +7114,9 @@ private Panel panel1,
return true; return true;
} }
public boolean intersceneNoise(boolean bayer_artifacts_debug) { public boolean intersceneNoise(
boolean use_aux,
boolean bayer_artifacts_debug) {
long startTime=System.nanoTime(); long startTime=System.nanoTime();
// load needed sensor and kernels files // load needed sensor and kernels files
if (!prepareRigImages()) return false; if (!prepareRigImages()) return false;
...@@ -7105,7 +7126,7 @@ private Panel panel1, ...@@ -7105,7 +7126,7 @@ private Panel panel1,
if (DEBUG_LEVEL > -2){ if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++"); System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++");
} }
/*
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
...@@ -7132,15 +7153,62 @@ private Panel panel1, ...@@ -7132,15 +7153,62 @@ private Panel panel1,
QUAD_CLT.setGPU(GPU_QUAD); QUAD_CLT.setGPU(GPU_QUAD);
} }
} }
*/
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) {
try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu);
} catch (Exception e) {
System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
}
if (use_aux) {
if (CLT_PARAMETERS.useGPU(true) && (QUAD_CLT_AUX != null) && (GPU_QUAD_AUX == null)) { // if GPU AUX is needed
try {
GPU_QUAD_AUX = new GpuQuad(//
GPU_TILE_PROCESSOR, QUAD_CLT_AUX,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
QUAD_CLT_AUX.setGPU(GPU_QUAD_AUX);
}
} else {
if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed
try {
GPU_QUAD = new GpuQuad(
GPU_TILE_PROCESSOR, QUAD_CLT,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
QUAD_CLT.setGPU(GPU_QUAD);
}
}
}
QuadCLT quadCLT = use_aux ? QUAD_CLT_AUX : QUAD_CLT;
ColorProcParameters colorProcParameters = use_aux ? COLOR_PROC_PARAMETERS_AUX : COLOR_PROC_PARAMETERS;
try { try {
TWO_QUAD_CLT.intersceneNoise( TWO_QUAD_CLT.intersceneNoise(
QUAD_CLT, // QuadCLT quadCLT_main, quadCLT, // QuadCLT quadCLT_main,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters, DEBAYER_PARAMETERS, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters, colorProcParameters, // EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters, CHANNEL_GAINS_PARAMETERS, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters, RGB_PARAMETERS, // EyesisCorrectionParameters.RGBParameters rgbParameters,
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
...@@ -7164,7 +7232,7 @@ private Panel panel1, ...@@ -7164,7 +7232,7 @@ private Panel panel1,
return true; return true;
} }
public boolean intersceneNoiseStats() { public boolean intersceneNoiseStats(boolean use_aux) {
long startTime=System.nanoTime(); long startTime=System.nanoTime();
// load needed sensor and kernels files // load needed sensor and kernels files
if (!prepareRigImages()) return false; if (!prepareRigImages()) return false;
...@@ -7174,7 +7242,7 @@ private Panel panel1, ...@@ -7174,7 +7242,7 @@ private Panel panel1,
if (DEBUG_LEVEL > -2){ if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++"); System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++");
} }
/*
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
...@@ -7201,13 +7269,60 @@ private Panel panel1, ...@@ -7201,13 +7269,60 @@ private Panel panel1,
QUAD_CLT.setGPU(GPU_QUAD); QUAD_CLT.setGPU(GPU_QUAD);
} }
} }
*/
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) {
try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu);
} catch (Exception e) {
System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
}
if (use_aux) {
if (CLT_PARAMETERS.useGPU(true) && (QUAD_CLT_AUX != null) && (GPU_QUAD_AUX == null)) { // if GPU AUX is needed
try {
GPU_QUAD_AUX = new GpuQuad(//
GPU_TILE_PROCESSOR, QUAD_CLT_AUX,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
QUAD_CLT_AUX.setGPU(GPU_QUAD_AUX);
}
} else {
if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed
try {
GPU_QUAD = new GpuQuad(
GPU_TILE_PROCESSOR, QUAD_CLT,
4,
3);
} catch (Exception e) {
System.out.println("Failed to initialize GpuQuad class");
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} //final int debugLevel);
QUAD_CLT.setGPU(GPU_QUAD);
}
}
}
QuadCLT quadCLT = use_aux ? QUAD_CLT_AUX : QUAD_CLT;
ColorProcParameters colorProcParameters = use_aux ? COLOR_PROC_PARAMETERS_AUX : COLOR_PROC_PARAMETERS;
try { try {
TWO_QUAD_CLT.intersceneNoiseStats( TWO_QUAD_CLT.intersceneNoiseStats(
QUAD_CLT, // QuadCLT quadCLT_main, quadCLT, // QUAD_CLT, // QuadCLT quadCLT_main,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters, CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters, DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters, colorProcParameters, // COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters, CHANNEL_GAINS_PARAMETERS, //CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters, RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters, EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
......
...@@ -16693,8 +16693,6 @@ public class ImageDttCPU { ...@@ -16693,8 +16693,6 @@ public class ImageDttCPU {
final int width, final int width,
final TpTask [] tp_tasks, final TpTask [] tp_tasks,
final TpTask [] tp_tasks_target, // null or wider array to provide target disparity for neighbors final TpTask [] tp_tasks_target, // null or wider array to provide target disparity for neighbors
// final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
// final double disparity_corr, // apply to disparity array data only, tp_tasks are already corrected
final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// dcorr_td should be either null, or double [tp_tasks.length][][]; // dcorr_td should be either null, or double [tp_tasks.length][][];
final double [][][][] dcorr_td, // [tile][pair][4][64] sparse by pair transform domain representation of corr pairs final double [][][][] dcorr_td, // [tile][pair][4][64] sparse by pair transform domain representation of corr pairs
...@@ -16703,9 +16701,6 @@ public class ImageDttCPU { ...@@ -16703,9 +16701,6 @@ public class ImageDttCPU {
final GeometryCorrection geometryCorrection, final GeometryCorrection geometryCorrection,
final int kernel_step, final int kernel_step,
final int window_type, final int window_type,
// final double disparity_corr, should be aapplied to tp_tasks already!
final double corr_red, final double corr_red,
final double corr_blue, final double corr_blue,
// related to tilt // related to tilt
......
...@@ -2017,7 +2017,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -2017,7 +2017,7 @@ public class QuadCLT extends QuadCLTCPU {
true); //newAllowed, // save true); //newAllowed, // save
String file_name = image_name + suffix; String file_name = image_name + suffix;
String file_path = x3d_path + Prefs.getFileSeparator() + file_name + ".tiff"; String file_path = x3d_path + Prefs.getFileSeparator() + file_name + ".tiff";
if (getGPU().getQuadCLT() != this) { if ((getGPU() != null) && (getGPU().getQuadCLT() != this)) {
getGPU().updateQuadCLT(this); // to re-load new set of Bayer images to the GPU getGPU().updateQuadCLT(this); // to re-load new set of Bayer images to the GPU
} }
...@@ -2034,8 +2034,8 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -2034,8 +2034,8 @@ public class QuadCLT extends QuadCLTCPU {
threadsMax, // final int threadsMax, // maximal number of threads to launch threadsMax, // final int threadsMax, // maximal number of threads to launch
false, // final boolean updateStatus, false, // final boolean updateStatus,
debugLevel); // final int debugLevel); debugLevel); // final int debugLevel);
FileSaver fs=new FileSaver(img_noise); // FileSaver fs=new FileSaver(img_noise); // is null, will be saved inside to /home/elphel/lwir16-proc/proc1/results_cuda/1626032208_613623-AUX-SHIFTED-D0.0
fs.saveAsTiff(file_path); // fs.saveAsTiff(file_path);
} }
public ImagePlus processCLTQuadCorrGPU( public ImagePlus processCLTQuadCorrGPU(
...@@ -2054,7 +2054,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -2054,7 +2054,7 @@ public class QuadCLT extends QuadCLTCPU {
if (gpuQuad == null) { if (gpuQuad == null) {
System.out.println("GPU instance is not initialized, using CPU mode"); System.out.println("GPU instance is not initialized, using CPU mode");
processCLTQuadCorrCPU( processCLTQuadCorrCPU(
imp_quad, // ImagePlus [] imp_quad, // should have properties "name"(base for saving results), "channel","path" // imp_quad, // ImagePlus [] imp_quad, // should have properties "name"(base for saving results), "channel","path"
saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null // Not needed use this.saturation_imp saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null // Not needed use this.saturation_imp
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
......
...@@ -9329,7 +9329,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -9329,7 +9329,7 @@ if (debugLevel > -100) return true; // temporarily !
if (updateStatus) IJ.showStatus("CPU: Rendering 4 image set (disparity = 0) for "+quadCLT_main.image_name+ "and a thumb nail"); if (updateStatus) IJ.showStatus("CPU: Rendering 4 image set (disparity = 0) for "+quadCLT_main.image_name+ "and a thumb nail");
quadCLT_main.processCLTQuadCorrCPU( // returns ImagePlus, but it already should be saved/shown quadCLT_main.processCLTQuadCorrCPU( // returns ImagePlus, but it already should be saved/shown
imp_srcs_main, // [srcChannel], // should have properties "name"(base for saving results), "channel","path" // imp_srcs_main, // [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp_main, // boolean [][] saturation_imp, // (near) saturated pixels or null saturation_imp_main, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters, clt_parameters,
debayerParameters, debayerParameters,
...@@ -9469,8 +9469,10 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -9469,8 +9469,10 @@ if (debugLevel > -100) return true; // temporarily !
} else { // if (quadCLT_main.correctionsParameters.clt_batch_explore) { } else { // if (quadCLT_main.correctionsParameters.clt_batch_explore) {
int num_restored = 0; int num_restored = 0;
try { try {
num_restored = quadCLT_main.restoreDSI(DSI_MAIN_SUFFIX, // "-DSI_COMBO", "-DSI_MAIN" num_restored = quadCLT_main.restoreDSI(
dsi); DSI_MAIN_SUFFIX, // "-DSI_COMBO", "-DSI_MAIN"
dsi,
false);
} catch (Exception e) { } catch (Exception e) {
...@@ -9622,7 +9624,7 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -9622,7 +9624,7 @@ if (debugLevel > -100) return true; // temporarily !
if (updateStatus) IJ.showStatus("Rendering 4 AUX image set (disparity = 0) for "+quadCLT_aux.image_name); if (updateStatus) IJ.showStatus("Rendering 4 AUX image set (disparity = 0) for "+quadCLT_aux.image_name);
quadCLT_aux.processCLTQuadCorrCPU( // returns ImagePlus, but it already should be saved/shown quadCLT_aux.processCLTQuadCorrCPU( // returns ImagePlus, but it already should be saved/shown
imp_srcs_aux, // [srcChannel], // should have properties "name"(base for saving results), "channel","path" // imp_srcs_aux, // [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp_aux, // boolean [][] saturation_imp, // (near) saturated pixels or null saturation_imp_aux, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters, clt_parameters,
debayerParameters, debayerParameters,
...@@ -9674,7 +9676,9 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -9674,7 +9676,9 @@ if (debugLevel > -100) return true; // temporarily !
dsi[DSI_DISPARITY_AUX_LMA] = aux_last_scan[2]; dsi[DSI_DISPARITY_AUX_LMA] = aux_last_scan[2];
// quadCLT_main.saveDSIMain (dsi); // quadCLT_main.saveDSIMain (dsi);
quadCLT_aux.saveDSIAll (dsi); quadCLT_aux.saveDSIAll (
"-DSI_MAIN", // String suffix, // "-DSI_MAIN"
dsi);
if (clt_parameters.rig.ml_copyJP4) { if (clt_parameters.rig.ml_copyJP4) {
copyJP4src( copyJP4src(
set_name, // String set_name set_name, // String set_name
......
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