Commit a47aabbe authored by Andrey Filippov's avatar Andrey Filippov

Linear output for GRAY32 GEO output, UM for ARGB (slow fillNaNs)

parent 24d7049d
...@@ -489,7 +489,14 @@ public class CLTParameters { ...@@ -489,7 +489,14 @@ public class CLTParameters {
public boolean gmap_save_alt = true; // save height map (meters ASL) public boolean gmap_save_alt = true; // save height map (meters ASL)
public boolean gmap_save_tiff32 = true; // save float TIFF (NaN for transparency) with geo metadata (top left corner) public boolean gmap_save_tiff32 = true; // save float TIFF (NaN for transparency) with geo metadata (top left corner)
public boolean gmap_save_tiff = true; // save transparent TIFF with geo metadata (top left corner) public boolean gmap_save_tiff = true; // save transparent TIFF with geo metadata (top left corner)
public int gmap_tiff_pal = 0; // LWIR palette for TIFF public int gmap_tiff_pal = 0; // LWIR palette for ARGB TIFF
public boolean gmap_um = true; // Use unsharp mask filter for ARGB TIFF maps
public double gmap_um_sigma = 0.4; // Unsharp mask sigma for ARGB TIFF maps (in meters)
public double gmap_um_weight = 0.8; // Unsharp mask weight for ARGB TIFF maps
public boolean gmap_lwir_autorange = true; // Autorange LWIR textures for ARGB TIFF maps
public boolean gmap_um_fixed = false; // Use fixed range after unsharp mask instead of autorange for ARGB TIFF maps
public double gmap_um_range = 500; // Full range after unsharp mask for ARGB TIFF maps
public boolean generate_bg = true; // Generate background image for 3dmodels public boolean generate_bg = true; // Generate background image for 3dmodels
public boolean show_textures = true; // show generated textures public boolean show_textures = true; // show generated textures
...@@ -1640,6 +1647,13 @@ public class CLTParameters { ...@@ -1640,6 +1647,13 @@ public class CLTParameters {
properties.setProperty(prefix+"gmap_save_tiff", this.gmap_save_tiff+""); // boolean properties.setProperty(prefix+"gmap_save_tiff", this.gmap_save_tiff+""); // boolean
properties.setProperty(prefix+"gmap_tiff_pal", this.gmap_tiff_pal+""); // int properties.setProperty(prefix+"gmap_tiff_pal", this.gmap_tiff_pal+""); // int
properties.setProperty(prefix+"gmap_um", this.gmap_um+""); // boolean
properties.setProperty(prefix+"gmap_um_sigma", this.gmap_um_sigma+""); // double
properties.setProperty(prefix+"gmap_um_weight", this.gmap_um_weight+""); // double
properties.setProperty(prefix+"gmap_lwir_autorange", this.gmap_lwir_autorange+""); // boolean
properties.setProperty(prefix+"gmap_um_fixed", this.gmap_um_fixed+""); // boolean
properties.setProperty(prefix+"gmap_um_range", this.gmap_um_range+""); // double
properties.setProperty(prefix+"generate_bg", this.generate_bg+""); properties.setProperty(prefix+"generate_bg", this.generate_bg+"");
properties.setProperty(prefix+"show_textures", this.show_textures+""); properties.setProperty(prefix+"show_textures", this.show_textures+"");
properties.setProperty(prefix+"debug_filters", this.debug_filters+""); properties.setProperty(prefix+"debug_filters", this.debug_filters+"");
...@@ -2664,6 +2678,13 @@ public class CLTParameters { ...@@ -2664,6 +2678,13 @@ public class CLTParameters {
if (properties.getProperty(prefix+"gmap_save_tiff")!=null) this.gmap_save_tiff=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_save_tiff")); if (properties.getProperty(prefix+"gmap_save_tiff")!=null) this.gmap_save_tiff=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_save_tiff"));
if (properties.getProperty(prefix+"gmap_tiff_pal")!=null) this.gmap_tiff_pal=Integer.parseInt(properties.getProperty(prefix+ "gmap_tiff_pal"));// int if (properties.getProperty(prefix+"gmap_tiff_pal")!=null) this.gmap_tiff_pal=Integer.parseInt(properties.getProperty(prefix+ "gmap_tiff_pal"));// int
if (properties.getProperty(prefix+"gmap_um")!=null) this.gmap_um=Boolean.parseBoolean(properties.getProperty(prefix+"gmap_um"));
if (properties.getProperty(prefix+"gmap_um_sigma")!=null) this.gmap_um_sigma=Double.parseDouble(properties.getProperty(prefix+"gmap_um_sigma"));
if (properties.getProperty(prefix+"gmap_um_weight")!=null) this.gmap_um_weight=Double.parseDouble(properties.getProperty(prefix+"gmap_um_weight"));
if (properties.getProperty(prefix+"gmap_lwir_autorange")!=null) this.gmap_lwir_autorange=Boolean.parseBoolean(properties.getProperty(prefix+"gmap_lwir_autorange"));
if (properties.getProperty(prefix+"gmap_um_fixed")!=null) this.gmap_um_fixed=Boolean.parseBoolean(properties.getProperty(prefix+"gmap_um_fixed"));
if (properties.getProperty(prefix+"gmap_um_range")!=null) this.gmap_um_range=Double.parseDouble(properties.getProperty(prefix+"gmap_um_range"));
if (properties.getProperty(prefix+"generate_bg")!=null) this.generate_bg=Boolean.parseBoolean(properties.getProperty(prefix+"generate_bg")); if (properties.getProperty(prefix+"generate_bg")!=null) this.generate_bg=Boolean.parseBoolean(properties.getProperty(prefix+"generate_bg"));
if (properties.getProperty(prefix+"show_textures")!=null) this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures")); if (properties.getProperty(prefix+"show_textures")!=null) this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures"));
if (properties.getProperty(prefix+"debug_filters")!=null) this.debug_filters=Boolean.parseBoolean(properties.getProperty(prefix+"debug_filters")); if (properties.getProperty(prefix+"debug_filters")!=null) this.debug_filters=Boolean.parseBoolean(properties.getProperty(prefix+"debug_filters"));
...@@ -3939,9 +3960,25 @@ public class CLTParameters { ...@@ -3939,9 +3960,25 @@ public class CLTParameters {
"Save float (32-bit) TIFF with geo and resolution metadata (coordinates correspond to the top left image corner), NAN for transparency."); "Save float (32-bit) TIFF with geo and resolution metadata (coordinates correspond to the top left image corner), NAN for transparency.");
gd.addCheckbox ("Save ARGB Tiff with transparency and Geo",this.gmap_save_tiff, // true; // enable change FG pixel to opaque from transparent gd.addCheckbox ("Save ARGB Tiff with transparency and Geo",this.gmap_save_tiff, // true; // enable change FG pixel to opaque from transparent
"Save transparent TIFF with geo and resolution metadata (coordinates correspond to the top left image corner)."); "Save transparent TIFF with geo and resolution metadata (coordinates correspond to the top left image corner).");
gd.addNumericField("Crop maps extra", this.gmap_tiff_pal, 0,3,"", // minimal neighbors to keep alpha gd.addNumericField("LWIR palette for Geo", this.gmap_tiff_pal, 0,3,"", // minimal neighbors to keep alpha
"LWIR palette for Geo/transparency TIFF output."); "LWIR palette for Geo/transparency TIFF output.");
gd.addMessage ("Unsharp mask parameters for ARGB render of the ground maps");
gd.addCheckbox ("Apply unsharp mask to ARGB render", this.gmap_um,
"Use unsharp mask filter for texture.");
gd.addNumericField("Unsharp mask sigma", this.gmap_um_sigma, 5,7,"m",
"Unsharp mask sigma for ARGB ground map render in meters.");
gd.addNumericField("Unsharp mask weight", this.gmap_um_weight, 5,7,"",
"Unsharp mask weight for ARGB ground map render.");
gd.addCheckbox ("Autorange LWIR textures", this.gmap_lwir_autorange,
"Autorange LWIR ARGB ground map render (after unsharp mask).");
gd.addCheckbox ("Fixed range (after unsharp only)", this.gmap_um_fixed,
"Use fixed range after unsharp mask for ARGB ground map instead of autorange.");
gd.addNumericField("Full range for ARGB ground map render",this.gmap_um_range, 5,7,"counts",
"Full range after unsharp mask when fixed range is selected.");
gd.addMessage ("Earlier 3D generation parameters"); gd.addMessage ("Earlier 3D generation parameters");
gd.addCheckbox ("Generate background (infinity) image for 3D (not needed for view down)", this.generate_bg); gd.addCheckbox ("Generate background (infinity) image for 3D (not needed for view down)", this.generate_bg);
gd.addCheckbox ("Show generated textures", this.show_textures); gd.addCheckbox ("Show generated textures", this.show_textures);
...@@ -5163,6 +5200,13 @@ public class CLTParameters { ...@@ -5163,6 +5200,13 @@ public class CLTParameters {
this.gmap_save_tiff= gd.getNextBoolean(); this.gmap_save_tiff= gd.getNextBoolean();
this.gmap_tiff_pal= (int) gd.getNextNumber(); this.gmap_tiff_pal= (int) gd.getNextNumber();
this.gmap_um = gd.getNextBoolean();
this.gmap_um_sigma = gd.getNextNumber();
this.gmap_um_weight = gd.getNextNumber();
this.gmap_lwir_autorange = gd.getNextBoolean();
this.gmap_um_fixed = gd.getNextBoolean();
this.gmap_um_range = gd.getNextNumber();
this.generate_bg= gd.getNextBoolean(); this.generate_bg= gd.getNextBoolean();
this.show_textures= gd.getNextBoolean(); this.show_textures= gd.getNextBoolean();
this.debug_filters= gd.getNextBoolean(); this.debug_filters= gd.getNextBoolean();
......
...@@ -194,13 +194,13 @@ public class ElphelTiffWriter { ...@@ -194,13 +194,13 @@ public class ElphelTiffWriter {
int bands = 1; // 4 bands for ARGB, 3 for RGB etc int bands = 1; // 4 bands for ARGB, 3 for RGB etc
int[] bandOffsets = {0}; // length == bands, 0 == R, 1 == G, 2 == B and 3 == A int[] bandOffsets = {0}; // length == bands, 0 == R, 1 == G, 2 == B and 3 == A
// Create a TYPE_FLOAT sample model (specifying how the pixels are stored) // Create a TYPE_FLOAT sample model (specifying how the pixels are stored)
SampleModel sampleModel0 = new PixelInterleavedSampleModel( // SampleModel sampleModel0 = new PixelInterleavedSampleModel(
DataBuffer.TYPE_FLOAT, // DataBuffer.TYPE_FLOAT,
width, // width,
height, // height,
bands, // bands,
width * bands, // width * bands,
bandOffsets); // bandOffsets);
// Create a color model compatible with this sample model/raster (TYPE_FLOAT) // Create a color model compatible with this sample model/raster (TYPE_FLOAT)
// Note that the number of bands must equal the number of color components in the // Note that the number of bands must equal the number of color components in the
......
...@@ -8668,7 +8668,7 @@ public class QuadCLTCPU { ...@@ -8668,7 +8668,7 @@ public class QuadCLTCPU {
double [][][] textures // [nslices][nchn][i] double [][][] textures // [nslices][nchn][i]
) { ) {
if ((textures == null) || (textures.length==0)) { if ((textures == null) || (textures.length==0)) {
throw new IllegalArgumentException ("umTextures(): Empty textures"); throw new IllegalArgumentException ("getMinMaxTextures(): Empty textures");
} }
final boolean is_mono = textures[0].length <= 2; final boolean is_mono = textures[0].length <= 2;
final int alpha_chn = is_mono? 1 : 3; final int alpha_chn = is_mono? 1 : 3;
...@@ -16456,6 +16456,52 @@ public class QuadCLTCPU { ...@@ -16456,6 +16456,52 @@ public class QuadCLTCPU {
return true; return true;
} }
// Currently only a single-slice 32-bit file (with NaN for tranparency)
public boolean writeLwirGeoTiff32(
final CLTParameters clt_parameters,
double [] data,
double [] lla, // latitude, longitude, altitude (or null)
LocalDateTime dt, // local date/time or null
double pix_in_meters,
int width,
QuadCLT scene,
String suffix, // include "-geo"
int debugLevel) {
if (scene == null) {
scene = (QuadCLT) this;
}
int height = data.length/width;
String set_name = getImageName();
if (set_name == null ) {
QuadCLTCPU.SetChannels [] set_channels = setChannels(debugLevel);
set_name = set_channels[0].set_name;
}
String model_dir= correctionsParameters.selectX3dDirectory(
set_name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
null,
true, // smart,
true); //newAllowed, // save\
String title = getImageName()+suffix;
ImagePlus imp = ShowDoubleFloatArrays.makeArrays(
data, // double[] pixels,
width, // int width,
height, // int height,
title); // String title);
String image_path = model_dir + Prefs.getFileSeparator() + title+".tiff";
ElphelTiffWriter.saveTiffARGBOrGray32(
imp,
image_path,
lla, // double [] lla, // latitude, longitude, altitude (or null)
dt, // LocalDateTime dt, // local date/time or null
pix_in_meters, //double pix_in_meters, // resolution or Double.NaN
false, // imageJTags,
debugLevel);
return true;
}
/** broke /** broke
public boolean writeRatingFile( // USED in lwir public boolean writeRatingFile( // USED in lwir
......
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