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

Move and rename source files

parent 22eee817
Branches
Tags
1 merge request!312Support new basler cameras
Pipeline #27166 passed
Showing
with 32 additions and 22 deletions
......@@ -20,6 +20,14 @@ enum class Projection {
EQUIRECTANGULAR = 2
};
typedef unsigned int capability_t;
static const capability_t kCapMovable = 0x0001; // A movable virtual cam
static const capability_t kCapVideo = 0x0002; // Is a video feed
static const capability_t kCapActive = 0x0004; // An active depth sensor
static const capability_t kCapStereo = 0x0008; // Has right RGB
static const capability_t kCapDepth = 0x0010; // Has depth capabilities
/**
* All properties associated with cameras. This structure is designed to
* operate on CPU and GPU.
......
......@@ -7,8 +7,6 @@
#include <ftl/net/universe.hpp>
#include <ftl/uri.hpp>
#include <ftl/rgbd/camera.hpp>
#include <ftl/rgbd/detail/source.hpp>
#include <ftl/codecs/packet.hpp>
#include <opencv2/core/mat.hpp>
#include <Eigen/Eigen>
#include <string>
......@@ -25,6 +23,9 @@ class Universe;
namespace rgbd {
class BaseSourceImpl;
typedef std::function<void(int64_t,ftl::rgbd::Frame&)> FrameCallback;
static inline bool isValidDepth(float d) { return (d > 0.01f) && (d < 39.99f); }
/**
......@@ -58,7 +59,7 @@ class Source : public ftl::Configurable {
/**
* Is this source valid and ready to grab?.
*/
bool isReady() { return (impl_) ? impl_->isReady() : false; }
bool isReady();
/**
* Change the second channel source.
......@@ -105,10 +106,7 @@ class Source : public ftl::Configurable {
/**
* Get the source's camera intrinsics.
*/
const Camera &parameters() const {
if (impl_) return impl_->params_;
else throw FTL_Error("Cannot get parameters for bad source");
}
const Camera &parameters() const;
/**
* Get camera intrinsics for another channel. For example the right camera
......@@ -141,7 +139,7 @@ class Source : public ftl::Configurable {
std::string getURI() { return value("uri", std::string("")); }
ftl::rgbd::FrameState &state() { return impl_->state_; }
ftl::rgbd::FrameState &state();
SHARED_MUTEX &mutex() { return mutex_; }
......
......@@ -11,15 +11,6 @@ namespace ftl{
namespace rgbd {
class Source;
typedef std::function<void(int64_t,ftl::rgbd::Frame&)> FrameCallback;
typedef unsigned int capability_t;
static const capability_t kCapMovable = 0x0001; // A movable virtual cam
static const capability_t kCapVideo = 0x0002; // Is a video feed
static const capability_t kCapActive = 0x0004; // An active depth sensor
static const capability_t kCapStereo = 0x0008; // Has right RGB
static const capability_t kCapDepth = 0x0010; // Has depth capabilities
class BaseSourceImpl {
public:
......
#include <loguru.hpp>
#include <ftl/rgbd/source.hpp>
#include "basesource.hpp"
#include <ftl/threads.hpp>
//#include "sources/net/net.hpp"
......@@ -74,6 +75,15 @@ Source::~Source() {
if (impl_) delete impl_;
}
bool Source::isReady() { return (impl_) ? impl_->isReady() : false; }
const Camera &Source::parameters() const {
if (impl_) return impl_->params_;
else throw FTL_Error("Cannot get parameters for bad source");
}
ftl::rgbd::FrameState &Source::state() { return impl_->state_; }
cv::Mat Source::cameraMatrix() const {
cv::Mat m = (cv::Mat_<float>(3,3) << parameters().fx, 0.0, -parameters().cx, 0.0, parameters().fy, -parameters().cy, 0.0, 0.0, 1.0);
return m;
......
#ifndef _FTL_RGBD_IMAGE_HPP_
#define _FTL_RGBD_IMAGE_HPP_
#include "../../basesource.hpp"
namespace ftl {
namespace rgbd {
namespace detail {
......
......@@ -4,7 +4,7 @@
#include <loguru.hpp>
#include <ftl/rgbd/source.hpp>
#include "../../basesource.hpp"
#include <ftl/cuda_common.hpp>
namespace ftl {
......
......@@ -2,7 +2,7 @@
#ifndef _FTL_RGBD_PYLON_HPP_
#define _FTL_RGBD_PYLON_HPP_
#include <ftl/rgbd/detail/source.hpp>
#include "../../basesource.hpp"
#include <string>
namespace Pylon {
......
......@@ -2,7 +2,7 @@
#ifndef _FTL_RGBD_REALSENSE_HPP_
#define _FTL_RGBD_REALSENSE_HPP_
#include <ftl/rgbd/detail/source.hpp>
#include "../../basesource.hpp"
#include <librealsense2/rs.hpp>
#include <string>
......
#ifndef _FTL_RGBD_SCREENCAPTURE_HPP_
#define _FTL_RGBD_SCREENCAPTURE_HPP_
#include <ftl/rgbd/detail/source.hpp>
#include "../../basesource.hpp"
#include <ftl/config.h>
namespace ftl {
......
......@@ -2,7 +2,7 @@
#ifndef _FTL_RGBD_STEREOVIDEO_HPP_
#define _FTL_RGBD_STEREOVIDEO_HPP_
#include <ftl/rgbd/source.hpp>
#include "../../basesource.hpp"
#include <ftl/operators/operator.hpp>
#include <string>
......
......@@ -3,6 +3,7 @@
//---- Mocks -------------------------------------------------------------------
#include <ftl/rgbd/source.hpp>
#include "../src/basesource.hpp"
#include <ftl/config.h>
#include <nlohmann/json.hpp>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment