@@ -1316,7 +1316,7 @@ public class Correlation2d {
}
// Full size/resolution.but on a larger rectangle
publicdouble[]debugStrip3(
publicdouble[]debugStrip3(// not used in lwir
double[]strip){
if(strip==null)returnnull;
intcenter=transform_size-1;
...
...
@@ -1341,7 +1341,7 @@ public class Correlation2d {
returnpadded_strip;
}
publicdouble[]mismatchPairsCM(// returns x-xcenter, y, strength (sign same as disparity)
publicdouble[]mismatchPairsCM(// returns x-xcenter, y, strength (sign same as disparity) // USED in lwir
ImageDttParametersimgdtt_params,
double[][]corrs,
intpair_mask,// which pairs to process
...
...
@@ -1378,7 +1378,7 @@ public class Correlation2d {
}elseif(isDiagonalOtherPair(pair)){
icenter[0]=ixcenter;
icenter[1]=-ixcenter;
}else{
}else{// not used in lwir
System.out.println("************ BUG: illegal pair type for pair1"+pair);
returnnull;
}
...
...
@@ -1422,7 +1422,7 @@ public class Correlation2d {
}elseif(isDiagonalOtherPair(pair)){
rslt[3*np+0]=xcenter-xm;
rslt[3*np+1]=-xcenter-ym;
}else{
}else{// not used in lwir
System.out.println("************ BUG: illegal pair type for pair "+pair);
returnnull;
}
...
...
@@ -1439,7 +1439,7 @@ public class Correlation2d {
// returns array 3*num_pairs long
// TODO: now works for small offsets. Maybe add re-calculate int argmax for each pair? xcenter is still needed to subtract Add switch? (small/large correction)
publicdouble[]mismatchPairs(// returns x-xcenter, y, strength (sign same as disparity)
publicdouble[]mismatchPairs(// returns x-xcenter, y, strength (sign same as disparity) // not used in lwir
ImageDttParametersimgdtt_params,
double[][]corrs,
intpair_mask,// which pairs to process
...
...
@@ -1508,7 +1508,7 @@ public class Correlation2d {
}
// run a single correlation poly
publicdouble[]single2dPoly(// returns x-xcenter, y, strength (sign same as disparity)
publicdouble[]single2dPoly(// returns x-xcenter, y, strength (sign same as disparity) // not used in lwir
ImageDttParametersimgdtt_params,
double[]corr,
doublexcenter,// -disparity to compare. use 0?
...
...
@@ -1537,7 +1537,7 @@ public class Correlation2d {
}
// ignores negative values
publicdouble[]single2dCM(// returns x-xcenter, y, strength (sign same as disparity)
publicdouble[]single2dCM(// returns x-xcenter, y, strength (sign same as disparity) // not used in lwir
ImageDttParametersimgdtt_params,
double[]corr,
doublexcenter,// -disparity to compare. use 0?
...
...
@@ -1590,7 +1590,7 @@ public class Correlation2d {
publicdouble[][]corr4dirsLMA(
publicdouble[][]corr4dirsLMA(// USED in lwir
ImageDttParametersimgdtt_params,
double[][]corrs,
intpair_mask,// which pairs to process
...
...
@@ -1609,7 +1609,7 @@ public class Correlation2d {
voidclt_convert_double_kernel(// converts double resolution kernel // not used in lwir
double[]src_kernel,//
double[]dst_kernel,// should be (2*dtt_size-1) * (2*dtt_size-1) + extra_items size - kernel and dx, dy to the nearest 1/2 pixels + actual full center shift)
intsrc_size,// 64
...
...
@@ -4755,7 +4755,7 @@ public class ImageDtt {
dst_kernel[indx++]=0.5*(sy/s);
}
voidclt_normalize_kernel(//
voidclt_normalize_kernel(// not used in lwir
double[]kernel,// should be (2*dtt_size-1) * (2*dtt_size-1) + 4 size (last (2*dtt_size-1) are not modified)
double[]window,// normalizes result kernel * window to have sum of elements == 1.0
intdtt_size,// 8
...
...
@@ -4779,7 +4779,7 @@ public class ImageDtt {
}
}
voidclt_symmetrize_kernel(//
voidclt_symmetrize_kernel(// not used in lwir
double[]kernel,// should be (2*dtt_size-1) * (2*dtt_size-1) +2 size (last 2 are not modified)
double[][]sym_kernels,// set of 4 SS, AS, SA, AA kdernels, each dtt_size * dtt_size (may have 5-th with center shift
finalintdtt_size)// 8
...
...
@@ -4806,7 +4806,7 @@ public class ImageDtt {
}
}
voidclt_dtt3_kernel(//
voidclt_dtt3_kernel(// not used in lwir
double[][]kernels,// set of 4 SS, AS, SA, AA kdernels, each dtt_size * dtt_size (may have 5-th with center shift
finalintdtt_size,// 8
DttRad2dtt)
...
...
@@ -4834,8 +4834,8 @@ public class ImageDtt {
publicdoubledyc_dx=0.0;
publicdoubledyc_dy=0.0;
publicCltExtra(){}
publicCltExtra(double[]data)
publicCltExtra(){}// not used in lwir
publicCltExtra(double[]data)// USED in lwir
{
data_x=data[0];// kernel data is relative to this displacement X (0.5 pixel increments)
data_y=data[1];// kernel data is relative to this displacement Y (0.5 pixel increments)
...
...
@@ -4846,7 +4846,7 @@ public class ImageDtt {
dyc_dx=data[6];
dyc_dy=data[7];
}
publicdouble[]getArray()
publicdouble[]getArray()// not used in lwir
{
double[]rslt={
data_x,
...
...
@@ -4862,7 +4862,7 @@ public class ImageDtt {
}
}
publicvoidoffsetKernelSensor(
publicvoidoffsetKernelSensor(// not used in lwir
double[][]clt_tile,// clt tile, including [4] - metadata
doubledx,
doubledy){
...
...
@@ -4873,7 +4873,7 @@ public class ImageDtt {
ce.data_y+=dy;
clt_tile[4]=ce.getArray();
}
publicvoidclt_fill_coord_corr(
publicvoidclt_fill_coord_corr(// not used in lwir
finalintkern_step,// distance between kernel centers, in pixels.
finaldouble[][][][][]clt_data,
finalintthreadsMax,// maximal number of threads to launch
strength=strip_combo[ixy[0]+clt_parameters.transform_size-1];// strength at integer max on axis
disparity=-ixy[0];
result[STR_FULL_INDEX]=strength;
...
...
@@ -7735,7 +7735,7 @@ public class ImageDtt {
}
// removed HOR/VERT
// proceed only if CM correlation result is non-null // for compatibility with old code we need it to run regardless of the strength of the normal correlation
if(corr_stat!=null){
if(corr_stat!=null){// USED in lwir
disparity=-corr_stat[0];
result[DISP_FULL_INDEX]=disparity;
// see if strength is enough to proceed with LMA/poly (otherwise keep disp/strength
filter_direct[i*clt_parameters.transform_size+j]=Math.exp(-(i*i+j*j)/(2*clt_parameters.getCorrSigma(isMonochrome())));// FIXME: should be sigma*sigma !
...
...
@@ -8967,13 +8967,13 @@ public class ImageDtt {
}
// add optional initialization of debug layers here
if(disparity_bimap!=null){
for(inti=0;i<disparity_bimap.length;i++){
for(inti=0;i<disparity_bimap.length;i++){// USED in lwir
disparity_bimap[i]=newdouble[tilesY*tilesX];
}
}
if(ers_delay!=null){
ers_delay[0]=newdouble[quad_main][];
ers_delay[0]=newdouble[quad_main][];// not used in lwir
System.out.println("initGeometryCorrection(): All sensors have to have the same distortion model, but channels 0 and "+i+" mismatch");
returnfalse;
returnfalse;// not used in lwir
}
}
...
...
@@ -513,7 +513,7 @@ public class QuadCLT {
System.out.println("Adjusted camera to orient X Y along the sides of a square");
}else{
System.out.println("============= Cannot adustSquare() as it requires exactly 4 sensors, "+numSensors+" provided ==========");
returnfalse;
returnfalse;// not used in lwir
}
// Print parameters
if(debugLevel>0){
...
...
@@ -528,7 +528,7 @@ public class QuadCLT {
//GeometryCorrection
publicdouble[][][][][]calculateCLTKernel(// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
publicdouble[][][][][]calculateCLTKernel(// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel // not used in lwir
finalPixelMapping.SensorDatasensor,// to calculate extra shift
finalImageStackkernelStack,// first stack with 3 colors/slices convolution kernels
finalintkernelSize,// 64
...
...
@@ -765,7 +765,7 @@ public class QuadCLT {
returnclt_kernels;
}
publicdouble[][]flattenCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - 4 values shift x,y)
publicdouble[][]flattenCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - 4 values shift x,y) // not used in lwir
finaldouble[][][][][]kernels,// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
...
...
@@ -843,7 +843,7 @@ public class QuadCLT {
returnclt_flat;
}
publicvoidshowCLTKernels(
publicvoidshowCLTKernels(// not used in lwir
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
finalintglobalDebugLevel)// update status info
...
...
@@ -860,7 +860,7 @@ public class QuadCLT {
}
}
publicvoidshowCLTKernels(
publicvoidshowCLTKernels(// not used in lwir
intchn,
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
...
...
@@ -884,7 +884,7 @@ public class QuadCLT {
titles);
}
// USED in lwir
publicdouble[][][][][]extractCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - shift x,y)
finalfloat[][]flat_kernels,// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
finalintwidth,
...
...
@@ -955,7 +955,7 @@ public class QuadCLT {
}
publicbooleancreateCLTKernels(
publicbooleancreateCLTKernels(// not used in lwir
CLTParametersclt_parameters,
intsrcKernelSize,
intthreadsMax,// maximal number of threads to launch
...
...
@@ -1048,7 +1048,7 @@ public class QuadCLT {
publicbooleanreadCLTKernels(
publicbooleanreadCLTKernels(// USED in lwir
CLTParametersclt_parameters,
intthreadsMax,// maximal number of threads to launch
booleanupdateStatus,
...
...
@@ -1137,7 +1137,7 @@ public class QuadCLT {
// mostly for testing
//eyesisKernelImage
publicdouble[]extractOneKernelFromStack(
publicdouble[]extractOneKernelFromStack(// not used in lwir
finalintkernelSize,// 64
finalintchn,
finalintxTile,// horizontal number of kernel to extract
...
...
@@ -1153,7 +1153,7 @@ public class QuadCLT {
yTile);// vertical number of kernel to extract
}
publicdouble[]extractOneKernelFromStack(
publicdouble[]extractOneKernelFromStack(// not used in lwir
finalImageStackkernelStack,// first stack with 3 colors/slices convolution kernels
finalintkernelSize,// 64
finalintchn,
...
...
@@ -1172,7 +1172,7 @@ public class QuadCLT {
returnkernel;
}
// to be used in threaded method
privatevoidextractOneKernel(float[]pixels,// array of combined square kernels, each
privatevoidextractOneKernel(float[]pixels,// array of combined square kernels, each // not used in lwir
double[]kernel,// will be filled, should have correct size before call
intnumHor,// number of kernels in a row
intxTile,// horizontal number of kernel to extract
System.out.println("Vignetting data for channel "+srcChannel+" has "+eyesisCorrections.channelVignettingCorrection[srcChannel].length+" pixels, image "+sourceFiles[nFile]+" has "+pixels.length);
returnnull;
returnnull;// not used in lwir
}
// TODO: Move to do it once:
doublemin_non_zero=0.0;
...
...
@@ -3411,7 +3411,7 @@ public class QuadCLT {
}
}
}else{// assuming GR/BG pattern
}else{// assuming GR/BG pattern // not used in lwir
System.out.println("Applying fixed color gain correction parameters: Gr="+
ImagePlus[]imp_quad,// should have properties "name"(base for saving results), "channel","path"
boolean[][]saturation_imp,// (near) saturated pixels or null
CLTParametersclt_parameters,
...
...
@@ -6753,7 +6753,7 @@ public class QuadCLT {
returntrue;
}
ArrayList<CLTPass3d>prepareDisparityScan(
ArrayList<CLTPass3d>prepareDisparityScan(// USED in lwir
doublescan_start,
doublescan_step,
intscan_count){
...
...
@@ -6779,7 +6779,7 @@ public class QuadCLT {
* @param debugLevel
* @return true on success, false - on failure
*/
publicbooleanextrinsicsCLT(
publicbooleanextrinsicsCLT(// USED in lwir
CLTParametersclt_parameters,
booleanadjust_poly,
finalintthreadsMax,// maximal number of threads to launch
...
...
@@ -7124,7 +7124,7 @@ public class QuadCLT {
}
publicdouble[][]getRigDSFromTwoQuadCL(
publicdouble[][]getRigDSFromTwoQuadCL(// not used in lwir
TwoQuadCLTtwoQuadCLT,//maybe null in no-rig mode, otherwise may contain rig measurements to be used as infinity ground truth
CLTParametersclt_parameters,
finalintdebugLevel){
...
...
@@ -7165,7 +7165,7 @@ public class QuadCLT {
* @param debugLevel
* @return true on success, false on failure
*/
publicbooleanextrinsicsCLTfromGT(
publicbooleanextrinsicsCLTfromGT(// USED in lwir
// TwoQuadCLT twoQuadCLT, //maybe null in no-rig mode, otherwise may contain rig measurements to be used as infinity ground truth
GeometryCorrectiongeometryCorrection_main,// only used for aux camera if coordinates are for main (null for LWIR)
double[][]rig_disp_strength,
...
...
@@ -7316,11 +7316,11 @@ public class QuadCLT {
clt_parameters.corr_magic_scale,// double magic_coeff, // still not understood coefficent that reduces reported disparity value. Seems to be around 8.5
debugLevelInner-1);// + (clt_parameters.fine_dbg ? 1:0)); // int debugLevel)
if(new_corr==null){
returnfalse;
returnfalse;// not used in lwir
}
comp_diff=0.0;
intnum_pars=0;
if(adjust_poly){
if(adjust_poly){// not used in lwir
apply_fine_corr(
new_corr,
debugLevelInner+2);
...
...
@@ -7343,7 +7343,7 @@ public class QuadCLT {
if(comp_diff<min_poly_update){// add other parameter to exit from poly