Commit 4bdc8501 authored by Andrey Filippov's avatar Andrey Filippov

working version, starting texture generation

parent ab99e29d
......@@ -6656,7 +6656,7 @@ public class ImageDttCPU {
schn = MONO_CHN; // clone green to red and blue output
}
if (texture_tile[schn] == null) {
dpixels[chn] = null;
dpixels[chn] = null; //09.12.2022 WRONG - keep as is, do once ??????
} else {
// should it be better to multiply each color by alpha before accumulating? No, it is already windowed!
if ((chn != 3) || !sharp_alpha) {
......
......@@ -12553,7 +12553,6 @@ public class QuadCLTCPU {
"shape_id-"+(scanIndex - next_pass), // id
null, // class
scan.getTextureBounds(),
// scan.selected,
scan.getSelected(),
scan_disparity, // scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM],
clt_parameters.transform_size,
......@@ -12613,8 +12612,8 @@ public class QuadCLTCPU {
return; // not used in lwir
}
int [][] indices = tp.getCoordIndices( // starting with 0, -1 - not selected
bounds,
selected);
bounds,
selected);
double [][] texCoord = tp.getTexCoords( // get texture coordinates for indices
indices);
double [][] worldXYZ = tp.getCoords( // get world XYZ in meters for indices
......@@ -12639,7 +12638,7 @@ public class QuadCLTCPU {
indices);
triangles = tp.filterTriangles(
triangles = tp.filterTriangles( // remove crazy triangles with large disparity difference
triangles,
indexedDisparity, // disparities per vertex index
maxDispTriangle); // maximal disparity difference in a triangle
......@@ -13013,14 +13012,15 @@ public class QuadCLTCPU {
}
}
}
// create 8*tilesX * 8*tilesY RBGA (?) image. input for mono (Y,,,A), output [null,null, Y, A]?
double [][] texture_overlap = image_dtt.combineRBGATiles(
texture_tiles_cluster, // texture_tiles, // array [tp.tilesY][tp.tilesX][4][4*transform_size] or [tp.tilesY][tp.tilesX]{null}
/// image_dtt.transform_size,
true, // when false - output each tile as 16x16, true - overlap to make 8x8
clt_parameters.sharp_alpha, // combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
threadsMax, // maximal number of threads to launch
debugLevel);
// Update alpha to sharpen "tree branches"
if (clt_parameters.alpha1 > 0){ // negative or 0 - keep alpha as it was
double scale = (clt_parameters.alpha1 > clt_parameters.alpha0) ? (1.0/(clt_parameters.alpha1 - clt_parameters.alpha0)) : 0.0;
for (int i = 0; i < texture_overlap[alpha_index].length; i++){
......@@ -13036,6 +13036,8 @@ public class QuadCLTCPU {
double [][] texture_rgba = {texture_overlap[0],texture_overlap[1],texture_overlap[2],texture_overlap[3]};
double [][] texture_rgbx = ((clt_parameters.alpha1 > 0)? texture_rgba: texture_rgb);
// Resize was extracting rectangle from the full size texture. With consolidated texture (9.12.2022) multiple
// rectangles can be extracted from a single texture array
boolean resize = true;
if (resize) {
texture_rgbx = resizeGridTexture(
......@@ -13051,7 +13053,7 @@ public class QuadCLTCPU {
if ((width <= 0) || (height <= 0)) {
System.out.println("***** BUG in getPassImage(): width="+width+", height="+height+", resize="+resize+" ****"); // not used in lwir
}
// 9.12.2022: should be done for each cluster
ImagePlus imp_texture_cluster = linearStackToColor(
clt_parameters,
colorProcParameters,
......
......@@ -8867,7 +8867,7 @@ ImageDtt.startAndJoin(threads);
return indices;
}
public double [][] getTexCoords( // get texture coordinates for indices
public static double [][] getTexCoords( // get texture coordinates for indices
int [][] indices)
{
int maxIndex = -1;
......@@ -8913,7 +8913,6 @@ ImageDtt.startAndJoin(threads);
for (int x = 0; (x < width) && (indx <= maxIndex); x++){
if (indices[y][x] >=0){
// center coordinates for 8*8 tile is [3.5,3.5]
// double disp = disparity[(bounds.y + y) * tilesX + (bounds.x + x)];
double disp = (disparity == null)? min_disparity:( disparity[(bounds.y + y) * tilesX + (bounds.x + x)]);
if (disp < min_disparity) disp = min_disparity;
else if (disp > max_disparity) disp = max_disparity;
......@@ -8962,7 +8961,7 @@ ImageDtt.startAndJoin(threads);
return coordinate;
}
int getMaxIndex(int [][] indices)
static int getMaxIndex(int [][] indices)
{
int height = indices.length;
int width = indices[0].length;
......@@ -8976,7 +8975,7 @@ ImageDtt.startAndJoin(threads);
return -1;
}
public int [][] filterTriangles(
public static int [][] filterTriangles(
int [][] triangles,
double [] disparity, // disparities per vertex index
double maxDispDiff) // maximal disparity difference in a triangle
......@@ -9013,13 +9012,11 @@ ImageDtt.startAndJoin(threads);
}
public int [][] triangulateCluster(
public static int [][] triangulateCluster(
int [][] indices)
{
int height = indices.length;
int width = indices[0].length;
// int [][] ind = new int [height][];
// for (int i = 0; i < width; i++) ind[i] = indices[i].clone();
class Triangle {
int [] points = new int [3];
Triangle (int i1, int i2, int i3){
......@@ -9070,7 +9067,7 @@ ImageDtt.startAndJoin(threads);
return triangles;
}
int iSign (int a) {return (a > 0) ? 1 : ((a < 0)? -1 : 0);}
static int iSign (int a) {return (a > 0) ? 1 : ((a < 0)? -1 : 0);}
public void testTriangles(
String texturePath,
......@@ -9136,7 +9133,7 @@ ImageDtt.startAndJoin(threads);
}
public double [] fillNaNs(
public static double [] fillNaNs(
final double [] data,
int width,
final int grow,
......
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