filter.h

00001
00002 /***************************************************************************
00003  *  filter.h - Abstract class defining a filter
00004  *
00005  *  Created: Tue May 03 19:50:02 2005
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023
00024 #ifndef __FIREVISION_FILTER_H_
00025 #define __FIREVISION_FILTER_H_
00026 
00027 #include <fvutils/base/types.h>
00028 #include <fvutils/base/roi.h>
00029
00030 class Filter
00031 {
00032
00033  public:
00034   Filter(const char *name, unsigned int max_num_buffers = 1);
00035   virtual ~Filter();
00036
00037   virtual void set_src_buffer(unsigned char *buf, ROI *roi,
00038                               orientation_t ori = ORI_HORIZONTAL,
00039                               unsigned int buffer_num = 0);
00040
00041   virtual void set_src_buffer(unsigned char *buf, ROI *roi,
00042                               unsigned int buffer_num);
00043
00044   virtual void set_dst_buffer(unsigned char *buf, ROI *roi);
00045
00046
00047   virtual void set_orientation(orientation_t ori, unsigned int buffer_num);
00048   virtual const char * name();
00049
00050   virtual void apply() = 0 ;
00051
00052   void shrink_region(ROI *r, unsigned int n);
00053
00054  protected:
00055   /** Maximum number of buffers */
00056   unsigned int    _max_num_buffers;
00057   /** Filter name */
00058   char           *_name;
00059 
00060   /** Source buffers, dynamically allocated by Filter ctor. */
00061   unsigned char  **src;
00062   /** Destination buffer */
00063   unsigned char  *dst;
00064 
00065   /** Source ROIs, dynamically allocated by Filter ctor. */
00066   ROI            **src_roi;
00067   /** Destination ROI */
00068   ROI            *dst_roi;
00069 
00070   /** Orientations, one for each source image */
00071   orientation_t  *ori;
00072 };
00073
00074 #endif