Commit 2ea2b2c9 authored by Andrey Filippov's avatar Andrey Filippov

More work on low-textured areas with bi-quad camera

parent b3cf8b8a
......@@ -5,7 +5,7 @@
**
** -----------------------------------------------------------------------------**
**
** TwoQuadCLT.java is free software: you can redistribute it and/or modify
** BiCamDSI.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
......@@ -25,13 +25,52 @@ import java.util.ArrayList;
public class BiCamDSI {
// public int tilesX;
// public int tilesY;
TileNeibs tnImage; // = new TileNeibs(tilesX, tilesY)
int threadsMax;
ArrayList<BiScan> biScans;
public int addBiScan(
double [] disparity,
double [] strength,
boolean [] trusted,
boolean [] disabled) {
if (biScans == null) biScans = new ArrayList<BiScan>();
biScans.add(new BiScan(this, biScans.size(), disparity, strength, trusted, disabled));
return biScans.size()-1;
}
public int addBiScan(
double [][] disparity_bimap) {
return addBiScan(
disparity_bimap[ImageDtt.BI_TARGET_INDEX], // double [] disparity,
disparity_bimap[ImageDtt.BI_STR_CROSS_INDEX], // double [] strength,
null, // boolean [] trusted,
null); // boolean [] disabled)
}
public BiScan getLastBiScan() {
return getBiScan(-1);
}
public BiScan getBiScan(int indx) {
if (biScans.isEmpty()) return null;
return biScans.get((indx>=0)? indx: (biScans.size() - 1));
}
public double [] getTargetDisparity(int indx) {
BiScan biScan = getBiScan(indx);
if (biScan == null) return null;
return biScan.target_disparity;
}
public BiCamDSI(
int tilesX,
int tilesY) {
int tilesY,
int threadsMax) {
this.threadsMax = threadsMax;
tnImage = new TileNeibs(tilesX, tilesY);
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -588,6 +588,9 @@ private Panel panel1,
addButton("AUX Extrinsics", panelClt4, color_process);
addButton("AUX show fine", panelClt4, color_configure);
// addButton("Rig enhance", panelClt4, color_conf_process);
// /"Reset GT"
addButton("Reset GT", panelClt4, color_stop);
addButton("Ground truth 0", panelClt4, color_configure);
addButton("Ground truth", panelClt4, color_conf_process);
addButton("ML export", panelClt4, color_conf_process);
addButton("Rig planes", panelClt4, color_conf_process);
......@@ -4594,13 +4597,27 @@ private Panel panel1,
return;
/* ======================================================================== */
} else if (label.equals("Reset GT")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
resetGroundTruth();
return;
/* ======================================================================== */
} else if (label.equals("Ground truth 0")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
enhanceByRig(false);
return;
/* ======================================================================== */
} else if (label.equals("Ground truth")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
enhanceByRig();
enhanceByRig(true);
return;
/* ======================================================================== */
/* ======================================================================== */
} else if (label.equals("CLT planes")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
......@@ -5052,10 +5069,14 @@ private Panel panel1,
return true;
}
public boolean enhanceByRig() {
//resetGroundTruthByRig()
public boolean resetGroundTruth() {
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null)) return false;
QUAD_CLT.resetGroundTruthByRig();
return true;
}
public boolean enhanceByRig( boolean use_planes) {
long startTime=System.nanoTime();
if ((QUAD_CLT == null) || (QUAD_CLT.tp == null) || (QUAD_CLT.tp.clt_3d_passes == null)) {
String msg = "DSI data is not available. Please run \"CLT 3D\" first";
IJ.showMessage("Error",msg);
......@@ -5067,21 +5088,16 @@ private Panel panel1,
if (configPath.equals("ABORT")) return false;
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Enhancing single-camera DSI by the dual-camera rig++++++++++++++");
System.out.println("++++++++++++++ Enhancing single-camera DSI by the dual-camera rig using planes ++++++++++++++");
}
try {
TWO_QUAD_CLT.enhanceByRig( // actually there is no sense to process multiple image sets. Combine with other processing?
QUAD_CLT, // QuadCLT quadCLT_main,
QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
use_planes, // final boolean use_planes,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //final int debugLevel);
if (configPath!=null) {
saveTimestampedProperties( // save config again
configPath, // full path or null
......
......@@ -2711,7 +2711,7 @@ public class ImageDtt {
for (int chn = 0; chn < numcol; chn++){
tiles_debayered[i][chn] = tile_debayer_shot_corr(
(chn != 2), // red or blue (flase - green)
(chn != 2), // red or blue (false - green)
iclt_tile[i][chn],
2 * transform_size,
lt_window2, // squared lapping window
......@@ -7098,12 +7098,12 @@ public class ImageDtt {
for (int i =0; i<quad; i++){
for (int chn = 0; chn < numcol; chn++){
// tiles_debayered[i][chn] = tile_debayer(
// (chn != 2), // red or blue (flase - green)
// (chn != 2), // red or blue (false - green)
// iclt_tile[i][chn],
// 2 * transform_size);
tiles_debayered[i][chn] = tile_debayer_shot_corr(
(chn != 2), // red or blue (flase - green)
(chn != 2), // red or blue (false - green)
iclt_tile[i][chn],
2 * transform_size,
lt_window2, // squared lapping window
......@@ -7642,7 +7642,7 @@ public class ImageDtt {
for (int chn = 0; chn < numcol; chn++){
tiles_debayered[i][chn] = tile_debayer_shot_corr(
(chn != 2), // red or blue (flase - green)
(chn != 2), // red or blue (false - green)
iclt_tile[i][chn],
2 * clt_parameters.transform_size,
lt_window2, // squared lapping window
......
......@@ -73,6 +73,9 @@ public class QuadCLT {
// magic scale should be set before using TileProcessor (calculated disparities depend on it)
public void resetGroundTruthByRig() {
tp.rig_disparity_strength = null;
}
public double [][] getGroundTruthByRig(){
if (tp == null) return null;
return tp.rig_disparity_strength;
......@@ -118,6 +121,57 @@ public class QuadCLT {
}
}
// used for aux camera
public boolean setupImageData(
String image_name,
String [] sourceFiles,
EyesisCorrectionParameters.CLTParameters clt_parameters,
int threadsMax,
int debugLevel) {
QuadCLT.SetChannels [] set_channels_aux = setChannels(image_name, debugLevel);
if ((set_channels_aux == null) || (set_channels_aux.length==0)) {
System.out.println("No files for the auxiliary camera match series "+image_name);
return false;
}
double [] referenceExposures_aux = eyesisCorrections.calcReferenceExposures(debugLevel); // multiply each image by this and divide by individual (if not NaN)
int [] channelFiles_aux = set_channels_aux[0].fileNumber();
// make single
boolean [][] saturation_aux = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles_aux.length][] : null;
double [] scaleExposures_aux = new double[channelFiles_aux.length];
ImagePlus [] imp_srcs_aux = conditionImageSet(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
sourceFiles, // String [] sourceFiles,
image_name, // set_channels_aux[0].name(), // String set_name,
referenceExposures_aux, // double [] referenceExposures,
channelFiles_aux, // int [] channelFiles,
scaleExposures_aux, //output // double [] scaleExposures
saturation_aux, //output // boolean [][] saturation_imp,
debugLevel); // int debugLevel);
double [][][] double_stacks_aux = new double [imp_srcs_aux.length][][];
for (int i = 0; i < double_stacks_aux.length; i++){
double_stacks_aux[i] = eyesisCorrections.bayerToDoubleStack(
imp_srcs_aux[i], // source Bayer image, linearized, 32-bit (float))
null); // no margins, no oversample
}
for (int i = 0; i < double_stacks_aux.length; i++){
for (int j =0 ; j < double_stacks_aux[i][0].length; j++){
double_stacks_aux[i][2][j]*=0.5; // Scale green 0.5 to compensate more pixels than R,B
}
}
setTiles (imp_srcs_aux[0], // set global tp.tilesX, tp.tilesY
clt_parameters,
threadsMax);
this.image_name = image_name;
image_data = double_stacks_aux;
saturation_imp = saturation_aux;
tp.setTrustedCorrelation(clt_parameters.grow_disp_trust);
tp.resetCLTPasses();
return true;
}
public QuadCLT(
String prefix,
......
......@@ -59,6 +59,12 @@ public class TileNeibs{
int [] xy = {indx % sizeX ,indx / sizeX};
return xy;
}
int getSizeX() {
return sizeX;
}
int getSizeY() {
return sizeY;
}
/**
* Get element index from x and y
......
This diff is collapsed.
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