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
8d0998f2
Commit
8d0998f2
authored
Jan 29, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working snapshot, improving clusterization
parent
2f3efffd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
668 additions
and
192 deletions
+668
-192
TexturedModel.java
...n/java/com/elphel/imagej/tileprocessor/TexturedModel.java
+559
-147
TileCluster.java
...ain/java/com/elphel/imagej/tileprocessor/TileCluster.java
+77
-13
TriMesh.java
src/main/java/com/elphel/imagej/x3d/export/TriMesh.java
+32
-32
No files found.
src/main/java/com/elphel/imagej/tileprocessor/TexturedModel.java
View file @
8d0998f2
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TileCluster.java
View file @
8d0998f2
...
...
@@ -32,6 +32,9 @@ class TileCluster{
// <0 - outside, 0 - inner /true disparity, border_int_max - outer border layer, ...
int
[]
border_int
;
// will replace border? Provide on-the-fly?
int
border_int_max
;
// outer border value
int
[]
stitch_stitched
;
// +1 - stitch, +2 - stitched
int
[]
no_connect
;
// bit mask of prohibited directions
double
[]
disparity
;
// all and only unused - NaN
int
[]
cluster_index
=
null
;
// for debug purposes, index of the source cluster
int
index
=
-
1
;
...
...
@@ -54,9 +57,11 @@ class TileCluster{
public
TileCluster
(
Rectangle
bounds
,
int
index
,
// <0 to skip
boolean
[]
border
,
//
boolean [] border,
int
[]
border_int
,
// will replace border? Provide on-the-fly?
int
border_int_max
,
// outer border value
int
[]
stitch_stitched
,
// +1 - stitch, +2 - stitched
int
[]
no_connect
,
// bit mask of prohibited directions
double
[]
disparity
,
boolean
is_sky
){
this
.
bounds
=
bounds
;
...
...
@@ -67,16 +72,15 @@ class TileCluster{
Arrays
.
fill
(
disparity
,
Double
.
NaN
);
}
this
.
disparity
=
disparity
;
if
(
border
==
null
)
{
border
=
new
boolean
[
bounds
.
width
*
bounds
.
height
];
if
(
border_int
!=
null
)
{
for
(
int
i
=
0
;
i
<
border_int
.
length
;
i
++)
{
border
[
i
]
=
border_int
[
i
]
==
border_int_max
;
}
// boolean []
border
=
new
boolean
[
bounds
.
width
*
bounds
.
height
];
if
(
border_int
!=
null
)
{
for
(
int
i
=
0
;
i
<
border_int
.
length
;
i
++)
{
border
[
i
]
=
border_int
[
i
]
==
border_int_max
;
}
}
this
.
border
=
border
;
//
this.border = border;
// for back compatibility
if
(
border_int
==
null
)
{
border_int
=
new
int
[
bounds
.
width
*
bounds
.
height
];
...
...
@@ -90,9 +94,19 @@ class TileCluster{
}
}
}
this
.
border_int
=
border_int
;
this
.
border_int_max
=
border_int_max
;
if
(
stitch_stitched
==
null
)
{
stitch_stitched
=
new
int
[
bounds
.
width
*
bounds
.
height
];
}
this
.
stitch_stitched
=
stitch_stitched
;
if
(
no_connect
==
null
)
{
no_connect
=
new
int
[
bounds
.
width
*
bounds
.
height
];
}
this
.
no_connect
=
no_connect
;
}
public
boolean
isSky
()
{
return
is_sky
;
}
...
...
@@ -123,6 +137,8 @@ class TileCluster{
}
public
boolean
[]
getBorder
()
{
return
border
;}
// Modify to use border_int (==border_int_max)?
public
int
[]
getBorderInt
()
{
return
border_int
;}
public
int
[]
getStitchStitched
()
{
return
stitch_stitched
;}
public
int
[]
getNoConnect
()
{
return
no_connect
;}
public
int
getBorderIntMax
()
{
return
border_int_max
;}
public
double
[]
getDisparity
()
{
return
disparity
;}
public
void
setDisparity
(
double
[]
disparity
)
{
this
.
disparity
=
disparity
;}
...
...
@@ -208,6 +224,46 @@ class TileCluster{
}
return
sub_border_int
;
}
public
int
[]
getSubStitchStitched
(
int
indx
)
{
if
(
clust_list
==
null
)
{
return
null
;
}
Rectangle
sub_bounds
=
clust_list
.
get
(
indx
).
bounds
;
int
[]
sub_stitch_stitched
=
new
int
[
sub_bounds
.
width
*
sub_bounds
.
height
];
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
(
stitch_stitched
,
src_y
*
bounds
.
width
+
src_x
,
sub_stitch_stitched
,
dst_y
*
sub_bounds
.
width
,
sub_bounds
.
width
);
}
return
sub_stitch_stitched
;
}
public
int
[]
getSubNoConnect
(
int
indx
)
{
if
(
clust_list
==
null
)
{
return
null
;
}
Rectangle
sub_bounds
=
clust_list
.
get
(
indx
).
bounds
;
int
[]
sub_no_connect
=
new
int
[
sub_bounds
.
width
*
sub_bounds
.
height
];
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
(
no_connect
,
src_y
*
bounds
.
width
+
src_x
,
sub_no_connect
,
dst_y
*
sub_bounds
.
width
,
sub_bounds
.
width
);
}
return
sub_no_connect
;
}
// returns selected for all non-NAN, so it is possible to use NEGATIVE_INFINITY for non-NaN
...
...
@@ -223,10 +279,6 @@ class TileCluster{
return
sub_selection
;
}
public
boolean
[]
getSelected
()
{
if
(
disparity
==
null
)
{
return
null
;
...
...
@@ -356,6 +408,18 @@ class TileCluster{
disparity
,
dst_y
*
bounds
.
width
+
dst_x
,
tileCluster
.
bounds
.
width
);
System
.
arraycopy
(
tileCluster
.
stitch_stitched
,
src_y
*
tileCluster
.
bounds
.
width
,
stitch_stitched
,
dst_y
*
bounds
.
width
+
dst_x
,
tileCluster
.
bounds
.
width
);
System
.
arraycopy
(
tileCluster
.
no_connect
,
src_y
*
tileCluster
.
bounds
.
width
,
no_connect
,
dst_y
*
bounds
.
width
+
dst_x
,
tileCluster
.
bounds
.
width
);
}
return
;
}
...
...
src/main/java/com/elphel/imagej/x3d/export/TriMesh.java
View file @
8d0998f2
...
...
@@ -2283,41 +2283,41 @@ public class TriMesh {
// New version with subdivision
public
static
void
generateClusterX3d
(
// New version with alpha
boolean
full_texture
,
// true - full size image, false - bounds only
int
subdivide_mesh
,
// 0,1 - full tiles only, 2 - 2x2 pixels, 4 - 2x2 pixels
boolean
[]
alpha
,
// boolean alpha - true - opaque, false - transparent. Full/bounds
// matching selection
double
[]
dalpha
,
// before boolean
X3dOutput
x3dOutput
,
// output x3d if not null
WavefrontExport
wfOutput
,
// output WSavefront if not null
boolean
full_texture
,
// true - full size image, false - bounds only
int
subdivide_mesh
,
// 0,1 - full tiles only, 2 - 2x2 pixels, 4 - 2x2 pixels
boolean
[]
alpha
,
// boolean alpha - true - opaque, false - transparent. Full/bounds
// matching selection
double
[]
dalpha
,
// before boolean
X3dOutput
x3dOutput
,
// output x3d if not null
WavefrontExport
wfOutput
,
// output WSavefront if not null
ArrayList
<
TriMesh
>
tri_meshes
,
String
texturePath
,
String
id
,
String
class_name
,
Rectangle
bounds
,
Rectangle
texture_bounds
,
// if not null - allows trimmed combo textures
String
texturePath
,
String
id
,
String
class_name
,
Rectangle
bounds
,
Rectangle
texture_bounds
,
// if not null - allows trimmed combo textures
// Below selected and disparity are bounds.width*bounds.height
boolean
[]
selected
,
// may be either tilesX * tilesY or bounds.width*bounds.height
double
[]
disparity
,
// if null, will use min_disparity
int
[]
border_int
,
int
max_border
,
int
tile_size
,
int
tilesX
,
int
tilesY
,
boolean
[]
selected
,
// may be either tilesX * tilesY or bounds.width*bounds.height
double
[]
disparity
,
// if null, will use min_disparity
int
[]
border_int
,
int
max_border
,
int
tile_size
,
int
tilesX
,
int
tilesY
,
GeometryCorrection
geometryCorrection
,
boolean
correctDistortions
,
// requires backdrop image to be corrected also
double
[]
tri_img
,
//
int
tri_img_width
,
double
min_disparity
,
double
max_disparity
,
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
,
int
debug_level
,
boolean
dbg_plot_center
,
// = true;
double
dbg_line_color
,
// = 1.0;
double
dbg_center_color
// = 3.0;
boolean
correctDistortions
,
// requires backdrop image to be corrected also
double
[]
tri_img
,
//
int
tri_img_width
,
double
min_disparity
,
double
max_disparity
,
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
,
int
debug_level
,
boolean
dbg_plot_center
,
// = true;
double
dbg_line_color
,
// = 1.0;
double
dbg_center_color
// = 3.0;
)
throws
IOException
{
if
(
bounds
==
null
)
{
...
...
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