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

Add options to config

parent 758099da
No related branches found
No related tags found
1 merge request!153Implements #223 colour based smooth, but is too simplistic
Pipeline #16053 passed
This commit is part of merge request !153. Comments created here will be created in the context of that merge request.
...@@ -27,15 +27,15 @@ __global__ void depth_smooth_kernel( ...@@ -27,15 +27,15 @@ __global__ void depth_smooth_kernel(
float contrib = 0.0f; float contrib = 0.0f;
float new_depth = 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 // Get colour difference to center
uchar4 cN = colour_in.tex2D((int)x+u, (int)y+v); const uchar4 cN = colour_in.tex2D((int)x+u, (int)y+v);
float colourWeight = ftl::cuda::colourWeighting(c, cN, thresh); const float colourWeight = ftl::cuda::colourWeighting(c, cN, thresh);
float dN = depth_in.tex2D((int)x + u, (int)y + v); const float dN = depth_in.tex2D((int)x + u, (int)y + v);
float3 posN = camera.screenToCam(x+u, y+v, dN); 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; contrib += weight;
new_depth += dN * weight; new_depth += dN * weight;
} }
......
...@@ -272,10 +272,11 @@ static void run(ftl::Configurable *root) { ...@@ -272,10 +272,11 @@ static void run(ftl::Configurable *root) {
UNIQUE_LOCK(scene_A.mtx, lk); UNIQUE_LOCK(scene_A.mtx, lk);
cv::cuda::GpuMat tmp; cv::cuda::GpuMat tmp;
float factor = filter->value("smooth_factor", 0.04f); float factor = filter->value("smooth_factor", 0.4f);
float colour_limit = filter->value("colour_limit", 50.0f); float colour_limit = filter->value("colour_limit", 30.0f);
bool do_smooth = filter->value("pre_smooth", false); bool do_smooth = filter->value("pre_smooth", false);
int iters = filter->value("iterations", 1); int iters = filter->value("iterations", 3);
int radius = filter->value("radius", 5);
if (do_smooth) { if (do_smooth) {
// Presmooth... // Presmooth...
...@@ -298,7 +299,7 @@ static void run(ftl::Configurable *root) { ...@@ -298,7 +299,7 @@ static void run(ftl::Configurable *root) {
f.createTexture<uchar4>(Channel::Colour), f.createTexture<uchar4>(Channel::Colour),
f.createTexture<float>(Channel::Depth2, ftl::rgbd::Format<float>(f.get<cv::cuda::GpuMat>(Channel::Depth).size())), f.createTexture<float>(Channel::Depth2, ftl::rgbd::Format<float>(f.get<cv::cuda::GpuMat>(Channel::Depth).size())),
s->parameters(), s->parameters(),
1, factor, colour_limit, iters, 0 radius, factor, colour_limit, iters, 0
); );
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment