#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "./base.hpp" #ifndef __FRAME_H #define __FRAME_H typedef struct _Frame { FILE *stream; int w; int h; int depth; } Frame; FILE *make_buffer(const uint8_t *, const size_t); int read_buffer(FILE *, uint8_t **, size_t *); #ifdef __cplusplus typedef Frame CFrame; namespace DartOpenMvg { openMVG::image::Image imageFromFrame(const Frame *); class Frame { protected: std::stringstream mStream; int mW; int mH; int mDepth; public: // TODO make this private const CFrame *cFrame; // TODO make this private std::unique_ptr mRegions; Frame(const _Frame *f) : mW(f->w), mH(f->h), mDepth(f->depth) { cFrame = f; uint8_t *buffer_data = NULL; size_t len = 0; read_buffer(f->stream, &buffer_data, &len); mStream = std::stringstream(std::string((char *)buffer_data)); } openMVG::image::Image getMvgImage(); void calculateFeatures(); }; typedef std::pair FrameMatchKey; typedef std::map, openMVG::matching::IndMatches> FrameFeatureMatch; class Frames : protected std::vector { protected: openMVG::matching::PairWiseMatches mFeatureMap; openMVG::tracks::STLMAPTracks mTracks; openMVG::sfm::SfM_Data mSfmData; openMVG::sfm::Bundle_Adjustment_Ceres mAdjustment; public: Frames(openMVG::sfm::Bundle_Adjustment_Ceres::BA_Ceres_options &); void computeMatches(); void buildTracks(); void adjust (); void resection (); void resectionAll (); }; } #endif _FFI_PLUGIN Frame *new_frame_from_handle(FILE *, int, int, int); _FFI_PLUGIN Frame *new_frame_from_data(const uint8_t *, const size_t, int, int, int); void frame_cleanup(Frame *); #endif // __FRAME_H