Skip to content
Snippets Groups Projects

Implements #196 stream capturing

Merged Nicolas Pope requested to merge bug/196/snapshotcapture into master
2 files
+ 49
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -3,11 +3,17 @@
#include <ftl/codecs/reader.hpp>
#include <ftl/codecs/decoder.hpp>
#include <ftl/codecs/packet.hpp>
#include <ftl/rgbd/camera.hpp>
#include <fstream>
#include <Eigen/Eigen>
using ftl::codecs::codec_t;
static ftl::codecs::Decoder *decoder;
static void createDecoder(const ftl::codecs::Packet &pkt) {
if (decoder) {
if (!decoder->accepts(pkt)) {
@@ -41,6 +47,18 @@ int main(int argc, char **argv) {
if (spkt.channel & 0x1 > 0) return;
if (spkt.streamID == current_stream) {
if (pkt.codec == codec_t::POSE) {
Eigen::Matrix4d p = Eigen::Map<Eigen::Matrix4d>((double*)pkt.data.data());
LOG(INFO) << "Have pose: " << p;
return;
}
if (pkt.codec == codec_t::CALIBRATION) {
ftl::rgbd::Camera *camera = (ftl::rgbd::Camera*)pkt.data.data();
LOG(INFO) << "Have calibration: " << camera->fx;
return;
}
LOG(INFO) << "Reading packet: (" << (int)spkt.streamID << "," << (int)spkt.channel << ") " << (int)pkt.codec << ", " << (int)pkt.definition;
cv::Mat frame(cv::Size(ftl::codecs::getWidth(pkt.definition),ftl::codecs::getHeight(pkt.definition)), CV_8UC3);
Loading