Commit e6a1d91b authored by Andrey Filippov's avatar Andrey Filippov

center-of-mass for 16, propagated changes (4->16) for disparity_map

parent d8b8ffdc
......@@ -225,19 +225,26 @@ public class ImageDtt extends ImageDttCPU {
boolean need_corr = (clt_mismatch != null) || (fcorr_combo_td !=null) || (fcorr_td !=null) ; // (not the only reason)
// skipping DISPARITY_VARIATIONS_INDEX - it was not used
if (disparity_map != null){
for (int i = 0; i<disparity_map.length;i++) if ((disparity_modes & (1 << i)) != 0){
if ((i == OVEREXPOSED) && (saturation_imp == null)) {
continue;
}
disparity_map[i] = new double [tilesY*tilesX];
if ((i >= IMG_TONE_RGB) || ((i >= IMG_DIFF0_INDEX) && (i < (IMG_DIFF0_INDEX + 4)))) {
for (int i = 0; i<disparity_map.length;i++) {
if (isSliceBit(i) && ((disparity_modes & (1 << i)) != 0)) {
if ((i == OVEREXPOSED) && (saturation_imp == null)) {
continue;
}
disparity_map[i] = new double [tilesY*tilesX];
if (isCorrBit (i)) {
need_corr = true;
}
} else if (isDiffIndex(i) && needImgDiffs(disparity_modes)){
disparity_map[i] = new double [tilesY*tilesX];
need_macro = true;
} else if (isToneRGBIndex(i) && needTonesRGB(disparity_modes)){
disparity_map[i] = new double [tilesY*tilesX];
need_macro = true;
}
if (i <=DISPARITY_STRENGTH_INDEX) {
need_corr = true;
}
}
}
if (clt_mismatch != null){
for (int i = 0; i<clt_mismatch.length;i++){
......@@ -373,11 +380,12 @@ public class ImageDtt extends ImageDttCPU {
dust_remove, // boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
false, // boolean calc_textures,
true); // boolean calc_extra)
float [][] extra = gpuQuad.getExtra();
float [][] extra = gpuQuad.getExtra(); // now 4*numSensors
int num_cams = gpuQuad.getNumCams();
for (int ncam = 0; ncam < num_cams; ncam++) {
int indx = ncam + IMG_DIFF0_INDEX;
if ((disparity_modes & (1 << indx)) != 0){
// if ((disparity_modes & (1 << indx)) != 0){
if (needImgDiffs(disparity_modes)){
disparity_map[indx] = new double [extra[ncam].length];
for (int i = 0; i < extra[ncam].length; i++) {
disparity_map[indx][i] = extra[ncam][i];
......@@ -386,6 +394,7 @@ public class ImageDtt extends ImageDttCPU {
}
for (int nc = 0; nc < (extra.length - num_cams); nc++) {
int sindx = nc + num_cams;
/*
int indx = nc + IMG_TONE_RGB;
if ((disparity_modes & (1 << indx)) != 0){
disparity_map[indx] = new double [extra[sindx].length];
......@@ -393,6 +402,17 @@ public class ImageDtt extends ImageDttCPU {
disparity_map[indx][i] = extra[sindx][i];
}
}
*/
int indx = nc + getImgToneRGB(); // IMG_TONE_RGB;
// if ((disparity_modes & (1 << indx)) != 0){
if (needTonesRGB(disparity_modes)){
disparity_map[indx] = new double [extra[sindx].length];
for (int i = 0; i < extra[sindx].length; i++) {
disparity_map[indx][i] = extra[sindx][i];
}
}
}
}
// does it need non-overlapping texture tiles
......@@ -1019,6 +1039,7 @@ public class ImageDtt extends ImageDttCPU {
boolean need_macro = false;
boolean need_corr = (clt_mismatch != null) || (fcorr_combo_td !=null) || (fcorr_td !=null) ; // (not the only reason)
// skipping DISPARITY_VARIATIONS_INDEX - it was not used
/*
if (disparity_map != null){
for (int i = 0; i<disparity_map.length;i++) if ((disparity_modes & (1 << i)) != 0){
if ((i == OVEREXPOSED) && (saturation_imp == null)) {
......@@ -1033,6 +1054,28 @@ public class ImageDtt extends ImageDttCPU {
}
}
}
*/
if (disparity_map != null){
for (int i = 0; i<disparity_map.length;i++) {
if (isSliceBit(i) && ((disparity_modes & (1 << i)) != 0)) {
if ((i == OVEREXPOSED) && (saturation_imp == null)) {
continue;
}
disparity_map[i] = new double [tilesY*tilesX];
if (isCorrBit (i)) {
need_corr = true;
}
} else if (isDiffIndex(i) && needImgDiffs(disparity_modes)){
disparity_map[i] = new double [tilesY*tilesX];
need_macro = true;
} else if (isToneRGBIndex(i) && needTonesRGB(disparity_modes)){
disparity_map[i] = new double [tilesY*tilesX];
need_macro = true;
}
}
}
if (clt_mismatch != null){
for (int i = 0; i<clt_mismatch.length;i++){
......@@ -1201,7 +1244,8 @@ public class ImageDtt extends ImageDttCPU {
int num_cams = gpuQuad.getNumCams();
for (int ncam = 0; ncam < num_cams; ncam++) {
int indx = ncam + IMG_DIFF0_INDEX;
if ((disparity_modes & (1 << indx)) != 0){
// if ((disparity_modes & (1 << indx)) != 0){
if (needImgDiffs(disparity_modes)){
disparity_map[indx] = new double [extra[ncam].length];
for (int i = 0; i < extra[ncam].length; i++) {
disparity_map[indx][i] = extra[ncam][i];
......@@ -1210,8 +1254,9 @@ public class ImageDtt extends ImageDttCPU {
}
for (int nc = 0; nc < (extra.length - num_cams); nc++) {
int sindx = nc + num_cams;
int indx = nc + IMG_TONE_RGB;
if ((disparity_modes & (1 << indx)) != 0){
int indx = nc + getImgToneRGB(); // IMG_TONE_RGB;
// if ((disparity_modes & (1 << indx)) != 0){
if (needTonesRGB(disparity_modes)){
disparity_map[indx] = new double [extra[sindx].length];
for (int i = 0; i < extra[sindx].length; i++) {
disparity_map[indx][i] = extra[sindx][i];
......
......@@ -62,6 +62,7 @@ public class MacroCorrelation {
mTilesY, // int tilesY,
tileSize, // int tileSize,
tp.superTileSize, // int superTileSize,
tp.getNumSensors(),
tp.isMonochrome(),
tp.isLwir(),
tp.isAux(),
......@@ -80,7 +81,7 @@ public class MacroCorrelation {
final double macro_disparity_step,
final int debugLevel){
int numSensors = geometryCorrection.getNumSensors();
double [][][] input_data = CLTMacroSetData( // perform single pass according to prepared tiles operations and disparity
src_scan); // final CLTPass3d src_scan, // results of the normal correlations (now expecting infinity)
if (debugLevel > 0) {
......@@ -144,6 +145,8 @@ public class MacroCorrelation {
final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
final int mTiles = mTilesX * mTilesY;
final int num_chn = 3;
final int numSensors = tp.getNumSensors();
final int toneRGB = ImageDtt.getImgToneRGB(numSensors);
double corr_red = 0.5; // Red to green correlation weight
double corr_blue = 0.2; // Blue to green correlation weight
double [] col_weights = new double[3];
......@@ -152,10 +155,10 @@ public class MacroCorrelation {
col_weights[1] = corr_blue * col_weights[2];
final double [][][] input_data = new double [ImageDtt.QUAD][num_chn][mTiles*tileSize*tileSize];
final int INDX_R0 = ImageDtt.IMG_TONE_RGB;
final int INDX_B0 = ImageDtt.IMG_TONE_RGB + ImageDtt.QUAD;
final int INDX_G0 = ImageDtt.IMG_TONE_RGB + 2 * ImageDtt.QUAD;
final double [][][] input_data = new double [numSensors][num_chn][mTiles*tileSize*tileSize];
final int INDX_R0 = toneRGB;
final int INDX_B0 = toneRGB + numSensors;
final int INDX_G0 = toneRGB + 2 * numSensors;
for (int sub_cam =0; sub_cam < input_data.length; sub_cam++){
for (int pty = 0; pty < pTilesY; pty++){
......@@ -279,34 +282,14 @@ public class MacroCorrelation {
}
double min_corr_selected = clt_parameters.min_corr;
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(geometryCorrection.getNumSensors()).length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] shiftXY = {{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}};
double [][][][] clt_corr_combo = null; // new double [ImageDtt.TCORR_TITLES.length][mTilesY][mTilesX][]; // needed always
double [][][][][] clt_corr_partial = null; // [tp.tilesY][tp.tilesX][pair][color][(2*transform_size-1)*(2*transform_size-1)]
/*
if (show_corr_partial) {
clt_corr_partial = new double [mTilesY][mTilesX][][][];
for (int i = 0; i < mTilesY; i++){
for (int j = 0; j < mTilesX; j++){
clt_corr_partial[i][j] = null;
}
}
}
if (show_corr_combo) {
clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][mTilesY][mTilesX][]; // needed always
for (int i = 0; i < mTilesY; i++){
for (int j = 0; j < mTilesX; j++){
for (int k = 0; k<clt_corr_combo.length; k++){
clt_corr_combo[k][i][j] = null;
}
}
}
}
*/
ImageDtt image_dtt = new ImageDtt(
geometryCorrection.getNumSensors(),
......
......@@ -3227,7 +3227,7 @@ public class OpticalFlow {
tilesY,
true,
"accumulated_disparity_map-"+nrefine,
ImageDtt.DISPARITY_TITLES
ImageDtt.getDisparityTitles(ref_scene.getNumSensors()) // ImageDtt.DISPARITY_TITLES
);
// update disparities
final int disparity_index = ImageDtt.DISPARITY_INDEX_CM; // 2
......@@ -3426,7 +3426,7 @@ public class OpticalFlow {
tilesY,
true,
"accumulated_disparity_map-"+nrefine,
ImageDtt.DISPARITY_TITLES
ImageDtt.getDisparityTitles(ref_scene.getNumSensors()) // ImageDtt.DISPARITY_TITLES
);
}
// update disparities
......@@ -3637,7 +3637,7 @@ public class OpticalFlow {
tilesY,
true,
"accumulated_disparity_map-"+nrefine,
ImageDtt.DISPARITY_TITLES
ImageDtt.getDisparityTitles(ref_scene.getNumSensors()) // ImageDtt.DISPARITY_TITLES
);
}
// update disparities
......@@ -3907,7 +3907,7 @@ public class OpticalFlow {
ref_scene.isLwir(),
clt_parameters.getScaleStrength(ref_scene.isAux()),
ref_scene.getGPU());
double[][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double[][] disparity_map = new double [image_dtt.getDisparityTitles().length][];
int disparity_modes =
ImageDtt.BITS_ALL_DISPARITIES |
......@@ -4818,7 +4818,7 @@ public class OpticalFlow {
ref_scene.isLwir(),
clt_parameters.getScaleStrength(ref_scene.isAux()),
ref_scene.getGPU());
double[][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double[][] disparity_map = new double [image_dtt.getDisparityTitles().length][];
int disparity_modes =
ImageDtt.BITS_ALL_DISPARITIES |
......
......@@ -3009,10 +3009,10 @@ public class QuadCLT extends QuadCLTCPU {
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
double [][][][] clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][tilesY][tilesX][]; // will only be used inside?
// double min_corr_selected = clt_parameters.min_corr; // 0.02 was not used !
// yes, needed (for macro)
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
//if ((i >= IMG_TONE_RGB) || ((i >= IMG_DIFF0_INDEX) && (i < (IMG_DIFF0_INDEX + 4)))) {
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
/*
double [][] shiftXY = new double [4][2];
// not used
......@@ -3269,7 +3269,8 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
/*
double [][] shiftXY = new double [4][2];
// not used
......@@ -3421,7 +3422,9 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
ImageDtt image_dtt = new ImageDtt(
getNumSensors(),
clt_parameters.transform_size,
......@@ -3729,8 +3732,11 @@ public class QuadCLT extends QuadCLTCPU {
}
}
double[][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double[][] disparity_map_fake = new double [ImageDtt.DISPARITY_TITLES.length][];
// double[][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// double[][] disparity_map_fake = new double [ImageDtt.DISPARITY_TITLES.length][];
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
double [][] disparity_map_fake = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
int disparity_modes =
ImageDtt.BITS_ALL_DISPARITIES |
ImageDtt.BITS_ALL_DIFFS | // needs max_diff?
......@@ -4134,7 +4140,8 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
/*
double [][] shiftXY = new double [4][2];
// not used
......@@ -4283,7 +4290,9 @@ public class QuadCLT extends QuadCLTCPU {
clt_corr_partial1[i][j] = null;
}
}
double [][] disparity_map1 = new double [ImageDtt.DISPARITY_TITLES.length][];
// double [][] disparity_map1 = new double [ImageDtt.DISPARITY_TITLES.length][];
double [][] disparity_map1 = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
float [][][][] corr_td_blur = image_dtt.blur_corr_GPU( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
......
......@@ -520,17 +520,22 @@ public class QuadCLTCPU {
if (tp == null) return null;
return tp.rig_disparity_strength;
}
public void setTiles (ImagePlus imp, // set tp.tilesX, tp.tilesY // USED in lwir
public void setTiles (
ImagePlus imp, // set tp.tilesX, tp.tilesY // USED in lwir
int numSensors,
CLTParameters clt_parameters,
int threadsMax
){
setTiles(clt_parameters,
setTiles(
numSensors,
clt_parameters,
imp.getWidth()/clt_parameters.transform_size,
imp.getHeight()/clt_parameters.transform_size,
threadsMax);
}
public void setTiles ( // USED in lwir
int numSensors,
CLTParameters clt_parameters,
int tilesX,
int tilesY,
......@@ -542,6 +547,7 @@ public class QuadCLTCPU {
tilesY,
clt_parameters.transform_size,
clt_parameters.stSize,
numSensors,
isMonochrome(),
isLwir(),
isAux(),
......@@ -4077,8 +4083,9 @@ public class QuadCLTCPU {
}
}
setTiles (imp_srcs[0], // set global tp.tilesX, tp.tilesY
clt_parameters,
threadsMax); // where to get it? Use instance member
getNumSensors(), // tp.getNumSensors(),
clt_parameters,
threadsMax); // where to get it? Use instance member
tp.setTrustedCorrelation(clt_parameters.grow_disp_trust);
tp.resetCLTPasses();
return imp_srcs;
......@@ -4674,7 +4681,8 @@ public class QuadCLTCPU {
clt_combo_dbg = new double [num_pairs][][][];
}
} // clt_parameters.corr_mismatch = false
disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
// disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
}
// Includes all 3 colors - will have zeros in unused
......@@ -4866,7 +4874,18 @@ public class QuadCLTCPU {
}
}
}
// visualize correlation results
if (disparity_map != null){
if (!batch_mode && clt_parameters.show_map && (debugLevel > -2)){
sdfa_instance.showArrays(
disparity_map,
tilesX,
tilesY,
true,
image_name+sAux()+"-DISP_MAP-D"+clt_parameters.disparity,
ImageDtt.getDisparityTitles(getNumSensors())); // ImageDtt.DISPARITY_TITLES);
}
}
/*
// visualize correlation results
......@@ -5340,7 +5359,8 @@ public class QuadCLTCPU {
} // clt_parameters.corr_mismatch = false
}
// Includes all 3 colors - will have zeros in unused
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double min_corr_selected = clt_parameters.min_corr;
double [][] shiftXY = new double [getNumSensors()][2];
......@@ -6176,7 +6196,8 @@ public class QuadCLTCPU {
}
}
// Includes all 3 colors - will have zeros in unused
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging) last 4 - max pixel differences
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double min_corr_selected = clt_parameters.min_corr;
double [][] shiftXY = new double [4][2];
......@@ -6296,7 +6317,7 @@ public class QuadCLTCPU {
tilesY,
true,
name+sAux()+"-DISP_MAP-D"+clt_parameters.disparity,
ImageDtt.DISPARITY_TITLES);
ImageDtt.getDisparityTitles(getNumSensors()));// ImageDtt.DISPARITY_TITLES);
}
/*
if (clt_mismatch != null) {
......@@ -7342,7 +7363,9 @@ public class QuadCLTCPU {
}
}
setTiles (imp_quad[0], // set global tp.tilesX, tp.tilesY
setTiles (
imp_quad[0], // set global tp.tilesX, tp.tilesY
tp.getNumSensors(),
clt_parameters,
threadsMax);
final int tilesX = tp.getTilesX();
......@@ -7356,7 +7379,9 @@ public class QuadCLTCPU {
// undecided, so 2 modes of combining alpha - same as rgb, or use center tile only
double min_corr_selected = clt_parameters.min_corr;
double [][][] disparity_maps = new double [clt_parameters.disp_scan_count][ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
// double [][][] disparity_maps = new double [clt_parameters.disp_scan_count][ImageDtt.DISPARITY_TITLES.length][];
double [][][] disparity_maps = new double [clt_parameters.disp_scan_count][ImageDtt.getDisparityTitles(getNumSensors()).length][];
double [][][] clt_mismatches = new double [clt_parameters.disp_scan_count][12][];
for (int scan_step = 0; scan_step < clt_parameters.disp_scan_count; scan_step++) {
double disparity = clt_parameters.disp_scan_start + scan_step * clt_parameters.disp_scan_step;
......@@ -7556,8 +7581,8 @@ public class QuadCLTCPU {
ImageDtt.DISPARITY_STRENGTH_INDEX,
ImageDtt.DISPARITY_VARIATIONS_INDEX};
String [] disparity_titles = new String [disp_indices.length];
for (int i = 0; i < disparity_titles.length; i++ ) disparity_titles[i] = ImageDtt.DISPARITY_TITLES[i];
// for (int i = 0; i < disparity_titles.length; i++ ) disparity_titles[i] = ImageDtt.DISPARITY_TITLES[i];
for (int i = 0; i < disparity_titles.length; i++ ) disparity_titles[i] = ImageDtt.getDisparityTitles(getNumSensors())[i];
// 2,4,6,7};
String [] disparities_titles = new String [disparity_titles.length * clt_parameters.disp_scan_count];
double [][] disparities_maps = new double [disparity_titles.length * clt_parameters.disp_scan_count][];
......@@ -11618,8 +11643,8 @@ public class QuadCLTCPU {
double min_corr_selected = clt_parameters.min_corr; // 0.02
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
double [][] shiftXY = new double [4][2];
if (!clt_parameters.fine_corr_ignore) {
double [][] shiftXY0 = {
......@@ -11856,7 +11881,8 @@ public class QuadCLTCPU {
}
double min_corr_selected = clt_parameters.min_corr;
double [][] disparity_map = save_corr ? new double [ImageDtt.DISPARITY_TITLES.length][] : null; //[0] -residual disparity, [1] - orthogonal (just for debugging)
// double [][] disparity_map = save_corr ? new double [ImageDtt.DISPARITY_TITLES.length][] : null; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] disparity_map = save_corr ? new double [ImageDtt.getDisparityTitles(getNumSensors()).length][] : null; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] shiftXY = new double [4][2];
if (!clt_parameters.fine_corr_ignore) {
......@@ -11993,7 +12019,8 @@ public class QuadCLTCPU {
}
}
double min_corr_selected = clt_parameters.min_corr;
double [][] disparity_map = save_corr ? new double [ImageDtt.DISPARITY_TITLES.length][] : null; //[0] -residual disparity, [1] - orthogonal (just for debugging)
// double [][] disparity_map = save_corr ? new double [ImageDtt.DISPARITY_TITLES.length][] : null; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] disparity_map = save_corr ? new double [ImageDtt.getDisparityTitles(getNumSensors()).length][] : null; //[0] -residual disparity, [1] - orthogonal (just for debugging)
double [][] shiftXY = new double [4][2];
if (!clt_parameters.fine_corr_ignore) {
double [][] shiftXY0 = {
......
......@@ -37,7 +37,7 @@ import com.elphel.imagej.common.PolynomialApproximation;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
public class TileProcessor {
public static String [] SCAN_TITLES = {
public static String [] SCAN_TITLES = { // wrong now !
"tile_op", // 0
"final", // 1 - calculated, filtered, combined disparity
"disparity", // 2
......@@ -80,6 +80,7 @@ public class TileProcessor {
public boolean [] rig_post_poles_sel = null; // Rig tile selection after processing poles
public double [][] main_ds_ml = null; // main camera DSI restored from the COMBO-DSI file to generate ML test files
final int numSensors;
public boolean monochrome = false; // these are monochrome images
public boolean lwir = false; // all monochrome are lwir
private boolean is_aux = false; // this camera is aux
......@@ -98,11 +99,15 @@ public class TileProcessor {
public double [][] dbg_filtered_disp_strength;
// All parameters are set only once, during instantiation
public int getNumSensors() {
return numSensors;
}
public TileProcessor(
int tilesX,
int tilesY,
int tileSize,
int superTileSize,
int numSensors,
boolean monochrome,
boolean lwir,
boolean is_aux,
......@@ -115,6 +120,7 @@ public class TileProcessor {
this.tilesY = tilesY;
this.tileSize = tileSize;
this.superTileSize = superTileSize;
this.numSensors = numSensors;
this.monochrome = monochrome;
this.lwir = lwir;
this.is_aux = is_aux;
......@@ -128,6 +134,7 @@ public class TileProcessor {
this.tilesY = tp.tilesY;
this.tileSize = tp.tileSize;
this.superTileSize = tp.superTileSize;
this.numSensors = tp.numSensors;
this.monochrome = tp.monochrome;
this.lwir = tp.lwir;
this.is_aux = tp.is_aux;
......@@ -1147,7 +1154,9 @@ public class TileProcessor {
}
for (CLTPass3d combo_pass : combo_pass_list) {
combo_pass.tile_op = new int [tilesY][tilesX]; // for just non-zero
combo_pass.disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// combo_pass.disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
combo_pass.disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen];
......@@ -1481,7 +1490,8 @@ ImageDtt.startAndJoin(threads);
}
for (CLTPass3d combo_pass : combo_pass_list) {
combo_pass.tile_op = new int [tilesY][tilesX]; // for just non-zero
combo_pass.disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// combo_pass.disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
combo_pass.disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen];
......@@ -1798,7 +1808,8 @@ ImageDtt.startAndJoin(threads);
final int tlen = tilesX * tilesY;
final int disparity_index = usePoly ? ImageDtt.DISPARITY_INDEX_POLY : ImageDtt.DISPARITY_INDEX_CM;
combo_pass.tile_op = new int [tilesY][tilesX]; // for just non-zero
combo_pass.disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// combo_pass.disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
combo_pass.disparity_map = new double [ImageDtt.getDisparityTitles(getNumSensors()).length][];
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen];
......@@ -3701,6 +3712,7 @@ ImageDtt.startAndJoin(threads);
return ds;
}
// TODO: update for variable length
public double [][] getShowScan(
CLTPass3d scan,
boolean measured_only)
......@@ -3757,7 +3769,7 @@ ImageDtt.startAndJoin(threads);
dbg_img[ 9] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH];
dbg_img[20] = scan.disparity_map[ImageDtt.OVEREXPOSED];
for (int i = 0; i < 12; i++) {
dbg_img[this_IMG_TONE_RGB+i] = scan.disparity_map[ImageDtt.IMG_TONE_RGB + i];
dbg_img[this_IMG_TONE_RGB+i] = scan.disparity_map[ImageDtt.getImgToneRGB(numSensors) + i];
}
}
dbg_img[1] = scan.calc_disparity_combo;
......@@ -4025,7 +4037,8 @@ ImageDtt.startAndJoin(threads);
block_propagate, // tiles,
null); // prohibit);
if ((debugLevel > -1) && show_bgnd_nonbgnd){
new ShowDoubleFloatArrays().showArrays(bgnd_data.disparity_map, tilesX, tilesY, true, "bgnd_map",ImageDtt.DISPARITY_TITLES);
// new ShowDoubleFloatArrays().showArrays(bgnd_data.disparity_map, tilesX, tilesY, true, "bgnd_map",ImageDtt.DISPARITY_TITLES);
new ShowDoubleFloatArrays().showArrays(bgnd_data.disparity_map, tilesX, tilesY, true, "bgnd_map",ImageDtt.getDisparityTitles(getNumSensors()));
new ShowDoubleFloatArrays().showArrays(dbg_worst2, tilesX, tilesY, "worst2");
}
// TODO: check if minimal cluster strengh should be limited here
......
......@@ -1404,7 +1404,8 @@ public class TwoQuadCLT {
double [][][] port_xy_main_dbg = new double [tilesX*tilesY][][];
double [][][] port_xy_aux_dbg = new double [tilesX*tilesY][][];
// double [][][] corr2ddata = new double [1][][];
double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][];
double [][] disparity_map = new double [image_dtt.getDisparityTitles().length][];
final double [][][][][][][] clt_bidata = // new double[2][quad][nChn][tilesY][tilesX][][]; // first index - main/aux
image_dtt.clt_bi_quad_dbg (
......@@ -1443,17 +1444,19 @@ public class TwoQuadCLT {
port_xy_aux_dbg); // final double [][][] port_xy_aux_dbg) // for each tile/port save x,y pixel coordinates (gpu code development)
///// double [][] disparity_map = new double [ImageDtt.DISPARITY_TITLES.length][]; //[0] -residual disparity, [1] - orthogonal (just for debugging)
String [] sub_titles = new String [GPUTileProcessor.NUM_CAMS * (GPUTileProcessor.NUM_COLORS+1)];
int numSensors = GPUTileProcessor.NUM_CAMS; // Wrong - different for main and aux
String [] sub_titles = new String [numSensors * (GPUTileProcessor.NUM_COLORS+1)];
double [][] sub_disparity_map = new double [sub_titles.length][];
for (int ncam = 0; ncam < GPUTileProcessor.NUM_CAMS; ncam++) {
for (int ncam = 0; ncam < numSensors; ncam++) {
sub_disparity_map[ncam] = disparity_map[ncam + ImageDtt.IMG_DIFF0_INDEX];
sub_titles[ncam] = ImageDtt.DISPARITY_TITLES[ncam + ImageDtt.IMG_DIFF0_INDEX];
// sub_titles[ncam] = ImageDtt.DISPARITY_TITLES[ncam + ImageDtt.IMG_DIFF0_INDEX];
sub_titles[ncam] = ImageDtt.getDisparityTitles(numSensors)[ncam + ImageDtt.IMG_DIFF0_INDEX];
for (int ncol = 0; ncol < GPUTileProcessor.NUM_COLORS; ncol++) {
sub_disparity_map[ncam + (ncol + 1)* GPUTileProcessor.NUM_CAMS] =
disparity_map[ncam +ncol* GPUTileProcessor.NUM_CAMS+ ImageDtt.IMG_TONE_RGB];
sub_titles[ncam + (ncol + 1)* GPUTileProcessor.NUM_CAMS] =
ImageDtt.DISPARITY_TITLES[ncam +ncol* GPUTileProcessor.NUM_CAMS+ ImageDtt.IMG_TONE_RGB];
sub_disparity_map[ncam + (ncol + 1)* numSensors] =
disparity_map[ncam +ncol* numSensors+ ImageDtt.getImgToneRGB(numSensors)];
sub_titles[ncam + (ncol + 1)* numSensors] =
// ImageDtt.DISPARITY_TITLES[ncam +ncol* numSensors+ ImageDtt.getImgToneRGB(numSensors)];
ImageDtt.getDisparityTitles(numSensors)[ncam +ncol* numSensors+ ImageDtt.getImgToneRGB(numSensors)];
}
}
// String [] sub_titles = {ImageDtt.DISPARITY_TITLES[ImageDtt.IMG_DIFF0_INDEX]
......
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