Commit 624db0c0 authored by Andrey Filippov's avatar Andrey Filippov

Updating ExtrinsicAdjustment for variable number of sensors

parent 31555875
......@@ -3334,7 +3334,7 @@ public class ImageDtt extends ImageDttCPU {
dbg_img[18][nclust] = lma_ds[0][0] + disparity_array_center[clustY][clustX] + disparity_corr;
}
if ((lma_ds[0] != null) && (lma_ds[0][1]> 0.0)) {
lazy_eye_data[nclust] = new double [ExtrinsicAdjustment.INDX_LENGTH];
lazy_eye_data[nclust] = new double [ExtrinsicAdjustment.get_INDX_LENGTH(numSensors)];
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_STRENGTH] = strengh_k * lma_ds[0][1] * num_in_cluster[clustY][clustX];
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_DISP] = lma_ds[0][0] + disparity_array_center[clustY][clustX] + disparity_corr;
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_TARGET] = (disparity_array_center[clustY][clustX] + disparity_corr);
......@@ -3342,21 +3342,21 @@ public class ImageDtt extends ImageDttCPU {
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_PX + 0] = pxpy[clustY][clustX][0];
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_PX + 1] = pxpy[clustY][clustX][1];
for (int cam = 0; cam < quad; cam++) {
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_DYDDISP0 + cam] = tile_disp_dist[cam][2];
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_PYDIST + cam] = clust_pY [clustY][clustX][cam];
lazy_eye_data[nclust][ExtrinsicAdjustment.get_INDX_DYDDISP0(numSensors) + cam] = tile_disp_dist[cam][2];
lazy_eye_data[nclust][ExtrinsicAdjustment.get_INDX_PYDIST(numSensors) + cam] = clust_pY [clustY][clustX][cam];
}
for (int cam = 0; cam < ddnd.length; cam++) {
if (ddnd[cam] != null) { //convert to x,y from dd/nd
lazy_eye_data[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 0] = ddnd[cam][0] * rXY[cam][0] - ddnd[cam][1] * rXY[cam][1];
lazy_eye_data[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 1] = ddnd[cam][0] * rXY[cam][1] + ddnd[cam][1] * rXY[cam][0];
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_DD0 + cam] = ddnd[cam][0];
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_ND0 + cam] = ddnd[cam][1];
lazy_eye_data[nclust][ExtrinsicAdjustment.get_INDX_DD0(numSensors) + cam] = ddnd[cam][0];
lazy_eye_data[nclust][ExtrinsicAdjustment.get_INDX_ND0(numSensors) + cam] = ddnd[cam][1];
} else {
lazy_eye_data[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 0] = Double.NaN;
lazy_eye_data[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 1] = Double.NaN;
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_DD0 + cam] = Double.NaN;
lazy_eye_data[nclust][ExtrinsicAdjustment.INDX_ND0 + cam] = Double.NaN;
lazy_eye_data[nclust][ExtrinsicAdjustment.get_INDX_DD0(numSensors) + cam] = Double.NaN;
lazy_eye_data[nclust][ExtrinsicAdjustment.get_INDX_ND0(numSensors) + cam] = Double.NaN;
}
}
}
......@@ -3652,7 +3652,7 @@ public class ImageDtt extends ImageDttCPU {
}
if ((lma_ds[0] != null) && (lma_ds[0][1]> 0.0)) {
lazy_eye_data_final[nclust] = new double [ExtrinsicAdjustment.INDX_LENGTH];
lazy_eye_data_final[nclust] = new double [ExtrinsicAdjustment.get_INDX_LENGTH(numSensors)];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_STRENGTH] = strengh_k * lma_ds[0][1] * num_in_cluster_final[clustY][clustX];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_DISP] = lma_ds[0][0] + disparity_array_center[clustY][clustX] + disparity_corr;
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_TARGET] = disparity_array_center[clustY][clustX] + disparity_corr;
......@@ -3660,20 +3660,20 @@ public class ImageDtt extends ImageDttCPU {
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_PX + 0] = pxpy_super[clustY][clustX][0];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_PX + 1] = pxpy_super[clustY][clustX][1];
for (int cam = 0; cam < quad; cam++) {
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_DYDDISP0 + cam] = tile_disp_dist[cam][2];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_PYDIST + cam] = clust_pY_super [clustY][clustX][cam];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.get_INDX_DYDDISP0(numSensors) + cam] = tile_disp_dist[cam][2];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.get_INDX_PYDIST(numSensors) + cam] = clust_pY_super [clustY][clustX][cam];
}
for (int cam = 0; cam < ddnd.length; cam++) {
if (ddnd[cam] != null) { //convert to x,y from dd/nd
lazy_eye_data_final[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 0] = ddnd[cam][0] * rXY[cam][0] - ddnd[cam][1] * rXY[cam][1];
lazy_eye_data_final[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 1] = ddnd[cam][0] * rXY[cam][1] + ddnd[cam][1] * rXY[cam][0];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_DD0 + cam] = ddnd[cam][0];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_ND0 + cam] = ddnd[cam][1];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.get_INDX_DD0(numSensors) + cam] = ddnd[cam][0];
lazy_eye_data_final[nclust][ExtrinsicAdjustment.get_INDX_ND0(numSensors) + cam] = ddnd[cam][1];
} else {
lazy_eye_data_final[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 0] = Double.NaN;
lazy_eye_data_final[nclust][2 * cam + ExtrinsicAdjustment.INDX_X0 + 1] = Double.NaN;
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_DD0 + cam] = Double.NaN;
lazy_eye_data_final[nclust][ExtrinsicAdjustment.INDX_ND0 + cam] = Double.NaN;
lazy_eye_data_final[nclust][ExtrinsicAdjustment.get_INDX_DD0(numSensors) + cam] = Double.NaN;
lazy_eye_data_final[nclust][ExtrinsicAdjustment.get_INDX_ND0(numSensors) + cam] = Double.NaN;
}
}
}
......
......@@ -5078,7 +5078,14 @@ if (debugLevel < -100) {
clt_parameters.tileY, // final int debug_tileY,
threadsMax,
debugLevel);
double [][] dbg_img = new double[ExtrinsicAdjustment.DATA_TITLES.length][lazy_eye_data_dbg.length];
ExtrinsicAdjustment ea_dbg = new ExtrinsicAdjustment (
geometryCorrection, // GeometryCorrection gc,
1, // int clusterSize,
tilesX, // int clustersX,
tilesY); // int clustersY)
// double [][] dbg_img = new double[ExtrinsicAdjustment.DATA_TITLES.length][lazy_eye_data_dbg.length];
double [][] dbg_img = new double[ea_dbg.data_titles.length][lazy_eye_data_dbg.length];
for (int i = 0; i < dbg_img.length; i++) {
Arrays.fill(dbg_img[i], Double.NaN);
}
......@@ -5094,7 +5101,7 @@ if (debugLevel < -100) {
tp.getTilesY(),
true,
"LY-everytile",
ExtrinsicAdjustment.DATA_TITLES);
ea_dbg.data_titles); // ExtrinsicAdjustment.DATA_TITLES);
}
......
......@@ -5945,7 +5945,7 @@ public class QuadCLTCPU {
double [][] dsxy = new double[clustersX * clustersY][];
ImagePlus imp_sel = WindowManager.getCurrentImage();
if ((imp_sel == null) || (imp_sel.getStackSize() != ExtrinsicAdjustment.INDX_LENGTH)) {
if ((imp_sel == null) || (imp_sel.getStackSize() != ExtrinsicAdjustment.get_INDX_LENGTH(getNumSensors()))) {
System.out.println("No image / wrong image selected, bailing out");
return null;
} else {
......@@ -5958,7 +5958,7 @@ public class QuadCLTCPU {
return null;
}
ImageStack stack_sel = imp_sel.getStack();
float [][] fpixels = new float [ExtrinsicAdjustment.INDX_LENGTH][];
float [][] fpixels = new float [ExtrinsicAdjustment.get_INDX_LENGTH(getNumSensors())][];
for (int i = 0; i < fpixels.length; i++) {
fpixels[i] = (float[]) stack_sel.getPixels(i+1);
}
......@@ -6247,10 +6247,16 @@ public class QuadCLTCPU {
if (lazy_eye_data != null) {
int clustersX= (tilesX + clt_parameters.tileStep - 1) / clt_parameters.tileStep;
int clustersY= (tilesY + clt_parameters.tileStep - 1) / clt_parameters.tileStep;
double [][] dbg_cluster = new double [ExtrinsicAdjustment.INDX_LENGTH][clustersY * clustersX];
ExtrinsicAdjustment ea_dbg = new ExtrinsicAdjustment (
geometryCorrection, // GeometryCorrection gc,
clt_parameters.tileStep, // int clusterSize,
clustersX, // int clustersX,
clustersY); // int clustersY)
double [][] dbg_cluster = new double [ExtrinsicAdjustment.get_INDX_LENGTH(getNumSensors())][clustersY * clustersX];
for (int n = 0; n < lazy_eye_data.length; n++) {
if ((lazy_eye_data[n] != null) && (lazy_eye_data[n][ExtrinsicAdjustment.INDX_STRENGTH] >= clt_parameters.img_dtt.lma_diff_minw)) {
for (int i = 0; i < ExtrinsicAdjustment.INDX_LENGTH; i++ ) {
for (int i = 0; i < ExtrinsicAdjustment.get_INDX_LENGTH(getNumSensors()); i++ ) {
if (i == ExtrinsicAdjustment.INDX_STRENGTH) {
dbg_cluster[i][n] = lazy_eye_data[n][i] - clt_parameters.img_dtt.lma_diff_minw; // strength
} else {
......@@ -6258,7 +6264,7 @@ public class QuadCLTCPU {
}
}
} else {
for (int i = 0; i < ExtrinsicAdjustment.INDX_LENGTH; i++ ) {
for (int i = 0; i < ExtrinsicAdjustment.get_INDX_LENGTH(getNumSensors()); i++ ) {
if (i == ExtrinsicAdjustment.INDX_STRENGTH) {
dbg_cluster[i][n] = 0.0; // strength
} else {
......@@ -6274,7 +6280,7 @@ public class QuadCLTCPU {
clustersY,
true,
name+sAux()+"-CLT_MISMATCH-D"+clt_parameters.disparity+"_"+clt_parameters.tileStep+"x"+clt_parameters.tileStep,
ExtrinsicAdjustment.DATA_TITLES);
ea_dbg.data_titles); // ExtrinsicAdjustment.DATA_TITLES);
if (disparity_map != null){
int target_index = ImageDtt.DISPARITY_INDEX_INT;
......@@ -13084,7 +13090,7 @@ public class QuadCLTCPU {
CorrVector corr_vector = geometryCorrection.getCorrVector().clone();
double [] curr_corr_arr = corr_vector.toArray();
int clusters = ea.clustersX * ea.clustersY;
int num_ly = ExtrinsicAdjustment.INDX_LENGTH; // scan.getLazyEyeData().length;
int num_ly = ExtrinsicAdjustment.get_INDX_LENGTH(getNumSensors()); // scan.getLazyEyeData().length;
int num_pars = curr_corr_arr.length;
double [][][] ly_diff = new double [num_pars][num_ly][clusters];
for (int np = 0; np < num_pars; np++) {
......@@ -13208,14 +13214,14 @@ public class QuadCLTCPU {
*/
dbg_img = new double [num_pars][width*height];
for (int par = 0; par < num_pars; par++) {
for (int mode = 0; mode < ExtrinsicAdjustment.POINTS_SAMPLE; mode++) {
for (int mode = 0; mode < ExtrinsicAdjustment.get_POINTS_SAMPLE(getNumSensors()); mode++) {
int x0 = (mode % 3) * (ea.clustersX + gap);
int y0 = (mode / 3) * (ea.clustersY + gap);
for (int cluster = 0; cluster < clusters; cluster++) {
int x = x0 + (cluster % ea.clustersX);
int y = y0 + (cluster / ea.clustersX);
int pix = x + y * width;
int indx = (mode == 0) ? ExtrinsicAdjustment.INDX_DIFF : (ExtrinsicAdjustment.INDX_DD0 + mode - 1);
int indx = (mode == 0) ? ExtrinsicAdjustment.INDX_DIFF : (ExtrinsicAdjustment.get_INDX_DD0(getNumSensors()) + mode - 1);
if (mode == 0) {
dbg_img[par][pix] = -ly_diff[par][indx][cluster];
} else {
......@@ -13234,7 +13240,7 @@ public class QuadCLTCPU {
dbg_img = new double [num_pars][width*height];
for (int par = 0; par < num_pars; par++) {
for (int mode = 0; mode < ExtrinsicAdjustment.POINTS_SAMPLE; mode++) {
for (int mode = 0; mode < ExtrinsicAdjustment.get_POINTS_SAMPLE(getNumSensors()); mode++) {
int x0 = (mode % 3) * (ea.clustersX + gap);
int y0 = (mode / 3) * (ea.clustersY + gap);
for (int cluster = 0; cluster < clusters; cluster++) {
......
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