Skip to content
Snippets Groups Projects
Commit b01c3738 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Increased colour smoothing

parent 1a480a3d
No related branches found
No related tags found
1 merge request!90Implement #150 splat resizing
Pipeline #12711 passed
...@@ -400,8 +400,9 @@ __device__ inline float warpMin(float e) { ...@@ -400,8 +400,9 @@ __device__ inline float warpMin(float e) {
} }
#define ENERGY_THRESHOLD 0.1f #define ENERGY_THRESHOLD 0.1f
#define SMOOTHING_MULTIPLIER_A 10.0f #define SMOOTHING_MULTIPLIER_A 10.0f // For surface search
#define SMOOTHING_MULTIPLIER_B 5.0f #define SMOOTHING_MULTIPLIER_B 5.0f // For z contribution
#define SMOOTHING_MULTIPLIER_C 5.0f // For colour contribution
/* /*
...@@ -588,7 +589,7 @@ __global__ void dibr_attribute_contrib_kernel( ...@@ -588,7 +589,7 @@ __global__ void dibr_attribute_contrib_kernel(
if (camPos.z > params.camera.m_sensorDepthWorldMax) return; if (camPos.z > params.camera.m_sensorDepthWorldMax) return;
const uint2 screenPos = params.camera.cameraToKinectScreen(camPos); const uint2 screenPos = params.camera.cameraToKinectScreen(camPos);
const int upsample = min(UPSAMPLE_MAX, int((5.0f*r) * params.camera.fx / camPos.z)); const int upsample = 8; //min(UPSAMPLE_MAX, int((5.0f*r) * params.camera.fx / camPos.z));
// Not on screen so stop now... // Not on screen so stop now...
if (screenPos.x < 0 || screenPos.y < 0 || if (screenPos.x < 0 || screenPos.y < 0 ||
...@@ -613,7 +614,7 @@ __global__ void dibr_attribute_contrib_kernel( ...@@ -613,7 +614,7 @@ __global__ void dibr_attribute_contrib_kernel(
const float3 nearest = params.camera.kinectDepthToSkeleton((int)(screenPos.x+u),(int)(screenPos.y+v),d); const float3 nearest = params.camera.kinectDepthToSkeleton((int)(screenPos.x+u),(int)(screenPos.y+v),d);
// What is contribution of our current point at this pixel? // What is contribution of our current point at this pixel?
const float weight = ftl::cuda::spatialWeighting(length(nearest - camPos), SMOOTHING_MULTIPLIER_B*(nearest.z/params.camera.fx)); const float weight = ftl::cuda::spatialWeighting(length(nearest - camPos), SMOOTHING_MULTIPLIER_C*(nearest.z/params.camera.fx));
if (screenPos.x+u < colour_out.width() && screenPos.y+v < colour_out.height() && weight > 0.0f) { // TODO: Use confidence threshold here if (screenPos.x+u < colour_out.width() && screenPos.y+v < colour_out.height() && weight > 0.0f) { // TODO: Use confidence threshold here
const float4 wcolour = colour * weight; const float4 wcolour = colour * weight;
const float4 wnormal = normal * weight; const float4 wnormal = normal * weight;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment