Commit c8e09488 authored by Andrey Filippov's avatar Andrey Filippov

Added bicubic interpolation

parent 42058891
...@@ -493,6 +493,7 @@ public class CLTParameters { ...@@ -493,6 +493,7 @@ public class CLTParameters {
public boolean gmap_render_hdr = true; // generate textures w/o normalization to generate undistorted public boolean gmap_render_hdr = true; // generate textures w/o normalization to generate undistorted
public boolean gmap_en = true; // generate ground map from a drone (enables gmap_render_hdr) public boolean gmap_en = true; // generate ground map from a drone (enables gmap_render_hdr)
public boolean gmap_parallel_proj = true; // Use parallel projection (map) public boolean gmap_parallel_proj = true; // Use parallel projection (map)
public boolean gmap_bicubic = true; // Use bicubic interpolation (false - bilinear)
public boolean gmap_update_range = false; // for parallel only public boolean gmap_update_range = false; // for parallel only
// extracting ground projection plane // extracting ground projection plane
...@@ -1674,6 +1675,7 @@ public class CLTParameters { ...@@ -1674,6 +1675,7 @@ public class CLTParameters {
properties.setProperty(prefix+"gmap_render_hdr", this.gmap_render_hdr+""); // boolean properties.setProperty(prefix+"gmap_render_hdr", this.gmap_render_hdr+""); // boolean
properties.setProperty(prefix+"gmap_en", this.gmap_en+""); // boolean properties.setProperty(prefix+"gmap_en", this.gmap_en+""); // boolean
properties.setProperty(prefix+"gmap_parallel_proj", this.gmap_parallel_proj+""); // boolean properties.setProperty(prefix+"gmap_parallel_proj", this.gmap_parallel_proj+""); // boolean
properties.setProperty(prefix+"gmap_bicubic", this.gmap_bicubic+""); // boolean
properties.setProperty(prefix+"gmap_update_range", this.gmap_update_range+""); // boolean properties.setProperty(prefix+"gmap_update_range", this.gmap_update_range+""); // boolean
properties.setProperty(prefix+"gmap_use_lma", this.gmap_use_lma+""); // boolean properties.setProperty(prefix+"gmap_use_lma", this.gmap_use_lma+""); // boolean
...@@ -2726,6 +2728,7 @@ public class CLTParameters { ...@@ -2726,6 +2728,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"gmap_render_hdr")!=null) this.gmap_render_hdr=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_render_hdr")); if (properties.getProperty(prefix+"gmap_render_hdr")!=null) this.gmap_render_hdr=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_render_hdr"));
if (properties.getProperty(prefix+"gmap_en")!=null) this.gmap_en=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_en")); if (properties.getProperty(prefix+"gmap_en")!=null) this.gmap_en=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_en"));
if (properties.getProperty(prefix+"gmap_parallel_proj")!=null) this.gmap_parallel_proj=Boolean.parseBoolean(properties.getProperty(prefix+"gmap_parallel_proj")); if (properties.getProperty(prefix+"gmap_parallel_proj")!=null) this.gmap_parallel_proj=Boolean.parseBoolean(properties.getProperty(prefix+"gmap_parallel_proj"));
if (properties.getProperty(prefix+"gmap_bicubic")!=null) this.gmap_bicubic=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_bicubic"));
if (properties.getProperty(prefix+"gmap_update_range")!=null) this.gmap_update_range=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_update_range")); if (properties.getProperty(prefix+"gmap_update_range")!=null) this.gmap_update_range=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_update_range"));
if (properties.getProperty(prefix+"gmap_use_lma")!=null) this.gmap_use_lma=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_use_lma")); if (properties.getProperty(prefix+"gmap_use_lma")!=null) this.gmap_use_lma=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_use_lma"));
if (properties.getProperty(prefix+"gmap_discard_low")!=null) this.gmap_discard_low=Double.parseDouble(properties.getProperty(prefix+ "gmap_discard_low")); if (properties.getProperty(prefix+"gmap_discard_low")!=null) this.gmap_discard_low=Double.parseDouble(properties.getProperty(prefix+ "gmap_discard_low"));
...@@ -4031,6 +4034,8 @@ public class CLTParameters { ...@@ -4031,6 +4034,8 @@ public class CLTParameters {
"Render fixed-scale projection of the 3D model to a ground plane, such as for the UAS-generated imagery."); "Render fixed-scale projection of the 3D model to a ground plane, such as for the UAS-generated imagery.");
gd.addCheckbox ("Parallel (not center) projection (maps)", this.gmap_parallel_proj, // true; // enable change FG pixel to opaque from transparent gd.addCheckbox ("Parallel (not center) projection (maps)", this.gmap_parallel_proj, // true; // enable change FG pixel to opaque from transparent
"Parallel-project objects to a plane surface. If unchecked - use center (from the camera) projection."); "Parallel-project objects to a plane surface. If unchecked - use center (from the camera) projection.");
gd.addCheckbox ("Use bi-cubic texture interpolation", this.gmap_bicubic, // true; // enable change FG pixel to opaque from transparent
"Use bi-cubic texture interpolation. False - old way, is bilinear.");
gd.addCheckbox ("Fit all model (parallel only)", this.gmap_update_range, // true; // enable change FG pixel to opaque from transparent gd.addCheckbox ("Fit all model (parallel only)", this.gmap_update_range, // true; // enable change FG pixel to opaque from transparent
"Recalculate (increase) image size to fit all model elements. Unchecked - limit by plane intersection with the camera FOV."); "Recalculate (increase) image size to fit all model elements. Unchecked - limit by plane intersection with the camera FOV.");
...@@ -5307,6 +5312,7 @@ public class CLTParameters { ...@@ -5307,6 +5312,7 @@ public class CLTParameters {
this.gmap_render_hdr= gd.getNextBoolean(); this.gmap_render_hdr= gd.getNextBoolean();
this.gmap_en= gd.getNextBoolean(); this.gmap_en= gd.getNextBoolean();
this.gmap_parallel_proj= gd.getNextBoolean(); this.gmap_parallel_proj= gd.getNextBoolean();
this.gmap_bicubic= gd.getNextBoolean();
this.gmap_update_range= gd.getNextBoolean(); this.gmap_update_range= gd.getNextBoolean();
this.gmap_use_lma= gd.getNextBoolean(); this.gmap_use_lma= gd.getNextBoolean();
this.gmap_discard_low= gd.getNextNumber(); this.gmap_discard_low= gd.getNextNumber();
......
...@@ -2458,9 +2458,9 @@ public class TexturedModel { ...@@ -2458,9 +2458,9 @@ public class TexturedModel {
{ {
final boolean map_en = clt_parameters.gmap_en; final boolean map_en = clt_parameters.gmap_en;
final boolean render_hdr = clt_parameters.gmap_render_hdr || map_en;// true; //false; // true; // generate textures w/o normalization to generate undistorted final boolean render_hdr = clt_parameters.gmap_render_hdr || map_en;// true; //false; // true; // generate textures w/o normalization to generate undistorted
final boolean use_parallel_proj = clt_parameters.gmap_parallel_proj; // Use parallel projection (map) final boolean use_parallel_proj = clt_parameters.gmap_parallel_proj; // Use parallel projection (map)\
final boolean bicubic = clt_parameters.gmap_bicubic; // Use bicubic interpolation (false - bilinear)
final boolean update_range = clt_parameters.gmap_update_range; // for parallel only final boolean update_range = clt_parameters.gmap_update_range; // for parallel only
final boolean use_lma = clt_parameters.gmap_use_lma ; // true; // ; final boolean use_lma = clt_parameters.gmap_use_lma ; // true; // ;
final double discard_low = clt_parameters.gmap_discard_low ; //0.01; // fraction of all pixels final double discard_low = clt_parameters.gmap_discard_low ; //0.01; // fraction of all pixels
final double discard_high = clt_parameters.gmap_discard_high ; //0.5; // fraction of all pixels final double discard_high = clt_parameters.gmap_discard_high ; //0.5; // fraction of all pixels
...@@ -3178,11 +3178,17 @@ public class TexturedModel { ...@@ -3178,11 +3178,17 @@ public class TexturedModel {
boolean last_is_alpha = true; // last channel in textures slices is alpha boolean last_is_alpha = true; // last channel in textures slices is alpha
double [][] full_render_z; double [][] full_render_z;
if (use_parallel_proj) { if (use_parallel_proj) {
if (bicubic) {
full_render_z =render3D.render3dPlaneParallelProjBiCubic(
tri_meshes, // final ArrayList<TriMesh> tri_meshes,
last_is_alpha, // final boolean last_is_alpha,
debugLevel); //int debugLevel)
} else {
full_render_z =render3D.render3dPlaneParallelProj( full_render_z =render3D.render3dPlaneParallelProj(
tri_meshes, // final ArrayList<TriMesh> tri_meshes, tri_meshes, // final ArrayList<TriMesh> tri_meshes,
last_is_alpha, // final boolean last_is_alpha, last_is_alpha, // final boolean last_is_alpha,
// scenes[ref_index], //final QuadCLT ref_scene, // all coordinates relative to this scene
debugLevel); //int debugLevel) debugLevel); //int debugLevel)
}
} else { } else {
full_render_z =render3D.render3dPlaneCenterProj( full_render_z =render3D.render3dPlaneCenterProj(
tri_meshes, // final ArrayList<TriMesh> tri_meshes, tri_meshes, // final ArrayList<TriMesh> tri_meshes,
...@@ -3193,6 +3199,7 @@ public class TexturedModel { ...@@ -3193,6 +3199,7 @@ public class TexturedModel {
// String model_name = ref_scene.correctionsParameters.getModelName(ref_scene.getImageName()); // String model_name = ref_scene.correctionsParameters.getModelName(ref_scene.getImageName());
String suffix ="-RECT"; String suffix ="-RECT";
suffix +="-PIX"+pix_size * hdr_whs[2]; suffix +="-PIX"+pix_size * hdr_whs[2];
suffix += bicubic ? "-BC":"-BL";
if (gsmth_enable) { if (gsmth_enable) {
suffix +=mixed_flat ? "-FLAT_MIX":"-FLAT_CLN"; // flattened ground - mixed or clean suffix +=mixed_flat ? "-FLAT_MIX":"-FLAT_CLN"; // flattened ground - mixed or clean
} }
......
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