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
164444fe
Commit
164444fe
authored
Dec 02, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
still working on textures
parent
433c7f7f
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
967 additions
and
656 deletions
+967
-656
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+1
-1
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+22
-3
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+8
-4
TexturedModel.java
...n/java/com/elphel/imagej/tileprocessor/TexturedModel.java
+776
-634
TileCluster.java
...ain/java/com/elphel/imagej/tileprocessor/TileCluster.java
+101
-6
TileNeibs.java
src/main/java/com/elphel/imagej/tileprocessor/TileNeibs.java
+32
-0
TileProcessor.java
...n/java/com/elphel/imagej/tileprocessor/TileProcessor.java
+27
-8
No files found.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
164444fe
...
...
@@ -8044,7 +8044,7 @@ public class OpticalFlow {
payload_blue_sky
=
new
double
[
tiles
];
Arrays
.
fill
(
payload_blue_sky
,
Double
.
NaN
);
}
combo_dsn_final
[
COMBO_DSN_INDX_BLUE_SKY
]
=
payload_blue_sky
;
// restore modified parameters
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
save_bimax_combine_mode
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
164444fe
...
...
@@ -1788,7 +1788,9 @@ public class QuadCLT extends QuadCLTCPU {
final
boolean
filter_bg
,
// remove bg tiles (possibly occluded)
final
double
max_distortion
,
// maximal neighbor tiles offset as a fraction of tile size (8)
final
int
[]
cluster_index
,
// [tilesX*tilesY]
final
boolean
[]
border
,
// border tiles
final
boolean
[]
border
,
// border tiles for clusters?
final
int
discard_frame_edges
,
// do not use tiles that have pixels closer to the frame margins
final
int
keep_frame_tiles
,
// do not discard pixels for border tiles in reference frame
final
boolean
keep_channels
,
final
int
debugLevel
){
// FIXME: Move to clt_parameters;
...
...
@@ -1990,8 +1992,12 @@ public class QuadCLT extends QuadCLTCPU {
final
int
tilesX
=
scene
.
getTileProcessor
().
getTilesX
();
final
int
tilesY
=
scene
.
getTileProcessor
().
getTilesY
();
final
int
tiles
=
tilesX
*
tilesY
;
int
tile_size
=
scene
.
getTileProcessor
().
getTileSize
();
final
int
tile_size
=
scene
.
getTileProcessor
().
getTileSize
();
int
tile_len
=
tile_size
*
tile_size
;
// final int transform_size = clt_parameters.transform_size;
final
int
full_width
=
tilesX
*
tile_size
;
final
int
full_height
=
tilesY
*
tile_size
;
final
double
[][][][]
texture_tiles88
=
new
double
[
tilesY
][
tilesX
][][];
// here - non-overlapped!
// copy from windowed output to
final
TpTask
[]
ftp_tasks
=
tp_tasks
[
0
];
...
...
@@ -2033,7 +2039,7 @@ public class QuadCLT extends QuadCLTCPU {
}
ImageDtt
.
startAndJoin
(
threads
);
if
(
max_distortion
>
0
)
{
// remove distorted tiles
if
(
(
max_distortion
>
0
)
||
(
discard_frame_edges
>
0
)
)
{
// remove distorted tiles
double
max_distortion2
=
max_distortion
*
max_distortion
;
final
TileNeibs
tn
=
new
TileNeibs
(
tilesX
,
tilesY
);
final
boolean
[]
distorted
=
new
boolean
[
tiles
];
...
...
@@ -2078,6 +2084,19 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
// see if the tile should be removed because it is too close to the edge of the scene frame
if
(!
distorted
[
nTile
]
&&
(
discard_frame_edges
>
0
))
{
if
((
tileX
>=
keep_frame_tiles
)
&&
(
tileY
>=
keep_frame_tiles
)
&&
(
tileX
<
(
tilesX
-
keep_frame_tiles
))
&&
(
tileY
<
(
tilesY
-
keep_frame_tiles
)))
{
if
(
(
centerXY
[
0
]
<
discard_frame_edges
)
||
(
centerXY
[
1
]
<
discard_frame_edges
)
||
(
centerXY
[
0
]
>
(
full_width
-
discard_frame_edges
-
1
))
||
(
centerXY
[
1
]
>
(
full_height
-
discard_frame_edges
-
1
)))
{
distorted
[
nTile
]
=
true
;
}
}
}
}
else
{
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"Non-null texture for no-cluster, nTile="
+
nTile
+
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
164444fe
...
...
@@ -12056,6 +12056,7 @@ public class QuadCLTCPU {
clt_parameters
.
maxZtoXY
,
// double maxZtoXY, // 10.0. <=0 - do not use
clt_parameters
.
maxZ
,
clt_parameters
.
limitZ
,
null
,
// dbg_disp_tri_slice, // double [][] dbg_disp_tri_slice,
debugLevel
+
1
);
// int debug_level) > 0
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
...
...
@@ -12155,6 +12156,7 @@ public class QuadCLTCPU {
clt_parameters
.
maxZtoXY
,
// double maxZtoXY, // 10.0. <=0 - do not use
clt_parameters
.
maxZ
,
clt_parameters
.
limitZ
,
null
,
// double [][] dbg_disp_tri_slice,
debugLevel
+
1
);
// int debug_level) > 0
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
@@ -12203,7 +12205,8 @@ public class QuadCLTCPU {
double
maxDispTriangle
,
// relative <=0 - do not use
double
maxZtoXY
,
// 10.0. <=0 - do not use
double
maxZ
,
// far clip (0 - do not clip). Negative - limit by max
boolean
limitZ
,
boolean
limitZ
,
double
[][]
dbg_disp_tri_slice
,
int
debug_level
)
throws
IOException
{
...
...
@@ -12315,19 +12318,20 @@ public class QuadCLTCPU {
}
}
if
(
show_triangles
)
{
if
(
show_triangles
||
(
dbg_disp_tri_slice
!=
null
)
)
{
double
[]
ddisp
=
(
disparity
==
null
)?(
new
double
[
1
]):
disparity
;
if
(
disparity
==
null
)
{
ddisp
[
0
]
=
min_disparity
;
}
tp
.
testTriangles
(
texturePath
,
(
show_triangles
?
texturePath:
null
)
,
bounds
,
selected
,
ddisp
,
// disparity, // if disparity.length == 1 - use for all
tile_size
,
indices
,
triangles
);
triangles
,
dbg_disp_tri_slice
);
// double [][] debug_triangles);
}
if
(
x3dOutput
!=
null
)
{
x3dOutput
.
addCluster
(
...
...
src/main/java/com/elphel/imagej/tileprocessor/TexturedModel.java
View file @
164444fe
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TileCluster.java
View file @
164444fe
...
...
@@ -32,15 +32,19 @@ class TileCluster{
double
[]
disparity
;
// all and only unused - NaN
int
[]
cluster_index
=
null
;
// for debug purposes, index of the source cluster
int
index
=
-
1
;
boolean
is_sky
=
false
;
ArrayList
<
IndexedRectanle
>
clust_list
;
class
IndexedRectanle
{
int
index
;
Rectangle
bounds
;
boolean
is_sky
;
IndexedRectanle
(
int
index
,
Rectangle
bounds
){
Rectangle
bounds
,
boolean
is_sky
){
this
.
index
=
index
;
this
.
bounds
=
bounds
;
this
.
is_sky
=
is_sky
;
}
}
// to use cluster_index - set index >= 0, <0 - do not use.
...
...
@@ -48,9 +52,11 @@ class TileCluster{
Rectangle
bounds
,
int
index
,
// <0 to skip
boolean
[]
border
,
double
[]
disparity
){
double
[]
disparity
,
boolean
is_sky
){
this
.
bounds
=
bounds
;
this
.
index
=
index
;
this
.
index
=
index
;
this
.
is_sky
=
is_sky
;
/**
if (index >= 0) {
this.cluster_index = new int [bounds.width * bounds.height];
...
...
@@ -72,10 +78,31 @@ class TileCluster{
}
this
.
disparity
=
disparity
;
}
public
boolean
isSky
()
{
return
is_sky
;
}
public
int
getSkyClusterIndex
()
{
if
(
clust_list
==
null
)
{
return
-
2
;
}
for
(
int
i
=
0
;
i
<
clust_list
.
size
();
i
++)
{
if
(
clust_list
.
get
(
i
).
is_sky
)
{
return
i
;
}
}
return
-
1
;
}
public
Rectangle
getBounds
()
{
return
bounds
;}
public
Rectangle
getBounds
()
{
return
bounds
;
}
public
Rectangle
getBounds
(
int
gap
)
{
return
new
Rectangle
(
bounds
.
x
-
gap
,
bounds
.
y
-
gap
,
bounds
.
width
+
2
*
gap
,
bounds
.
height
+
2
*
gap
);
}
public
boolean
[]
getBorder
()
{
return
border
;}
public
double
[]
getDisparity
()
{
return
disparity
;}
public
void
setDisparity
(
double
[]
disparity
)
{
this
.
disparity
=
disparity
;}
public
double
[]
getSubDisparity
(
int
indx
)
{
// disparity should be NaN for unused !
if
(
clust_list
==
null
)
{
return
null
;
...
...
@@ -94,6 +121,32 @@ class TileCluster{
}
return
sub_disparity
;
}
public
void
setSubDisparity
(
int
indx
,
double
[]
sub_disparity
)
{
// disparity should be NaN for unused !
if
(
clust_list
==
null
)
{
return
;
}
Rectangle
sub_bounds
=
clust_list
.
get
(
indx
).
bounds
;
int
src_x
=
sub_bounds
.
x
-
bounds
.
x
;
for
(
int
dst_y
=
0
;
dst_y
<
sub_bounds
.
height
;
dst_y
++)
{
int
src_y
=
dst_y
+
sub_bounds
.
y
-
bounds
.
y
;
System
.
arraycopy
(
sub_disparity
,
dst_y
*
sub_bounds
.
width
,
disparity
,
src_y
*
bounds
.
width
+
src_x
,
sub_bounds
.
width
);
}
}
public
boolean
isSubSky
(
int
indx
)
{
if
(
clust_list
==
null
)
{
return
false
;
}
return
clust_list
.
get
(
indx
).
is_sky
;
}
public
boolean
[]
getSubBorder
(
int
indx
)
{
// disparity should be NaN for unused !
if
(
clust_list
==
null
)
{
...
...
@@ -113,7 +166,7 @@ class TileCluster{
}
return
sub_border
;
}
// returns selected for all non-NAN, so it is possible to use NEGATIVE_INFINITY for non-NaN
public
boolean
[]
getSubSelected
(
int
indx
)
{
// disparity should be NaN for unused !
if
(
clust_list
==
null
)
{
return
null
;
...
...
@@ -141,6 +194,15 @@ class TileCluster{
return
selected
;
}
public
Rectangle
getSubBounds
(
int
indx
)
{
if
(
clust_list
==
null
)
{
return
null
;
}
else
{
Rectangle
sub_bounds
=
clust_list
.
get
(
indx
).
bounds
;
return
sub_bounds
;
}
}
public
Rectangle
[]
getSubBounds
()
{
if
(
clust_list
==
null
)
{
return
null
;
...
...
@@ -163,6 +225,9 @@ class TileCluster{
return
sub_indices
;
}
}
public
void
resetClusterIndex
()
{
// to rebuild cluster index from disparity
this
.
cluster_index
=
null
;
}
public
int
[]
getClusterIndex
()
{
// (Now not) just a debug feature, no need to optimize?
if
(
clust_list
==
null
)
{
return
null
;
...
...
@@ -183,6 +248,36 @@ class TileCluster{
}
}
return
cluster_index
;
}
public
void
increaseBounds
()
{
int
num_subs
=
getSubBounds
().
length
;
for
(
int
indx
=
0
;
indx
<
num_subs
;
indx
++)
{
increaseBounds
(
indx
);
}
}
public
void
increaseBounds
(
int
sub_index
)
{
Rectangle
bounds
=
getSubBounds
(
sub_index
);
Rectangle
ext_bounds
=
new
Rectangle
(
bounds
.
x
-
1
,
bounds
.
y
-
1
,
bounds
.
width
+
2
,
bounds
.
height
+
2
);
if
(
ext_bounds
.
x
<
0
)
{
ext_bounds
.
width
+=
ext_bounds
.
x
;
ext_bounds
.
x
=
0
;
}
if
((
ext_bounds
.
x
+
ext_bounds
.
width
)
>
this
.
bounds
.
width
)
{
ext_bounds
.
width
=
this
.
bounds
.
width
-
ext_bounds
.
x
;
}
if
(
ext_bounds
.
y
<
0
)
{
ext_bounds
.
height
+=
ext_bounds
.
y
;
ext_bounds
.
y
=
0
;
}
if
((
ext_bounds
.
y
+
ext_bounds
.
height
)
>
this
.
bounds
.
height
)
{
ext_bounds
.
height
=
this
.
bounds
.
height
-
ext_bounds
.
y
;
}
bounds
.
x
=
ext_bounds
.
x
;
bounds
.
y
=
ext_bounds
.
y
;
bounds
.
width
=
ext_bounds
.
width
;
bounds
.
height
=
ext_bounds
.
height
;
}
...
...
@@ -194,7 +289,7 @@ class TileCluster{
if
(
clust_list
==
null
)
{
clust_list
=
new
ArrayList
<
IndexedRectanle
>();
}
clust_list
.
add
(
new
IndexedRectanle
(
tileCluster
.
index
,
tileCluster
.
bounds
));
clust_list
.
add
(
new
IndexedRectanle
(
tileCluster
.
index
,
tileCluster
.
bounds
,
tileCluster
.
isSky
()
));
int
dst_x
=
tileCluster
.
bounds
.
x
-
bounds
.
x
;
for
(
int
src_y
=
0
;
src_y
<
tileCluster
.
bounds
.
height
;
src_y
++)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/TileNeibs.java
View file @
164444fe
package
com
.
elphel
.
imagej
.
tileprocessor
;
import
java.awt.Rectangle
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -526,6 +527,37 @@ public class TileNeibs{
return
bound_shape
;
}
public
static
double
[]
getDoubleWindow
(
Rectangle
window
,
double
[]
data
,
int
data_width
)
{
double
[]
window_data
=
new
double
[
window
.
width
*
window
.
height
];
for
(
int
row
=
0
;
row
<
window
.
height
;
row
++)
{
System
.
arraycopy
(
data
,
(
window
.
y
+
row
)
*
data_width
+
window
.
x
,
window_data
,
row
*
window
.
width
,
window
.
width
);
}
return
window_data
;
}
public
static
void
setDoubleWindow
(
Rectangle
window
,
double
[]
window_data
,
double
[]
data
,
int
data_width
)
{
for
(
int
row
=
0
;
row
<
window
.
height
;
row
++)
{
System
.
arraycopy
(
window_data
,
row
*
window
.
width
,
data
,
(
window
.
y
+
row
)
*
data_width
+
window
.
x
,
window
.
width
);
}
}
public
int
[]
distanceFromEdge
(
boolean
[]
tiles
)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/TileProcessor.java
View file @
164444fe
...
...
@@ -8991,13 +8991,14 @@ ImageDtt.startAndJoin(threads);
static
int
iSign
(
int
a
)
{
return
(
a
>
0
)
?
1
:
((
a
<
0
)?
-
1
:
0
);}
public
void
testTriangles
(
String
texturePath
,
String
texturePath
,
// if not null - will show
Rectangle
bounds
,
boolean
[]
selected
,
double
[]
disparity
,
int
tile_size
,
int
[][]
indices
,
int
[][]
triangles
)
int
[][]
triangles
,
double
[][]
debug_triangles
)
// if not null - should be [2][width* height], will mark disparity and triangles
{
String
[]
titles
=
{
"disparity"
,
"triangles"
};
double
[][]
dbg_img
=
new
double
[
titles
.
length
][
tilesX
*
tilesY
*
tile_size
*
tile_size
];
...
...
@@ -9053,12 +9054,30 @@ ImageDtt.startAndJoin(threads);
}
}
}
ShowDoubleFloatArrays
.
showArrays
(
dbg_img
,
tilesX
*
tile_size
,
tilesY
*
tile_size
,
true
,
"triangles-"
+
texturePath
,
titles
);
if
(
texturePath
!=
null
)
{
ShowDoubleFloatArrays
.
showArrays
(
dbg_img
,
tilesX
*
tile_size
,
tilesY
*
tile_size
,
true
,
"triangles-"
+
texturePath
,
titles
);
}
if
(
debug_triangles
!=
null
)
{
int
indx_tri
=
(
debug_triangles
.
length
>
1
)
?
1
:
0
;
for
(
int
i
=
0
;
i
<
debug_triangles
[
indx_tri
].
length
;
i
++)
{
if
(
dbg_img
[
1
][
i
]
>
0
)
{
debug_triangles
[
indx_tri
][
i
]
=
dbg_img
[
1
][
i
];
// 10.0 to have the same scale as disparity
}
}
if
(
indx_tri
>
0
)
{
for
(
int
i
=
0
;
i
<
debug_triangles
[
indx_tri
].
length
;
i
++)
{
if
(!
Double
.
isNaN
(
dbg_img
[
0
][
i
]))
{
debug_triangles
[
0
][
i
]
=
dbg_img
[
0
][
i
];
// disparity if not NaN
}
}
}
}
}
...
...
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