97 lines
2.6 KiB
C++
97 lines
2.6 KiB
C++
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <openMVG/matching/cascade_hasher.hpp>
|
|
#include <openMVG/matching/regions_matcher.hpp>
|
|
#include <openMVG/matching_image_collection/Matcher.hpp>
|
|
#include <openMVG/matching_image_collection/Matcher_Regions.hpp>
|
|
#include <openMVG/matching_image_collection/Pair_Builder.hpp>
|
|
#include <openMVG/sfm/pipelines/sfm_regions_provider.hpp>
|
|
#include <openMVG/features/feature.hpp>
|
|
#include <openMVG/features/sift/octaver.hpp>
|
|
#include <openMVG/features/sift/SIFT_Anatomy_Image_Describer.hpp>
|
|
#include <openMVG/features/sift/sift_DescriptorExtractor.hpp>
|
|
#include <openMVG/features/sift/sift_KeypointExtractor.hpp>
|
|
#include <openMVG/features/akaze/AKAZE.hpp>
|
|
#include <openMVG/image/image_container.hpp>
|
|
#include <openMVG/image/image_io.hpp>
|
|
#include <openMVG/numeric/numeric.h>
|
|
#include <iostream>
|
|
#include <map>
|
|
#include <utility>
|
|
#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<uint8_t> imageFromFrame(const Frame *);
|
|
|
|
class InMemoryMatcherRegions : public openMVG::matching_image_collection::Matcher {
|
|
void Match(
|
|
const Pair_Set &,
|
|
PariWiseMatchesContainer &,
|
|
) const override;
|
|
};
|
|
|
|
class Frame
|
|
{
|
|
protected:
|
|
const CFrame *cFrame;
|
|
std::stringstream mStream;
|
|
int mW;
|
|
int mH;
|
|
int mDepth;
|
|
std::unique_ptr<openMVG::features::Regions> mRegions;
|
|
|
|
public:
|
|
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<u_char> DartOpenMvg::Frame::getMvgImage();
|
|
void calculateFeatures();
|
|
};
|
|
|
|
typedef std::pair<Frame, Frame> FrameMatchKey;
|
|
typedef std::map<FrameMatchKey, openMVG::matching::IndMatches> FrameFeatureMatch;
|
|
|
|
class Frames : std::vector<Frame>
|
|
{
|
|
|
|
protected:
|
|
FrameFeatureMatch mFeatureMap;
|
|
public:
|
|
void computeMatches();
|
|
};
|
|
}
|
|
#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);
|
|
|
|
#endif // __FRAME_H
|