Commit 182ed7f3 authored by Andrey Filippov's avatar Andrey Filippov

implementing non-quad 2D correlation (CPU)

parent 5bdb59ce
......@@ -158,6 +158,9 @@ public class CLTParameters {
public double fine_corr_y_2 = 0.0; // additionally shift image in port 2 in y direction
public double fine_corr_x_3 = 0.0; // additionally shift image in port 3 in x direction
public double fine_corr_y_3 = 0.0; // additionally shift image in port 3 in y direction
// public double [][] fine_corr_xy;
public boolean fine_corr_ignore = false; // Ignore manual pixel correction
public boolean fine_corr_apply = true; // Apply and set to ignore manual pixel correction after extrinsics correction
......
......@@ -1221,7 +1221,9 @@ public class EyesisDCT {
if (this.correctionsParameters.deconvolve) { // process with DCT, otherwise use simple debayer
ImageDtt image_dtt = new ImageDtt(
4, // 4 sensors, will not be used here
dctParameters.dct_size,
null, // FIXME: needs ImageDttParameters (clt_parameters.img_dtt),
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
......
......@@ -3113,7 +3113,9 @@ private Panel panel1,
}
ImageDtt image_dtt = new ImageDtt(
4, // number of sensors - not used here ?
DCT_PARAMETERS.dct_size,
null, // FIXME: needs ImageDttParameters (clt_parameters.img_dtt),
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
......@@ -3215,10 +3217,12 @@ private Panel panel1,
}
ImageDtt image_dtt = new ImageDtt(
4, // number of sensors - not used here ?
DCT_PARAMETERS.dct_size,
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
null, // FIXME: needs ImageDttParameters (clt_parameters.img_dtt),
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
double [][][][] dctdc_data = image_dtt.mdctStack(
DBG_IMP.getStack(),
DCT_PARAMETERS.kernel_chn,
......@@ -3309,7 +3313,7 @@ private Panel panel1,
EYESIS_DCT.showKernels(); // show restored kernels
}
}
EYESIS_DCT.processDCTChannelImages(
EYESIS_DCT.processDCTChannelImages( // hard-wired 4 sensors!
DCT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
NONLIN_PARAMETERS, //EyesisCorrectionParameters.NonlinParameters nonlinParameters,
......@@ -4729,7 +4733,8 @@ private Panel panel1,
}
///========================================
System.out.println("***** QUAD_CLT.cltDisparityScans() is removed");
/*
QUAD_CLT.cltDisparityScans(
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
......@@ -4740,7 +4745,7 @@ private Panel panel1,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL); //final int debugLevel);
*/
if (configPath!=null) {
saveTimestampedProperties( // save config again
configPath, // full path or null
......@@ -8074,10 +8079,12 @@ private Panel panel1,
}
ImageDtt image_dtt = new ImageDtt(
4, // number of sensors - not used here ?
CLT_PARAMETERS.transform_size,
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
CLT_PARAMETERS.img_dtt,
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
double [][][][][] clt_data = image_dtt.cltStack(
DBG_IMP.getStack(),
0, // CLT_PARAMETERS.kernel_chn,
......@@ -8208,7 +8215,9 @@ private Panel panel1,
}
String suffix = "-dx_"+(CLT_PARAMETERS.ishift_x+CLT_PARAMETERS.shift_x)+"_dy_"+(CLT_PARAMETERS.ishift_y+CLT_PARAMETERS.shift_y);
ImageDtt image_dtt = new ImageDtt(
4, // number of sensors
CLT_PARAMETERS.transform_size,
CLT_PARAMETERS.img_dtt,
COLOR_PROC_PARAMETERS.isMonochrome(),
COLOR_PROC_PARAMETERS.isLwir(),
CLT_PARAMETERS.getScaleStrength(false)); // Bayer, not monochrome
......
......@@ -35,6 +35,7 @@ public class Clt1d {
public int transform_size = 8;
int transform_len = 64;
int nSens = 4;
DttRad2 dtt;
ImageDtt image_dtt;
Correlation2d corr2d;
......@@ -46,11 +47,14 @@ public class Clt1d {
dtt = new DttRad2(transform_size);
dtt.set_window(1);
image_dtt = new ImageDtt(
nSens,
transform_size,
null, // FIXME: needs ImageDttParameters (clt_parameters.img_dtt),
false,
false,
1.0);
corr2d = new Correlation2d(
nSens,
transform_size, // int transform_size,
false, // boolean monochrome,
false); // boolean debug)
......
......@@ -13,13 +13,16 @@ public class ImageDtt extends ImageDttCPU {
private final GPUTileProcessor.GpuQuad gpuQuad;
public ImageDtt(
int numSensors,
int transform_size,
ImageDttParameters imgdtt_params,
boolean mono,
boolean lwir,
double scale_strengths,
GPUTileProcessor.GpuQuad gpuQuadIn){
super (
super ( numSensors,
transform_size,
imgdtt_params,
mono,
lwir,
scale_strengths);
......@@ -27,17 +30,19 @@ public class ImageDtt extends ImageDttCPU {
}
public ImageDtt(
int numSensors,
int transform_size,
ImageDttParameters imgdtt_params,
boolean mono,
boolean lwir,
double scale_strengths){
super (
super ( numSensors,
transform_size,
imgdtt_params,
mono,
lwir,
scale_strengths);
gpuQuad = null;
}
public GPUTileProcessor.GpuQuad getGPU() {
......@@ -500,24 +505,6 @@ public class ImageDtt extends ImageDttCPU {
if (corr_indices.length > 0) {
/*
if (true) { // debugging only
int [] wh = new int[2];
double [][] dbg_corr = GPUTileProcessor.getCorr2DView(
tilesX,
tilesY,
corr_indices,
fcorr2D,
wh);
(new ShowDoubleFloatArrays()).showArrays(
dbg_corr,
wh[0],
wh[1],
true,
"dbg-corr2D-initial", // name+"-CORR2D-D"+clt_parameters.disparity,
GPUTileProcessor.getCorrTitles());
}
*/
final int corr_length = fcorr2D[0].length;// all correlation tiles have the same size
// assuming that the correlation pairs sets are the same for each tile that has correlations
// find this number
......@@ -538,6 +525,7 @@ public class ImageDtt extends ImageDttCPU {
// double [][] corrs = new double [GPUTileProcessor.NUM_PAIRS][corr_length]; // 225-long (15x15)
Correlation2d corr2d = new Correlation2d(
numSensors,
imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -1379,6 +1367,7 @@ public class ImageDtt extends ImageDttCPU {
// double [][] corrs = new double [GPUTileProcessor.NUM_PAIRS][corr_length]; // 225-long (15x15)
Correlation2d corr2d = new Correlation2d(
numSensors,
imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -1762,6 +1751,7 @@ public class ImageDtt extends ImageDttCPU {
public void run() {
Correlation2d corr2d = new Correlation2d(
numSensors,
imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -2111,6 +2101,7 @@ public class ImageDtt extends ImageDttCPU {
public void run() {
Correlation2d corr2d = new Correlation2d(
numSensors,
imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -3165,6 +3156,7 @@ public class ImageDtt extends ImageDttCPU {
@Override
public void run() {
Correlation2d corr2d = new Correlation2d(
numSensors,
imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -3480,6 +3472,7 @@ public class ImageDtt extends ImageDttCPU {
@Override
public void run() {
Correlation2d corr2d = new Correlation2d(
numSensors,
imgdtt_params, // ImageDttParameters imgdtt_params,
transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......
......@@ -309,7 +309,9 @@ public class MacroCorrelation {
*/
ImageDtt image_dtt = new ImageDtt(
geometryCorrection.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
this.mtp.isMonochrome(),
this.mtp.isLwir(),
clt_parameters.getScaleStrength(this.mtp.isAux()));
......
......@@ -42,13 +42,15 @@ public class OpticalFlow {
public static double LINE_ERR = 0.1;
public int threadsMax = 100; // maximal number of threads to launch
public boolean updateStatus = true;
public int numSens;
public OpticalFlow (
int numSens,
int threadsMax, // maximal number of threads to launch
boolean updateStatus) {
this.threadsMax = threadsMax;
this.numSens = numSens;
this.threadsMax = threadsMax;
this.updateStatus = updateStatus;
}
/**
......@@ -1019,7 +1021,9 @@ public class OpticalFlow {
final int chn_offset = QuadCLT.DSRBG_STRENGTH; // start scene_tiles, reference tiles with this 2-nd index
final ImageDtt image_dtt = new ImageDtt(
numSens,
transform_size,
null, // FIXME: Needs ImageDttParameters (clt_parameters.img_dtt),
false,
false,
1.0);
......@@ -1046,6 +1050,7 @@ public class OpticalFlow {
double [][][] clt_tiles_scene = new double [num_channels][4][];
Correlation2d corr2d = new Correlation2d(
numSens,
transform_size, // int transform_size,
false, // boolean monochrome,
false); // boolean debug)
......@@ -1140,6 +1145,7 @@ public class OpticalFlow {
double [][] corr_tile_2D = new double [4][tile_length];
Correlation2d corr2d = new Correlation2d(
numSens,
transform_size, // int transform_size,
false, // boolean monochrome,
false); // boolean debug)
......@@ -3894,7 +3900,9 @@ public class OpticalFlow {
}
ImageDtt image_dtt = new ImageDtt(
numSens,
clt_parameters.transform_size,
clt_parameters.img_dtt,
ref_scene.isMonochrome(),
ref_scene.isLwir(),
clt_parameters.getScaleStrength(ref_scene.isAux()),
......@@ -4803,7 +4811,9 @@ public class OpticalFlow {
float [][][][][] fcorrs_combo_td = new float[num_scenes][4][tilesY][tilesX][];
ImageDtt image_dtt = new ImageDtt(
numSens,
clt_parameters.transform_size,
clt_parameters.img_dtt,
ref_scene.isMonochrome(),
ref_scene.isLwir(),
clt_parameters.getScaleStrength(ref_scene.isAux()),
......
......@@ -65,7 +65,7 @@ public class QuadCLT extends QuadCLTCPU {
*/
public QuadCLT(
public QuadCLT( // creates AUX, does not know numSensors?
String prefix,
Properties properties,
EyesisCorrections eyesisCorrections,
......@@ -2041,10 +2041,12 @@ public class QuadCLT extends QuadCLTCPU {
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
is_mono,
is_lwir,
clt_parameters.getScaleStrength(isAux())); // 1.0);
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
is_mono,
is_lwir,
clt_parameters.getScaleStrength(isAux())); // 1.0);
float [][] lpf_rgb = new float[][] {
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_r),
......@@ -2304,10 +2306,12 @@ public class QuadCLT extends QuadCLTCPU {
cwgreen});
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
is_mono,
is_lwir,
1.0);
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
is_mono,
is_lwir,
1.0);
float [][] lpf_rgb = new float[][] {
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_r),
image_dtt.floatGetCltLpfFd(clt_parameters.gpu_sigma_b),
......@@ -3023,7 +3027,9 @@ public class QuadCLT extends QuadCLTCPU {
double [][][][] texture_tiles = new double [tilesY][tilesX][][]; // ["RGBA".length()][];
*/
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -3277,7 +3283,9 @@ public class QuadCLT extends QuadCLTCPU {
}
*/
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -3415,7 +3423,9 @@ public class QuadCLT extends QuadCLTCPU {
}
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -3541,7 +3551,9 @@ public class QuadCLT extends QuadCLTCPU {
final double gpu_sigma_rb_corr = isMonochrome()? 1.0 : clt_parameters.gpu_sigma_rb_corr;
final double gpu_sigma_log_corr = clt_parameters.getGpuCorrLoGSigma(isMonochrome());
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -4136,7 +4148,9 @@ public class QuadCLT extends QuadCLTCPU {
}
*/
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -4594,7 +4608,9 @@ public class QuadCLT extends QuadCLTCPU {
}
*/
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -4712,7 +4728,9 @@ public class QuadCLT extends QuadCLTCPU {
}
*/
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......@@ -4919,7 +4937,9 @@ public class QuadCLT extends QuadCLTCPU {
}
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()),
......
......@@ -6217,7 +6217,9 @@ ImageDtt.startAndJoin(threads);
double [][][][] texture_tiles = scan_prev.getTextureTiles(); // each is null, manually set texture_tiles - null
ImageDtt image_dtt = new ImageDtt(
geometryCorrection.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(is_aux));
......
......@@ -655,7 +655,9 @@ public class TwoQuadCLT {
double [][] disparity_bimap = new double [ImageDtt.BIDISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
ImageDtt image_dtt = new ImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_main.isMonochrome(),
quadCLT_main.isLwir(),
clt_parameters.getScaleStrength(false));
......@@ -1380,7 +1382,9 @@ public class TwoQuadCLT {
}
double [][] disparity_bimap = new double [ImageDtt.BIDISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
ImageDtt image_dtt = new ImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_main.isMonochrome(),
quadCLT_main.isLwir(),
clt_parameters.getScaleStrength(false));
......@@ -2183,7 +2187,9 @@ public class TwoQuadCLT {
}
ImageDtt image_dtt = new ImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_main.isMonochrome(),
quadCLT_main.isLwir(),
clt_parameters.getScaleStrength(false));
......@@ -3090,7 +3096,9 @@ if (debugLevel > -100) return true; // temporarily !
}
}
ImageDtt image_dtt = new ImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_main.isMonochrome(),
quadCLT_main.isLwir(),
clt_parameters.getScaleStrength(false));
......@@ -3270,6 +3278,7 @@ if (debugLevel > -100) return true; // temporarily !
true, // smart,
true); //newAllowed, // save
Correlation2d corr2d = new Correlation2d(
quadCLT_main.getNumSensors(),
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
clt_parameters.transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -3491,6 +3500,7 @@ if (debugLevel > -100) return true; // temporarily !
true, // smart,
true); //newAllowed, // save
Correlation2d corr2d = new Correlation2d(
quadCLT_main.getNumSensors(),
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
clt_parameters.transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -7171,7 +7181,9 @@ if (debugLevel > -100) return true; // temporarily !
final boolean updateStatus,
final int debugLevel){
ImageDtt image_dtt = new ImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_main.isMonochrome(),
quadCLT_main.isLwir(),
clt_parameters.getScaleStrength(false));
......@@ -7265,6 +7277,7 @@ if (debugLevel > -100) return true; // temporarily !
}
Random rnd = new Random(System.nanoTime());
Correlation2d corr2d = new Correlation2d(
quadCLT_main.getNumSensors(),
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
clt_parameters.transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -7340,7 +7353,9 @@ if (debugLevel > -100) return true; // temporarily !
final boolean updateStatus,
final int debugLevel){
ImageDtt image_dtt = new ImageDtt(
quadCLT_main.getNumSensors(),
clt_parameters.transform_size,
clt_parameters.img_dtt,
quadCLT_aux.isMonochrome(),
quadCLT_aux.isLwir(),
clt_parameters.getScaleStrength(true));
......@@ -7404,6 +7419,7 @@ if (debugLevel > -100) return true; // temporarily !
int [][] tile_op = new int[tilesY][tilesX]; // common for both main and aux
double [][] disparity_array = new double[tilesY][tilesX];
Correlation2d corr2d = new Correlation2d(
quadCLT_main.getNumSensors(),
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
clt_parameters.transform_size, // int transform_size,
2.0, // double wndx_scale, // (wndy scale is always 1.0)
......@@ -8262,6 +8278,7 @@ if (debugLevel > -100) return true; // temporarily !
/// double k_prev = 0.75;
/// double corr_scale = 0.75;
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
......@@ -8287,7 +8304,7 @@ if (debugLevel > -100) return true; // temporarily !
public void interPairsLMA(
QuadCLT quadCLT_main, // tiles should be set
CLTParameters clt_parameters,
CLTParameters clt_parameters,
EyesisCorrectionParameters.DebayerParameters debayerParameters,
ColorProcParameters colorProcParameters,
ColorProcParameters colorProcParameters_aux,
......@@ -8340,6 +8357,7 @@ if (debugLevel > -100) return true; // temporarily !
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
......@@ -8449,6 +8467,7 @@ if (debugLevel > -100) return true; // temporarily !
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
......@@ -8537,6 +8556,7 @@ if (debugLevel > -100) return true; // temporarily !
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
......@@ -8593,6 +8613,7 @@ if (debugLevel > -100) return true; // temporarily !
debugLevel); // int debugLevel)
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
......@@ -8743,6 +8764,7 @@ if (debugLevel > -100) return true; // temporarily !
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
if (bayer_artifacts_debug) {
......
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