Commit 48429931 authored by Andrey Filippov's avatar Andrey Filippov

before implementing interscene ERS correction

parent ba6fb0e3
......@@ -5010,6 +5010,9 @@ private Panel panel1,
} else if (label.equals("LIST extrinsics")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
if (EYESIS_CORRECTIONS_AUX == null) {
EYESIS_CORRECTIONS_AUX = new EyesisCorrections(SYNC_COMMAND.stopRequested,CORRECTION_PARAMETERS.getAux());
}
listExtrinsics();
return;
/* ======================================================================== */
......@@ -6531,7 +6534,10 @@ private Panel panel1,
if (dir!=null) {
System.out.println("top directory = "+dir);
}
return MLStats.listExtrinsics(dir); // , mask);
return MLStats.listExtrinsics(
dir, // ); // , mask);
EYESIS_CORRECTIONS,
EYESIS_CORRECTIONS_AUX);
}
public boolean mlRecalc() {
......
......@@ -1461,7 +1461,7 @@ public class Corr2dLMA {
}
public double [][] lmaDisparityStrength( // restored from git
public double [][] lmaDisparityStrength1( // restored from git
double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
double lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
......@@ -1510,7 +1510,7 @@ public class Corr2dLMA {
public double [][] lmaDisparityStrength0(
public double [][] lmaDisparityStrength(
double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
double lma_min_max_ac, // minimal of A and C coefficients maximum (measures sharpest point/line)
......@@ -1554,7 +1554,7 @@ public class Corr2dLMA {
if ((strength < lma_min_strength) || Double.isNaN(disparity)) {
continue;
}
// strength = Math.sqrt(strength * Math.sqrt(abc[tile][0] * abc[tile][2])); // / area ); // new strength
strength = Math.sqrt(strength * Math.sqrt(abc[tile][0] * abc[tile][2])); // / area ); // new strength
ds[tile][0] = disparity;
ds[tile][1] = (strength * lma_str_scale) + lma_str_offset;
}
......
......@@ -45,6 +45,7 @@ import com.elphel.imagej.cameras.ColorProcParameters;
import com.elphel.imagej.cameras.EyesisCorrectionParameters;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.correction.EyesisCorrections;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import ij.IJ;
......@@ -555,18 +556,23 @@ public class MLStats {
}
public static boolean listExtrinsics(String dir) // , String mask)
public static boolean listExtrinsics(
String dir, //) // , String mask)
EyesisCorrections eyesis_corrections_main,
EyesisCorrections eyesis_corrections_aux)
{
Path path= Paths.get(dir);
boolean inPixels = true;
boolean inMrad = false;
boolean showATR = true;
boolean showZooms = true;
boolean showERS = true;
boolean showSym = true;
boolean showRigATR = true;
boolean showRigZoom = true;
boolean showRigAngle = true;
boolean showRigBaseline = false;
boolean showAux = true;
String mask = ".*EXTRINSICS\\.corr-xml";
GenericDialog gd = new GenericDialog("Select file mask and output format");
......@@ -575,11 +581,13 @@ public class MLStats {
gd.addCheckbox("Show results in mrad (false in arcseconds)", inMrad);
gd.addCheckbox("Show azimuths, tilts, rolls", showATR);
gd.addCheckbox("Show zooms", showZooms);
gd.addCheckbox("Show ERS", showERS);
gd.addCheckbox("Show symmetric angles", showSym);
gd.addCheckbox("Show rig azimuth, tilt, roll", showRigATR);
gd.addCheckbox("Show rig zoom", showRigZoom);
gd.addCheckbox("Show rig angle", showRigAngle);
gd.addCheckbox("Show rig baseline", showRigBaseline);
gd.addCheckbox("Show aux camera and rig", showAux);
gd.showDialog ();
if (gd.wasCanceled()) return false;
mask = gd.getNextString();
......@@ -587,19 +595,30 @@ public class MLStats {
inMrad = gd.getNextBoolean();
showATR = gd.getNextBoolean();
showZooms = gd.getNextBoolean();
showERS = gd.getNextBoolean();
showSym = gd.getNextBoolean();
showRigATR = gd.getNextBoolean();
showRigZoom = gd.getNextBoolean();
showRigAngle = gd.getNextBoolean();
showRigBaseline = gd.getNextBoolean();
showAux = gd.getNextBoolean();
if (!showAux) {
showRigATR = false;
showRigZoom = false;
showRigAngle = false;
showRigBaseline = false;
}
String units = inPixels ? "pix":(inMrad?"mil":"\"");
String zunits = inPixels ? "pix":(inMrad?"mil":"\"");
String ers_lin_units = inPixels ? "mm/s":"m/s";
double scale = inPixels ? 1.0 : (inMrad?1000.0:(180.0/Math.PI*60*60)); //leave pixels as is, convert radians to arc-sec
String fmt = "\t"+(inPixels ? "%8.4f":(inMrad?"%8.4f":"%8.2f"));
String fmt_angle = "\t%8.3f";
String fmt_len = "\t%8.3f";
int num_sym = showZooms? GeometryCorrection.CorrVector.LENGTH:GeometryCorrection.CorrVector.ZOOM_INDEX;
int num_sym = showZooms? GeometryCorrection.CorrVector.IMU_INDEX:GeometryCorrection.CorrVector.ZOOM_INDEX; // update
if (showERS) num_sym = GeometryCorrection.CorrVector.LENGTH;
class ModVerString{
String model;
String version;
......@@ -632,6 +651,12 @@ public class MLStats {
num_col+=4;
}
if (showERS) {
header+=String.format("\ters tilt (%s/s)\ters az (%s/s)\ters roll (%s/s)", units, units, units);
header+=String.format("\ters Vx (%s)\ters Vy (%s)\ters Vz (%s)", ers_lin_units, ers_lin_units, ers_lin_units);
num_col+=6;
}
if (showSym) {
for (int i = 0; i < num_sym; i++) {
header+=String.format("\tsym%02d-m", i);
......@@ -639,7 +664,7 @@ public class MLStats {
num_col+=num_sym;
}
if (showAux) {
if (showATR) {
header+=String.format("\taz a0 (%s)\taz a1 (%s)\taz a2 (%s)\taz a3 (%s)"+
"\ttl a0 (%s)\ttl a1 (%s) \ttl a2 (%s)\ttl a3 (%s)"+
......@@ -651,12 +676,18 @@ public class MLStats {
header+=String.format("\tzm a0 (%s)\tzm a1 (%s)\tzm a2 (%s)\tzm a3 (%s)", zunits, zunits, zunits, zunits);
num_col+=4;
}
if (showERS) {
header+=String.format("\ters tilt (%s/s) a\ters az (%s/s) a\ters roll (%s/s) a", units, units, units);
header+=String.format("\ters Vx (%s)\ters Vy (%s)\ters Vz (%s)", ers_lin_units, ers_lin_units, ers_lin_units);
num_col+=6;
}
if (showSym) {
for (int i = 0; i < num_sym; i++) {
header+=String.format("\tsym%02d-a", i);
}
num_col+=num_sym;
}
}
if (showRigATR) {
header+=String.format("\trig azmth (%s)\trig tilt(%s)\trig roll (%s)", units, units, units);
num_col+=3;
......@@ -712,13 +743,13 @@ public class MLStats {
QuadCLT qcm = new QuadCLT(
QuadCLT.PREFIX, // String prefix,
properties, // Properties properties,
null, // EyesisCorrections eyesisCorrections,
eyesis_corrections_main, // null, // EyesisCorrections eyesisCorrections,
null // EyesisCorrectionParameters.CorrectionParameters correctionsParameters
);
QuadCLT qca = new QuadCLT(
QuadCLT.PREFIX_AUX, // String prefix,
properties, // Properties properties,
null, // EyesisCorrections eyesisCorrections,
eyesis_corrections_aux, //null, // EyesisCorrections eyesisCorrections,
null // EyesisCorrectionParameters.CorrectionParameters correctionsParameters
);
System.out.println(indx+": model:"+model+", version:"+version+", name: "+name);
......@@ -778,6 +809,17 @@ public class MLStats {
}
}
if (showERS) { // main camera
double [] v = new double[6];
for (int i = 0; i < v.length ; i++) {
v[i] = scale * cvm.getExtrinsicParameterValue(i+GeometryCorrection.CorrVector.IMU_INDEX, inPixels);
sb.append(String.format(fmt,v[i])); // zooms
fmts [ncol] = fmt;
stats[ncol ][0]+=v[i];
stats[ncol++][1]+=v[i]*v[i];
}
}
if (showSym) {
for (int i = 0; i < num_sym; i++) {
double v = scale * cvm.getExtrinsicSymParameterValue(i, inPixels);
......@@ -788,7 +830,7 @@ public class MLStats {
}
}
if (showAux) {
if (showATR) { // aux camera
double [] v = new double[4];
for (int i = 0; i <4; i++) {
......@@ -837,6 +879,17 @@ public class MLStats {
stats[ncol++][1]+=v[i]*v[i];
}
}
if (showERS) { // main camera
double [] v = new double[6];
for (int i = 0; i < v.length ; i++) {
v[i] = scale * cva.getExtrinsicParameterValue(i+GeometryCorrection.CorrVector.IMU_INDEX, inPixels);
sb.append(String.format(fmt,v[i])); // zooms
fmts [ncol] = fmt;
stats[ncol ][0]+=v[i];
stats[ncol++][1]+=v[i]*v[i];
}
}
if (showSym) {
for (int i = 0; i < num_sym; i++) {
double v = scale * cva.getExtrinsicSymParameterValue(i, inPixels);
......@@ -846,6 +899,7 @@ public class MLStats {
stats[ncol++][1]+=v*v;
}
}
}
if (showRigATR) {
int [] indices = {
GeometryCorrection.RigOffset.AUX_AZIMUTH_INDEX,
......
......@@ -386,14 +386,60 @@ public class TileNeibs{
}
public int [] distanceFromEdge(
boolean [] tiles) {
int [] dfe = new int [tiles.length];
for (int i = 0; i < tiles.length; i++) dfe[i] = tiles[i] ? -1 : 0;
ArrayList<Integer> front = new ArrayList<Integer>();
int dist = 0;
for (boolean has_empty = true; has_empty;) {
has_empty = false;
for (int start_indx = 0; start_indx < tiles.length; start_indx++) if (dfe[start_indx] < 0){
has_empty = true;
// see if it has wave front around
boolean has_front_near = false;
for (int d = 0; (d < dirs) && !has_front_near; d++){
int ipx1 = getNeibIndex(start_indx, d);
if ((ipx1 >= 0) && (dfe[ipx1] == dist)) {
has_front_near = true;
}
}
if (has_front_near) {
dfe[start_indx] = dist+1;
front.add(start_indx);
// build wave front (may be several)
while (!front.isEmpty()) {
int ipx = front.remove(0);// get oldest element
for (int d = 0; (d < dirs) && !has_front_near; d++){
int ipx1 = getNeibIndex(ipx, d);
if ((ipx1 >= 0) && (dfe[ipx1] < 0)) { // fresh cell
// does it has front neighbor?
for (int d1 = 0; (d1 < dirs) && !has_front_near; d1++){
int ipx2 = getNeibIndex(ipx1, d1);
if ((ipx2 >= 0) && (dfe[ipx2] == dist)) { // old front cell
dfe[ipx1] = dist+1;
front.add(ipx1);
break;
}
}
}
}
}
}
}
dist++;
}
return dfe;
}
/**
* Enumerate clusters on rectangular area
* @param tiles selected tiles, size should be sizeX * sizeY
* @param ordered if true, order tiles from largest to smallest5
* @return integer array, where 0 is unused, 1+ cluster it belongs to
*/
public int [] enumerateClusters(
boolean [] tiles,
boolean ordered)
......
......@@ -8325,11 +8325,14 @@ if (debugLevel > -100) return true; // temporarily !
"pre-adjust-extrinsic-scan-"+s); //String title)
}
}
double inf_min = -1.0;
double inf_max = 1.0;
if (num_adjust_main >= (adjust_main/2)) {
inf_min = -0.2;
inf_max = 0.05;
double inf_min = clt_parameters.ly_inf_min_broad; // -0.5;
double inf_max = clt_parameters.ly_inf_max_broad; // 0.5;
if (clt_parameters.ly_inf_force_fine || (num_adjust_main >= (adjust_main/2))) {
inf_min = clt_parameters.ly_inf_min_narrow; // -0.2;
inf_max = clt_parameters.ly_inf_max_narrow; // 0.05;
System.out.println("Late adjustment, using narrow band infinity detection, inf_min="+inf_min+", inf_max="+inf_max);
} else {
System.out.println("Early adjustment, using wide band infinity detection, inf_min="+inf_min+", inf_max="+inf_max);
}
boolean ok = quadCLT_main.extrinsicsCLT(
clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters,
......@@ -8407,7 +8410,7 @@ if (debugLevel > -100) return true; // temporarily !
quadCLT_main.tp.clt_3d_passes.get( quadCLT_main.tp.clt_3d_passes.size() -1),
false); // boolean force_final);
if (debugLevel > -5){
if (debugLevel > -1) { //-5){
int scan_index = quadCLT_main.tp.clt_3d_passes.size() -1;
quadCLT_main.tp.showScan(
quadCLT_main.tp.clt_3d_passes.get(scan_index), // CLTPass3d scan,
......@@ -8508,6 +8511,18 @@ if (debugLevel > -100) return true; // temporarily !
}
if (num_restored < 2) {
System.out.println("No DSI from the main camera is available. Please re-run with 'clt_batch_explore' enabled to generate it");
if (quadCLT_main.correctionsParameters.clt_batch_save_extrinsics) {
saveProperties(
null, // String path, // full name with extension or w/o path to use x3d directory
null, // Properties properties, // if null - will only save extrinsics)
debugLevel);
}
if (quadCLT_main.correctionsParameters.clt_batch_save_all) {
saveProperties(
null, // String path, // full name with extension or w/o path to use x3d directory
properties, // Properties properties, // if null - will only save extrinsics)
debugLevel);
}
continue; // skipping to the next file
}
}
......@@ -8682,6 +8697,8 @@ if (debugLevel > -100) return true; // temporarily !
debugLevel); // final int debugLevel)
}
if (quadCLT_main.correctionsParameters.clt_batch_save_extrinsics) {
saveProperties(
null, // String path, // full name with extension or w/o path to use x3d directory
......
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