Commit 330ac1f3 authored by Andrey Filippov's avatar Andrey Filippov

Improved and tested initial DSI, fixed DSI filtering

parent ff4593c5
...@@ -1259,10 +1259,10 @@ public class CLTPass3d{ ...@@ -1259,10 +1259,10 @@ public class CLTPass3d{
final double strength = disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nTile]; final double strength = disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nTile];
final double disparity = disparity_map[ImageDtt.DISPARITY_INDEX_CM][nTile]; // is it combined with LMA? final double disparity = disparity_map[ImageDtt.DISPARITY_INDEX_CM][nTile]; // is it combined with LMA?
// double fom = strength - w_adisp * Math.abs(disparity) - w_cdiff * second_max; // double fom = strength - w_adisp * Math.abs(disparity) - w_cdiff * second_max;
double cdiff = (second_max == null) ? 0.0:second_max[nTile];
double fom = strength double fom = strength
- w_adisp * Math.abs(disparity) - w_adisp * Math.abs(disparity)
- w_cdiff * second_max[nTile] *(min_strength/strength); - w_cdiff * cdiff *(min_strength/strength);
if ((strength <= 0) || (strength <= min_strength) || Double.isNaN(fom)) { if ((strength <= 0) || (strength <= min_strength) || Double.isNaN(fom)) {
......
...@@ -219,7 +219,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -219,7 +219,7 @@ public class ImageDtt extends ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("a. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -1528,7 +1528,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -1528,7 +1528,7 @@ public class ImageDtt extends ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("b. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -2195,7 +2195,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -2195,7 +2195,7 @@ public class ImageDtt extends ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("c. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -2951,7 +2951,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -2951,7 +2951,7 @@ public class ImageDtt extends ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("d. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -3626,7 +3626,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -3626,7 +3626,7 @@ public class ImageDtt extends ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("e. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
......
...@@ -1829,7 +1829,7 @@ public class ImageDttCPU { ...@@ -1829,7 +1829,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("f. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -3624,7 +3624,7 @@ public class ImageDttCPU { ...@@ -3624,7 +3624,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("g. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -4602,7 +4602,7 @@ public class ImageDttCPU { ...@@ -4602,7 +4602,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("h. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -7878,7 +7878,7 @@ public class ImageDttCPU { ...@@ -7878,7 +7878,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("i. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -12732,7 +12732,7 @@ public class ImageDttCPU { ...@@ -12732,7 +12732,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ clt_parameters.img_dtt.ortho_height+" ortho_eff_height="+ clt_parameters.img_dtt.ortho_eff_height); System.out.println("ortho_height="+ clt_parameters.img_dtt.ortho_height+" ortho_eff_height="+ clt_parameters.img_dtt.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("j. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -13669,7 +13669,7 @@ public class ImageDttCPU { ...@@ -13669,7 +13669,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ clt_parameters.img_dtt.ortho_height+" ortho_eff_height="+ clt_parameters.img_dtt.ortho_eff_height); System.out.println("ortho_height="+ clt_parameters.img_dtt.ortho_height+" ortho_eff_height="+ clt_parameters.img_dtt.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("k. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -14386,7 +14386,7 @@ public class ImageDttCPU { ...@@ -14386,7 +14386,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ clt_parameters.img_dtt.ortho_height+" ortho_eff_height="+ clt_parameters.img_dtt.ortho_eff_height); System.out.println("ortho_height="+ clt_parameters.img_dtt.ortho_height+" ortho_eff_height="+ clt_parameters.img_dtt.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("l. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
...@@ -14798,7 +14798,7 @@ public class ImageDttCPU { ...@@ -14798,7 +14798,7 @@ public class ImageDttCPU {
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height); System.out.println("ortho_height="+ imgdtt_params.ortho_height+" ortho_eff_height="+ imgdtt_params.ortho_eff_height);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" ortho_weights["+i+"]="+ ortho_weights[i]); System.out.println("m. ortho_weights["+i+"]="+ ortho_weights[i]);
} }
} }
......
...@@ -136,7 +136,7 @@ public class IntersceneMatchParameters { ...@@ -136,7 +136,7 @@ public class IntersceneMatchParameters {
public double min_disparity = -0.15; // 0.2; public double min_disparity = -0.15; // 0.2;
public double max_sym_disparity = 0.1; // 0.2; public double max_sym_disparity = 0.1; // 0.2;
// 2 next are wrong currently - minimal strength is ~0.25 // 2 next are wrong currently - minimal strength is ~0.25
public double min_strength_lma = 0.3; // no real filtering public double min_strength_lma = 0.0; // 0.3; // no real filtering
public double min_strength_replace = 0.05; /// 0.14; /// Before /// - LWIR, after - RGB public double min_strength_replace = 0.05; /// 0.14; /// Before /// - LWIR, after - RGB
public double min_strength_blur = 0.06; /// 0.2; public double min_strength_blur = 0.06; /// 0.2;
public double sigma = 2; /// 5; public double sigma = 2; /// 5;
......
...@@ -4322,12 +4322,24 @@ public class OpticalFlow { ...@@ -4322,12 +4322,24 @@ public class OpticalFlow {
debugLevel-2); debugLevel-2);
} // split cycles to remove output clutter } // split cycles to remove output clutter
int debug_scene = -15; int debug_scene = -15;
boolean debug2 = true;
boolean [] reliable_ref = null; boolean [] reliable_ref = null;
if (min_ref_str > 0.0) { if (min_ref_str > 0.0) {
reliable_ref = quadCLTs[ref_index].getReliableTiles( // will be null if does not exist. reliable_ref = quadCLTs[ref_index].getReliableTiles( // will be null if does not exist.
min_ref_str, // double min_strength, min_ref_str, // double min_strength,
true); // boolean needs_lma); true); // boolean needs_lma);
if (debug2) {
double [] dbg_img = new double [reliable_ref.length];
for (int i = 0; i < dbg_img.length; i++) {
dbg_img[i] = reliable_ref[i]?1:0;
}
(new ShowDoubleFloatArrays()).showArrays(
dbg_img,
quadCLTs[ref_index].getTileProcessor().getTilesX(),
quadCLTs[ref_index].getTileProcessor().getTilesY(),
"reliable_ref");
}
} }
for (int scene_index = ref_index - 1; scene_index >= earliest_scene ; scene_index--) { for (int scene_index = ref_index - 1; scene_index >= earliest_scene ; scene_index--) {
...@@ -11431,7 +11443,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad ...@@ -11431,7 +11443,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
double max_change = 1.0e-3; double max_change = 1.0e-3;
double min_disparity = -0.2; double min_disparity = -0.2;
double max_sym_disparity = 0.2; double max_sym_disparity = 0.2;
double min_strength_lma = 0.7; // weaker - treat as non-lma double min_strength_lma = 0.0; // 7; // weaker - treat as non-lma
double min_strength_replace = 0.05; /// 0.14; /// Before /// - LWIR, after - RGB double min_strength_replace = 0.05; /// 0.14; /// Before /// - LWIR, after - RGB
double min_strength_blur = 0.06; /// 0.2; double min_strength_blur = 0.06; /// 0.2;
double sigma = 2; /// 5; double sigma = 2; /// 5;
...@@ -11684,7 +11696,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad ...@@ -11684,7 +11696,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
tilesX, // int width, tilesX, // int width,
sigma); // double sigma); sigma); // double sigma);
dbg_img[10] = disp.clone(); dbg_img[10] = disp.clone();
double [][] ds = {disp, clean_lma}; double [][] ds = {disp, dls[2]};
final double [][] ds_filled = QuadCLT.fillDisparityStrength( final double [][] ds_filled = QuadCLT.fillDisparityStrength(
ds, // final double [][] ds0, ds, // final double [][] ds0,
min_disparity, // final double min_disparity, min_disparity, // final double min_disparity,
......
...@@ -1867,6 +1867,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1867,6 +1867,7 @@ ImageDtt.startAndJoin(threads);
for (DSD dsd:dsd_list) { for (DSD dsd:dsd_list) {
CLTPass3d pass = passes.get(dsd.indx); CLTPass3d pass = passes.get(dsd.indx);
double [] diffs = pass.getSecondMaxDiff(false); double [] diffs = pass.getSecondMaxDiff(false);
double diff = (diffs == null)?Double.NaN:diffs[nt];
String prefix = " "; String prefix = " ";
if (dsd.indx == dsd_max_fom.indx) { if (dsd.indx == dsd_max_fom.indx) {
prefix = "+"; prefix = "+";
...@@ -1878,7 +1879,7 @@ ImageDtt.startAndJoin(threads); ...@@ -1878,7 +1879,7 @@ ImageDtt.startAndJoin(threads);
} }
System.out.println (String.format("%1s%4d: %8.3f %6.4f %6.4f %5b %1d %8.3f %8.3f", System.out.println (String.format("%1s%4d: %8.3f %6.4f %6.4f %5b %1d %8.3f %8.3f",
prefix, // prefix, //
dsd.indx, dsd.disparity, dsd.strength, dsd.adiff, dsd.has_lma, dsd.clust_radius, diffs[nt], dsd.fom)); dsd.indx, dsd.disparity, dsd.strength, dsd.adiff, dsd.has_lma, dsd.clust_radius, diff, dsd.fom));
} }
System.out.println(); System.out.println();
return; return;
......
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