double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
if((fs[0]==pre_last_cam)){
if((fs[0]==pre_last_cam)){
dd_deriv[0]=2*WGp*lim_negative*
dd_deriv[0]=2*WGp*lim_negative*
...
@@ -1218,9 +1488,10 @@ public class Corr2dLMA {
...
@@ -1218,9 +1488,10 @@ public class Corr2dLMA {
for(intddn=0;ddn<3;ddn++)if(dd_deriv[ddn]!=0.0){
for(intddn=0;ddn<3;ddn++)if(dd_deriv[ddn]!=0.0){
for(inti=0;i<dd_indices.length;i++){
for(inti=0;i<dd_indices.length;i++){
jt[dd_indices[i]][ns]+=dd_deriv[ddn]*mddnd.get(ddn,i);// already includes lim_negative *
jt[dd_indices[i]][ns]+=dd_deriv[ddn]*mddnd.get(ddn,i);// already includes lim_negative *
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
if((fs[0]==pre_last_cam)){
if((fs[0]==pre_last_cam)){
dd_deriv[0]=2*WGp*lim_negative_2d*
dd_deriv[0]=2*WGp*lim_negative_2d*
...
@@ -1394,14 +1674,15 @@ public class Corr2dLMA {
...
@@ -1394,14 +1674,15 @@ public class Corr2dLMA {
for(intddn=0;ddn<3;ddn++)if(dd_deriv[ddn]!=0.0){
for(intddn=0;ddn<3;ddn++)if(dd_deriv[ddn]!=0.0){
for(inti=0;i<dd_indices.length;i++){
for(inti=0;i<dd_indices.length;i++){
jt[dd_indices[i]][ns]+=dd_deriv[ddn]*mddnd.get(ddn,i);// already includes lim_negative *
jt[dd_indices[i]][ns]+=dd_deriv[ddn]*mddnd.get(ddn,i);// already includes lim_negative *
// process ddisp (last camera not used, is equal to minus sum of others to make a sum == 0)
// process ddisp (last camera not used, is equal to minus sum of others to make a sum == 0)
if(lazy_eye){
if(lazy_eye){
if(nmax==0){// only zero during first pass, then accumulate only
for(intf=0;f<num_cams;f++)if(par_map[ddisp_index+f]>=0){// -1 for the last_cam
for(intf=0;f<num_cams;f++)if(par_map[ddisp_index+f]>=0){// -1 for the last_cam
jt[par_map[ddisp_index+f]][ns]=0.0;
jt[par_map[ddisp_index+f]][ns]=0.0;
jt[par_map[ndisp_index+f]][ns]=0.0;
jt[par_map[ndisp_index+f]][ns]=0.0;
}
}
}
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double[]dd_deriv=newdouble[3];// derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
(adjust_ly?imgdtt_params.lma_cost_wy:0.0),// imgdtt_params.lma_cost_wy, // double cost_lazyeye_par, // cost for each of the non-zero disparity corrections lma_cost_wy
(adjust_ly?imgdtt_params.lma_cost_wy:0.0),// imgdtt_params.lma_cost_wy, // double cost_lazyeye_par, // cost for each of the non-zero disparity corrections lma_cost_wy
(adjust_ly?imgdtt_params.lma_cost_wxy:0.0)//imgdtt_params.lma_cost_wxy // double cost_lazyeye_odtho // cost for each of the non-zero ortho disparity corrections lma_cost_wxy
(adjust_ly?imgdtt_params.lma_cost_wxy:0.0)//imgdtt_params.lma_cost_wxy // double cost_lazyeye_odtho // cost for each of the non-zero ortho disparity corrections lma_cost_wxy
...
@@ -4262,7 +4271,8 @@ public class Correlation2d {
...
@@ -4262,7 +4271,8 @@ public class Correlation2d {
if(disp!=null){
if(disp!=null){
disp_str2[0]=disp;
disp_str2[0]=disp;
lma.initDisparity(// USED in lwir null pointer
lma.initDisparity(// USED in lwir null pointer
disp_str2);// double [][] disp_str // initial value of disparity
disp_str2,// double [][] disp_str // initial value of disparity
0);// int nmax); //
if(debug_level>1){
if(debug_level>1){
System.out.println("Input data:");
System.out.println("Input data:");
...
@@ -4413,15 +4423,7 @@ public class Correlation2d {
...
@@ -4413,15 +4423,7 @@ public class Correlation2d {
* Calculate each defined pair x,y expected offset, assuming only disparity, not lazy eye
* @param corrs - pairs 2D correlations (each in scanline order) - just to determine null/non-null
* @param disparity - expected disparity (e.g. from CM)
* @param disp_dist - per camera disparity matrix as a 1d (linescan order))
* @return per pair x,y expected center offset in 2D correlations or nulls for undefined pairs (or null if already set)
*/
publicdouble[][]getPairsOffsets(
double[][]corrs,
boolean[]pair_mask,
doubledisparity,
double[][]disp_dist){//
double[][]xy_offsets=newdouble[corrs.length][];
Matrix[]m_disp=Corr2dLMA.getMatrices(
disp_dist,// double [][] am_disp,
getNumSensors());// int num_cams)
for(intpair=0;pair<xy_offsets.length;pair++)if((pair<getNumPairs())&&(corrs[pair]!=null)&&((pair_mask==null)||pair_mask[pair])){// OK to calculate for each
corr_wnd,// double [][] corr_wnd, // correlation window to save on re-calculation of the window
corr_wnd,// double [][] corr_wnd, // correlation window to save on re-calculation of the window
corr_wnd_inv_limited,// corr_wnd_limited, // correlation window, limited not to be smaller than threshold - used for finding max/convex areas (or null)
corr_wnd_inv_limited,// corr_wnd_limited, // correlation window, limited not to be smaller than threshold - used for finding max/convex areas (or null)
...
@@ -2647,6 +2647,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2647,6 +2647,8 @@ public class ImageDtt extends ImageDttCPU {