Commit c46680e7 authored by Andrey Filippov's avatar Andrey Filippov

Added parameters, JPEG textures

parent 5ae26946
...@@ -384,20 +384,40 @@ public class CLTParameters { ...@@ -384,20 +384,40 @@ public class CLTParameters {
public int photo_offs_set = 0; // 0 - keep weighted offset average, 1 - balance result image, 2 - set weighted average to specific value public int photo_offs_set = 0; // 0 - keep weighted offset average, 1 - balance result image, 2 - set weighted average to specific value
public double photo_offs = 21946; // weighted average offset target value, if photo_offs_set (and not photo_offs_balance) public double photo_offs = 21946; // weighted average offset target value, if photo_offs_set (and not photo_offs_balance)
public boolean photo_debug = false; // Generate images and text public boolean photo_debug = false;// Generate images and text
public double tex_disp_adiffo = 0.12; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions public double tex_disp_adiffo = 0.10; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions
public double tex_disp_rdiffo = 0.1; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions public double tex_disp_rdiffo = 0.08; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions
public double tex_disp_adiffd = 0.18; // 0.6; // 0.4; disparity absolute tolerance to connect in diagonal directions public double tex_disp_adiffd = 0.14; // 0.6; // 0.4; disparity absolute tolerance to connect in diagonal directions
public double tex_disp_rdiffd = 0.15; // 0.18; // 0.12; disparity relative tolerance to connect in diagonal directions public double tex_disp_rdiffd = 0.12; // 0.18; // 0.12; disparity relative tolerance to connect in diagonal directions
public double tex_disp_fof = 1.5; // Increase tolerance for friend of a friend public double tex_disp_fof = 1.5; // Increase tolerance for friend of a friend
public int tex_jump_tiles = 2; // "jump" over small gaps when building initial clusters. jump_r == 2 allows jumping to other tiles in 5x5 square around the defined tile
public double tex_disp_adiffj = 0.10; // maximal absolute disparity difference for the "jumps".
public double tex_disp_rdiffj = 0.08; // maximal relative disparity difference for the "jumps".
public double tex_fg_bg = 0.1; // Minimal FG/BG disparity difference (NaN bg if difference from FG < this) public double tex_fg_bg = 0.1; // Minimal FG/BG disparity difference (NaN bg if difference from FG < this)
public double tex_distort = 0.8; // Maximal texture distortion to accumulate multiple scenes (0 - any) public double tex_distort = 0.8; // Maximal texture distortion to accumulate multiple scenes (0 - any)
public double tex_mb = 1.0; // Reduce texture weight if motion blur exceeds this (as square of MB length) public double tex_mb = 1.0; // Reduce texture weight if motion blur exceeds this (as square of MB length)
public double tex_max_disparity_lim = 100.0; // do not allow stray disparities above this
public double tex_min_trim_disparity = 2.0; // do not try to trim texture outlines with lower disparities
public int tex_max_neib_lev = 2; // 1 - single tiles layer around, 2 - two layers
public boolean tex_split_textures = false; // (debugLevel > 1000); // false;
public int tex_subdiv_tiles = 4; // subdivide tiles to smaller triangles
public int tex_sky_below = 10; // extend sky these tile rows below lowest
public boolean tex_debug_disp_tri = false; // !batch_mode && (debugLevel > 0); // TODO: use clt_parameters
public int tex_add_bg_tiles = 0; // If there is gap between clusters, add extra row of background tiles
public boolean tex_save_full_textures = true; // false; // true;
public double tex_alpha_threshold = 0.5;
public boolean tex_renormalize = true; // false - use normalizations from previous scenes to keep consistent colors
public boolean tex_alpha = false; // also - use jpeg?
public int tex_jpeg_quality = 95; // JPEG quality for textures
public boolean tex_um = true; // Use unsharp mask filter for textures public boolean tex_um = true; // Use unsharp mask filter for textures
public double tex_um_sigma = 2.0; // Unsharp mask sigma for textures public double tex_um_sigma = 2.0; // Unsharp mask sigma for textures
public double tex_um_weight = 0.8;// Unsharp mask weight public double tex_um_weight = 0.8; // Unsharp mask weight
public boolean tex_lwir_autorange = true; // Autorange LWIR textures public boolean tex_lwir_autorange = true; // Autorange LWIR textures
public boolean tex_um_fixed = false; // Use fixed range after unsharp mask instead of autorange public boolean tex_um_fixed = false; // Use fixed range after unsharp mask instead of autorange
public double tex_um_range = 500; // Full range after unsharp mask public double tex_um_range = 500; // Full range after unsharp mask
...@@ -1416,10 +1436,30 @@ public class CLTParameters { ...@@ -1416,10 +1436,30 @@ public class CLTParameters {
properties.setProperty(prefix+"tex_disp_adiffd", this.tex_disp_adiffd+""); // double properties.setProperty(prefix+"tex_disp_adiffd", this.tex_disp_adiffd+""); // double
properties.setProperty(prefix+"tex_disp_rdiffd", this.tex_disp_rdiffd+""); // double properties.setProperty(prefix+"tex_disp_rdiffd", this.tex_disp_rdiffd+""); // double
properties.setProperty(prefix+"tex_disp_fof", this.tex_disp_fof+""); // double properties.setProperty(prefix+"tex_disp_fof", this.tex_disp_fof+""); // double
properties.setProperty(prefix+"tex_jump_tiles", this.tex_jump_tiles+""); // int
properties.setProperty(prefix+"tex_disp_adiffj", this.tex_disp_adiffj+""); // double
properties.setProperty(prefix+"tex_disp_rdiffj", this.tex_disp_rdiffj+""); // double
properties.setProperty(prefix+"tex_fg_bg", this.tex_fg_bg+""); // double properties.setProperty(prefix+"tex_fg_bg", this.tex_fg_bg+""); // double
properties.setProperty(prefix+"tex_distort", this.tex_distort+""); // double properties.setProperty(prefix+"tex_distort", this.tex_distort+""); // double
properties.setProperty(prefix+"tex_mb", this.tex_mb+""); // double properties.setProperty(prefix+"tex_mb", this.tex_mb+""); // double
properties.setProperty(prefix+"tex_max_disparity_lim", this.tex_max_disparity_lim+""); // double
properties.setProperty(prefix+"tex_min_trim_disparity", this.tex_min_trim_disparity+""); // double
properties.setProperty(prefix+"tex_max_neib_lev", this.tex_max_neib_lev+""); // int
properties.setProperty(prefix+"tex_split_textures", this.tex_split_textures+""); // boolean
properties.setProperty(prefix+"tex_subdiv_tiles", this.tex_subdiv_tiles+""); // int
properties.setProperty(prefix+"tex_sky_below", this.tex_sky_below+""); // int
properties.setProperty(prefix+"tex_debug_disp_tri", this.tex_debug_disp_tri+""); // boolean
properties.setProperty(prefix+"tex_add_bg_tiles", this.tex_add_bg_tiles+""); // int
properties.setProperty(prefix+"tex_save_full_textures", this.tex_save_full_textures+""); // boolean
properties.setProperty(prefix+"tex_alpha_threshold", this.tex_alpha_threshold+""); // double
properties.setProperty(prefix+"tex_renormalize", this.tex_renormalize+""); // boolean
properties.setProperty(prefix+"tex_alpha", this.tex_alpha+""); // boolean
properties.setProperty(prefix+"tex_jpeg_quality", this.tex_jpeg_quality+""); // int
properties.setProperty(prefix+"tex_um", this.tex_um+""); // boolean properties.setProperty(prefix+"tex_um", this.tex_um+""); // boolean
properties.setProperty(prefix+"tex_um_sigma", this.tex_um_sigma+""); // double properties.setProperty(prefix+"tex_um_sigma", this.tex_um_sigma+""); // double
properties.setProperty(prefix+"tex_um_weight", this.tex_um_weight+""); // double properties.setProperty(prefix+"tex_um_weight", this.tex_um_weight+""); // double
...@@ -2321,9 +2361,28 @@ public class CLTParameters { ...@@ -2321,9 +2361,28 @@ public class CLTParameters {
if (properties.getProperty(prefix+"tex_disp_adiffd")!=null) this.tex_disp_adiffd=Double.parseDouble(properties.getProperty(prefix+"tex_disp_adiffd")); if (properties.getProperty(prefix+"tex_disp_adiffd")!=null) this.tex_disp_adiffd=Double.parseDouble(properties.getProperty(prefix+"tex_disp_adiffd"));
if (properties.getProperty(prefix+"tex_disp_rdiffd")!=null) this.tex_disp_rdiffd=Double.parseDouble(properties.getProperty(prefix+"tex_disp_rdiffd")); if (properties.getProperty(prefix+"tex_disp_rdiffd")!=null) this.tex_disp_rdiffd=Double.parseDouble(properties.getProperty(prefix+"tex_disp_rdiffd"));
if (properties.getProperty(prefix+"tex_disp_fof")!=null) this.tex_disp_fof=Double.parseDouble(properties.getProperty(prefix+"tex_disp_fof")); if (properties.getProperty(prefix+"tex_disp_fof")!=null) this.tex_disp_fof=Double.parseDouble(properties.getProperty(prefix+"tex_disp_fof"));
if (properties.getProperty(prefix+"tex_jump_tiles")!=null) this.tex_jump_tiles=Integer.parseInt(properties.getProperty(prefix+"tex_jump_tiles"));
if (properties.getProperty(prefix+"tex_disp_adiffj")!=null) this.tex_disp_adiffj=Double.parseDouble(properties.getProperty(prefix+"tex_disp_adiffj"));
if (properties.getProperty(prefix+"tex_disp_rdiffj")!=null) this.tex_disp_rdiffj=Double.parseDouble(properties.getProperty(prefix+"tex_disp_rdiffj"));
if (properties.getProperty(prefix+"tex_fg_bg")!=null) this.tex_fg_bg=Double.parseDouble(properties.getProperty(prefix+"tex_fg_bg")); if (properties.getProperty(prefix+"tex_fg_bg")!=null) this.tex_fg_bg=Double.parseDouble(properties.getProperty(prefix+"tex_fg_bg"));
if (properties.getProperty(prefix+"tex_distort")!=null) this.tex_distort=Double.parseDouble(properties.getProperty(prefix+"tex_distort")); if (properties.getProperty(prefix+"tex_distort")!=null) this.tex_distort=Double.parseDouble(properties.getProperty(prefix+"tex_distort"));
if (properties.getProperty(prefix+"tex_mb")!=null) this.tex_mb=Double.parseDouble(properties.getProperty(prefix+"tex_mb")); if (properties.getProperty(prefix+"tex_mb")!=null) this.tex_mb=Double.parseDouble(properties.getProperty(prefix+"tex_mb"));
if (properties.getProperty(prefix+"tex_max_disparity_lim")!=null)this.tex_max_disparity_lim=Double.parseDouble(properties.getProperty(prefix+"tex_max_disparity_lim"));
if (properties.getProperty(prefix+"tex_min_trim_disparity")!=null)this.tex_min_trim_disparity=Double.parseDouble(properties.getProperty(prefix+"tex_min_trim_disparity"));
if (properties.getProperty(prefix+"tex_max_neib_lev")!=null) this.tex_max_neib_lev=Integer.parseInt(properties.getProperty(prefix+"tex_max_neib_lev"));
if (properties.getProperty(prefix+"tex_split_textures")!=null) this.tex_split_textures=Boolean.parseBoolean(properties.getProperty(prefix+"tex_split_textures"));
if (properties.getProperty(prefix+"tex_subdiv_tiles")!=null) this.tex_subdiv_tiles=Integer.parseInt(properties.getProperty(prefix+"tex_subdiv_tiles"));
if (properties.getProperty(prefix+"tex_sky_below")!=null) this.tex_sky_below=Integer.parseInt(properties.getProperty(prefix+"tex_sky_below"));
if (properties.getProperty(prefix+"tex_debug_disp_tri")!=null) this.tex_debug_disp_tri=Boolean.parseBoolean(properties.getProperty(prefix+"tex_debug_disp_tri"));
if (properties.getProperty(prefix+"tex_add_bg_tiles")!=null) this.tex_add_bg_tiles=Integer.parseInt(properties.getProperty(prefix+"tex_add_bg_tiles"));
if (properties.getProperty(prefix+"tex_save_full_textures")!=null)this.tex_save_full_textures=Boolean.parseBoolean(properties.getProperty(prefix+"tex_save_full_textures"));
if (properties.getProperty(prefix+"tex_alpha_threshold")!=null) this.tex_alpha_threshold=Double.parseDouble(properties.getProperty(prefix+"tex_alpha_threshold"));
if (properties.getProperty(prefix+"tex_renormalize")!=null) this.tex_renormalize=Boolean.parseBoolean(properties.getProperty(prefix+"tex_renormalize"));
if (properties.getProperty(prefix+"tex_alpha")!=null) this.tex_alpha=Boolean.parseBoolean(properties.getProperty(prefix+"tex_alpha"));
if (properties.getProperty(prefix+"tex_jpeg_quality")!=null) this.tex_jpeg_quality=Integer.parseInt(properties.getProperty(prefix+"tex_jpeg_quality"));
if (properties.getProperty(prefix+"tex_um")!=null) this.tex_um=Boolean.parseBoolean(properties.getProperty(prefix+"tex_um")); if (properties.getProperty(prefix+"tex_um")!=null) this.tex_um=Boolean.parseBoolean(properties.getProperty(prefix+"tex_um"));
if (properties.getProperty(prefix+"tex_um_sigma")!=null) this.tex_um_sigma=Double.parseDouble(properties.getProperty(prefix+"tex_um_sigma")); if (properties.getProperty(prefix+"tex_um_sigma")!=null) this.tex_um_sigma=Double.parseDouble(properties.getProperty(prefix+"tex_um_sigma"));
...@@ -3386,6 +3445,14 @@ public class CLTParameters { ...@@ -3386,6 +3445,14 @@ public class CLTParameters {
"Disparity relative tolerance to connect in diagonal directions."); "Disparity relative tolerance to connect in diagonal directions.");
gd.addNumericField("Relax friend-of-a friend tolerance", this.tex_disp_fof, 5,7,"", gd.addNumericField("Relax friend-of-a friend tolerance", this.tex_disp_fof, 5,7,"",
"Relax (increase disparity) tolerance for friend of a friend."); "Relax (increase disparity) tolerance for friend of a friend.");
gd.addNumericField("Jump over gaps building clusters", this.tex_jump_tiles, 0,3,"",
"Jump over small gaps when building initial clusters. jump_r == 2 allows jumping to other tiles in 5x5 square around the defined tile.");
gd.addNumericField("Maximal absolute disparity difference for jumps", this.tex_disp_adiffj, 5,7,"",
"Maximal absolute disparity difference for the \"jumps\".");
gd.addNumericField("Maximal relative disparity difference for jumps", this.tex_disp_rdiffj, 5,7,"",
"Maximal relative disparity difference for the \"jumps\".");
gd.addNumericField("Minimal FG/BG disparity separation", this.tex_fg_bg, 5,7,"pix", gd.addNumericField("Minimal FG/BG disparity separation", this.tex_fg_bg, 5,7,"pix",
"Minimal FG/BG disparity difference (NaN bg if difference from FG < this)."); "Minimal FG/BG disparity difference (NaN bg if difference from FG < this).");
gd.addNumericField("Multiscene texture distortion", this.tex_distort, 5,7,"pix", gd.addNumericField("Multiscene texture distortion", this.tex_distort, 5,7,"pix",
...@@ -3393,6 +3460,34 @@ public class CLTParameters { ...@@ -3393,6 +3460,34 @@ public class CLTParameters {
gd.addNumericField("Maximal motion blur to reduce weight",this.tex_mb, 5,7,"pix", gd.addNumericField("Maximal motion blur to reduce weight",this.tex_mb, 5,7,"pix",
"Reduce texture weight if motion blur exceeds this (as square of MB length)."); "Reduce texture weight if motion blur exceeds this (as square of MB length).");
gd.addNumericField("Max disparity for meshe generation", this.tex_max_disparity_lim, 5,7,"pix",
"Do not allow stray disparities above this.");
gd.addNumericField("Minimal disparity for FG trimming", this.tex_min_trim_disparity, 5,7,"pix",
"Do not try to trim texture outlines with lower disparities.");
gd.addNumericField("Maximal border tile level", this.tex_max_neib_lev, 0,3,"",
"1 - single tiles layer around, 2 - two layers. Optimized for 2, may be broken for other values.");
gd.addCheckbox ("Split combo textures", this.tex_split_textures,
"Split combined texture images. False use multi-cluster full size texture images.");
gd.addNumericField("Subdivide tiles to emulate alpha", this.tex_subdiv_tiles, 0,3,"",
"Subdivide tiles to smaller triangles to improve lateral resolution. Best for 1-2-4-8.");
gd.addNumericField("Extend sky area", this.tex_sky_below, 0,3,"tiles",
"if >=0, extend sky these tile rows below lowest and extend sky up, right and left to full image.");
gd.addCheckbox ("Debug mesh triangles", this.tex_debug_disp_tri,
"Generate debug images for mesh triangles.");
gd.addNumericField("Add background tiles", this.tex_add_bg_tiles, 0,3,"tiles",
"If there is gap between clusters, add extra row of background tiles. Obsolete?");
gd.addCheckbox ("Save full textures", this.tex_save_full_textures,
"Will save anyway if !tex_split_textures.");
gd.addNumericField("Alpha threshold", this.tex_alpha_threshold, 5,7,"",
"Alpha threshold to consider it opaque.");
gd.addCheckbox ("Re-normalize photometric range", this.tex_renormalize,
"If false - use normalizations from previous scenes to keep consistent colors.");
gd.addCheckbox ("Use alpha in textures", this.tex_alpha,
"Use alpha in textures, false - remove alpha.");
gd.addNumericField("JPEG quality for textures", this.tex_jpeg_quality, 0,3,"%",
"If <=0 - save as png.");
gd.addMessage ("Textures rendering"); gd.addMessage ("Textures rendering");
gd.addCheckbox ("Apply unsharp mask", this.tex_um, gd.addCheckbox ("Apply unsharp mask", this.tex_um,
"Use unsharp mask filter for texture."); "Use unsharp mask filter for texture.");
...@@ -4461,10 +4556,30 @@ public class CLTParameters { ...@@ -4461,10 +4556,30 @@ public class CLTParameters {
this.tex_disp_adiffd = gd.getNextNumber(); this.tex_disp_adiffd = gd.getNextNumber();
this.tex_disp_rdiffd = gd.getNextNumber(); this.tex_disp_rdiffd = gd.getNextNumber();
this.tex_disp_fof = gd.getNextNumber(); this.tex_disp_fof = gd.getNextNumber();
this.tex_jump_tiles = (int) gd.getNextNumber();
this.tex_disp_adiffj = gd.getNextNumber();
this.tex_disp_rdiffj = gd.getNextNumber();
this.tex_fg_bg = gd.getNextNumber(); this.tex_fg_bg = gd.getNextNumber();
this.tex_distort = gd.getNextNumber(); this.tex_distort = gd.getNextNumber();
this.tex_mb = gd.getNextNumber(); this.tex_mb = gd.getNextNumber();
this.tex_max_disparity_lim = gd.getNextNumber();
this.tex_min_trim_disparity = gd.getNextNumber();
this.tex_max_neib_lev = (int) gd.getNextNumber();
this.tex_split_textures = gd.getNextBoolean();
this.tex_subdiv_tiles = (int) gd.getNextNumber();
this.tex_sky_below = (int) gd.getNextNumber();
this.tex_debug_disp_tri = gd.getNextBoolean();
this.tex_add_bg_tiles = (int) gd.getNextNumber();
this.tex_save_full_textures = gd.getNextBoolean();
this.tex_alpha_threshold = gd.getNextNumber();
this.tex_renormalize = gd.getNextBoolean();
this.tex_alpha = gd.getNextBoolean();
this.tex_jpeg_quality = (int) gd.getNextNumber();
this.tex_um = gd.getNextBoolean(); this.tex_um = gd.getNextBoolean();
this.tex_um_sigma = gd.getNextNumber(); this.tex_um_sigma = gd.getNextNumber();
this.tex_um_weight = gd.getNextNumber(); this.tex_um_weight = gd.getNextNumber();
......
...@@ -2715,6 +2715,7 @@ public class EyesisCorrections { ...@@ -2715,6 +2715,7 @@ public class EyesisCorrections {
int jpegQuality,// <0 - keep current, 0 - force Tiff, >0 use for JPEG int jpegQuality,// <0 - keep current, 0 - force Tiff, >0 use for JPEG
int debugLevel){ int debugLevel){
if (path!=null) { if (path!=null) {
FileInfo fi = new FileInfo();
path+=Prefs.getFileSeparator()+imp.getTitle(); path+=Prefs.getFileSeparator()+imp.getTitle();
boolean hasAlphaHighByte = false; boolean hasAlphaHighByte = false;
if ((imp.getStackSize()==1) && (imp.getFileInfo().fileType== FileInfo.RGB)) { if ((imp.getStackSize()==1) && (imp.getFileInfo().fileType== FileInfo.RGB)) {
...@@ -2735,7 +2736,8 @@ public class EyesisCorrections { ...@@ -2735,7 +2736,8 @@ public class EyesisCorrections {
path +".png", path +".png",
debugLevel debugLevel
); );
fi.url = path+".png";
fi.fileName = imp.getTitle()+".png";
} else { } else {
if (debugLevel > 0) System.out.println("Saving RGBA result to "+path+".tiff"); if (debugLevel > 0) System.out.println("Saving RGBA result to "+path+".tiff");
try { try {
...@@ -2753,6 +2755,8 @@ public class EyesisCorrections { ...@@ -2753,6 +2755,8 @@ public class EyesisCorrections {
} catch (DependencyException e) { } catch (DependencyException e) {
e.printStackTrace(); e.printStackTrace();
} }
fi.url = path+".tiff";
fi.fileName = imp.getTitle()+".tiff";
} }
} else if (((imp.getStackSize()==1)) && (jpegQuality!=0) && ((imp.getFileInfo().fileType== FileInfo.RGB) || (jpegQuality>0))) { } else if (((imp.getStackSize()==1)) && (jpegQuality!=0) && ((imp.getFileInfo().fileType== FileInfo.RGB) || (jpegQuality>0))) {
...@@ -2760,6 +2764,8 @@ public class EyesisCorrections { ...@@ -2760,6 +2764,8 @@ public class EyesisCorrections {
FileSaver fs=new FileSaver(imp); FileSaver fs=new FileSaver(imp);
if (jpegQuality>0) FileSaver.setJpegQuality(jpegQuality); if (jpegQuality>0) FileSaver.setJpegQuality(jpegQuality);
fs.saveAsJpeg(path+".jpeg"); fs.saveAsJpeg(path+".jpeg");
fi.url = path+".jpeg";
fi.fileName = imp.getTitle()+".jpeg";
} else { } else {
if (debugLevel>0) System.out.println("Saving result to "+path+".tiff"); if (debugLevel>0) System.out.println("Saving result to "+path+".tiff");
FileSaver fs=new FileSaver(imp); FileSaver fs=new FileSaver(imp);
...@@ -2789,7 +2795,10 @@ public class EyesisCorrections { ...@@ -2789,7 +2795,10 @@ public class EyesisCorrections {
} }
} else if (imp.getStackSize()>1) fs.saveAsTiffStack(path+".tiff"); } else if (imp.getStackSize()>1) fs.saveAsTiffStack(path+".tiff");
else fs.saveAsTiff(path+".tiff"); else fs.saveAsTiff(path+".tiff");
fi.url = path+".tiff";
fi.fileName = imp.getTitle()+".tiff";
} }
imp.setFileInfo(fi); // only url
} }
if (show) { if (show) {
imp.getProcessor().resetMinAndMax(); // probably not needed imp.getProcessor().resetMinAndMax(); // probably not needed
......
...@@ -1845,13 +1845,37 @@ public class TexturedModel { ...@@ -1845,13 +1845,37 @@ public class TexturedModel {
{ {
final boolean batch_mode = clt_parameters.batch_run; final boolean batch_mode = clt_parameters.batch_run;
final boolean gltf_emissive = clt_parameters.gltf_emissive; final boolean gltf_emissive = clt_parameters.gltf_emissive;
final boolean use_alpha_blend = false; final boolean use_alpha_blend = clt_parameters.gltf_alpha_blend;
final double tex_disp_adiffo = clt_parameters.tex_disp_adiffo; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions
final double tex_disp_rdiffo = clt_parameters.tex_disp_rdiffo; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions
final double tex_disp_adiffd = clt_parameters.tex_disp_adiffd; // 0.6; // 0.4; disparity absolute tolerance to connect in diagonal directions
final double tex_disp_rdiffd = clt_parameters.tex_disp_rdiffd; // 0.18; // 0.12; disparity relative tolerance to connect in diagonal directions
final double tex_disp_fof = clt_parameters.tex_disp_fof; // 1.5; // Increase tolerance for friend of a friend
final int jump_r = clt_parameters.tex_jump_tiles; // 2;
final double disp_adiffj = clt_parameters.tex_disp_adiffj;
final double disp_rdiffj = clt_parameters.tex_disp_rdiffj;
final double tex_fg_bg = clt_parameters.tex_fg_bg; // 0.1; // Minimal FG/BG disparity difference (NaN bg if difference from FG < this)
final double max_disparity_lim = clt_parameters.tex_max_disparity_lim; // 100.0; // do not allow stray disparities above this
final double min_trim_disparity =clt_parameters.tex_min_trim_disparity;// 2.0; // do not try to trim texture outlines with lower disparities
final int max_neib_lev = clt_parameters.tex_max_neib_lev; // 2; // 1 - single tiles layer around, 2 - two layers
final boolean split_textures = clt_parameters.tex_split_textures; // (debugLevel > 1000); // false;
final int subdiv_tiles = clt_parameters.tex_subdiv_tiles; // 4; // subdivide tiles to smaller triangles
final int sky_below = clt_parameters.tex_sky_below; // 10; // extend sky these tile rows below lowest
final boolean debug_disp_tri = clt_parameters.tex_debug_disp_tri; // !batch_mode && (debugLevel > 0); // TODO: use clt_parameters
// If there is gap between clusters, add extra row of background tiles
int add_bg_tiles = clt_parameters.tex_add_bg_tiles; // 0; // 1;
final boolean save_full_textures=clt_parameters.tex_save_full_textures || !clt_parameters.tex_split_textures; //true; // false; // true;
final double alpha_threshold = clt_parameters.tex_alpha_threshold; // 0.5;
final boolean renormalize = clt_parameters.tex_renormalize; // true; // false - use normalizations from previous scenes to keep consistent colors
final boolean no_alpha = !clt_parameters.tex_alpha; // true; // also - use jpeg?
final int jpeg_quality = clt_parameters.tex_jpeg_quality; //95; // JPEG quality for textures
final int sky_layer = 0; // source disparity layer that contains "blue sky"
final int ref_index = scenes.length - 1; final int ref_index = scenes.length - 1;
final QuadCLT ref_scene = scenes[ref_index]; final QuadCLT ref_scene = scenes[ref_index];
final TileProcessor tp = ref_scene.getTileProcessor(); final TileProcessor tp = ref_scene.getTileProcessor();
final boolean split_textures = (debugLevel > 1000); // false;
final int subdiv_tiles = 4; // subdivide tiles to smaller triangles
final boolean debug_disp_tri = !batch_mode && (debugLevel > 0); // TODO: use clt_parameters
if (ref_scene.image_data == null){ if (ref_scene.image_data == null){
return false; // not used in lwir return false; // not used in lwir
...@@ -1863,23 +1887,7 @@ public class TexturedModel { ...@@ -1863,23 +1887,7 @@ public class TexturedModel {
long startStepTime=System.nanoTime(); long startStepTime=System.nanoTime();
final int tilesX = tp.getTilesX(); final int tilesX = tp.getTilesX();
final int transform_size = tp.getTileSize(); final int transform_size = tp.getTileSize();
final double tex_disp_adiffo = clt_parameters.tex_disp_adiffo; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions
final double tex_disp_rdiffo = clt_parameters.tex_disp_rdiffo; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions
final double tex_disp_adiffd = clt_parameters.tex_disp_adiffd; // 0.6; // 0.4; disparity absolute tolerance to connect in diagonal directions
final double tex_disp_rdiffd = clt_parameters.tex_disp_rdiffd; // 0.18; // 0.12; disparity relative tolerance to connect in diagonal directions
final double tex_disp_fof = clt_parameters.tex_disp_fof; // 1.5; // Increase tolerance for friend of a friend
final int jump_r = 2; // FIXME
final double disp_adiffj = clt_parameters.tex_disp_adiffo; // FIXME
final double disp_rdiffj = clt_parameters.tex_disp_rdiffo; // FIXME
final double tex_fg_bg = clt_parameters.tex_fg_bg; // 0.1; // Minimal FG/BG disparity difference (NaN bg if difference from FG < this)
final int max_neib_lev = 2; // 1 - single tiles layer around, 2 - two layers
final int tex_cluster_gap= 2; // gap between clusters Make clt_parameters
final double max_disparity_lim = 100.0; // do not allow stray disparities above this
final double min_trim_disparity = 2.0; // do not try to trim texture outlines with lower disparities
final int width = tilesX * transform_size; final int width = tilesX * transform_size;
final int height = tp.getTilesY() * transform_size; final int height = tp.getTilesY() * transform_size;
// get multi-scene disparity map for FG and BG and filter it // get multi-scene disparity map for FG and BG and filter it
...@@ -1931,8 +1939,6 @@ public class TexturedModel { ...@@ -1931,8 +1939,6 @@ public class TexturedModel {
ds_fg_bg[1][i] = Double.NaN; ds_fg_bg[1][i] = Double.NaN;
} }
} }
int sky_layer = 0;
int sky_below = 10; // extend sky these tile rows below lowest
// Create data for consolidated textures (multiple texture segments combined in same "passes" // Create data for consolidated textures (multiple texture segments combined in same "passes"
TileCluster [] tileClusters = clusterizeFgBg( // wrong result type, not decided TileCluster [] tileClusters = clusterizeFgBg( // wrong result type, not decided
tilesX, // final int tilesX, tilesX, // final int tilesX,
...@@ -1967,7 +1973,6 @@ public class TexturedModel { ...@@ -1967,7 +1973,6 @@ public class TexturedModel {
scenes_sel[i] = true; scenes_sel[i] = true;
} }
// If there is gap between clusters, add extra row of background tiles // If there is gap between clusters, add extra row of background tiles
int add_bg_tiles = 0; // 1;
while ((add_bg_tiles--) > 0) { while ((add_bg_tiles--) > 0) {
extendClustersBackground( extendClustersBackground(
tileClusters, // final TileCluster[] tileClusters, tileClusters, // final TileCluster[] tileClusters,
...@@ -1977,8 +1982,6 @@ public class TexturedModel { ...@@ -1977,8 +1982,6 @@ public class TexturedModel {
tilesX); // final int tilesX) tilesX); // final int tilesX)
} }
boolean renormalize = true;// false - use normalizations from previous scenes to keep consistent colors
final boolean no_alpha = true;
double[][][] faded_textures = getInterCombinedTextures( // return ImagePlus[] matching tileClusters[], with alpha double[][][] faded_textures = getInterCombinedTextures( // return ImagePlus[] matching tileClusters[], with alpha
clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters,
...@@ -2004,22 +2007,21 @@ public class TexturedModel { ...@@ -2004,22 +2007,21 @@ public class TexturedModel {
transform_size, // int transform_size, transform_size, // int transform_size,
debugLevel); // final int debug_level) debugLevel); // final int debug_level)
boolean save_full_textures = true; // false; // true;
EyesisCorrectionParameters.CorrectionParameters correctionsParameters = ref_scene.correctionsParameters; EyesisCorrectionParameters.CorrectionParameters correctionsParameters = ref_scene.correctionsParameters;
String x3d_dir = ref_scene.getX3dDirectory(); String x3d_dir = ref_scene.getX3dDirectory();
if (save_full_textures || !split_textures) { boolean use_png = (jpeg_quality <= 0) || !no_alpha;
if (save_full_textures) { // || !split_textures) {
for (int nslice = 0; nslice < combined_textures.length; nslice++) { for (int nslice = 0; nslice < combined_textures.length; nslice++) {
EyesisCorrections.saveAndShow( EyesisCorrections.saveAndShow(
combined_textures[nslice], // imp_texture_cluster, combined_textures[nslice], // imp_texture_cluster,
x3d_dir, x3d_dir,
correctionsParameters.png, use_png, // correctionsParameters.png,
false, // (nslice < 4), // clt_parameters.show_textures, false, // (nslice < 4), // clt_parameters.show_textures,
-1, // jpegQuality){// <0 - keep current, 0 - force Tiff, >0 use for JPEG jpeg_quality, // -1, // jpegQuality){// <0 - keep current, 0 - force Tiff, >0 use for JPEG
1); // 1); //
} }
} }
double alpha_threshold = 0.5;
boolean [][] combined_alphas = null; boolean [][] combined_alphas = null;
if (subdiv_tiles > 0) { // Use subdiv_tiles==1 to keep alpha if (subdiv_tiles > 0) { // Use subdiv_tiles==1 to keep alpha
combined_alphas = new boolean [faded_textures.length][faded_textures[0][0].length]; combined_alphas = new boolean [faded_textures.length][faded_textures[0][0].length];
...@@ -2040,9 +2042,9 @@ public class TexturedModel { ...@@ -2040,9 +2042,9 @@ public class TexturedModel {
EyesisCorrections.saveAndShow( EyesisCorrections.saveAndShow(
imp_textures[i], // imp_texture_cluster, imp_textures[i], // imp_texture_cluster,
x3d_dir, x3d_dir,
correctionsParameters.png, use_png, // correctionsParameters.png,
false, // (nslice < 4), // clt_parameters.show_textures, false, // (nslice < 4), // clt_parameters.show_textures,
-1, // jpegQuality){// <0 - keep current, 0 - force Tiff, >0 use for JPEG jpeg_quality, // -1, // jpegQuality){// <0 - keep current, 0 - force Tiff, >0 use for JPEG
1); // 1); //
} }
} }
...@@ -2159,7 +2161,9 @@ public class TexturedModel { ...@@ -2159,7 +2161,9 @@ public class TexturedModel {
} }
continue; continue;
} }
String texturePath = imp_texture_cluster.getTitle()+".png"; // String texturePath = imp_texture_cluster.getTitle()+".png";
String texturePath = imp_texture_cluster.getOriginalFileInfo().fileName;
double [] scan_disparity = tileClusters[nslice].getSubDisparity(sub_i); // limited to cluster bounds double [] scan_disparity = tileClusters[nslice].getSubDisparity(sub_i); // limited to cluster bounds
boolean [] scan_selected = tileClusters[nslice].getSubSelected(sub_i); // limited to cluster bounds boolean [] scan_selected = tileClusters[nslice].getSubSelected(sub_i); // limited to cluster bounds
int [] scan_border_int = tileClusters[nslice].getSubBorderInt(sub_i); // limited to cluster bounds int [] scan_border_int = tileClusters[nslice].getSubBorderInt(sub_i); // limited to cluster bounds
......
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