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

Reproject uses high res if available

parent a854f96f
No related branches found
No related tags found
1 merge request!196High resolution colour
Pipeline #17090 failed
...@@ -94,7 +94,10 @@ __global__ void reprojection_kernel( ...@@ -94,7 +94,10 @@ __global__ void reprojection_kernel(
const float dotproduct = (max(dot(ray,n),-0.1f)+0.1) / 1.1f; const float dotproduct = (max(dot(ray,n),-0.1f)+0.1) / 1.1f;
const float d2 = depth_src.tex2D(int(screenPos.x+0.5f), int(screenPos.y+0.5f)); const float d2 = depth_src.tex2D(int(screenPos.x+0.5f), int(screenPos.y+0.5f));
const auto input = in.tex2D(screenPos.x, screenPos.y); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos);
const float inSX = float(in.width()) / float(depth_src.width());
const float inSY = float(in.height()) / float(depth_src.height());
const auto input = in.tex2D(screenPos.x*inSX, screenPos.y*inSY); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos);
// TODO: Z checks need to interpolate between neighbors if large triangles are used // TODO: Z checks need to interpolate between neighbors if large triangles are used
//float weight = ftl::cuda::weighting(fabs(camPos.z - d2), params.depthThreshold); //float weight = ftl::cuda::weighting(fabs(camPos.z - d2), params.depthThreshold);
...@@ -213,7 +216,11 @@ __global__ void reprojection_kernel( ...@@ -213,7 +216,11 @@ __global__ void reprojection_kernel(
if (screenPos.x >= depth_src.width() || screenPos.y >= depth_src.height()) return; if (screenPos.x >= depth_src.width() || screenPos.y >= depth_src.height()) return;
const float d2 = depth_src.tex2D((int)(screenPos.x+0.5f), (int)(screenPos.y+0.5f)); const float d2 = depth_src.tex2D((int)(screenPos.x+0.5f), (int)(screenPos.y+0.5f));
const auto input = in.tex2D(screenPos.x, screenPos.y); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos);
const float inSX = float(in.width()) / float(depth_src.width());
const float inSY = float(in.height()) / float(depth_src.height());
const auto input = in.tex2D(screenPos.x*inSX, screenPos.y*inSY); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos);
float weight = ftl::cuda::weighting(fabs(camPos.z - d2), 0.02f); float weight = ftl::cuda::weighting(fabs(camPos.z - d2), 0.02f);
const B weighted = make<B>(input) * weight; const B weighted = make<B>(input) * weight;
......
...@@ -220,13 +220,13 @@ void Triangular::__reprojectChannel(ftl::rgbd::Frame &output, ftl::codecs::Chann ...@@ -220,13 +220,13 @@ void Triangular::__reprojectChannel(ftl::rgbd::Frame &output, ftl::codecs::Chann
auto &f = scene_->frames[i]; auto &f = scene_->frames[i];
auto *s = scene_->sources[i]; auto *s = scene_->sources[i];
if (f.get<GpuMat>(in).type() == CV_8UC3) { /*if (f.get<GpuMat>(in).type() == CV_8UC3) {
// Convert to 4 channel colour // Convert to 4 channel colour
auto &col = f.get<GpuMat>(in); auto &col = f.get<GpuMat>(in);
GpuMat tmp(col.size(), CV_8UC4); GpuMat tmp(col.size(), CV_8UC4);
cv::cuda::swap(col, tmp); cv::cuda::swap(col, tmp);
cv::cuda::cvtColor(tmp,col, cv::COLOR_BGR2BGRA); cv::cuda::cvtColor(tmp,col, cv::COLOR_BGR2BGRA);
} }*/
auto transform = MatrixConversion::toCUDA(s->getPose().cast<float>().inverse() * t.cast<float>().inverse()) * params_.m_viewMatrixInverse; auto transform = MatrixConversion::toCUDA(s->getPose().cast<float>().inverse() * t.cast<float>().inverse()) * params_.m_viewMatrixInverse;
auto transformR = MatrixConversion::toCUDA(s->getPose().cast<float>().inverse()).getFloat3x3(); auto transformR = MatrixConversion::toCUDA(s->getPose().cast<float>().inverse()).getFloat3x3();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment