1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * vise.h: A superclass for all video stabilization engine classes.
28 #include "transformation.h"
33 * Class vise accepts images from vise_core. It is assumed, when an image is
34 * received, that all transformations required for stabilization are available.
35 * This class is abstract, and must be subclassed to be instantiated.
42 ale_real scale_factor
;
47 * Write a frame. This function does not support sequences having
48 * more than 100,000,000 frames (starting count with frame zero).
50 void write_frame(const image
*im
, unsigned int frame_number
) {
51 if (frame_number
> 99999999) {
52 fprintf(stderr
, "\n\n *** Frame count too high for d2::vise::write_frame() ***\n\n\n");
56 int length
= strlen(prefix
) + strlen(suffix
) + 8 + 1;
57 char *filename_string
= (char *) malloc(length
* sizeof(char));
59 snprintf(filename_string
, length
, "%s%08d%s", prefix
, frame_number
, suffix
);
61 image_rw::write_image(filename_string
, im
, &image_rw::exp());
63 free(filename_string
);
66 vise(render
*r
, const char *prefix
, const char *suffix
, ale_real scale_factor
) {
67 this->prefix
= prefix
;
68 this->suffix
= suffix
;
70 this->scale_factor
= scale_factor
;
74 * Accept an image for rendering.
77 virtual void render_frame(unsigned int frame_number
) = 0;
80 * Report the frame lag for this stabilizer.
83 virtual unsigned int lag() = 0;