00001
00002 /*----------------------------------------------------------------------------
00003 * E.S.O.
00004 *----------------------------------------------------------------------------
00005 * File name : image_filters.h
00006 * Author : Nicolas Devillard
00007 * Created on : Aug 29, 1995
00008 * Hardware : Sun Sparc 20
00009 * Software : ANSI C under Solaris Unix
00010 * Part of ECLIPSE library for Adonis
00011 * Description : various image filters in spatial domain
00012 *--------------------------------------------------------------------------*/
00013
00014 /*
00015
00016 $Id: image_filters.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00017 $Author: amodigli $
00018 $Date: 2003/09/03 12:50:47 $
00019 $Revision: 1.1 $
00020
00021 */
00022
00023 extern double FILTER_3X3_MEAN[] ;
00024 extern double FILTER_3X3_DX[] ;
00025 extern double FILTER_3X3_DY[] ;
00026 extern double FILTER_3X3_DX2[] ;
00027 extern double FILTER_3X3_DY2[] ;
00028 extern double FILTER_CONTOUR1[] ;
00029 extern double FILTER_CONTOUR2[] ;
00030 extern double FILTER_CONTOUR3[] ;
00031 extern double FILTER_CONTRAST1[] ;
00032 extern double FILTER_5X5_MEAN[] ;
00033 extern double FILTER_MIN[] ;
00034 extern double FILTER_MAX[] ;
00035 extern double FILTER_MEDIAN[] ;
00036 extern double FILTER_MAX_MINUS_MIN[] ;
00037
00038
00039 #ifndef _IMAGE_FILTERS_H_
00040 #define _IMAGE_FILTERS_H_
00041
00042 /*----------------------------------------------------------------------------
00043 * Includes
00044 *--------------------------------------------------------------------------*/
00045
00046 #include <stdio.h>
00047 #include <stdlib.h>
00048 #include <string.h>
00049 #include <malloc.h>
00050
00051 #include "memory.h"
00052 #include "cube_defs.h"
00053 #include "image_handling.h"
00054 #include "pixel_handling.h"
00055 #include "function_1d.h"
00056
00057
00058
00059 /*----------------------------------------------------------------------------
00060 * Function prototypes
00061 *--------------------------------------------------------------------------*/
00062
00063
00064 /*---------------------------------------------------------------------------
00065 * Function : image_filter3x3()
00066 * In : 1 image, 3x3 filter matrix
00067 * Out : 1 newly allocated image
00068 * Job : filter an image spatially
00069 * Notice : The filter is defined by a 3x3 double matrix.
00070 * If the matrix is:
00071 * f1 f2 f3
00072 * f4 f5 f6
00073 * f7 f8 f9
00074 * Then the filter is given as a pointer to 9 double elements,
00075 * being : {f1, f2, f3, f4, f5, f6, f7, f8, f9}
00076 *--------------------------------------------------------------------------*/
00077
00078 OneImage *
00079 image_filter3x3(
00080 OneImage * image_in,
00081 double * filter
00082 ) ;
00083
00084
00085 /*---------------------------------------------------------------------------
00086 * Function : image_filter5x5()
00087 * In : 1 image, 5x5 filter matrix
00088 * Out : 1 newly allocated image
00089 * Job : filter an image in spatial domain
00090 * Notice : The filter is defined by a 5x5 double matrix.
00091 * If the matrix is :
00092 * f1 f2 f3 f4 f5
00093 * f6 f7 f8 f9 f10
00094 * f11 f12 f13 f14 f15
00095 * f16 f17 f18 f19 f20
00096 * f21 f22 f23 f24 f25
00097 * Then the filter is given as a pointer to 25 double elements,
00098 * being : {f1, ..., f25}
00099 *--------------------------------------------------------------------------*/
00100
00101 OneImage *
00102 image_filter5x5(
00103 OneImage * image_in,
00104 double * filter
00105 ) ;
00106
00107
00108 /*---------------------------------------------------------------------------
00109 * Function : image_filter_morpho()
00110 * In : 1 image, 3x3 filter matrix
00111 * Out : 1 newly allocated image
00112 * Job : filter an image in spatial domain
00113 * Notice : The filter is defined by a 3x3 double matrix.
00114 * If the matrix is:
00115 * f1 f2 f3
00116 * f4 f5 f6
00117 * f7 f8 f9
00118 * Then the filter is given as a pointer to 9 double elements,
00119 * being : {f1, f2, f3, f4, f5, f6, f7, f8, f9}
00120 * The first filter element applies to the min value in the
00121 * 3x3 neighborhood of the current pixel, the 9th element of
00122 * the filter matrix applies to the maximum, and other
00123 * elements are sorted accordingly to their position.
00124 *--------------------------------------------------------------------------*/
00125
00126 OneImage *
00127 image_filter_morpho(
00128 OneImage * image_in,
00129 double * filter
00130 ) ;
00131
00132
00133
00134 /*----------------------------------------------------------------------------
00135 * Function : image_filter_median()
00136 * In : OneImage *
00137 * Out : pointer to newly created OneImage
00138 * Job : apply an optimized median filter to an image
00139 * Notice : highly optimized. about 30% faster than standard qsort()
00140 *--------------------------------------------------------------------------*/
00141
00142 OneImage *
00143 image_filter_median(
00144 OneImage * in
00145 ) ;
00146
00147
00148 /*--------------------------------------------------------------------------
00149 Function : image_filter_large_median()
00150 In : OneImage, the filter sizes
00151 Out : new allocated image
00152 Job :
00153 Notice : The median kernel is gradually reduced to
00154 (filtsize/2+1)*(filtsize/2+1) at borders
00155 -------------------------------------------------------------------------*/
00156 OneImage *image_filter_large_median( OneImage * in, int filtsizex,
00157 int filtsizey) ;
00158
00159
00160 /*--------------------------------------------------------------------------
00161 Function : image_filter_vertical_median()
00162 In : OneImage, the filter size
00163 Out : new allocated image
00164 Job :
00165 Notice : Allocated image is of size in->lx,in->ly
00166 border pixels are median filtered with a decreasing
00167 kernel size
00168 -------------------------------------------------------------------------*/
00169 OneImage *image_filter_vertical_median( OneImage *in, int filtsize ) ;
00170
00171 /*--------------------------------------------------------------------------
00172 Function : image_filter_horizontal_median()
00173 In : OneImage, the filter size
00174 Out : new allocated image
00175 Job :
00176 Notice : Allocated image is of size in->lx,in->ly,
00177 border pixels are median filtered with a decreasing
00178 kernel size
00179 -------------------------------------------------------------------------*/
00180 OneImage *image_filter_horizontal_median( OneImage *in, int filtsize ) ;
00181 #endif
00182 /*--------------------------------------------------------------------------*/
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001