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

Fix missing virtual capabilities

parent b5d24c0c
No related branches found
No related tags found
1 merge request!109Resolves #173 remove voxel code
...@@ -77,11 +77,13 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda ...@@ -77,11 +77,13 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda
params.m_viewMatrixInverse = MatrixConversion::toCUDA(src->getPose().cast<float>()); params.m_viewMatrixInverse = MatrixConversion::toCUDA(src->getPose().cast<float>());
params.camera = camera; params.camera = camera;
LOG(INFO) << "VPOSE = " << src->getPose();
// Clear all channels to 0 or max depth // Clear all channels to 0 or max depth
temp_.get<GpuMat>(Channel::Depth).setTo(cv::Scalar(0x7FFFFFFF), cvstream); temp_.get<GpuMat>(Channel::Depth).setTo(cv::Scalar(0x7FFFFFFF), cvstream);
temp_.get<GpuMat>(Channel::Depth2).setTo(cv::Scalar(0x7FFFFFFF), cvstream); temp_.get<GpuMat>(Channel::Depth2).setTo(cv::Scalar(0x7FFFFFFF), cvstream);
out.get<GpuMat>(Channel::Depth).setTo(cv::Scalar(1000.0f), cvstream); out.get<GpuMat>(Channel::Depth).setTo(cv::Scalar(1000.0f), cvstream);
out.get<GpuMat>(Channel::Colour).setTo(cv::Scalar(0,0,0), cvstream); out.get<GpuMat>(Channel::Colour).setTo(cv::Scalar(76,76,76), cvstream);
LOG(INFO) << "Render ready: " << camera.width << "," << camera.height; LOG(INFO) << "Render ready: " << camera.width << "," << camera.height;
...@@ -99,7 +101,7 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda ...@@ -99,7 +101,7 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda
// Needs to create points channel first? // Needs to create points channel first?
if (!f.hasChannel(Channel::Points)) { if (!f.hasChannel(Channel::Points)) {
LOG(INFO) << "Creating points..."; LOG(INFO) << "Creating points... " << s->parameters().width;
auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size())); auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size()));
auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>().inverse()); auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>().inverse());
...@@ -166,16 +168,16 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda ...@@ -166,16 +168,16 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda
//src->write(scene_.timestamp, output_, stream); //src->write(scene_.timestamp, output_, stream);
} else { } else {
LOG(INFO) << "No second rendering"; LOG(INFO) << "No second rendering";
if (value("splatting", false)) { //if (value("splatting", false)) {
//ftl::cuda::splat_points(depth1_, colour1_, normal1_, depth2_, colour2_, params, stream); //ftl::cuda::splat_points(depth1_, colour1_, normal1_, depth2_, colour2_, params, stream);
//src->writeFrames(ts, colour1_, depth2_, stream); //src->writeFrames(ts, colour1_, depth2_, stream);
//src->write(scene_.timestamp, out, stream); //src->write(scene_.timestamp, out, stream);
} else { //} else {
//ftl::cuda::int_to_float(depth1_, depth2_, 1.0f / 1000.0f, stream); //ftl::cuda::int_to_float(depth1_, depth2_, 1.0f / 1000.0f, stream);
//temp_.get<GpuMat>(Channel::Depth).convertTo(out.get<GpuMat>(Channel::Depth), CV_32F, 1.0f / 1000.0f, cvstream); temp_.get<GpuMat>(Channel::Depth).convertTo(out.get<GpuMat>(Channel::Depth), CV_32F, 1.0f / 1000.0f, cvstream);
//src->writeFrames(ts, colour1_, depth2_, stream); //src->writeFrames(ts, colour1_, depth2_, stream);
//src->write(scene_.timestamp, output_, stream); //src->write(scene_.timestamp, output_, stream);
} //}
} }
//} //}
......
...@@ -74,6 +74,7 @@ Streamer::Streamer(nlohmann::json &config, Universe *net) ...@@ -74,6 +74,7 @@ Streamer::Streamer(nlohmann::json &config, Universe *net)
if (sources_.find(uri) != sources_.end()) { if (sources_.find(uri) != sources_.end()) {
Eigen::Matrix4d pose; Eigen::Matrix4d pose;
memcpy(pose.data(), buf.data(), buf.size()); memcpy(pose.data(), buf.data(), buf.size());
LOG(INFO) << "SET POSE:";
sources_[uri]->src->setPose(pose); sources_[uri]->src->setPose(pose);
} }
}); });
......
...@@ -8,6 +8,7 @@ class VirtualImpl : public ftl::rgbd::detail::Source { ...@@ -8,6 +8,7 @@ class VirtualImpl : public ftl::rgbd::detail::Source {
public: public:
explicit VirtualImpl(ftl::rgbd::Source *host, const ftl::rgbd::Camera &params) : ftl::rgbd::detail::Source(host) { explicit VirtualImpl(ftl::rgbd::Source *host, const ftl::rgbd::Camera &params) : ftl::rgbd::detail::Source(host) {
params_ = params; params_ = params;
capabilities_ = ftl::rgbd::kCapMovable | ftl::rgbd::kCapVideo | ftl::rgbd::kCapStereo;
} }
~VirtualImpl() { ~VirtualImpl() {
...@@ -15,6 +16,7 @@ class VirtualImpl : public ftl::rgbd::detail::Source { ...@@ -15,6 +16,7 @@ class VirtualImpl : public ftl::rgbd::detail::Source {
} }
bool capture(int64_t ts) override { bool capture(int64_t ts) override {
timestamp_ = ts;
return true; return true;
} }
...@@ -38,9 +40,13 @@ class VirtualImpl : public ftl::rgbd::detail::Source { ...@@ -38,9 +40,13 @@ class VirtualImpl : public ftl::rgbd::detail::Source {
frame.download(Channel::Colour + Channel::Depth); frame.download(Channel::Colour + Channel::Depth);
cv::swap(frame.get<cv::Mat>(Channel::Colour), rgb_); cv::swap(frame.get<cv::Mat>(Channel::Colour), rgb_);
cv::swap(frame.get<cv::Mat>(Channel::Depth), depth_); cv::swap(frame.get<cv::Mat>(Channel::Depth), depth_);
LOG(INFO) << "Written: " << rgb_.cols;
} else { } else {
LOG(ERROR) << "Missing colour or depth frame in rendering"; LOG(ERROR) << "Missing colour or depth frame in rendering";
} }
auto cb = host_->callback();
if (cb) cb(timestamp_, rgb_, depth_);
} }
return true; return true;
} }
......
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