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

Support channel blending

parent 208d97d0
No related branches found
No related tags found
1 merge request!162Support channel blending
Pipeline #16293 passed
This commit is part of merge request !162. Comments created here will be created in the context of that merge request.
......@@ -48,11 +48,13 @@ namespace {
constexpr char const *const defaultImageViewFragmentShader =
R"(#version 330
uniform sampler2D image;
uniform sampler2D image1;
uniform sampler2D image2;
uniform float blendAmount;
out vec4 color;
in vec2 uv;
void main() {
color = texture(image, uv);
color = blendAmount * texture(image1, uv) + (1.0 - blendAmount) * texture(image2, uv);
})";
}
......@@ -457,8 +459,12 @@ void ftl::gui::Screen::draw(NVGcontext *ctx) {
size().x() * r, size().y() * r);*/
mShader.bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mImageID);
mShader.setUniform("image", 0);
glBindTexture(GL_TEXTURE_2D, leftEye_);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, (camera_->getRight().isValid()) ? rightEye_ : leftEye_);
mShader.setUniform("image1", 0);
mShader.setUniform("image2", 1);
mShader.setUniform("blendAmount", (camera_->getChannel() != ftl::codecs::Channel::Left) ? root_->value("blending", 0.5f) : 1.0f);
mShader.setUniform("scaleFactor", scaleFactor);
mShader.setUniform("position", imagePosition);
mShader.drawIndexed(GL_TRIANGLES, 0, 2);
......
......@@ -8,9 +8,6 @@ set(OPERSRC
src/normals.cpp
src/filling.cpp
src/filling.cu
src/nvopticalflow.cpp
src/disparity/optflow_smoothing.cu
src/disparity/optflow_smoothing.cpp
src/disparity/disp2depth.cu
src/disparity/disparity_to_depth.cpp
src/disparity/fixstars_sgm.cpp
......@@ -20,7 +17,9 @@ set(OPERSRC
)
if (HAVE_OPTFLOW)
list(APPEND OPERSRC src/nvopticalflow.cpp)
list(APPEND OPERSRC src/nvopticalflow.cpp
src/disparity/optflow_smoothing.cu
src/disparity/optflow_smoothing.cpp)
endif()
add_library(ftloperators ${OPERSRC})
......
#pragma once
#include <ftl/config.h>
#include <ftl/operators/operator.hpp>
#ifdef HAVE_OPTFLOW
#include <opencv2/cudaoptflow.hpp>
#endif
#include <libsgm.h>
......@@ -73,6 +77,7 @@ class DisparityToDepth : public ftl::operators::Operator {
/*
* Optical flow smoothing for depth
*/
#ifdef HAVE_OPTFLOW
class OpticalFlowTemporalSmoothing : public ftl::operators::Operator {
public:
explicit OpticalFlowTemporalSmoothing(ftl::Configurable*);
......@@ -91,6 +96,7 @@ class OpticalFlowTemporalSmoothing : public ftl::operators::Operator {
int n_max_;
float threshold_;
};
#endif
}
}
......@@ -126,7 +126,10 @@ void StereoVideoSource::init(const string &file) {
pipeline_depth_ = ftl::config::create<ftl::operators::Graph>(host_, "disparity");
pipeline_depth_->append<ftl::operators::FixstarsSGM>("algorithm");
#ifdef HAVE_OPTFLOW
pipeline_depth_->append<ftl::operators::OpticalFlowTemporalSmoothing>("optflow_filter");
#endif
pipeline_depth_->append<ftl::operators::DisparityBilateralFilter>("bilateral_filter");
pipeline_depth_->append<ftl::operators::DisparityToDepth>("calculate_depth");
......
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