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
f9a763aa
Commit
f9a763aa
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Hack faster colour distance
parent
cd9eb9b5
No related branches found
No related tags found
1 merge request
!71
Implements #130 for optional MLS merging
Pipeline
#12349
passed
5 years ago
Stage: all
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/reconstruct/src/depth_camera.cu
+11
-6
11 additions, 6 deletions
applications/reconstruct/src/depth_camera.cu
with
11 additions
and
6 deletions
applications/reconstruct/src/depth_camera.cu
+
11
−
6
View file @
f9a763aa
...
@@ -38,14 +38,19 @@ extern __device__ float spatialWeighting(float r);
...
@@ -38,14 +38,19 @@ extern __device__ float spatialWeighting(float r);
* Real-time foreground-background segmentation using codebook model.
* Real-time foreground-background segmentation using codebook model.
* Real-Time Imaging. https://doi.org/10.1016/j.rti.2004.12.004
* Real-Time Imaging. https://doi.org/10.1016/j.rti.2004.12.004
*/
*/
__device__
float
colordiffFloat
(
const
uchar4
&
pa
,
const
uchar4
&
pb
)
{
__device__
inline
float
colordiffFloat
(
const
uchar4
&
pa
,
const
uchar4
&
pb
)
{
float
x_2
=
pb
.
x
*
pb
.
x
+
pb
.
y
*
pb
.
y
+
pb
.
z
*
pb
.
z
;
const
float
x_2
=
pb
.
x
*
pb
.
x
+
pb
.
y
*
pb
.
y
+
pb
.
z
*
pb
.
z
;
float
v_2
=
pa
.
x
*
pa
.
x
+
pa
.
y
*
pa
.
y
+
pa
.
z
*
pa
.
z
;
const
float
v_2
=
pa
.
x
*
pa
.
x
+
pa
.
y
*
pa
.
y
+
pa
.
z
*
pa
.
z
;
float
xv_2
=
pow
(
pb
.
x
*
pa
.
x
+
pb
.
y
*
pa
.
y
+
pb
.
z
*
pa
.
z
,
2
);
const
float
xv_2
=
pow
(
pb
.
x
*
pa
.
x
+
pb
.
y
*
pa
.
y
+
pb
.
z
*
pa
.
z
,
2
);
float
p_2
=
xv_2
/
v_2
;
const
float
p_2
=
xv_2
/
v_2
;
return
sqrt
(
x_2
-
p_2
);
return
sqrt
(
x_2
-
p_2
);
}
}
__device__
float
colordiffFloat2
(
const
uchar4
&
pa
,
const
uchar4
&
pb
)
{
float3
delta
=
make_float3
((
float
)
pa
.
x
-
(
float
)
pb
.
x
,
(
float
)
pa
.
y
-
(
float
)
pb
.
y
,
(
float
)
pa
.
z
-
(
float
)
pb
.
z
);
return
length
(
delta
);
}
/*
/*
* Colour weighting as suggested in:
* Colour weighting as suggested in:
* C. Kuster et al. Spatio-Temporal Geometry Fusion for Multiple Hybrid Cameras using Moving Least Squares Surfaces. 2014.
* C. Kuster et al. Spatio-Temporal Geometry Fusion for Multiple Hybrid Cameras using Moving Least Squares Surfaces. 2014.
...
@@ -98,7 +103,7 @@ __global__ void mls_smooth_kernel(ftl::cuda::TextureObject<float> output, HashDa
...
@@ -98,7 +103,7 @@ __global__ void mls_smooth_kernel(ftl::cuda::TextureObject<float> output, HashDa
uchar4
c2
=
tex2D
<
uchar4
>
(
camera
.
colour
,
screenPos
.
x
+
u
,
screenPos
.
y
+
v
);
uchar4
c2
=
tex2D
<
uchar4
>
(
camera
.
colour
,
screenPos
.
x
+
u
,
screenPos
.
y
+
v
);
//float4 normal = tex2D<float4>(camera.normal, screenPos.x+u, screenPos.y+v);
//float4 normal = tex2D<float4>(camera.normal, screenPos.x+u, screenPos.y+v);
const
float3
worldPos
=
camera
.
pose
*
camera
.
params
.
kinectDepthToSkeleton
(
screenPos
.
x
+
u
,
screenPos
.
y
+
v
,
depth
);
const
float3
worldPos
=
camera
.
pose
*
camera
.
params
.
kinectDepthToSkeleton
(
screenPos
.
x
+
u
,
screenPos
.
y
+
v
,
depth
);
const
float
weight
=
spatialWeighting
(
length
(
mPos
-
worldPos
))
*
colourWeighting
(
colordiffFloat
(
c1
,
c2
));
const
float
weight
=
spatialWeighting
(
length
(
mPos
-
worldPos
))
*
colourWeighting
(
colordiffFloat
2
(
c1
,
c2
));
wpos
+=
weight
*
worldPos
;
wpos
+=
weight
*
worldPos
;
//wnorm += weight*make_float3(normal);
//wnorm += weight*make_float3(normal);
...
...
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