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
Show more breadcrumbs
Nicolas Pope
ftl
Commits
566507ea
Commit
566507ea
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Alternate MLS merging strategy
parent
411ee5fd
No related branches found
No related tags found
No related merge requests found
Pipeline
#12413
passed
5 years ago
Stage: all
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
applications/reconstruct/src/depth_camera.cu
+40
-2
40 additions, 2 deletions
applications/reconstruct/src/depth_camera.cu
applications/reconstruct/src/integrators.cu
+8
-0
8 additions, 0 deletions
applications/reconstruct/src/integrators.cu
with
48 additions
and
2 deletions
applications/reconstruct/src/depth_camera.cu
+
40
−
2
View file @
566507ea
...
...
@@ -107,6 +107,7 @@ void ftl::cuda::int_to_float(const ftl::cuda::TextureObject<int> &in, ftl::cuda:
// TODO:(Nick) Put this in a common location (used in integrators.cu)
extern
__device__
float
spatialWeighting
(
float
r
);
extern
__device__
float
spatialWeighting
(
float
r
,
float
h
);
/*
* Kim, K., Chalidabhongse, T. H., Harwood, D., & Davis, L. (2005).
...
...
@@ -175,6 +176,39 @@ __device__ float mlsCamera(int cam, const float3 &mPos, uchar4 c1, float3 &wpos)
return
weights
;
}
__device__
float
mlsCameraNoColour
(
int
cam
,
const
float3
&
mPos
,
uchar4
c1
,
float3
&
wpos
,
float
h
)
{
const
ftl
::
voxhash
::
DepthCameraCUDA
&
camera
=
c_cameras
[
cam
];
const
float3
pf
=
camera
.
poseInverse
*
mPos
;
float3
pos
=
make_float3
(
0.0
f
,
0.0
f
,
0.0
f
);
const
uint2
screenPos
=
make_uint2
(
camera
.
params
.
cameraToKinectScreenInt
(
pf
));
float
weights
=
0.0
f
;
//#pragma unroll
for
(
int
v
=-
WINDOW_RADIUS
;
v
<=
WINDOW_RADIUS
;
++
v
)
{
for
(
int
u
=-
WINDOW_RADIUS
;
u
<=
WINDOW_RADIUS
;
++
u
)
{
//if (screenPos.x+u < width && screenPos.y+v < height) { //on creen
float
depth
=
tex2D
<
float
>
(
camera
.
depth
,
screenPos
.
x
+
u
,
screenPos
.
y
+
v
);
const
float3
camPos
=
camera
.
params
.
kinectDepthToSkeleton
(
screenPos
.
x
+
u
,
screenPos
.
y
+
v
,
depth
);
float
weight
=
spatialWeighting
(
length
(
pf
-
camPos
),
h
);
if
(
weight
>
0.0
f
)
{
uchar4
c2
=
tex2D
<
uchar4
>
(
camera
.
colour
,
screenPos
.
x
+
u
,
screenPos
.
y
+
v
);
if
(
colourWeighting
(
colordiffFloat2
(
c1
,
c2
))
>
0.0
f
)
{
wpos
+=
weight
*
(
camera
.
pose
*
camPos
);
weights
+=
weight
;
}
}
//}
}
}
//wpos += (camera.pose * pos);
return
weights
;
}
__device__
float
mlsCameraBest
(
int
cam
,
const
float3
&
mPos
,
uchar4
c1
,
float3
&
wpos
)
{
const
ftl
::
voxhash
::
DepthCameraCUDA
&
camera
=
c_cameras
[
cam
];
...
...
@@ -260,8 +294,12 @@ __global__ void mls_smooth_kernel(ftl::cuda::TextureObject<float4> output, HashP
if
(
hashParams
.
m_flags
&
ftl
::
voxhash
::
kFlagMLS
)
{
for
(
uint
cam2
=
0
;
cam2
<
numcams
;
++
cam2
)
{
if
(
cam2
==
cam
)
continue
;
//weights += mlsCamera(cam2, mPos, c1, wpos);
weights
+=
mlsCameraBest
(
cam2
,
mPos
,
c1
,
wpos
);
if
(
cam2
==
cam
)
weights
+=
mlsCameraNoColour
(
cam2
,
mPos
,
c1
,
wpos
,
c_hashParams
.
m_spatialSmoothing
*
0.1
f
);
//weights += 0.5*mlsCamera(cam2, mPos, c1, wpos);
weights
+=
mlsCameraNoColour
(
cam2
,
mPos
,
c1
,
wpos
,
c_hashParams
.
m_spatialSmoothing
*
5.0
f
);
// Previous approach
//if (cam2 == cam) continue;
//weights += mlsCameraBest(cam2, mPos, c1, wpos);
}
wpos
/=
weights
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
applications/reconstruct/src/integrators.cu
+
8
−
0
View file @
566507ea
...
...
@@ -58,6 +58,14 @@ __device__ float spatialWeighting(float r) {
return
rh
*
rh
*
rh
*
rh
;
}
__device__
float
spatialWeighting
(
float
r
,
float
h
)
{
//const float h = c_hashParams.m_spatialSmoothing;
if
(
r
>=
h
)
return
0.0
f
;
float
rh
=
r
/
h
;
rh
=
1.0
f
-
rh
*
rh
;
return
rh
*
rh
*
rh
*
rh
;
}
__global__
void
integrateDepthMapsKernel
(
HashData
hashData
,
HashParams
hashParams
,
int
numcams
)
{
__shared__
uint
all_warp_ballot
;
...
...
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