morphologicalfilter.cpp

00001
00002 /***************************************************************************
00003  *  morphological.cpp - interface for a morphological filter
00004  *
00005  *  Created: Tue Mar 27 23:27:46 2007
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 #include <filters/morphology/morphologicalfilter.h>
00025
00026 #include <cstddef>
00027 
00028 /** @class MorphologicalFilter <filters/morphology/morphologicalfilter.h>
00029  * Morphological filter interface.
00030  * This interface defines specific API details for morphological filters.
00031  *
00032  * @author Tim Niemueller
00033  *
00034  */
00035 
00036 /** Constructor.
00037  * @param name filter name
00038  * @param max_num_buffers maximum number of source buffers. */
00039 MorphologicalFilter::MorphologicalFilter(const char *name, unsigned int max_num_buffers)
00040   : Filter(name, max_num_buffers)
00041 {
00042   se = NULL;
00043   se_width = se_height = se_anchor_x = se_anchor_y = 0;
00044 }
00045
00046 
00047 /** Destructor. */
00048 MorphologicalFilter::~MorphologicalFilter()
00049 {
00050 }
00051
00052 
00053 /** Set the structuring element for successive filter runs.
00054  * @param se structuring element buffer. This is just a line-wise concatenated array
00055  * of values. A value of zero means ignore, any other value means to consider this
00056  * value.
00057  * @param se_width width of structuring element
00058  * @param se_height height of structuring element
00059  * @param se_anchor_x x coordinate of anchor in structuring element
00060  * @param se_anchor_y y coordinate of anchor in structuring element
00061  */
00062 void
00063 MorphologicalFilter::set_structuring_element(unsigned char *se,
00064                                              unsigned int se_width, unsigned int se_height,
00065                                              unsigned int se_anchor_x, unsigned int se_anchor_y)
00066 {
00067   this->se          = se;
00068   this->se_width    = se_width;
00069   this->se_height   = se_height;
00070   this->se_anchor_x = se_anchor_x;
00071   this->se_anchor_y = se_anchor_y;
00072 }