Skip to content
Snippets Groups Projects

Add show bad colour option

Merged Nicolas Pope requested to merge feature/missingcolour into master
3 files
+ 58
1
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -441,9 +441,11 @@ __global__ void dibr_normalise_kernel(
const unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
if (x < in.width() && y < in.height()) {
const float contrib = contribs.tex2D((int)x,(int)y);
const A a = in.tex2D((int)x,(int)y);
//const float4 normal = normals.tex2D((int)x,(int)y);
const float contrib = contribs.tex2D((int)x,(int)y);
//out(x,y) = (contrib == 0.0f) ? make<B>(a) : make<B>(a / contrib);
if (contrib > 0.0f) {
out(x,y) = make<B>(a / contrib);
@@ -464,3 +466,39 @@ void ftl::cuda::dibr_normalise(TextureObject<A> &in, TextureObject<B> &out, Text
template void ftl::cuda::dibr_normalise<float4,uchar4>(TextureObject<float4> &in, TextureObject<uchar4> &out, TextureObject<float> &contribs, cudaStream_t stream);
template void ftl::cuda::dibr_normalise<float,float>(TextureObject<float> &in, TextureObject<float> &out, TextureObject<float> &contribs, cudaStream_t stream);
template void ftl::cuda::dibr_normalise<float4,float4>(TextureObject<float4> &in, TextureObject<float4> &out, TextureObject<float> &contribs, cudaStream_t stream);
// ===== Show bad colour normalise =============================================
__global__ void show_missing_colour_kernel(
TextureObject<float> depth,
TextureObject<uchar4> out,
TextureObject<float> contribs,
uchar4 bad_colour,
ftl::rgbd::Camera cam) {
const unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
const unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
if (x < out.width() && y < out.height()) {
const float contrib = contribs.tex2D((int)x,(int)y);
const float d = depth.tex2D(x,y);
if (contrib < 0.0000001f && d > cam.minDepth && d < cam.maxDepth) {
out(x,y) = bad_colour;
}
}
}
void ftl::cuda::show_missing_colour(
TextureObject<float> &depth,
TextureObject<uchar4> &out,
TextureObject<float> &contribs,
uchar4 bad_colour,
const ftl::rgbd::Camera &cam,
cudaStream_t stream) {
const dim3 gridSize((out.width() + T_PER_BLOCK - 1)/T_PER_BLOCK, (out.height() + T_PER_BLOCK - 1)/T_PER_BLOCK);
const dim3 blockSize(T_PER_BLOCK, T_PER_BLOCK);
show_missing_colour_kernel<<<gridSize, blockSize, 0, stream>>>(depth, out, contribs, bad_colour, cam);
cudaSafeCall( cudaGetLastError() );
}
Loading