Commit 7135cb85 authored by Andrey Filippov's avatar Andrey Filippov

Updated TileProcessor:getShowScan for variable number of sensors

parent 6346b15e
...@@ -73,7 +73,11 @@ public class CLTPass3d{ ...@@ -73,7 +73,11 @@ public class CLTPass3d{
public double [][] tiles_RBGA = null; public double [][] tiles_RBGA = null;
SuperTiles superTiles = null; SuperTiles superTiles = null;
TileProcessor tileProcessor; final TileProcessor tileProcessor;
public int getNumSensors() {
return tileProcessor.getNumSensors();
}
public CLTPass3d (TileProcessor tileProcessor) public CLTPass3d (TileProcessor tileProcessor)
{ {
this.tileProcessor = tileProcessor; this.tileProcessor = tileProcessor;
...@@ -304,8 +308,8 @@ public class CLTPass3d{ ...@@ -304,8 +308,8 @@ public class CLTPass3d{
public double [][] getDiffs (){ public double [][] getDiffs (){
if (disparity_map == null) return null; if (disparity_map == null) return null;
double [][] these_diffs = new double[ImageDtt.QUAD][]; double [][] these_diffs = new double[getNumSensors()][];
for (int i = 0; i< ImageDtt.QUAD; i++) these_diffs[i] = disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]; for (int i = 0; i< these_diffs.length; i++) these_diffs[i] = disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]; // IMG_DIFF0_INDEX does not depend on num sensors
return these_diffs; return these_diffs;
} }
......
...@@ -85,7 +85,7 @@ public class ImageDttCPU { ...@@ -85,7 +85,7 @@ public class ImageDttCPU {
{0,1,3,4}}; // bottom right {0,1,3,4}}; // bottom right
// public static int FORCE_DISPARITY_BIT = 8; // move to parameters? // public static int FORCE_DISPARITY_BIT = 8; // move to parameters?
static int QUAD = 4; // number of cameras in camera // static int QUAD = 4; // number of cameras in camera
static int GREEN_CHN = 2; // index of green channel static int GREEN_CHN = 2; // index of green channel
static int MONO_CHN = 2; // index of channel used in monochrome mode static int MONO_CHN = 2; // index of channel used in monochrome mode
......
...@@ -194,7 +194,7 @@ public class MacroCorrelation { ...@@ -194,7 +194,7 @@ public class MacroCorrelation {
final int mTilesY = (pTilesY + tileSize - 1) / tileSize; final int mTilesY = (pTilesY + tileSize - 1) / tileSize;
final int mTiles = mTilesX * mTilesY; final int mTiles = mTilesX * mTilesY;
final int num_chn = tmp_input? 3: (1 + ((other_channels == null) ? 0 : (other_channels[0].length))); final int num_chn = tmp_input? 3: (1 + ((other_channels == null) ? 0 : (other_channels[0].length)));
final double [][][] input_data = new double [ImageDtt.QUAD][num_chn][mTiles*tileSize*tileSize]; final double [][][] input_data = new double [src_scan.getNumSensors()][num_chn][mTiles*tileSize*tileSize];
// double [][] tiles_tone = src_scan.getTileRBGA( No, we need individual subcameras // double [][] tiles_tone = src_scan.getTileRBGA( No, we need individual subcameras
// 4); // int num_layers); // 4); // int num_layers);
// TODO: add other channels (average tone) // TODO: add other channels (average tone)
......
...@@ -37,7 +37,8 @@ import com.elphel.imagej.common.PolynomialApproximation; ...@@ -37,7 +37,8 @@ import com.elphel.imagej.common.PolynomialApproximation;
import com.elphel.imagej.common.ShowDoubleFloatArrays; import com.elphel.imagej.common.ShowDoubleFloatArrays;
public class TileProcessor { public class TileProcessor {
public static String [] SCAN_TITLES = { // wrong now !
public static String [] SCAN_TITLES4 = {
"tile_op", // 0 "tile_op", // 0
"final", // 1 - calculated, filtered, combined disparity "final", // 1 - calculated, filtered, combined disparity
"disparity", // 2 "disparity", // 2
...@@ -66,11 +67,13 @@ public class TileProcessor { ...@@ -66,11 +67,13 @@ public class TileProcessor {
"d0","d1","d2","d3" "d0","d1","d2","d3"
// "ly_force" // force lazy eye disparity // "ly_force" // force lazy eye disparity
}; };
public static String [] SCAN_TITLES_DS = { public static String [] SCAN_TITLES_DS = {
"disparity", "disparity",
"strength" "strength"
}; };
public final String [] scan_titles;
public ArrayList <CLTPass3d> clt_3d_passes = null; public ArrayList <CLTPass3d> clt_3d_passes = null;
public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera
...@@ -102,6 +105,22 @@ public class TileProcessor { ...@@ -102,6 +105,22 @@ public class TileProcessor {
public int getNumSensors() { public int getNumSensors() {
return numSensors; return numSensors;
} }
public static int getStringIndex(String needle, String [] haystack) {
for (int i = 0; i < haystack.length; i++) {
if (haystack[i].equals(needle)) return i;
}
String shaystack = "{";
for (String s:haystack) {
shaystack +="\""+s+"\",";
}
shaystack +="}";
throw new IllegalArgumentException ("Scan title\""+needle+"\" is not found in "+shaystack);
}
public int getScanTitleIndex(String title) {
return getStringIndex(title, scan_titles);
}
public TileProcessor( public TileProcessor(
int tilesX, int tilesX,
int tilesY, int tilesY,
...@@ -128,7 +147,21 @@ public class TileProcessor { ...@@ -128,7 +147,21 @@ public class TileProcessor {
this.trustedCorrelation = trustedCorrelation; this.trustedCorrelation = trustedCorrelation;
this.maxOverexposure = maxOverexposure; this.maxOverexposure = maxOverexposure;
this.threadsMax = threadsMax; this.threadsMax = threadsMax;
this.scan_titles = new String[SCAN_TITLES4.length + (this.numSensors-4)*6];
int idiff0 = getStringIndex("diff0", SCAN_TITLES4);
int idiff2max = getStringIndex("diff2max", SCAN_TITLES4);
int ir0 = getStringIndex("r0", SCAN_TITLES4);
int indx = 0;
for (int i = 0; i < idiff0; i++) scan_titles[indx++] = SCAN_TITLES4[i];
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "diff"+i;
for (int i = idiff2max; i < ir0; i++) scan_titles[indx++] = SCAN_TITLES4[i];
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "r"+i;
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "b"+i;
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "g"+i;
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "y"+i;
for (int i = 0; i < numSensors; i++) scan_titles[indx++] = "d"+i;
} }
public TileProcessor(TileProcessor tp) { public TileProcessor(TileProcessor tp) {
this.tilesX = tp.tilesX; this.tilesX = tp.tilesX;
this.tilesY = tp.tilesY; this.tilesY = tp.tilesY;
...@@ -143,6 +176,7 @@ public class TileProcessor { ...@@ -143,6 +176,7 @@ public class TileProcessor {
this.maxOverexposure = tp.maxOverexposure; this.maxOverexposure = tp.maxOverexposure;
this.threadsMax = tp.threadsMax; this.threadsMax = tp.threadsMax;
this.globalDebugLevel = tp.globalDebugLevel; this.globalDebugLevel = tp.globalDebugLevel;
this.scan_titles = tp.scan_titles;
// next should not be needed for new instance // next should not be needed for new instance
/* /*
...@@ -492,7 +526,7 @@ public class TileProcessor { ...@@ -492,7 +526,7 @@ public class TileProcessor {
if ((good_comp == null) || (!good_comp[0] && !good_comp[1] && !good_comp[2])){ if ((good_comp == null) || (!good_comp[0] && !good_comp[1] && !good_comp[2])){
pass.tile_op[ty][tx] = 0; pass.tile_op[ty][tx] = 0;
pass.texture_tiles = null; pass.texture_tiles = null;
for (int i = 0; i< ImageDtt.QUAD; i++) pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = 0.0; for (int i = 0; i< numSensors; i++) pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = 0.0;
} }
if ((good_comp == null) || !good_comp[0]) { if ((good_comp == null) || !good_comp[0]) {
pass.calc_disparity[nt] = Double.NaN; pass.calc_disparity[nt] = Double.NaN;
...@@ -1157,7 +1191,7 @@ public class TileProcessor { ...@@ -1157,7 +1191,7 @@ public class TileProcessor {
// 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][]; 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]; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen]; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen];
combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX] = new double[tlen]; combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX] = new double[tlen];
...@@ -1341,7 +1375,7 @@ public class TileProcessor { ...@@ -1341,7 +1375,7 @@ public class TileProcessor {
combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx]; combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx];
combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt]; combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt];
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) { for (int i = 0; i< numSensors; i++) {
if (pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]!= null) {// do not copy empty if (pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]!= null) {// do not copy empty
combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt]; combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt];
} }
...@@ -1360,7 +1394,7 @@ public class TileProcessor { ...@@ -1360,7 +1394,7 @@ public class TileProcessor {
combo_pass.calc_disparity[nt] = Double.NaN; combo_pass.calc_disparity[nt] = Double.NaN;
combo_pass.strength[nt] = 0.0; combo_pass.strength[nt] = 0.0;
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN;
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = Double.NaN;
combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt] = Double.NaN;
...@@ -1396,7 +1430,7 @@ public class TileProcessor { ...@@ -1396,7 +1430,7 @@ public class TileProcessor {
combo_pass.calc_disparity_hor[nt] = Double.NaN; combo_pass.calc_disparity_hor[nt] = Double.NaN;
combo_pass.strength_hor[nt] = 0.0; combo_pass.strength_hor[nt] = 0.0;
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN;
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt] = Double.NaN;
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt] = 0.0; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt] = 0.0;
...@@ -1433,7 +1467,7 @@ public class TileProcessor { ...@@ -1433,7 +1467,7 @@ public class TileProcessor {
combo_pass.calc_disparity_vert[nt] = Double.NaN; combo_pass.calc_disparity_vert[nt] = Double.NaN;
combo_pass.strength_vert[nt] = 0.0; combo_pass.strength_vert[nt] = 0.0;
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN;
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt] = Double.NaN;
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt] = 0.0; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt] = 0.0;
...@@ -1492,7 +1526,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1492,7 +1526,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.tile_op = new int [tilesY][tilesX]; // for just non-zero 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][]; 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]; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen]; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen];
combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX] = new double[tlen]; combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX] = new double[tlen];
...@@ -1669,7 +1703,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1669,7 +1703,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx]; combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx];
combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt]; combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt];
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) { for (int i = 0; i< numSensors; i++) {
if (pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]!= null) {// do not copy empty if (pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]!= null) {// do not copy empty
combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt]; combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt];
} }
...@@ -1688,7 +1722,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1688,7 +1722,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.calc_disparity[nt] = Double.NaN; combo_pass.calc_disparity[nt] = Double.NaN;
combo_pass.strength[nt] = 0.0; combo_pass.strength[nt] = 0.0;
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN;
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = Double.NaN;
combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt] = Double.NaN;
...@@ -1724,7 +1758,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1724,7 +1758,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.calc_disparity_hor[nt] = Double.NaN; combo_pass.calc_disparity_hor[nt] = Double.NaN;
combo_pass.strength_hor[nt] = 0.0; combo_pass.strength_hor[nt] = 0.0;
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN;
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR][nt] = Double.NaN;
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt] = 0.0; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH][nt] = 0.0;
...@@ -1761,7 +1795,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1761,7 +1795,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.calc_disparity_vert[nt] = Double.NaN; combo_pass.calc_disparity_vert[nt] = Double.NaN;
combo_pass.strength_vert[nt] = 0.0; combo_pass.strength_vert[nt] = 0.0;
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = Double.NaN;
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt] = Double.NaN; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT][nt] = Double.NaN;
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt] = 0.0; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH][nt] = 0.0;
...@@ -1810,7 +1844,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1810,7 +1844,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.tile_op = new int [tilesY][tilesX]; // for just non-zero 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][]; 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]; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i] = new double[tlen];
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen]; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM] = new double[tlen];
combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX] = new double[tlen]; combo_pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX] = new double[tlen];
...@@ -1958,7 +1992,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1958,7 +1992,7 @@ ImageDtt.startAndJoin(threads);
combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx]; combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx];
combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt]; combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt];
// Only copy for full disparity // Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt]; for (int i = 0; i< numSensors; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt];
if (copyDebug){ if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt]; combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt];
...@@ -3535,11 +3569,11 @@ ImageDtt.startAndJoin(threads); ...@@ -3535,11 +3569,11 @@ ImageDtt.startAndJoin(threads);
} }
public String [] getScanTitles() { public String [] getScanTitles() {
return SCAN_TITLES; return scan_titles; // SCAN_TITLES;
} }
public String [] getScanTitles(boolean ds_only) { public String [] getScanTitles(boolean ds_only) {
return ds_only ? SCAN_TITLES_DS : SCAN_TITLES; return ds_only ? SCAN_TITLES_DS : scan_titles; // SCAN_TITLES;
} }
public void showScan( public void showScan(
...@@ -3718,8 +3752,7 @@ ImageDtt.startAndJoin(threads); ...@@ -3718,8 +3752,7 @@ ImageDtt.startAndJoin(threads);
boolean measured_only) boolean measured_only)
{ {
int NUM_SLICES=getScanTitles().length; int NUM_SLICES=getScanTitles().length;
int this_IMG_TONE_RGB = 21; int this_IMG_TONE_RGB = getScanTitleIndex("r0");
// int ly_force_indx = 41;
double corr_red = 0.5; // Red to green correlation weight double corr_red = 0.5; // Red to green correlation weight
double corr_blue = 0.2; // Blue to green correlation weight double corr_blue = 0.2; // Blue to green correlation weight
double scale_diff = 5.0; // scale 0.5*(r+b)-G to match Y double scale_diff = 5.0; // scale 0.5*(r+b)-G to match Y
...@@ -3727,68 +3760,92 @@ ImageDtt.startAndJoin(threads); ...@@ -3727,68 +3760,92 @@ ImageDtt.startAndJoin(threads);
col_weights[2] = 1.0/(1.0 + corr_red + corr_blue); // green color col_weights[2] = 1.0/(1.0 + corr_red + corr_blue); // green color
col_weights[0] = corr_red * col_weights[2]; col_weights[0] = corr_red * col_weights[2];
col_weights[1] = corr_blue * col_weights[2]; col_weights[1] = corr_blue * col_weights[2];
int this_IMG_TONE_RGB_R = this_IMG_TONE_RGB + 0; int this_IMG_TONE_RGB_R = getScanTitleIndex("r0");
int this_IMG_TONE_RGB_B = this_IMG_TONE_RGB + 4; int this_IMG_TONE_RGB_B = getScanTitleIndex("b0");
int this_IMG_TONE_RGB_G = this_IMG_TONE_RGB + 8; int this_IMG_TONE_RGB_G = getScanTitleIndex("g0");
int this_IMG_TONE_RGB_Y = this_IMG_TONE_RGB+12; int this_IMG_TONE_RGB_Y = getScanTitleIndex("y0");
int this_IMG_TONE_RGB_DIFF = this_IMG_TONE_RGB+16; int this_IMG_TONE_RGB_DIFF = getScanTitleIndex("d0");
// boolean [] ly_force = scan.getLazyEyeForceDisparity(); // boolean [] ly_force = scan.getLazyEyeForceDisparity();
int i_tile_op = getScanTitleIndex("tile_op"); // 0
int i_final = getScanTitleIndex("final"); // 1
int i_disparity = getScanTitleIndex("disparity"); // 2
int i_disp_cm = getScanTitleIndex("disp_cm"); // 3
int i_disp_hor = getScanTitleIndex("disp_hor"); // 4
int i_disp_vert = getScanTitleIndex("disp_vert"); // 5
int i_final_strength = getScanTitleIndex("final_strength"); // 6
int i_strength = getScanTitleIndex("strength"); // 7
int i_strength_hor = getScanTitleIndex("strength_hor"); // 8
int i_strength_vert = getScanTitleIndex("strength_vert"); // 9
int i_selection = getScanTitleIndex("selection"); // 10
int i_border_tiles = getScanTitleIndex("border_tiles"); // 11
int i_max_tried = getScanTitleIndex("max_tried"); // 12
int i_diff0 = getScanTitleIndex("diff0"); // 13*
int i_diff2max = getScanTitleIndex("diff2max"); // 17*
int i_diff2maxAvg = getScanTitleIndex("diff2maxAvg"); // 18*
int i_normStrength = getScanTitleIndex("normStrength"); // 19*
int i_overexp = getScanTitleIndex("overexp"); // 20*
int i_getImgToneRGB = ImageDtt.getImgToneRGB(numSensors);
int tlen = tilesX*tilesY; int tlen = tilesX*tilesY;
if (scan.tile_op == null) measured_only = false; if (scan.tile_op == null) measured_only = false;
boolean [] measured = new boolean [tlen]; boolean [] measured = new boolean [tlen];
double [][] dbg_img = new double[NUM_SLICES][]; double [][] dbg_img = new double[NUM_SLICES][];
if (scan.tile_op != null) dbg_img[ 0] = new double[tlen]; if (scan.tile_op != null) dbg_img[i_tile_op] = new double[tlen];
if (scan.disparity != null) dbg_img[ 2] = new double[tlen]; if (scan.disparity != null) dbg_img[i_disparity] = new double[tlen];
if (scan.selected != null) dbg_img[10] = new double[tlen]; if (scan.selected != null) dbg_img[i_selection] = new double[tlen];
if (scan.border_tiles != null) dbg_img[11] = new double[tlen]; if (scan.border_tiles != null) dbg_img[i_border_tiles] = new double[tlen];
if (scan.max_tried_disparity != null) dbg_img[12] = new double[tlen]; if (scan.max_tried_disparity != null) dbg_img[i_max_tried] = new double[tlen];
// if (ly_force != null) dbg_img[ly_force_indx] = new double[tlen]; // if (ly_force != null) dbg_img[ly_force_indx] = new double[tlen];
for (int ty = 0; ty < tilesY; ty++) for (int tx = 0; tx < tilesX; tx++){ for (int ty = 0; ty < tilesY; ty++) for (int tx = 0; tx < tilesX; tx++){
int nt = ty*tilesX + tx; int nt = ty*tilesX + tx;
if (scan.tile_op != null) { if (scan.tile_op != null) {
dbg_img[ 0][nt] = scan.tile_op[ty][tx]; dbg_img[i_tile_op][nt] = scan.tile_op[ty][tx];
measured[nt] = scan.tile_op[ty][tx] > 0; measured[nt] = scan.tile_op[ty][tx] > 0;
} }
if (scan.disparity != null) dbg_img[ 2][nt] = scan.disparity[ty][tx]; if (scan.disparity != null) dbg_img[i_disparity] [nt] = scan.disparity[ty][tx];
if (scan.selected != null) dbg_img[10][nt] = scan.selected[nt]? 1.0:0.0; if (scan.selected != null) dbg_img[i_selection] [nt] = scan.selected[nt]? 1.0:0.0;
if (scan.border_tiles != null) dbg_img[11][nt] = scan.border_tiles[nt]? 1.0:0.0; if (scan.border_tiles != null) dbg_img[i_border_tiles][nt] = scan.border_tiles[nt]? 1.0:0.0;
if (scan.max_tried_disparity != null) dbg_img[12][nt] = scan.max_tried_disparity[ty][tx]; if (scan.max_tried_disparity != null) dbg_img[i_max_tried] [nt] = scan.max_tried_disparity[ty][tx];
// if (ly_force != null) dbg_img[ly_force_indx][nt] = ly_force[nt]? 1.0:0.0; // if (ly_force != null) dbg_img[ly_force_indx][nt] = ly_force[nt]? 1.0:0.0;
} }
double [] strength4 = null; double [] strength4 = null;
if (scan.disparity_map != null){ if (scan.disparity_map != null){
strength4 = scan.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX]; strength4 = scan.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX];
dbg_img[ 3] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM]; dbg_img[i_disp_cm] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM];
dbg_img[ 4] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_HOR]; dbg_img[i_disp_hor] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_HOR];
dbg_img[ 5] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_VERT]; dbg_img[i_disp_vert] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_VERT];
dbg_img[ 7] = scan.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX]; dbg_img[i_strength] = scan.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX];
dbg_img[ 8] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH]; dbg_img[i_strength_hor] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_HOR_STRENGTH];
dbg_img[ 9] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH]; dbg_img[i_strength_vert] = scan.disparity_map[ImageDtt.DISPARITY_INDEX_VERT_STRENGTH];
dbg_img[20] = scan.disparity_map[ImageDtt.OVEREXPOSED]; dbg_img[i_overexp] = scan.disparity_map[ImageDtt.OVEREXPOSED];
for (int i = 0; i < 12; i++) { // int this_IMG_TONE_RGB = getScanTitleIndex("r0");
dbg_img[this_IMG_TONE_RGB+i] = scan.disparity_map[ImageDtt.getImgToneRGB(numSensors) + i]; // int i_getImgToneRGB = ImageDtt.getImgToneRGB(numSensors);
}
} for (int i = 0; i < 3 *numSensors; i++) {
dbg_img[1] = scan.calc_disparity_combo; dbg_img[this_IMG_TONE_RGB+i] = scan.disparity_map[i_getImgToneRGB + i];
dbg_img[6] = scan.strength; }
}
dbg_img[i_final] = scan.calc_disparity_combo;
dbg_img[i_final_strength] = scan.strength;
double [][] these_diffs = scan.getDiffs(); double [][] these_diffs = scan.getDiffs();
double [] diff2max = scan.getSecondMaxDiff(false); double [] diff2max = scan.getSecondMaxDiff(false);
double [] diff2maxAvg = scan.getSecondMaxDiff(true); double [] diff2maxAvg = scan.getSecondMaxDiff(true);
if (these_diffs != null) { if (these_diffs != null) {
dbg_img[13] = these_diffs[0]; for (int i = 0; i < numSensors; i++) {
dbg_img[14] = these_diffs[1]; dbg_img[i_diff0+i] = these_diffs[i];
dbg_img[15] = these_diffs[2]; }
dbg_img[16] = these_diffs[3]; dbg_img[i_diff2max] = diff2max;
dbg_img[17] = diff2max; dbg_img[i_diff2maxAvg] = diff2maxAvg;
dbg_img[18] = diff2maxAvg; dbg_img[i_normStrength] = new double[tlen];
dbg_img[19] = new double[tlen];
if ((diff2maxAvg != null) && (strength4 != null)) { if ((diff2maxAvg != null) && (strength4 != null)) {
for (int i = 0; i < tlen; i++){ for (int i = 0; i < tlen; i++){
if (diff2maxAvg[i] > 0.0){ if (diff2maxAvg[i] > 0.0){
dbg_img[19][i] = strength4[i]/ diff2maxAvg[i]; dbg_img[i_normStrength][i] = strength4[i] / diff2maxAvg[i];
} }
} }
} }
......
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