Skip to content
Snippets Groups Projects
local.hpp 1.43 KiB
Newer Older
#ifndef _FTL_LOCAL_HPP_
#define _FTL_LOCAL_HPP_

Nicolas Pope's avatar
Nicolas Pope committed
#include <ftl/configurable.hpp>
#include <ftl/cuda_common.hpp>
#include <nlohmann/json.hpp>

namespace cv {
	class Mat;
	class VideoCapture;
};

namespace ftl {
namespace rgbd {
namespace detail {

Nicolas Pope's avatar
Nicolas Pope committed
class Calibrate;

Nicolas Pope's avatar
Nicolas Pope committed
class LocalSource : public Configurable {
	explicit LocalSource(nlohmann::json &config);
Nicolas Pope's avatar
Nicolas Pope committed
	LocalSource(nlohmann::json &config, const std::string &vid);
Nicolas Pope's avatar
Nicolas Pope committed
	//bool left(cv::Mat &m);
	//bool right(cv::Mat &m);
	bool grab();
	bool get(cv::cuda::GpuMat &l, cv::cuda::GpuMat &r, cv::cuda::GpuMat &h, Calibrate *c, cv::cuda::Stream &stream);
Nicolas Pope's avatar
Nicolas Pope committed

	unsigned int width() const { return dwidth_; }
	unsigned int height() const { return dheight_; }

	unsigned int fullWidth() const { return width_; }
	unsigned int fullHeight() const { return height_; }

	inline bool hasHigherRes() const { return dwidth_ != width_; }
	
	//void setFramerate(float fps);
	//float getFramerate() const;
	
	double getTimestamp() const;
	
	bool isStereo() const;
	
	private:
	double timestamp_;
Nicolas Pope's avatar
Nicolas Pope committed
	//double tps_;
Nicolas Pope's avatar
Nicolas Pope committed
	//bool flip_;
	//bool flip_v_;
Nicolas Pope's avatar
Nicolas Pope committed
	bool nostereo_;
Nicolas Pope's avatar
Nicolas Pope committed
	//float downsize_;
	cv::VideoCapture *camera_a_;
	cv::VideoCapture *camera_b_;
Nicolas Pope's avatar
Nicolas Pope committed
	unsigned int width_;
	unsigned int height_;
	unsigned int dwidth_;
	unsigned int dheight_;
Nicolas Pope's avatar
Nicolas Pope committed

	cv::cuda::HostMem left_hm_;
	cv::cuda::HostMem right_hm_;
	cv::cuda::HostMem hres_hm_;
	cv::Mat rtmp_;