Compare commits
2 Commits
5d05c42411
...
9f641ffbf7
Author | SHA1 | Date | |
---|---|---|---|
|
9f641ffbf7 | ||
|
cc317d0d24 |
@ -3,11 +3,12 @@ name: LibDartOpenMVG
|
|||||||
description: |
|
description: |
|
||||||
Dart bindings for the OpenMVG library.
|
Dart bindings for the OpenMVG library.
|
||||||
output: 'lib/libdart_openmvg_generated.dart'
|
output: 'lib/libdart_openmvg_generated.dart'
|
||||||
compiler-opts: '-I/usr/include -L /usr/lib/ -lpng'
|
|
||||||
headers:
|
headers:
|
||||||
entry-points:
|
entry-points:
|
||||||
|
- 'src/frame.h'
|
||||||
- 'src/image.h'
|
- 'src/image.h'
|
||||||
include-directives:
|
include-directives:
|
||||||
|
- 'src/frame.h'
|
||||||
- 'src/image.h'
|
- 'src/image.h'
|
||||||
preamble: |
|
preamble: |
|
||||||
// ignore_for_file: always_specify_types
|
// ignore_for_file: always_specify_types
|
||||||
|
@ -25,50 +25,22 @@ class LibDartOpenMVG {
|
|||||||
lookup)
|
lookup)
|
||||||
: _lookup = lookup;
|
: _lookup = lookup;
|
||||||
|
|
||||||
ffi.Pointer<ImageResult> image_result_new(
|
ffi.Pointer<FILE> make_buffer(
|
||||||
ffi.Pointer<u_char> arg0,
|
ffi.Pointer<ffi.Uint8> arg0,
|
||||||
int data_len,
|
int arg1,
|
||||||
) {
|
) {
|
||||||
return _image_result_new(
|
return _make_buffer(
|
||||||
arg0,
|
arg0,
|
||||||
data_len,
|
arg1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
late final _image_result_newPtr = _lookup<
|
late final _make_bufferPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Pointer<ImageResult> Function(
|
ffi.Pointer<FILE> Function(
|
||||||
ffi.Pointer<u_char>, ffi.Size)>>('image_result_new');
|
ffi.Pointer<ffi.Uint8>, ffi.Size)>>('make_buffer');
|
||||||
late final _image_result_new = _image_result_newPtr.asFunction<
|
late final _make_buffer = _make_bufferPtr
|
||||||
ffi.Pointer<ImageResult> Function(ffi.Pointer<u_char>, int)>();
|
.asFunction<ffi.Pointer<FILE> Function(ffi.Pointer<ffi.Uint8>, int)>();
|
||||||
|
|
||||||
ffi.Pointer<ImageResult> image_result_new_error(
|
|
||||||
int error_t,
|
|
||||||
) {
|
|
||||||
return _image_result_new_error(
|
|
||||||
error_t,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
late final _image_result_new_errorPtr =
|
|
||||||
_lookup<ffi.NativeFunction<ffi.Pointer<ImageResult> Function(ffi.Int)>>(
|
|
||||||
'image_result_new_error');
|
|
||||||
late final _image_result_new_error = _image_result_new_errorPtr
|
|
||||||
.asFunction<ffi.Pointer<ImageResult> Function(int)>();
|
|
||||||
|
|
||||||
int image_result_free(
|
|
||||||
ffi.Pointer<ImageResult> arg0,
|
|
||||||
) {
|
|
||||||
return _image_result_free(
|
|
||||||
arg0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
late final _image_result_freePtr =
|
|
||||||
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ImageResult>)>>(
|
|
||||||
'image_result_free');
|
|
||||||
late final _image_result_free = _image_result_freePtr
|
|
||||||
.asFunction<int Function(ffi.Pointer<ImageResult>)>();
|
|
||||||
|
|
||||||
ffi.Pointer<Frame> new_frame_from_handle(
|
ffi.Pointer<Frame> new_frame_from_handle(
|
||||||
ffi.Pointer<FILE> arg0,
|
ffi.Pointer<FILE> arg0,
|
||||||
@ -115,6 +87,51 @@ class LibDartOpenMVG {
|
|||||||
ffi.Pointer<Frame> Function(
|
ffi.Pointer<Frame> Function(
|
||||||
ffi.Pointer<ffi.Uint8>, int, int, int, int)>();
|
ffi.Pointer<ffi.Uint8>, int, int, int, int)>();
|
||||||
|
|
||||||
|
ffi.Pointer<ImageResult> image_result_new(
|
||||||
|
ffi.Pointer<u_char> arg0,
|
||||||
|
int data_len,
|
||||||
|
) {
|
||||||
|
return _image_result_new(
|
||||||
|
arg0,
|
||||||
|
data_len,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _image_result_newPtr = _lookup<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Pointer<ImageResult> Function(
|
||||||
|
ffi.Pointer<u_char>, ffi.Size)>>('image_result_new');
|
||||||
|
late final _image_result_new = _image_result_newPtr.asFunction<
|
||||||
|
ffi.Pointer<ImageResult> Function(ffi.Pointer<u_char>, int)>();
|
||||||
|
|
||||||
|
ffi.Pointer<ImageResult> image_result_new_error(
|
||||||
|
int arg0,
|
||||||
|
) {
|
||||||
|
return _image_result_new_error(
|
||||||
|
arg0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _image_result_new_errorPtr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Pointer<ImageResult> Function(ffi.Int)>>(
|
||||||
|
'image_result_new_error');
|
||||||
|
late final _image_result_new_error = _image_result_new_errorPtr
|
||||||
|
.asFunction<ffi.Pointer<ImageResult> Function(int)>();
|
||||||
|
|
||||||
|
int image_result_free(
|
||||||
|
ffi.Pointer<ImageResult> arg0,
|
||||||
|
) {
|
||||||
|
return _image_result_free(
|
||||||
|
arg0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _image_result_freePtr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ImageResult>)>>(
|
||||||
|
'image_result_free');
|
||||||
|
late final _image_result_free = _image_result_freePtr
|
||||||
|
.asFunction<int Function(ffi.Pointer<ImageResult>)>();
|
||||||
|
|
||||||
ffi.Pointer<ImageResult> archimedes_get_image_data(
|
ffi.Pointer<ImageResult> archimedes_get_image_data(
|
||||||
ffi.Pointer<Frame> arg0,
|
ffi.Pointer<Frame> arg0,
|
||||||
) {
|
) {
|
||||||
@ -244,6 +261,8 @@ final class _IO_codecvt extends ffi.Opaque {}
|
|||||||
|
|
||||||
final class _IO_wide_data extends ffi.Opaque {}
|
final class _IO_wide_data extends ffi.Opaque {}
|
||||||
|
|
||||||
|
typedef Frame = _Frame;
|
||||||
|
|
||||||
final class _ImageResult extends ffi.Struct {
|
final class _ImageResult extends ffi.Struct {
|
||||||
external ffi.Pointer<u_char> data;
|
external ffi.Pointer<u_char> data;
|
||||||
|
|
||||||
@ -257,4 +276,3 @@ final class _ImageResult extends ffi.Struct {
|
|||||||
typedef u_char = __u_char;
|
typedef u_char = __u_char;
|
||||||
typedef __u_char = ffi.UnsignedChar;
|
typedef __u_char = ffi.UnsignedChar;
|
||||||
typedef ImageResult = _ImageResult;
|
typedef ImageResult = _ImageResult;
|
||||||
typedef Frame = _Frame;
|
|
||||||
|
@ -10,5 +10,5 @@ DIR=$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)
|
|||||||
|
|
||||||
SRC_DIR=$(realpath ${DIR}/../src)
|
SRC_DIR=$(realpath ${DIR}/../src)
|
||||||
|
|
||||||
find ${SRC_DIR} -name "*.c*" -o -name "*.h" -o -name "CMakeLists.txt" | \
|
find ${SRC_DIR} -name "*.c*" -o -name "*.h*" -o -name "CMakeLists.txt" | \
|
||||||
entr -r ${DIR}/compilelib.sh
|
entr -r ${DIR}/compilelib.sh
|
@ -59,6 +59,8 @@ set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE) # we only want lib
|
|||||||
add_definitions(${PNG_DEFINITIONS})
|
add_definitions(${PNG_DEFINITIONS})
|
||||||
|
|
||||||
add_library(${LIBDART_OPENMVG} SHARED
|
add_library(${LIBDART_OPENMVG} SHARED
|
||||||
|
"frame.cxx"
|
||||||
|
"streamingview.cxx"
|
||||||
"image.cxx"
|
"image.cxx"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -68,11 +70,9 @@ target_include_directories(
|
|||||||
${FFMPEG_INCLUDE_DIRS}
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
${PNG_INCLUDE_DIRS}
|
${PNG_INCLUDE_DIRS}
|
||||||
${ARCHIMEDES_INCLUDE_DIRS}
|
${ARCHIMEDES_INCLUDE_DIRS}
|
||||||
${OPENMVG_INCLUDE_DIRS}/src
|
${OpenMVG_DIR}/../../../include/openMVG_dependencies/cereal/include/cereal/
|
||||||
)
|
)
|
||||||
|
|
||||||
# message("LIBRARIES:" ${OpenMVG_LIBRARIES})
|
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${LIBDART_OPENMVG}
|
${LIBDART_OPENMVG}
|
||||||
cwalk
|
cwalk
|
||||||
@ -93,7 +93,6 @@ set_target_properties(${LIBDART_OPENMVG}
|
|||||||
OUTPUT_NAME ${LIBDART_OPENMVG}
|
OUTPUT_NAME ${LIBDART_OPENMVG}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_options(${LIBDART_OPENMVG} PRIVATE "-Wl,-Bstatic")
|
|
||||||
target_link_options(${LIBDART_OPENMVG} PRIVATE "-Wl,-Bdynamic")
|
target_link_options(${LIBDART_OPENMVG} PRIVATE "-Wl,-Bdynamic")
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
|
15
src/base.hpp
Normal file
15
src/base.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTC extern "C"
|
||||||
|
#define START_EXTC_GRP extern "C" {
|
||||||
|
#define END_EXTC_GRP }
|
||||||
|
#else
|
||||||
|
#define EXTC
|
||||||
|
#define START_EXTC_GRP
|
||||||
|
#define END_EXTC_GRP
|
||||||
|
#endif // _CPLUSPLUS
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define _FFI_PLUGIN extern "C" __attribute__((visibility("default"))) __attribute__((used))
|
||||||
|
#else
|
||||||
|
# define _FFI_PLUGIN __attribute__((visibility("default"))) __attribute__((used))
|
||||||
|
#endif // __cplusplus
|
39
src/frame.cxx
Normal file
39
src/frame.cxx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "frame.h"
|
||||||
|
|
||||||
|
|
||||||
|
FILE *make_buffer(const uint8_t *data, const size_t data_len)
|
||||||
|
{
|
||||||
|
FILE *file = fmemopen((void *)data, data_len, "r+");
|
||||||
|
|
||||||
|
if (file == NULL)
|
||||||
|
{
|
||||||
|
perror("Error opening file");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seek to the beginning of the file
|
||||||
|
rewind(file);
|
||||||
|
|
||||||
|
// Write the data to the file
|
||||||
|
fwrite(data, sizeof(uint8_t), data_len, file);
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Frame *new_frame_from_data(const uint8_t *data, const size_t data_len, int w, int h, int depth)
|
||||||
|
{
|
||||||
|
FILE *buf = make_buffer(data, data_len);
|
||||||
|
return new_frame_from_handle(buf, w, h, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Frame *new_frame_from_handle(FILE *stream, int w, int h, int depth)
|
||||||
|
{
|
||||||
|
Frame *f = (Frame *)malloc(sizeof(Frame));
|
||||||
|
f->stream = stream;
|
||||||
|
f->w = w;
|
||||||
|
f->h = h;
|
||||||
|
f->depth = depth;
|
||||||
|
return f;
|
||||||
|
}
|
20
src/frame.h
Normal file
20
src/frame.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "./base.hpp"
|
||||||
|
|
||||||
|
typedef struct _Frame
|
||||||
|
{
|
||||||
|
FILE *stream;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
int depth;
|
||||||
|
} Frame;
|
||||||
|
|
||||||
|
FILE *make_buffer(const uint8_t *, const size_t);
|
||||||
|
|
||||||
|
_FFI_PLUGIN
|
||||||
|
const Frame *new_frame_from_handle(FILE *, int, int, int);
|
||||||
|
|
||||||
|
_FFI_PLUGIN
|
||||||
|
const Frame *new_frame_from_data(const uint8_t *, const size_t, int, int, int);
|
@ -1,14 +1,19 @@
|
|||||||
#include "./image.h"
|
#include "./image.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#include <cereal/archives/binary.hpp>
|
||||||
#include <openMVG/image/image_io.hpp>
|
#include <openMVG/image/image_io.hpp>
|
||||||
#include <openMVG/image/image_concat.hpp>
|
#include <openMVG/image/image_concat.hpp>
|
||||||
|
#include <openMVG/sfm/sfm_view.hpp>
|
||||||
|
#include <openMVG/sfm/sfm_view_io.hpp>
|
||||||
|
#include <Eigen/src/Core/util/Constants.h>
|
||||||
#endif // __ cplusplus
|
#endif // __ cplusplus
|
||||||
|
|
||||||
_FFI_PLUGIN
|
_FFI_PLUGIN
|
||||||
ImageResult *image_result_new(const u_char *data, const size_t data_len) {
|
ImageResult *image_result_new(const u_char *data, const size_t data_len)
|
||||||
ImageResult *r = (ImageResult *) malloc(sizeof(ImageResult));
|
{
|
||||||
r->data = (u_char *) calloc(sizeof(u_char), data_len);
|
ImageResult *r = (ImageResult *)malloc(sizeof(ImageResult));
|
||||||
|
r->data = (u_char *)calloc(sizeof(u_char), data_len);
|
||||||
memcpy(r->data, data, data_len * sizeof(u_char));
|
memcpy(r->data, data, data_len * sizeof(u_char));
|
||||||
r->data_len = data_len;
|
r->data_len = data_len;
|
||||||
r->error = 0;
|
r->error = 0;
|
||||||
@ -16,8 +21,9 @@ ImageResult *image_result_new(const u_char *data, const size_t data_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_FFI_PLUGIN
|
_FFI_PLUGIN
|
||||||
ImageResult *image_result_new_error(const error_t err) {
|
ImageResult *image_result_new_error(const error_t err)
|
||||||
ImageResult *r = (ImageResult *) malloc(sizeof(ImageResult));
|
{
|
||||||
|
ImageResult *r = (ImageResult *)malloc(sizeof(ImageResult));
|
||||||
r->data = NULL;
|
r->data = NULL;
|
||||||
r->data_len = 0;
|
r->data_len = 0;
|
||||||
r->error = err;
|
r->error = err;
|
||||||
@ -25,62 +31,37 @@ ImageResult *image_result_new_error(const error_t err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_FFI_PLUGIN
|
_FFI_PLUGIN
|
||||||
void free_image_result(ImageResult *image_result) {
|
void free_image_result(ImageResult *image_result)
|
||||||
|
{
|
||||||
free(image_result->data);
|
free(image_result->data);
|
||||||
free(image_result);
|
free(image_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Frame *new_frame_from_handle(FILE *stream, int w, int h, int depth)
|
|
||||||
{
|
|
||||||
Frame *f = (Frame *)malloc(sizeof(Frame));
|
|
||||||
f->stream = stream;
|
|
||||||
f->w = w;
|
|
||||||
f->h = h;
|
|
||||||
f->depth = depth;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE *make_buffer(const uint8_t *data, const size_t data_len)
|
std::vector<u_char> Archimedes::get_image_data_as_vector(const Frame *frame)
|
||||||
{
|
{
|
||||||
FILE *file = fmemopen((void *)data, data_len, "r+");
|
rewind(frame->stream);
|
||||||
|
std::vector<unsigned char> imageData;
|
||||||
if (file == NULL)
|
if (!openMVG::image::ReadPngStream(frame->stream, &imageData, (int *)&(frame->w), (int *)&(frame->h), (int *)&(frame->depth)))
|
||||||
{
|
{
|
||||||
perror("Error opening file");
|
throw std::runtime_error("Could not read stream");
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
return imageData;
|
||||||
// Seek to the beginning of the file
|
|
||||||
rewind(file);
|
|
||||||
|
|
||||||
// Write the data to the file
|
|
||||||
fwrite(data, sizeof(uint8_t), data_len, file);
|
|
||||||
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
_FFI_PLUGIN
|
|
||||||
const Frame *
|
|
||||||
new_frame_from_data(const uint8_t *data, const size_t data_len, int w, int h, int depth)
|
|
||||||
{
|
|
||||||
FILE *buf = make_buffer(data, data_len);
|
|
||||||
return new_frame_from_handle(buf, w, h, depth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
extern "C"
|
|
||||||
ImageResult *Archimedes::get_image_data(const Frame *frame)
|
ImageResult *Archimedes::get_image_data(const Frame *frame)
|
||||||
{
|
{
|
||||||
std::vector<unsigned char> imageData;
|
try {
|
||||||
rewind(frame->stream);
|
const std::vector<u_char> imageData = get_image_data_as_vector(frame);
|
||||||
if (!openMVG::image::ReadPngStream(frame->stream, &imageData, (int *)&(frame->w), (int *)&(frame->h), (int *)&(frame->depth))) {
|
|
||||||
printf("ERROR: Could not read stream!\n");
|
|
||||||
return image_result_new_error(1);
|
|
||||||
}
|
|
||||||
printf("Read %lu bytes.\n", imageData.size());
|
printf("Read %lu bytes.\n", imageData.size());
|
||||||
const unsigned char *data = imageData.data();
|
const unsigned char *data = imageData.data();
|
||||||
return image_result_new(data, imageData.size());
|
return image_result_new(data, imageData.size());
|
||||||
|
} catch (const std::runtime_error& e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
return image_result_new_error(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -91,9 +72,28 @@ ImageResult *archimedes_get_image_data(const Frame *frame)
|
|||||||
return Archimedes::get_image_data(frame);
|
return Archimedes::get_image_data(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
_FFI_PLUGIN
|
|
||||||
int Archimedes::images_to_sfm(const Frame **frames, size_t n_frames)
|
int Archimedes::images_to_sfm(const Frame **frames, size_t n_frames)
|
||||||
{
|
{
|
||||||
|
using namespace openMVG::sfm;
|
||||||
|
|
||||||
|
const Frame *frame = frames[0];
|
||||||
|
const std::vector<u_char> imageData = get_image_data_as_vector(frame);
|
||||||
|
|
||||||
|
const size_t w = frame->w;
|
||||||
|
const size_t h = frame->h;
|
||||||
|
|
||||||
|
// Create the Eigen matrix and the image
|
||||||
|
|
||||||
|
Eigen::Matrix<u_char, Eigen::Dynamic, Eigen::Dynamic, 1> eigenMatrix(w, h);
|
||||||
|
for (int i = 0; i < w * h; ++i) {
|
||||||
|
eigenMatrix(i / h, i % h) = imageData[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
openMVG::image::Image bvgImage(eigenMatrix);
|
||||||
|
|
||||||
|
|
||||||
|
SfM_Data sfmData {};
|
||||||
|
sfmData.views = Views();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
45
src/image.h
45
src/image.h
@ -29,34 +29,40 @@
|
|||||||
#include <openMVG/sfm/pipelines/stellar/sfm_stellar_engine.hpp>
|
#include <openMVG/sfm/pipelines/stellar/sfm_stellar_engine.hpp>
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#include "./base.hpp"
|
||||||
|
#include "frame.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <error.h>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
# define _FFI_PLUGIN extern "C" __attribute__((visibility("default"))) __attribute__((used))
|
|
||||||
#else
|
|
||||||
# define _FFI_PLUGIN __attribute__((visibility("default"))) __attribute__((used))
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
auto png_sig_cm = png_sig_cmp;
|
auto png_sig_cm = png_sig_cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#define error_t int
|
||||||
|
|
||||||
typedef struct _Frame
|
#ifdef __cplusplus
|
||||||
{
|
|
||||||
FILE *stream;
|
|
||||||
int w;
|
|
||||||
int h;
|
|
||||||
int depth;
|
|
||||||
} Frame;
|
|
||||||
|
|
||||||
|
class StreamedView : openMVG::sfm::View {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
const Frame *mFrame;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
StreamedView(const Frame *);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct _ImageResult
|
typedef struct _ImageResult
|
||||||
{
|
{
|
||||||
@ -72,21 +78,12 @@ ImageResult *image_result_new_error(const error_t);
|
|||||||
_FFI_PLUGIN
|
_FFI_PLUGIN
|
||||||
int image_result_free(ImageResult *);
|
int image_result_free(ImageResult *);
|
||||||
|
|
||||||
_FFI_PLUGIN
|
|
||||||
const Frame *new_frame_from_handle(FILE *, int, int, int);
|
|
||||||
_FFI_PLUGIN
|
|
||||||
const Frame *
|
|
||||||
new_frame_from_data(const uint8_t *, const size_t, int, int, int);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
typedef openMVG::image::Image<openMVG::image::RGBColor> RgbImage;
|
|
||||||
typedef std::vector<openMVG::features::AffinePointFeature> FeatureVector;
|
|
||||||
typedef openMVG::image::Image<unsigned char> UImage;
|
|
||||||
typedef std::vector<openMVG::features::MSER::MSERRegion> RegionVector;
|
|
||||||
typedef openMVG::sfm::SfM_Data Sfm_Data;
|
|
||||||
|
|
||||||
extern "C" namespace Archimedes
|
namespace Archimedes
|
||||||
{
|
{
|
||||||
|
std::vector<u_char> get_image_data_as_vector(const Frame *frame);
|
||||||
ImageResult *get_image_data(const Frame *);
|
ImageResult *get_image_data(const Frame *);
|
||||||
int images_to_sfm(const Frame **, size_t);
|
int images_to_sfm(const Frame **, size_t);
|
||||||
}
|
}
|
||||||
|
15
src/streamingview.cxx
Normal file
15
src/streamingview.cxx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "streamingview.hpp"
|
||||||
|
|
||||||
|
template<class Archive>
|
||||||
|
void libdart_openmvg::StreamingView::load(cereal::BinaryOutputArchive &ar) const {
|
||||||
|
int i = 0;
|
||||||
|
while (i = fgetc(mFrame->stream) != EOF) {
|
||||||
|
ar(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Archive>
|
||||||
|
void libdart_openmvg::StreamingView::save(cereal::BinaryInputArchive &ar) const {
|
||||||
|
// int i = 0;
|
||||||
|
// todo
|
||||||
|
}
|
25
src/streamingview.hpp
Normal file
25
src/streamingview.hpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include <archives/binary.hpp>
|
||||||
|
#include <openMVG/sfm/sfm_view.hpp>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "frame.h"
|
||||||
|
|
||||||
|
typedef openMVG::sfm::View View;
|
||||||
|
|
||||||
|
namespace libdart_openmvg
|
||||||
|
{
|
||||||
|
|
||||||
|
struct StreamingView : View
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Frame *mFrame;
|
||||||
|
|
||||||
|
public:
|
||||||
|
StreamingView(const Frame *frame) : mFrame(frame), View () {}
|
||||||
|
template <class Archive>
|
||||||
|
void save(cereal::BinaryInputArchive &) const;
|
||||||
|
template <class Archive>
|
||||||
|
void load(cereal::BinaryOutputArchive &) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user