4 * Copyright (C) Georg Martius - January 2013
5 * georg dot martius at web dot de
7 * This file is part of vid.stab video stabilization library
9 * vid.stab is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License,
11 * as published by the Free Software Foundation; either version 2, or
12 * (at your option) any later version.
14 * vid.stab is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GNU Make; see the file COPYING. If not, write to
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include "transformtype.h"
29 #include "motiondetect.h"
30 #include "transform.h"
33 /// Vector of LocalMotions
34 typedef VSVector VSManyLocalMotions
;
35 /// helper macro to access a localmotions vector in the VSVector of all Frames
36 #define VSMLMGet(manylocalmotions,index) \
37 ((LocalMotions*)vs_vector_get(manylocalmotions,index))
40 /// stores local motions to file
41 int vsStoreLocalmotions(FILE* f
, const LocalMotions
* lms
);
43 /// restores local motions from file
44 LocalMotions
vsRestoreLocalmotions(FILE* f
);
47 /// writes the header to the file that is to be holding the local motions
48 int vsPrepareFile(const VSMotionDetect
* td
, FILE* f
);
50 /// appends the given localmotions to the file
51 int vsWriteToFile(const VSMotionDetect
* td
, FILE* f
, const LocalMotions
* lms
);
53 /// reads the header of the file and return the version number (used by readLocalmotionsFile)
54 int vsReadFileVersion(FILE* f
);
57 * reads the next set of localmotions from the file, return VS_ERROR on error or
58 * if nothing is read (used by readLocalmotionsFile)
60 int vsReadFromFile(FILE* f
, LocalMotions
* lms
);
63 * reads the entire file of localmotions, return VS_ERROR on error or if nothing is read
65 * The format is as follows:
66 * The file must begin with 'VID.STAB version\n'
67 * Lines with # at the beginning are comments and will be ignored
68 * Data lines have the structure: Frame NUM (<LocalMotions>)
69 * where LocalMotions ::= List [(LM v.x v.y f.x f.y f.size contrast match),...]
71 int vsReadLocalMotionsFile(FILE* f
, VSManyLocalMotions
* lms
);
73 // read the transformations from the given file (Deprecated format)
74 int vsReadOldTransforms(const VSTransformData
* td
, FILE* f
, VSTransformations
* trans
);