Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
151ea276
Commit
151ea276
authored
Aug 28, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes here and there during program use/debugging
parent
67ee5db2
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
237 additions
and
132 deletions
+237
-132
ThermalColor.java
src/main/java/com/elphel/imagej/cameras/ThermalColor.java
+2
-2
IntersceneLmaParameters.java
.../elphel/imagej/tileprocessor/IntersceneLmaParameters.java
+1
-1
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+94
-57
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+44
-14
TexturedModel.java
...n/java/com/elphel/imagej/tileprocessor/TexturedModel.java
+95
-57
Render3D.java
src/main/java/com/elphel/imagej/x3d/export/Render3D.java
+1
-1
No files found.
src/main/java/com/elphel/imagej/cameras/ThermalColor.java
View file @
151ea276
...
@@ -28,8 +28,8 @@ public class ThermalColor {
...
@@ -28,8 +28,8 @@ public class ThermalColor {
double
k
=
out_range
/
PALETTE_RANGE
;
double
k
=
out_range
/
PALETTE_RANGE
;
double
value
=
(
v
-
min
)/(
max
-
min
)
*
(
this
.
palette
.
length
-
1
);
double
value
=
(
v
-
min
)/(
max
-
min
)
*
(
this
.
palette
.
length
-
1
);
int
ivalue
=
(
int
)
(
value
);
int
ivalue
=
(
int
)
(
value
);
if
(
i
value
<
0
)
return
this
.
palette
[
0
];
if
(
value
<
0
)
return
this
.
palette
[
0
];
if
(
i
value
>=
(
this
.
palette
.
length
-
1
))
return
this
.
palette
[
this
.
palette
.
length
-
1
];
if
(
value
>=
(
this
.
palette
.
length
-
1
))
return
this
.
palette
[
this
.
palette
.
length
-
1
];
double
a
=
(
value
-
ivalue
);
// 0..1
double
a
=
(
value
-
ivalue
);
// 0..1
double
[]
rslt
=
{
double
[]
rslt
=
{
k
*((
1
-
a
)
*
this
.
palette
[
ivalue
][
0
]
+
a
*
this
.
palette
[
ivalue
+
1
][
0
]),
k
*((
1
-
a
)
*
this
.
palette
[
ivalue
][
0
]
+
a
*
this
.
palette
[
ivalue
+
1
][
0
]),
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLmaParameters.java
View file @
151ea276
...
@@ -116,7 +116,7 @@ public class IntersceneLmaParameters {
...
@@ -116,7 +116,7 @@ public class IntersceneLmaParameters {
gd
.
addMessage
(
"Interframe LMA parameters selection"
);
gd
.
addMessage
(
"Interframe LMA parameters selection"
);
gd
.
addCheckbox
(
"3D mode (use disparity)"
,
this
.
ilma_3d
,
gd
.
addCheckbox
(
"3D mode (use disparity)"
,
this
.
ilma_3d
,
"Use disparity for interscene matching (as for UAS imagery)"
);
"Use disparity for interscene matching (as for UAS imagery)"
);
gd
.
addNumericField
(
"Disp
[
arity weight"
,
this
.
ilma_disparity_weight
,
6
,
8
,
""
,
gd
.
addNumericField
(
"Disparity weight"
,
this
.
ilma_disparity_weight
,
6
,
8
,
""
,
"Disparity component weight compared to dX and dY"
);
"Disparity component weight compared to dX and dY"
);
gd
.
addCheckbox
(
"LMA in 3D mode"
,
this
.
ilma_3d_lma
,
gd
.
addCheckbox
(
"LMA in 3D mode"
,
this
.
ilma_3d_lma
,
"Use LMA disparity for interscene matching (as for UAS imagery)"
);
"Use LMA disparity for interscene matching (as for UAS imagery)"
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
151ea276
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
151ea276
...
@@ -223,6 +223,7 @@ public class QuadCLTCPU {
...
@@ -223,6 +223,7 @@ public class QuadCLTCPU {
// cac
// cac
public
double
[][]
getGround
(
public
double
[][]
getGround
(
boolean
use_lma
,
boolean
use_lma
,
double
disparity_offset
,
double
discard_low
,
// fraction of all pixels
double
discard_low
,
// fraction of all pixels
double
discard_high
,
// fraction of all pixels
double
discard_high
,
// fraction of all pixels
double
discard_adisp
,
// discard above/below this fraction of average height
double
discard_adisp
,
// discard above/below this fraction of average height
...
@@ -234,22 +235,24 @@ public class QuadCLTCPU {
...
@@ -234,22 +235,24 @@ public class QuadCLTCPU {
int
debug_level
int
debug_level
)
{
)
{
double
[]
z_tilts
=
null
;
double
[]
z_tilts
=
null
;
final
int
tilesX
=
getTileProcessor
().
getTilesX
();
double
normal_damping
=
0.001
;
// pull to horizontal if not enough data
final
int
tilesY
=
getTileProcessor
().
getTilesY
();
// final int tilesX=getTileProcessor().getTilesX();
double
hist_rlow
=
0.4
;
// final int tilesY=getTileProcessor().getTilesY();
double
hist_rlow
=
0.5
;
double
hist_rhigh
=
2.0
;
double
hist_rhigh
=
2.0
;
int
min_good
=
20
;
//number of good tiles
int
min_good
=
20
;
//number of good tiles
int
min_good_quad
=
20
;
// number of good tiles per quadrant
to calculate tilts
/// int min_good_quad = 20; // number of good tiles per quadrant
to calculate tilts
int
gap_frac2
=
20
;
///
int gap_frac2= 20;
double
rel_hight
=
0.2
;
// when calculating scale, ignore objects far from plane
double
rel_hight
=
0.2
;
// when calculating scale, ignore objects far from plane
int
num_bins
=
1000
;
int
num_bins
=
1000
;
double
[][]
dls
=
getDLS
();
double
[][]
dls
=
getDLS
();
if
(
dls
==
null
)
{
if
(
dls
==
null
)
{
return
null
;
return
null
;
}
}
double
[][]
ds
=
new
double
[][]
{
dls
[
use_lma
?
1
:
0
],
dls
[
2
]};
double
[][]
ds
=
new
double
[][]
{
dls
[
use_lma
?
1
:
0
]
.
clone
()
,
dls
[
2
]};
double
sw
=
0
,
swd
=
0
;
double
sw
=
0
,
swd
=
0
;
for
(
int
i
=
0
;
i
<
ds
[
0
].
length
;
i
++)
if
(!
Double
.
isNaN
(
ds
[
0
][
i
])){
for
(
int
i
=
0
;
i
<
ds
[
0
].
length
;
i
++)
if
(!
Double
.
isNaN
(
ds
[
0
][
i
])){
ds
[
0
][
i
]
-=
disparity_offset
;
sw
+=
ds
[
1
][
i
];
sw
+=
ds
[
1
][
i
];
swd
+=
ds
[
0
][
i
]
*
ds
[
1
][
i
];
swd
+=
ds
[
0
][
i
]
*
ds
[
1
][
i
];
}
}
...
@@ -318,7 +321,9 @@ public class QuadCLTCPU {
...
@@ -318,7 +321,9 @@ public class QuadCLTCPU {
}
}
return
null
;
// too few good
return
null
;
// too few good
}
}
double
z_avg
=
getGeometryCorrection
().
getZFromDisparity
(
swd
/
sw
);
// double z_avg= getGeometryCorrection().getZFromDisparity(swd/sw);
/*
int gap_x_0 = tilesX/2 - tilesX/gap_frac2;
int gap_x_0 = tilesX/2 - tilesX/gap_frac2;
int gap_x_1 = tilesX/2 + tilesX/gap_frac2;
int gap_x_1 = tilesX/2 + tilesX/gap_frac2;
int gap_y_0 = tilesY/2 - tilesY/gap_frac2;
int gap_y_0 = tilesY/2 - tilesY/gap_frac2;
...
@@ -348,9 +353,11 @@ public class QuadCLTCPU {
...
@@ -348,9 +353,11 @@ public class QuadCLTCPU {
System.out.println("There are less than 3 quadrants ("+num_good_quads+") having more than "+min_good_quad+" tiles");
System.out.println("There are less than 3 quadrants ("+num_good_quads+") having more than "+min_good_quad+" tiles");
System.out.println("Using only level "+z_avg+", ignoring tilt.");
System.out.println("Using only level "+z_avg+", ignoring tilt.");
}
}
z_tilts
=
new
double
[]
{
z_avg
,
0.0
,
0.0
};
// no tilts
z_tilts = new double[] {
-
z_avg, 0.0, 0.0}; // no tilts
// return new double[] {z_avg, 0.0, 0.0}; // no tilts
// return new double[] {z_avg, 0.0, 0.0}; // no tilts
} else {
} else {
*/
// fit plane
// fit plane
double
[]
ref_disparity
=
ds
[
0
].
clone
();
double
[]
ref_disparity
=
ds
[
0
].
clone
();
for
(
int
i
=
0
;
i
<
ref_disparity
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
ref_disparity
.
length
;
i
++)
{
...
@@ -381,17 +388,18 @@ public class QuadCLTCPU {
...
@@ -381,17 +388,18 @@ public class QuadCLTCPU {
mindx
++;
mindx
++;
}
}
PolynomialApproximation
pa
=
new
PolynomialApproximation
();
PolynomialApproximation
pa
=
new
PolynomialApproximation
();
double
[]
damping
=
new
double
[]
{
normal_damping
,
normal_damping
};
double
[][]
approx2d
=
pa
.
quadraticApproximation
(
double
[][]
approx2d
=
pa
.
quadraticApproximation
(
mdata
,
mdata
,
true
,
// boolean forceLinear, // use linear approximation
true
,
// boolean forceLinear, // use linear approximation
null
,
// double [] damping, null OK
damping
,
// double [] damping, null OK
-
1
);
// debug level
-
1
);
// debug level
z_tilts
=
new
double
[]
{
approx2d
[
0
][
2
],
approx2d
[
0
][
0
],
approx2d
[
0
][
1
]};
z_tilts
=
new
double
[]
{
approx2d
[
0
][
2
],
approx2d
[
0
][
0
],
approx2d
[
0
][
1
]};
if
(
debug_level
>
-
3
)
{
if
(
debug_level
>
-
3
)
{
System
.
out
.
println
(
"Found ground plane: level="
+
z_tilts
[
0
]+
", tiltX="
+
z_tilts
[
1
]+
", tiltY="
+
z_tilts
[
2
]);
System
.
out
.
println
(
"Found ground plane: level="
+
z_tilts
[
0
]+
", tiltX="
+
z_tilts
[
1
]+
", tiltY="
+
z_tilts
[
2
]);
}
}
}
/* } */
// ground - negative Z. picture right - positive X, picture up - positive Y
// ground - negative Z. picture right - positive X, picture up - positive Y
// positive tiltX - to the right higher ground (lower altitude above it) or camera tilted left
// positive tiltX - to the right higher ground (lower altitude above it) or camera tilted left
// positive tiltY - picture up - higher ground (or camera tilted back)
// positive tiltY - picture up - higher ground (or camera tilted back)
...
@@ -402,11 +410,16 @@ public class QuadCLTCPU {
...
@@ -402,11 +410,16 @@ public class QuadCLTCPU {
// It is approximate for small angles. OK for now
// It is approximate for small angles. OK for now
double
[][]
to_ground_xyxatr
=
ErsCorrection
.
invertXYZATR
(
ground_xyxatr
);
double
[][]
to_ground_xyxatr
=
ErsCorrection
.
invertXYZATR
(
ground_xyxatr
);
// recalculate coordinates for all pixels including weak ones
// recalculate coordinates for all pixels including weak ones
double
[]
ref_disparity
=
dls
[
0
].
clone
();
// double []
ref_disparity
=
dls
[
0
].
clone
();
for
(
int
i
=
0
;
i
<
ref_disparity
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
ref_disparity
.
length
;
i
++)
{
if
(
Double
.
isNaN
(
ref_disparity
[
i
]))
ref_disparity
[
i
]
=
0.0
;
if
(
Double
.
isNaN
(
ref_disparity
[
i
]))
ref_disparity
[
i
]
=
0.0
;
else
{
ref_disparity
[
i
]
-=
disparity_offset
;
}
}
double
[][]
wxyz
=
OpticalFlow
.
transformToWorldXYZ
(
}
// double [][]
wxyz
=
OpticalFlow
.
transformToWorldXYZ
(
ref_disparity
,
// final double [] disparity_ref, // invalid tiles - NaN in disparity
ref_disparity
,
// final double [] disparity_ref, // invalid tiles - NaN in disparity
(
QuadCLT
)
this
,
// final QuadCLT quadClt, // now - may be null - for testing if scene is rotated ref
(
QuadCLT
)
this
,
// final QuadCLT quadClt, // now - may be null - for testing if scene is rotated ref
THREADS_MAX
);
// int threadsMax)
THREADS_MAX
);
// int threadsMax)
...
@@ -432,8 +445,11 @@ public class QuadCLTCPU {
...
@@ -432,8 +445,11 @@ public class QuadCLTCPU {
if
(
y
<
y_min_max
[
0
])
y_min_max
[
0
]
=
y
;
if
(
y
<
y_min_max
[
0
])
y_min_max
[
0
]
=
y
;
else
if
(
y
>
y_min_max
[
1
])
y_min_max
[
1
]
=
y
;
else
if
(
y
>
y_min_max
[
1
])
y_min_max
[
1
]
=
y
;
}
}
if
((
x_min_max
==
null
)
||
(
y_min_max
==
null
))
{
return
null
;
// no points at all?
}
if
(
x0y0
!=
null
)
{
if
(
x0y0
!=
null
)
{
x0y0
[
0
]
=
x_min_max
[
0
];
x0y0
[
0
]
=
x_min_max
[
0
];
// null
x0y0
[
1
]
=
y_min_max
[
0
];
x0y0
[
1
]
=
y_min_max
[
0
];
}
}
int
scale
=
0
;
int
scale
=
0
;
...
@@ -8387,6 +8403,9 @@ public class QuadCLTCPU {
...
@@ -8387,6 +8403,9 @@ public class QuadCLTCPU {
double
[][]
rgba
=
new
double
[
num_slices
][];
double
[][]
rgba
=
new
double
[
num_slices
][];
for
(
int
i
=
0
;
i
<
3
;
i
++)
rgba
[
i
]
=
new
double
[
texture_data
[
main_color_index
].
length
];
for
(
int
i
=
0
;
i
<
3
;
i
++)
rgba
[
i
]
=
new
double
[
texture_data
[
main_color_index
].
length
];
for
(
int
i
=
0
;
i
<
rbg_in
[
main_color_index
].
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
rbg_in
[
main_color_index
].
length
;
i
++)
{
if
(
i
==
160000
)
{
System
.
out
.
println
(
"i="
+
i
);
}
double
[]
rgb
=
tc
.
getRGB
(
texture_data
[
main_color_index
][
i
]);
double
[]
rgb
=
tc
.
getRGB
(
texture_data
[
main_color_index
][
i
]);
rgba
[
0
][
i
]
=
rgb
[
0
];
// red
rgba
[
0
][
i
]
=
rgb
[
0
];
// red
rgba
[
1
][
i
]
=
rgb
[
1
];
// green
rgba
[
1
][
i
]
=
rgb
[
1
];
// green
...
@@ -15421,6 +15440,7 @@ public class QuadCLTCPU {
...
@@ -15421,6 +15440,7 @@ public class QuadCLTCPU {
public
boolean
writeLwirPreview
(
public
boolean
writeLwirPreview
(
final
CLTParameters
clt_parameters
,
final
CLTParameters
clt_parameters
,
double
[]
data
,
double
[]
data
,
double
[]
minmax
,
// null for auto
QuadCLT
scene
,
QuadCLT
scene
,
int
tex_palette
,
int
tex_palette
,
String
suffix
,
String
suffix
,
...
@@ -15429,6 +15449,7 @@ public class QuadCLTCPU {
...
@@ -15429,6 +15449,7 @@ public class QuadCLTCPU {
clt_parameters
,
clt_parameters
,
data
,
data
,
getTileProcessor
().
getTilesX
()
*
getTileProcessor
().
getTileSize
(),
getTileProcessor
().
getTilesX
()
*
getTileProcessor
().
getTileSize
(),
minmax
,
// double [] minmax, // null for auto
scene
,
scene
,
tex_palette
,
tex_palette
,
suffix
,
suffix
,
...
@@ -15438,6 +15459,7 @@ public class QuadCLTCPU {
...
@@ -15438,6 +15459,7 @@ public class QuadCLTCPU {
final
CLTParameters
clt_parameters
,
final
CLTParameters
clt_parameters
,
double
[]
data
,
double
[]
data
,
int
width
,
int
width
,
double
[]
minmax
,
// null for auto
QuadCLT
scene
,
QuadCLT
scene
,
int
tex_palette
,
int
tex_palette
,
String
suffix
,
String
suffix
,
...
@@ -15449,7 +15471,15 @@ public class QuadCLTCPU {
...
@@ -15449,7 +15471,15 @@ public class QuadCLTCPU {
for
(
int
i
=
0
;
i
<
rendered_texture
[
0
].
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
rendered_texture
[
0
].
length
;
i
++)
{
rendered_texture
[
1
][
i
]
=
Double
.
isNaN
(
rendered_texture
[
0
][
i
])?
0.0
:
1.0
;
rendered_texture
[
1
][
i
]
=
Double
.
isNaN
(
rendered_texture
[
0
][
i
])?
0.0
:
1.0
;
}
}
double
[]
minmax
=
scene
.
getColdHot
();
// used in linearStackToColor (from this current scene)
// double [] minmax = scene.getColdHot(); // used in linearStackToColor (from this current scene)
if
(!
suffix
.
equals
(
""
))
{
if
(
minmax
==
null
)
{
// to replace standard preview file name
minmax
=
scene
.
getColdHot
();
// used in linearStackToColor (from this current scene)
suffix
+=
"-AUTORANGE"
;
}
else
{
suffix
+=
"-RANGE"
+(
minmax
[
1
]-
minmax
[
0
]);
}
}
// int width = getTileProcessor().getTilesX() *getTileProcessor().getTileSize();
// int width = getTileProcessor().getTilesX() *getTileProcessor().getTileSize();
int
height
=
data
.
length
/
width
;
int
height
=
data
.
length
/
width
;
String
set_name
=
getImageName
();
String
set_name
=
getImageName
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/TexturedModel.java
View file @
151ea276
...
@@ -2452,6 +2452,7 @@ public class TexturedModel {
...
@@ -2452,6 +2452,7 @@ public class TexturedModel {
final
int
debugLevel
)
final
int
debugLevel
)
{
{
final
boolean
render_hdr
=
true
;
//false; // true; // generate textures w/o normalization to generate undistorted
final
boolean
render_hdr
=
true
;
//false; // true; // generate textures w/o normalization to generate undistorted
final
double
range_disparity_offset
=
clt_parameters
.
imp
.
range_disparity_offset
;
// double range_disparity_offset
final
boolean
batch_mode
=
clt_parameters
.
multiseq_run
;
// batch_run;
final
boolean
batch_mode
=
clt_parameters
.
multiseq_run
;
// batch_run;
final
boolean
gltf_emissive
=
clt_parameters
.
gltf_emissive
;
final
boolean
gltf_emissive
=
clt_parameters
.
gltf_emissive
;
final
boolean
use_alpha_blend
=
clt_parameters
.
gltf_alpha_blend
;
final
boolean
use_alpha_blend
=
clt_parameters
.
gltf_alpha_blend
;
...
@@ -2495,6 +2496,9 @@ public class TexturedModel {
...
@@ -2495,6 +2496,9 @@ public class TexturedModel {
// final int show_slice_bitmap = clt_parameters.lre_show_slice_bitmap;
// final int show_slice_bitmap = clt_parameters.lre_show_slice_bitmap;
final
int
sky_layer
=
0
;
// source disparity layer that contains "blue sky"
final
int
sky_layer
=
0
;
// source disparity layer that contains "blue sky"
final
boolean
tex_um_fixed
=
clt_parameters
.
tex_um_fixed
;
// imp.mono_fixed; // true; // normalize to fixed range when converting to 8 bits
final
double
tex_um_range
=
clt_parameters
.
tex_um_range
;
// imp.mono_range; // 500.0; // monochrome full-scale range (+/- half)
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
();
...
@@ -2986,10 +2990,12 @@ public class TexturedModel {
...
@@ -2986,10 +2990,12 @@ public class TexturedModel {
double
discard_adisp
=
0.2
;
// discard above/below this fraction of average height
double
discard_adisp
=
0.2
;
// discard above/below this fraction of average height
double
discard_rdisp
=
0.02
;
// discard above/below this fraction of average height
double
discard_rdisp
=
0.02
;
// discard above/below this fraction of average height
double
pix_size
=
0.005
;
// hdr_x0y0, // in meters
double
pix_size
=
0.005
;
// hdr_x0y0, // in meters
int
max_image_width
=
3200
;
// increase pixel size as a power of 2 until image fits
int
max_image_width
=
4000
;
//
3200; // increase pixel size as a power of 2 until image fits
boolean
crop_empty
=
true
;
boolean
crop_empty
=
true
;
int
crop_extra
=
20
;
int
crop_extra
=
20
;
int
[]
tex_pals
=
{
0
,
1
,
2
};
int
[]
tex_pals
=
{
0
,
1
,
2
};
// boolean use_fixed_range = true;
// double fixed_range = 250.0;
int
tex_palette_start
=
0
;
int
tex_palette_start
=
0
;
int
tex_palette_end
=
12
;
int
tex_palette_end
=
12
;
...
@@ -2997,6 +3003,7 @@ public class TexturedModel {
...
@@ -2997,6 +3003,7 @@ public class TexturedModel {
double
[]
hdr_x0y0
=
new
double
[
2
];
double
[]
hdr_x0y0
=
new
double
[
2
];
double
[][]
to_ground_xyxatr
=
scenes
[
ref_index
].
getGround
(
double
[][]
to_ground_xyxatr
=
scenes
[
ref_index
].
getGround
(
use_lma
,
// boolean use_lma,
use_lma
,
// boolean use_lma,
range_disparity_offset
,
// double range_disparity_offset
discard_low
,
// double discard_low, // fraction of all pixels
discard_low
,
// double discard_low, // fraction of all pixels
discard_high
,
// double discard_high, // fraction of all pixels
discard_high
,
// double discard_high, // fraction of all pixels
discard_adisp
,
// double discard_adisp, // discard above/below this fraction of average height
discard_adisp
,
// double discard_adisp, // discard above/below this fraction of average height
...
@@ -3006,7 +3013,9 @@ public class TexturedModel {
...
@@ -3006,7 +3013,9 @@ public class TexturedModel {
hdr_x0y0
,
// double [] x0y0, // initialize to double[2] to return width, height
hdr_x0y0
,
// double [] x0y0, // initialize to double[2] to return width, height
hdr_whs
,
// int [] whs, // initialize to int[3] to return {width, height, scale reduction}
hdr_whs
,
// int [] whs, // initialize to int[3] to return {width, height, scale reduction}
debugLevel
);
// int debug_level
debugLevel
);
// int debug_level
if
(
to_ground_xyxatr
==
null
)
{
System
.
out
.
println
(
"***** Failed to detect flat ground surface, skipping rendering and output files generation *****"
);
}
else
{
Render3D
render3D
=
new
Render3D
(
Render3D
render3D
=
new
Render3D
(
//x3d_dir, // String x3d_dir,
//x3d_dir, // String x3d_dir,
//ref_scene.correctionsParameters.getModelName(ref_scene.getImageName()), // String model_name,
//ref_scene.correctionsParameters.getModelName(ref_scene.getImageName()), // String model_name,
...
@@ -3022,7 +3031,7 @@ public class TexturedModel {
...
@@ -3022,7 +3031,7 @@ public class TexturedModel {
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
scenes
[
ref_index
],
//final QuadCLT ref_scene, // all coordinates relative to this scene
debugLevel
);
//int debugLevel)
debugLevel
);
//int debugLevel)
// 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"
;
if
(
clt_parameters
.
tex_um
)
{
if
(
clt_parameters
.
tex_um
)
{
suffix
+=
"-UM"
+(
clt_parameters
.
tex_um_sigma
)+
"_"
+(
clt_parameters
.
tex_um_weight
);
suffix
+=
"-UM"
+(
clt_parameters
.
tex_um_sigma
)+
"_"
+(
clt_parameters
.
tex_um_weight
);
...
@@ -3049,12 +3058,15 @@ public class TexturedModel {
...
@@ -3049,12 +3058,15 @@ public class TexturedModel {
img_cropped
,
// double [][] data,
img_cropped
,
// double [][] data,
wh
[
0
],
// int width, // int tilesX,
wh
[
0
],
// int width, // int tilesX,
wh
[
1
]);
// int height, // int tilesY,
wh
[
1
]);
// int height, // int tilesY,
// for (int tex_palette = tex_palette_start; tex_palette <= tex_palette_end; tex_palette++) {
// for (int tex_palette = tex_palette_start; tex_palette <= tex_palette_end; tex_palette++) {
for
(
int
tex_palette:
tex_pals
)
{
for
(
int
tex_palette:
tex_pals
)
{
// try with fixed range?
double
[]
minmax
=
tex_um_fixed
?
(
new
double
[]
{-
tex_um_range
/
2
,
tex_um_range
/
2
}):
null
;
scenes
[
ref_index
].
writeLwirPreview
(
scenes
[
ref_index
].
writeLwirPreview
(
clt_parameters
,
// final CLTParameters clt_parameters,
clt_parameters
,
// final CLTParameters clt_parameters,
img_cropped
[
0
],
// double [] data,
img_cropped
[
0
],
// double [] data,
wh
[
0
],
// int width, // int tilesX,
wh
[
0
],
// int width, // int tilesX,
minmax
,
// double [] minmax, // null for auto
null
,
// QuadCLT scene,
null
,
// QuadCLT scene,
tex_palette
,
// int tex_palette,
tex_palette
,
// int tex_palette,
suffix
+
"-CROP"
+
"-PAL"
+
tex_palette
,
// +tex_palette, // String suffix,
suffix
+
"-CROP"
+
"-PAL"
+
tex_palette
,
// +tex_palette, // String suffix,
...
@@ -3062,6 +3074,7 @@ public class TexturedModel {
...
@@ -3062,6 +3074,7 @@ public class TexturedModel {
}
}
}
}
}
}
}
if
(
dbg_mesh_imgs
!=
null
)
{
if
(
dbg_mesh_imgs
!=
null
)
{
ShowDoubleFloatArrays
.
showArrays
(
ShowDoubleFloatArrays
.
showArrays
(
...
@@ -7112,7 +7125,7 @@ public class TexturedModel {
...
@@ -7112,7 +7125,7 @@ public class TexturedModel {
final
double
mb_max_gain
=
clt_parameters
.
imp
.
mb_max_gain
;
// 5.0; // motion blur maximal gain (if more - move second point more than a pixel
final
double
mb_max_gain
=
clt_parameters
.
imp
.
mb_max_gain
;
// 5.0; // motion blur maximal gain (if more - move second point more than a pixel
final
double
max_distortion
=
clt_parameters
.
tex_distort
;
// 0.5; // Maximal texture distortion to accumulate multiple scenes (0 - any)
final
double
max_distortion
=
clt_parameters
.
tex_distort
;
// 0.5; // Maximal texture distortion to accumulate multiple scenes (0 - any)
final
double
tex_mb
=
clt_parameters
.
tex_mb
;
// 1.0; // Reduce texture weight if motion blur exceeds this (as square of MB length)
final
double
tex_mb
=
clt_parameters
.
imp
.
mb_en
?
clt_parameters
.
tex_mb
:
0.0
;
// 1.0; // Reduce texture weight if motion blur exceeds this (as square of MB length)
final
boolean
is_lwir
=
ref_scene
.
isLwir
();
final
boolean
is_lwir
=
ref_scene
.
isLwir
();
final
boolean
tex_um
=
clt_parameters
.
tex_um
;
// imp.um_mono; // TODO: add own parameter
final
boolean
tex_um
=
clt_parameters
.
tex_um
;
// imp.um_mono; // TODO: add own parameter
final
double
tex_um_sigma
=
clt_parameters
.
tex_um_sigma
;
// imp.um_sigma;
final
double
tex_um_sigma
=
clt_parameters
.
tex_um_sigma
;
// imp.um_sigma;
...
@@ -7129,6 +7142,7 @@ public class TexturedModel {
...
@@ -7129,6 +7142,7 @@ public class TexturedModel {
final
boolean
save_um_texture0
=
clt_parameters
.
tex_save_um_texture0
;
final
boolean
save_um_texture0
=
clt_parameters
.
tex_save_um_texture0
;
final
boolean
save_preview
=
clt_parameters
.
tex_save_preview
;
final
boolean
save_preview
=
clt_parameters
.
tex_save_preview
;
// final boolean show_sky_textures = clt_parameters.lre_show_sky_textures && !clt_parameters.multiseq_run;
// final boolean show_sky_textures = clt_parameters.lre_show_sky_textures && !clt_parameters.multiseq_run;
// final int show_slice_bitmap = clt_parameters.lre_show_slice_bitmap;
// final int show_slice_bitmap = clt_parameters.lre_show_slice_bitmap;
// final int shrink_sky_tiles = 2 * (2 +clt_parameters.tex_sky_extra); // 4; // 2; sum of 2 +bg extend
// final int shrink_sky_tiles = 2 * (2 +clt_parameters.tex_sky_extra); // 4; // 2; sum of 2 +bg extend
...
@@ -7639,14 +7653,38 @@ public class TexturedModel {
...
@@ -7639,14 +7653,38 @@ public class TexturedModel {
dbg_titles
[
i
]
=
dbg_subtitles
[
i
%
dbg_subtitles
.
length
]
+
"-"
+
(
i
/
dbg_subtitles
.
length
);
dbg_titles
[
i
]
=
dbg_subtitles
[
i
%
dbg_subtitles
.
length
]
+
"-"
+
(
i
/
dbg_subtitles
.
length
);
}
}
if
(
save_preview
)
{
if
(
save_preview
)
{
// final boolean tex_um_fixed = clt_parameters.tex_um_fixed; // imp.mono_fixed; // true; // normalize to fixed range when converting to 8 bits
// final double tex_um_range = clt_parameters.tex_um_range; // imp.mono_range; // 500.0; // monochrome full-scale range (+/- half)
double
[]
minmax
=
tex_um_fixed
?
(
new
double
[]
{-
tex_um_range
/
2
,
tex_um_range
/
2
}):
null
;
/*
ref_scene.writePreview( // may move to different (earlier) stage of processing, (search for "-combined_textures")
ref_scene.writePreview( // may move to different (earlier) stage of processing, (search for "-combined_textures")
dbg_textures[0], // double [] data,
dbg_textures[0], // double [] data,
debugLevel); // int debugLevel
debugLevel); // int debugLevel
*/
// Trying different palettes
// Trying different palettes
int
tex_palette
=
2
;
// regular color
int
tex_palette
=
0
;
// regular mono white-hot
ref_scene
.
writeLwirPreview
(
clt_parameters
,
// final CLTParameters clt_parameters,
dbg_textures
[
0
],
// double [] data,
minmax
,
// double [] minmax, // null for auto
null
,
// QuadCLT scene,
tex_palette
,
// int tex_palette,
""
,
// +tex_palette, // String suffix,
debugLevel
);
// int debugLevel)
tex_palette
=
1
;
// regular color
ref_scene
.
writeLwirPreview
(
clt_parameters
,
// final CLTParameters clt_parameters,
dbg_textures
[
0
],
// double [] data,
minmax
,
// double [] minmax, // null for auto
null
,
// QuadCLT scene,
tex_palette
,
// int tex_palette,
"-black_hot"
,
// +tex_palette, // String suffix,
debugLevel
);
// int debugLevel)
tex_palette
=
2
;
// regular color
ref_scene
.
writeLwirPreview
(
ref_scene
.
writeLwirPreview
(
clt_parameters
,
// final CLTParameters clt_parameters,
clt_parameters
,
// final CLTParameters clt_parameters,
dbg_textures
[
0
],
// double [] data,
dbg_textures
[
0
],
// double [] data,
minmax
,
// double [] minmax, // null for auto
null
,
// QuadCLT scene,
null
,
// QuadCLT scene,
tex_palette
,
// int tex_palette,
tex_palette
,
// int tex_palette,
"-color"
,
// +tex_palette, // String suffix,
"-color"
,
// +tex_palette, // String suffix,
...
...
src/main/java/com/elphel/imagej/x3d/export/Render3D.java
View file @
151ea276
...
@@ -69,7 +69,7 @@ public class Render3D {
...
@@ -69,7 +69,7 @@ public class Render3D {
this
.
out_width
=
out_width
;
this
.
out_width
=
out_width
;
this
.
out_height
=
out_height
;
this
.
out_height
=
out_height
;
this
.
toground
=
toground
;
this
.
toground
=
toground
;
this
.
tocam
=
ErsCorrection
.
invertXYZATR
(
this
.
toground
);
this
.
tocam
=
ErsCorrection
.
invertXYZATR
(
this
.
toground
);
// null
// double [][] test1 = ErsCorrection.invertXYZATR(this.tocam); //OK
// double [][] test1 = ErsCorrection.invertXYZATR(this.tocam); //OK
// double [][] test2 = ErsCorrection.invertXYZATR(test1); // OK
// double [][] test2 = ErsCorrection.invertXYZATR(test1); // OK
// ground plane x0, y0 in camera coordinates
// ground plane x0, y0 in camera coordinates
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment