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
4bdc8501
Commit
4bdc8501
authored
Sep 13, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working version, starting texture generation
parent
ab99e29d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
17 deletions
+16
-17
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+1
-1
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+9
-7
TileProcessor.java
...n/java/com/elphel/imagej/tileprocessor/TileProcessor.java
+6
-9
No files found.
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
4bdc8501
...
@@ -6656,7 +6656,7 @@ public class ImageDttCPU {
...
@@ -6656,7 +6656,7 @@ public class ImageDttCPU {
schn
=
MONO_CHN
;
// clone green to red and blue output
schn
=
MONO_CHN
;
// clone green to red and blue output
}
}
if
(
texture_tile
[
schn
]
==
null
)
{
if
(
texture_tile
[
schn
]
==
null
)
{
dpixels
[
chn
]
=
null
;
dpixels
[
chn
]
=
null
;
//09.12.2022 WRONG - keep as is, do once ??????
}
else
{
}
else
{
// should it be better to multiply each color by alpha before accumulating? No, it is already windowed!
// should it be better to multiply each color by alpha before accumulating? No, it is already windowed!
if
((
chn
!=
3
)
||
!
sharp_alpha
)
{
if
((
chn
!=
3
)
||
!
sharp_alpha
)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
4bdc8501
...
@@ -12553,7 +12553,6 @@ public class QuadCLTCPU {
...
@@ -12553,7 +12553,6 @@ public class QuadCLTCPU {
"shape_id-"
+(
scanIndex
-
next_pass
),
// id
"shape_id-"
+(
scanIndex
-
next_pass
),
// id
null
,
// class
null
,
// class
scan
.
getTextureBounds
(),
scan
.
getTextureBounds
(),
// scan.selected,
scan
.
getSelected
(),
scan
.
getSelected
(),
scan_disparity
,
// scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM],
scan_disparity
,
// scan.disparity_map[ImageDtt.DISPARITY_INDEX_CM],
clt_parameters
.
transform_size
,
clt_parameters
.
transform_size
,
...
@@ -12613,8 +12612,8 @@ public class QuadCLTCPU {
...
@@ -12613,8 +12612,8 @@ public class QuadCLTCPU {
return
;
// not used in lwir
return
;
// not used in lwir
}
}
int
[][]
indices
=
tp
.
getCoordIndices
(
// starting with 0, -1 - not selected
int
[][]
indices
=
tp
.
getCoordIndices
(
// starting with 0, -1 - not selected
bounds
,
bounds
,
selected
);
selected
);
double
[][]
texCoord
=
tp
.
getTexCoords
(
// get texture coordinates for indices
double
[][]
texCoord
=
tp
.
getTexCoords
(
// get texture coordinates for indices
indices
);
indices
);
double
[][]
worldXYZ
=
tp
.
getCoords
(
// get world XYZ in meters for indices
double
[][]
worldXYZ
=
tp
.
getCoords
(
// get world XYZ in meters for indices
...
@@ -12639,7 +12638,7 @@ public class QuadCLTCPU {
...
@@ -12639,7 +12638,7 @@ public class QuadCLTCPU {
indices
);
indices
);
triangles
=
tp
.
filterTriangles
(
triangles
=
tp
.
filterTriangles
(
// remove crazy triangles with large disparity difference
triangles
,
triangles
,
indexedDisparity
,
// disparities per vertex index
indexedDisparity
,
// disparities per vertex index
maxDispTriangle
);
// maximal disparity difference in a triangle
maxDispTriangle
);
// maximal disparity difference in a triangle
...
@@ -13013,14 +13012,15 @@ public class QuadCLTCPU {
...
@@ -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
(
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}
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
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
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
threadsMax
,
// maximal number of threads to launch
debugLevel
);
debugLevel
);
// Update alpha to sharpen "tree branches"
if
(
clt_parameters
.
alpha1
>
0
){
// negative or 0 - keep alpha as it was
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
;
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
++){
for
(
int
i
=
0
;
i
<
texture_overlap
[
alpha_index
].
length
;
i
++){
...
@@ -13036,6 +13036,8 @@ public class QuadCLTCPU {
...
@@ -13036,6 +13036,8 @@ public class QuadCLTCPU {
double
[][]
texture_rgba
=
{
texture_overlap
[
0
],
texture_overlap
[
1
],
texture_overlap
[
2
],
texture_overlap
[
3
]};
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
);
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
;
boolean
resize
=
true
;
if
(
resize
)
{
if
(
resize
)
{
texture_rgbx
=
resizeGridTexture
(
texture_rgbx
=
resizeGridTexture
(
...
@@ -13051,7 +13053,7 @@ public class QuadCLTCPU {
...
@@ -13051,7 +13053,7 @@ public class QuadCLTCPU {
if
((
width
<=
0
)
||
(
height
<=
0
))
{
if
((
width
<=
0
)
||
(
height
<=
0
))
{
System
.
out
.
println
(
"***** BUG in getPassImage(): width="
+
width
+
", height="
+
height
+
", resize="
+
resize
+
" ****"
);
// not used in lwir
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
(
ImagePlus
imp_texture_cluster
=
linearStackToColor
(
clt_parameters
,
clt_parameters
,
colorProcParameters
,
colorProcParameters
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/TileProcessor.java
View file @
4bdc8501
...
@@ -8867,7 +8867,7 @@ ImageDtt.startAndJoin(threads);
...
@@ -8867,7 +8867,7 @@ ImageDtt.startAndJoin(threads);
return
indices
;
return
indices
;
}
}
public
double
[][]
getTexCoords
(
// get texture coordinates for indices
public
static
double
[][]
getTexCoords
(
// get texture coordinates for indices
int
[][]
indices
)
int
[][]
indices
)
{
{
int
maxIndex
=
-
1
;
int
maxIndex
=
-
1
;
...
@@ -8913,7 +8913,6 @@ ImageDtt.startAndJoin(threads);
...
@@ -8913,7 +8913,6 @@ ImageDtt.startAndJoin(threads);
for
(
int
x
=
0
;
(
x
<
width
)
&&
(
indx
<=
maxIndex
);
x
++){
for
(
int
x
=
0
;
(
x
<
width
)
&&
(
indx
<=
maxIndex
);
x
++){
if
(
indices
[
y
][
x
]
>=
0
){
if
(
indices
[
y
][
x
]
>=
0
){
// center coordinates for 8*8 tile is [3.5,3.5]
// 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
)]);
double
disp
=
(
disparity
==
null
)?
min_disparity:
(
disparity
[(
bounds
.
y
+
y
)
*
tilesX
+
(
bounds
.
x
+
x
)]);
if
(
disp
<
min_disparity
)
disp
=
min_disparity
;
if
(
disp
<
min_disparity
)
disp
=
min_disparity
;
else
if
(
disp
>
max_disparity
)
disp
=
max_disparity
;
else
if
(
disp
>
max_disparity
)
disp
=
max_disparity
;
...
@@ -8962,7 +8961,7 @@ ImageDtt.startAndJoin(threads);
...
@@ -8962,7 +8961,7 @@ ImageDtt.startAndJoin(threads);
return
coordinate
;
return
coordinate
;
}
}
int
getMaxIndex
(
int
[][]
indices
)
static
int
getMaxIndex
(
int
[][]
indices
)
{
{
int
height
=
indices
.
length
;
int
height
=
indices
.
length
;
int
width
=
indices
[
0
].
length
;
int
width
=
indices
[
0
].
length
;
...
@@ -8976,7 +8975,7 @@ ImageDtt.startAndJoin(threads);
...
@@ -8976,7 +8975,7 @@ ImageDtt.startAndJoin(threads);
return
-
1
;
return
-
1
;
}
}
public
int
[][]
filterTriangles
(
public
static
int
[][]
filterTriangles
(
int
[][]
triangles
,
int
[][]
triangles
,
double
[]
disparity
,
// disparities per vertex index
double
[]
disparity
,
// disparities per vertex index
double
maxDispDiff
)
// maximal disparity difference in a triangle
double
maxDispDiff
)
// maximal disparity difference in a triangle
...
@@ -9013,13 +9012,11 @@ ImageDtt.startAndJoin(threads);
...
@@ -9013,13 +9012,11 @@ ImageDtt.startAndJoin(threads);
}
}
public
int
[][]
triangulateCluster
(
public
static
int
[][]
triangulateCluster
(
int
[][]
indices
)
int
[][]
indices
)
{
{
int
height
=
indices
.
length
;
int
height
=
indices
.
length
;
int
width
=
indices
[
0
].
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
{
class
Triangle
{
int
[]
points
=
new
int
[
3
];
int
[]
points
=
new
int
[
3
];
Triangle
(
int
i1
,
int
i2
,
int
i3
){
Triangle
(
int
i1
,
int
i2
,
int
i3
){
...
@@ -9070,7 +9067,7 @@ ImageDtt.startAndJoin(threads);
...
@@ -9070,7 +9067,7 @@ ImageDtt.startAndJoin(threads);
return
triangles
;
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
(
public
void
testTriangles
(
String
texturePath
,
String
texturePath
,
...
@@ -9136,7 +9133,7 @@ ImageDtt.startAndJoin(threads);
...
@@ -9136,7 +9133,7 @@ ImageDtt.startAndJoin(threads);
}
}
public
double
[]
fillNaNs
(
public
static
double
[]
fillNaNs
(
final
double
[]
data
,
final
double
[]
data
,
int
width
,
int
width
,
final
int
grow
,
final
int
grow
,
...
...
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