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

Fix for 2D snapshot

parent 87d660a3
No related branches found
No related tags found
No related merge requests found
Pipeline #26454 passed
...@@ -437,6 +437,19 @@ void ftl::gui::Camera::_draw(std::vector<ftl::rgbd::FrameSet*> &fss) { ...@@ -437,6 +437,19 @@ void ftl::gui::Camera::_draw(std::vector<ftl::rgbd::FrameSet*> &fss) {
record_sender_->post(fs2); record_sender_->post(fs2);
record_stream_->select(0, Channels<0>(Channel::Colour)); record_stream_->select(0, Channels<0>(Channel::Colour));
f.swapTo(Channels<0>(Channel::Colour), frame_); f.swapTo(Channels<0>(Channel::Colour), frame_);
} else if (do_snapshot_) {
do_snapshot_ = false;
cv::Mat flipped;
cv::Mat im1;
frame_.get<cv::cuda::GpuMat>(Channel::Colour).download(im1);
{
//UNIQUE_LOCK(mutex_, lk);
cv::flip(im1, flipped, 0);
}
cv::cvtColor(flipped, flipped, cv::COLOR_BGRA2BGR);
cv::imwrite(snapshot_filename_, flipped);
} }
} }
...@@ -775,14 +788,16 @@ const void ftl::gui::Camera::captureFrame() { ...@@ -775,14 +788,16 @@ const void ftl::gui::Camera::captureFrame() {
} }
void ftl::gui::Camera::snapshot(const std::string &filename) { void ftl::gui::Camera::snapshot(const std::string &filename) {
cv::Mat flipped; /*cv::Mat flipped;
{ {
UNIQUE_LOCK(mutex_, lk); UNIQUE_LOCK(mutex_, lk);
//cv::flip(im1_, flipped, 0); //cv::flip(im1_, flipped, 0);
} }
cv::cvtColor(flipped, flipped, cv::COLOR_BGRA2BGR); cv::cvtColor(flipped, flipped, cv::COLOR_BGRA2BGR);
cv::imwrite(filename, flipped); cv::imwrite(filename, flipped);*/
snapshot_filename_ = filename;
do_snapshot_ = true;
} }
void ftl::gui::Camera::startVideoRecording(const std::string &filename) { void ftl::gui::Camera::startVideoRecording(const std::string &filename) {
......
...@@ -147,6 +147,8 @@ class Camera { ...@@ -147,6 +147,8 @@ class Camera {
float lerpSpeed_; float lerpSpeed_;
bool sdepth_; bool sdepth_;
bool pause_; bool pause_;
bool do_snapshot_ = false;
std::string snapshot_filename_;
ftl::codecs::Channel channel_; ftl::codecs::Channel channel_;
ftl::codecs::Channels<0> channels_; ftl::codecs::Channels<0> channels_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment