Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Maintenance on Tuesday 15.4. at 14:00. ETA 60 - 90 minutes.
Show more breadcrumbs
Nicolas Pope
ftl
Commits
15bc458b
Commit
15bc458b
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Resolve neighbour buffer loop
parent
4e5f708b
No related branches found
No related tags found
1 merge request
!88
Implements #146 upsampling option
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/reconstruct/src/dibr.cu
+19
-3
19 additions, 3 deletions
applications/reconstruct/src/dibr.cu
with
19 additions
and
3 deletions
applications/reconstruct/src/dibr.cu
+
19
−
3
View file @
15bc458b
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#define WARP_SIZE 32
#define WARP_SIZE 32
#define DEPTH_THRESHOLD 0.05f
#define DEPTH_THRESHOLD 0.05f
#define UPSAMPLE_MAX 60
#define UPSAMPLE_MAX 60
#define MAX_ITERATIONS
64
// Note: Must be multiple of 32
#define MAX_ITERATIONS
32
// Note: Must be multiple of 32
#define SPATIAL_SMOOTHING 0.005f
#define SPATIAL_SMOOTHING 0.005f
using
ftl
::
cuda
::
TextureObject
;
using
ftl
::
cuda
::
TextureObject
;
...
@@ -457,7 +457,9 @@ __device__ inline float warpMin(float e) {
...
@@ -457,7 +457,9 @@ __device__ inline float warpMin(float e) {
// If it is close enough...
// If it is close enough...
if
(
point
.
z
>
params
.
camera
.
m_sensorDepthWorldMin
&&
point
.
z
<
params
.
camera
.
m_sensorDepthWorldMax
&&
length
(
point
-
minPos
)
<=
0.02
f
)
{
if
(
point
.
z
>
params
.
camera
.
m_sensorDepthWorldMin
&&
point
.
z
<
params
.
camera
.
m_sensorDepthWorldMax
&&
length
(
point
-
minPos
)
<=
0.02
f
)
{
// Append to neighbour list
// Append to neighbour list
unsigned
int
idx
=
atomicInc
(
&
nidx
[
warp
],
MAX_NEIGHBORS_2
-
1
);
//unsigned int idx = atomicInc(&nidx[warp], MAX_NEIGHBORS_2-1);
unsigned
int
idx
=
atomicAdd
(
&
nidx
[
warp
],
1
);
if
(
idx
>=
MAX_NEIGHBORS_2
)
break
;
neighborhood_cache
[
warp
][
idx
]
=
point
;
neighborhood_cache
[
warp
][
idx
]
=
point
;
atomicMax
(
&
maximum
[
warp
],
point
.
z
*
1000.0
f
);
atomicMax
(
&
maximum
[
warp
],
point
.
z
*
1000.0
f
);
}
}
...
@@ -475,6 +477,20 @@ __device__ inline float warpMin(float e) {
...
@@ -475,6 +477,20 @@ __device__ inline float warpMin(float e) {
if
(
maxDepth
<=
params
.
camera
.
m_sensorDepthWorldMin
)
return
;
if
(
maxDepth
<=
params
.
camera
.
m_sensorDepthWorldMin
)
return
;
//if (y == 200) printf("interval: %f\n", maxDepth);
//if (y == 200) printf("interval: %f\n", maxDepth);
// If all samples say same depth, then agree and return
// TODO: Check this is valid, since small energies should be removed...
/*if (fabs(minDepth - maxDepth) < 0.0001f) {
if (lane == 0) {
const unsigned int cx = x;
const unsigned int cy = y;
if (minDepth < params.camera.m_sensorDepthWorldMax && cx < depth.width() && cy < depth.height()) {
// Transform estimated point to virtual cam space and output z
atomicMin(&depth(cx,cy), minDepth * 1000.0f);
}
}
return;
}*/
float
maxenergy
=
-
1.0
f
;
float
maxenergy
=
-
1.0
f
;
float
bestdepth
=
0.0
f
;
float
bestdepth
=
0.0
f
;
...
@@ -482,7 +498,7 @@ __device__ inline float warpMin(float e) {
...
@@ -482,7 +498,7 @@ __device__ inline float warpMin(float e) {
// Search for best or threshold energy
// Search for best or threshold energy
for
(
int
k
=
lane
;
k
<
MAX_ITERATIONS
;
k
+=
WARP_SIZE
)
{
for
(
int
k
=
lane
;
k
<
MAX_ITERATIONS
;
k
+=
WARP_SIZE
)
{
const
float3
nearest
=
params
.
camera
.
kinectDepthToSkeleton
(
x
,
y
,
minDepth
+
float
(
k
)
*
interval
);
const
float3
nearest
=
params
.
camera
.
kinectDepthToSkeleton
(
x
,
y
,
minDepth
+
float
(
k
)
*
interval
);
const
float
myenergy
=
ftl
::
cuda
::
mls_point_energy
<
MAX_NEIGHBORS_2
>
(
neighborhood_cache
[
warp
],
nearest
,
nidx
[
warp
],
SPATIAL_SMOOTHING
);
const
float
myenergy
=
ftl
::
cuda
::
mls_point_energy
<
MAX_NEIGHBORS_2
>
(
neighborhood_cache
[
warp
],
nearest
,
min
(
nidx
[
warp
],
MAX_NEIGHBORS_2
),
SPATIAL_SMOOTHING
);
const
float
newenergy
=
warpMax
(
max
(
myenergy
,
maxenergy
));
const
float
newenergy
=
warpMax
(
max
(
myenergy
,
maxenergy
));
bestdepth
=
(
myenergy
==
newenergy
)
?
nearest
.
z
:
(
newenergy
>
maxenergy
)
?
0.0
f
:
bestdepth
;
bestdepth
=
(
myenergy
==
newenergy
)
?
nearest
.
z
:
(
newenergy
>
maxenergy
)
?
0.0
f
:
bestdepth
;
maxenergy
=
newenergy
;
maxenergy
=
newenergy
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment