29 #ifndef OPENCV_FLANN_SAVING_H_
30 #define OPENCV_FLANN_SAVING_H_
40 #ifdef FLANN_SIGNATURE_
41 #undef FLANN_SIGNATURE_
43 #define FLANN_SIGNATURE_ "FLANN_INDEX"
51 struct Datatype<char> {
static flann_datatype_t
type() {
return FLANN_INT8; } };
53 struct Datatype<short> {
static flann_datatype_t
type() {
return FLANN_INT16; } };
55 struct Datatype<int> {
static flann_datatype_t
type() {
return FLANN_INT32; } };
57 struct Datatype<unsigned char> {
static flann_datatype_t
type() {
return FLANN_UINT8; } };
59 struct Datatype<unsigned short> {
static flann_datatype_t
type() {
return FLANN_UINT16; } };
61 struct Datatype<unsigned int> {
static flann_datatype_t
type() {
return FLANN_UINT32; } };
63 struct Datatype<float> {
static flann_datatype_t
type() {
return FLANN_FLOAT32; } };
65 struct Datatype<double> {
static flann_datatype_t
type() {
return FLANN_FLOAT64; } };
75 flann_datatype_t data_type;
76 flann_algorithm_t index_type;
87 template<
typename Distance>
88 void save_header(FILE* stream,
const NNIndex<Distance>&
index)
109 inline IndexHeader load_header(FILE* stream)
114 if (read_size!=(
size_t)1) {
128 void save_value(FILE* stream,
const T&
value,
size_t count = 1)
134 void save_value(FILE* stream,
const cvflann::Matrix<T>&
value)
149 void load_value(FILE* stream,
T&
value,
size_t count = 1)
152 if (read_cnt !=
count) {
158 void load_value(FILE* stream, cvflann::Matrix<T>&
value)
166 if (read_cnt != (
size_t)(
value.rows*
value.cols)) {
176 size_t read_cnt =
fread(&
size,
sizeof(
size_t), 1, stream);
182 if (read_cnt !=
size) {
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition: calib3d.hpp:1867
int rows
Definition: core_c.h:257
int CvScalar value
Definition: core_c.h:720
CvMat * header
Definition: core_c.h:782
int cols
Definition: core_c.h:221
int index
Definition: core_c.h:634
CvSize size
Definition: core_c.h:112
int int type
Definition: core_c.h:221
int count
Definition: core_c.h:1413
@ StsParseError
invalid syntax/structure of the parsed file
Definition: base.hpp:112
@ StsError
unknown /unspecified error
Definition: base.hpp:71
int rows
Definition: types_c.h:485
int cols
Definition: types_c.h:486