Skip to content
Snippets Groups Projects

Implements #223 colour based smooth, but is too simplistic

Merged Nicolas Pope requested to merge feature/223/presmooth into master
2 files
+ 12
11
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -27,15 +27,15 @@ __global__ void depth_smooth_kernel(
float contrib = 0.0f;
float new_depth = 0.0f;
for (int u=-RADIUS; u<=RADIUS; ++u) {
for (int v=-RADIUS; v<=RADIUS; ++v) {
for (int v=-RADIUS; v<=RADIUS; ++v) {
for (int u=-RADIUS; u<=RADIUS; ++u) {
// Get colour difference to center
uchar4 cN = colour_in.tex2D((int)x+u, (int)y+v);
float colourWeight = ftl::cuda::colourWeighting(c, cN, thresh);
float dN = depth_in.tex2D((int)x + u, (int)y + v);
float3 posN = camera.screenToCam(x+u, y+v, dN);
const uchar4 cN = colour_in.tex2D((int)x+u, (int)y+v);
const float colourWeight = ftl::cuda::colourWeighting(c, cN, thresh);
const float dN = depth_in.tex2D((int)x + u, (int)y + v);
const float3 posN = camera.screenToCam(x+u, y+v, dN);
const float weight = ftl::cuda::spatialWeighting(posN, pos, factor * colourWeight);
float weight = ftl::cuda::spatialWeighting(posN, pos, factor * colourWeight);
contrib += weight;
new_depth += dN * weight;
}
Loading