Commit c3ee5b3f authored by Andrey Filippov's avatar Andrey Filippov

Dual max LMA

parent db3deeef
...@@ -74,6 +74,10 @@ import jcuda.nvrtc.nvrtcProgram; ...@@ -74,6 +74,10 @@ import jcuda.nvrtc.nvrtcProgram;
public class GPUTileProcessor { public class GPUTileProcessor {
public static boolean USE_DS_DP = false; // Use Dynamic Shared memory with Dynamic Parallelism (not implemented) public static boolean USE_DS_DP = false; // Use Dynamic Shared memory with Dynamic Parallelism (not implemented)
String LIBRARY_PATH = "/usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a"; // linux String LIBRARY_PATH = "/usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a"; // linux
// Can be downloaded and twice extracted from
// https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-cudart-dev-11-2_11.2.152-1_amd64.deb
// First deb itself, then data.tar.xz, and it will have usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a inside
// Found "cuda-cudart-dev" on https://ubuntu.pkgs.org/
static String GPU_RESOURCE_DIR = "kernels"; static String GPU_RESOURCE_DIR = "kernels";
static String [] GPU_KERNEL_FILES = {"dtt8x8.cuh","TileProcessor.cuh"}; static String [] GPU_KERNEL_FILES = {"dtt8x8.cuh","TileProcessor.cuh"};
// "*" - generated defines, first index - separately compiled unit // "*" - generated defines, first index - separately compiled unit
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2629,9 +2629,9 @@ public class ImageDtt extends ImageDttCPU { ...@@ -2629,9 +2629,9 @@ public class ImageDtt extends ImageDttCPU {
} }
} }
if (debugTile1) { if (debugTile1) {
correlation2d.corrLMA2DualMax( // null pointer Corr2dLMA lma_dual = correlation2d.corrLMA2DualMax( // null pointer
imgdtt_params, // ImageDttParameters imgdtt_params, imgdtt_params, // ImageDttParameters imgdtt_params,
1, // int combine_mode, // 0 - both, 1 - strongest, 2 - nearest to zero, 3 - FG, 4 - BG 0, // 3, // 0, // 1, // int combine_mode, // 0 - both, 1 - strongest, 2 - nearest to zero, 3 - FG, 4 - BG
// imgdtt_params.lmas_LY_single, // false, // boolean adjust_ly, // adjust Lazy Eye // imgdtt_params.lmas_LY_single, // false, // boolean adjust_ly, // adjust Lazy Eye
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 {
(debugTile0 ? 1: -2), // int debug_level, (debugTile0 ? 1: -2), // int debug_level,
tileX, // int tileX, // just for debug output tileX, // int tileX, // just for debug output
tileY ); tileY );
System.out.println("clt_process_tl_correlations() corrLMA2DualMax() done, lma_dual="+
((lma_dual== null)? "null": " not null"));
} }
......
...@@ -84,6 +84,7 @@ public class ImageDttParameters { ...@@ -84,6 +84,7 @@ public class ImageDttParameters {
public int bimax_rad_convex_search = 2; // how far from predicted to search for maximums public int bimax_rad_convex_search = 2; // how far from predicted to search for maximums
public int bimax_min_num_samples = 4; // minimal number of samples per pair per maximum public int bimax_min_num_samples = 4; // minimal number of samples per pair per maximum
public int bimax_min_num_pairs = 8; // minimal number of used pairs public int bimax_min_num_pairs = 8; // minimal number of used pairs
public boolean bimax_dual_pass = true; // First pass - do not adjust disparity
//lmamask_ //lmamask_
public boolean lmamask_dbg = false; // show LMA images, exit after single BG public boolean lmamask_dbg = false; // show LMA images, exit after single BG
...@@ -183,7 +184,7 @@ public class ImageDttParameters { ...@@ -183,7 +184,7 @@ public class ImageDttParameters {
public double lma_disp_range = 5.0; // disparity range to combine in one cluster (to mitigate ERS public double lma_disp_range = 5.0; // disparity range to combine in one cluster (to mitigate ERS
// LMA single parameters // LMA single parameters
// public boolean lmas_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) // public boolean lmas_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola)
public int lmas_gaussian = 0; // 0 - parabola, 1 - Gaussian, 2 - limited parabola, 3 - limited squared parabola public int lmas_gaussian = 3; // 0 - parabola, 1 - Gaussian, 2 - limited parabola, 3 - limited squared parabola
public boolean lmas_adjust_wm = true; // used in new for width public boolean lmas_adjust_wm = true; // used in new for width
public boolean lmas_adjust_wy = true; // adjust non-circular public boolean lmas_adjust_wy = true; // adjust non-circular
public boolean lmas_adjust_ag = true; // adjust gains gains public boolean lmas_adjust_ag = true; // adjust gains gains
...@@ -212,7 +213,7 @@ public class ImageDttParameters { ...@@ -212,7 +213,7 @@ public class ImageDttParameters {
public int lma_gaussian = 0; // 0 - parabola, 1 - Gaussian, 2 - limited parabola, 3 - limited squared parabola public int lma_gaussian = 0; // 0 - parabola, 1 - Gaussian, 2 - limited parabola, 3 - limited squared parabola
public boolean lma_second = true; // re-run LMA after removing weak/failed tiles public boolean lma_second = true; // re-run LMA after removing weak/failed tiles
// public boolean lma_second_gaussian = false; // re-run after removing weal/failed in Gaussian mode // public boolean lma_second_gaussian = false; // re-run after removing weal/failed in Gaussian mode
public int lma_second_gaussian = 0; // false; // re-run after removing weal/failed in Gaussian mode public int lma_second_gaussian = 0; // false; // re-run after removing weak/failed in Gaussian mode
public boolean lma_adjust_wm = true; // used in new for width public boolean lma_adjust_wm = true; // used in new for width
public boolean lma_adjust_wy = true; // false; // used in new for ellipse public boolean lma_adjust_wy = true; // false; // used in new for ellipse
public boolean lma_adjust_wxy = true; // used in new for lazy eye adjust parallel-to-disparity correction public boolean lma_adjust_wxy = true; // used in new for lazy eye adjust parallel-to-disparity correction
...@@ -472,6 +473,8 @@ public class ImageDttParameters { ...@@ -472,6 +473,8 @@ public class ImageDttParameters {
"Minimal number of samples per pair per maximum to use this pair by LMA (each of the maximums used)"); "Minimal number of samples per pair per maximum to use this pair by LMA (each of the maximums used)");
gd.addNumericField("Minimal number of used pairs", this.bimax_min_num_pairs, 0, 3, "", gd.addNumericField("Minimal number of used pairs", this.bimax_min_num_pairs, 0, 3, "",
"Do not use LMA if total number of used pairs is lower"); "Do not use LMA if total number of used pairs is lower");
gd.addCheckbox ("Dual-pass LMA", this.bimax_dual_pass,
"First adjust other parameters (keeping disparities), then add disparities");
gd.addMessage("LMA samples filter based on estimated disparity"); gd.addMessage("LMA samples filter based on estimated disparity");
gd.addCheckbox ("Debug LMA", this.lmamask_dbg, gd.addCheckbox ("Debug LMA", this.lmamask_dbg,
...@@ -888,6 +891,7 @@ public class ImageDttParameters { ...@@ -888,6 +891,7 @@ public class ImageDttParameters {
this.bimax_rad_convex_search= (int) gd.getNextNumber(); this.bimax_rad_convex_search= (int) gd.getNextNumber();
this.bimax_min_num_samples= (int) gd.getNextNumber(); this.bimax_min_num_samples= (int) gd.getNextNumber();
this.bimax_min_num_pairs= (int) gd.getNextNumber(); this.bimax_min_num_pairs= (int) gd.getNextNumber();
this.bimax_dual_pass = gd.getNextBoolean();
this.lmamask_dbg = gd.getNextBoolean(); this.lmamask_dbg = gd.getNextBoolean();
this.lmamask_en = gd.getNextBoolean(); this.lmamask_en = gd.getNextBoolean();
...@@ -1114,6 +1118,7 @@ public class ImageDttParameters { ...@@ -1114,6 +1118,7 @@ public class ImageDttParameters {
properties.setProperty(prefix+"bimax_rad_convex_search", this.bimax_rad_convex_search +""); properties.setProperty(prefix+"bimax_rad_convex_search", this.bimax_rad_convex_search +"");
properties.setProperty(prefix+"bimax_min_num_samples", this.bimax_min_num_samples +""); properties.setProperty(prefix+"bimax_min_num_samples", this.bimax_min_num_samples +"");
properties.setProperty(prefix+"bimax_min_num_pairs", this.bimax_min_num_pairs +""); properties.setProperty(prefix+"bimax_min_num_pairs", this.bimax_min_num_pairs +"");
properties.setProperty(prefix+"bimax_dual_pass", this.bimax_dual_pass +"");
properties.setProperty(prefix+"lmamask_dbg", this.lmamask_dbg +""); properties.setProperty(prefix+"lmamask_dbg", this.lmamask_dbg +"");
properties.setProperty(prefix+"lmamask_en", this.lmamask_en +""); properties.setProperty(prefix+"lmamask_en", this.lmamask_en +"");
...@@ -1344,6 +1349,7 @@ public class ImageDttParameters { ...@@ -1344,6 +1349,7 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"bimax_rad_convex_search")!=null) this.bimax_rad_convex_search=Integer.parseInt(properties.getProperty(prefix+"bimax_rad_convex_search")); if (properties.getProperty(prefix+"bimax_rad_convex_search")!=null) this.bimax_rad_convex_search=Integer.parseInt(properties.getProperty(prefix+"bimax_rad_convex_search"));
if (properties.getProperty(prefix+"bimax_min_num_samples")!=null) this.bimax_min_num_samples=Integer.parseInt(properties.getProperty(prefix+"bimax_min_num_samples")); if (properties.getProperty(prefix+"bimax_min_num_samples")!=null) this.bimax_min_num_samples=Integer.parseInt(properties.getProperty(prefix+"bimax_min_num_samples"));
if (properties.getProperty(prefix+"bimax_min_num_pairs")!=null) this.bimax_min_num_pairs=Integer.parseInt(properties.getProperty(prefix+"bimax_min_num_pairs")); if (properties.getProperty(prefix+"bimax_min_num_pairs")!=null) this.bimax_min_num_pairs=Integer.parseInt(properties.getProperty(prefix+"bimax_min_num_pairs"));
if (properties.getProperty(prefix+"bimax_dual_pass")!=null) this.bimax_dual_pass=Boolean.parseBoolean(properties.getProperty(prefix+"bimax_dual_pass"));
if (properties.getProperty(prefix+"lmamask_dbg")!=null) this.lmamask_dbg=Boolean.parseBoolean(properties.getProperty(prefix+"lmamask_dbg")); if (properties.getProperty(prefix+"lmamask_dbg")!=null) this.lmamask_dbg=Boolean.parseBoolean(properties.getProperty(prefix+"lmamask_dbg"));
if (properties.getProperty(prefix+"lmamask_en")!=null) this.lmamask_en=Boolean.parseBoolean(properties.getProperty(prefix+"lmamask_en")); if (properties.getProperty(prefix+"lmamask_en")!=null) this.lmamask_en=Boolean.parseBoolean(properties.getProperty(prefix+"lmamask_en"));
...@@ -1591,6 +1597,7 @@ public class ImageDttParameters { ...@@ -1591,6 +1597,7 @@ public class ImageDttParameters {
idp.bimax_rad_convex_search= this.bimax_rad_convex_search; idp.bimax_rad_convex_search= this.bimax_rad_convex_search;
idp.bimax_min_num_samples= this.bimax_min_num_samples; idp.bimax_min_num_samples= this.bimax_min_num_samples;
idp.bimax_min_num_pairs= this.bimax_min_num_pairs; idp.bimax_min_num_pairs= this.bimax_min_num_pairs;
idp.bimax_dual_pass= this.bimax_dual_pass;
idp.lmamask_dbg= this.lmamask_dbg; idp.lmamask_dbg= this.lmamask_dbg;
idp.lmamask_en= this.lmamask_en; idp.lmamask_en= this.lmamask_en;
......
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