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 {
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_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 show_textures = true; // show generated textures
......@@ -1639,6 +1646,13 @@ public class CLTParameters {
properties.setProperty(prefix+"gmap_save_tiff32", this.gmap_save_tiff32+""); // 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_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+"show_textures", this.show_textures+"");
......@@ -2663,6 +2677,13 @@ public class CLTParameters {
if (properties.getProperty(prefix+"gmap_save_tiff32")!=null) this.gmap_save_tiff32=Boolean.parseBoolean(properties.getProperty(prefix+ "gmap_save_tiff32"));
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_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+"show_textures")!=null) this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures"));
......@@ -3939,8 +3960,24 @@ public class CLTParameters {
"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
"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.");
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.addCheckbox ("Generate background (infinity) image for 3D (not needed for view down)", this.generate_bg);
......@@ -5159,10 +5196,17 @@ public class CLTParameters {
this.gmap_tex_pals = CLTParameters.str_to_iarr(gd.getNextString());
this.gmap_save_alt= gd.getNextBoolean();
this.gmap_save_tiff32= gd.getNextBoolean();
this.gmap_save_tiff32= gd.getNextBoolean();
this.gmap_save_tiff= gd.getNextBoolean();
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.show_textures= gd.getNextBoolean();
this.debug_filters= gd.getNextBoolean();
......
......@@ -194,13 +194,13 @@ public class ElphelTiffWriter {
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
// Create a TYPE_FLOAT sample model (specifying how the pixels are stored)
SampleModel sampleModel0 = new PixelInterleavedSampleModel(
DataBuffer.TYPE_FLOAT,
width,
height,
bands,
width * bands,
bandOffsets);
// SampleModel sampleModel0 = new PixelInterleavedSampleModel(
// DataBuffer.TYPE_FLOAT,
// width,
// height,
// bands,
// width * bands,
// bandOffsets);
// 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
......
......@@ -8668,7 +8668,7 @@ public class QuadCLTCPU {
double [][][] textures // [nslices][nchn][i]
) {
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 int alpha_chn = is_mono? 1 : 3;
......@@ -16456,6 +16456,52 @@ public class QuadCLTCPU {
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
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