00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00030 #ifndef __LIBMORPHO__
00031 #define __LIBMORPHO__
00032
00033
00034 #include <stdio.h>
00035 #include <string.h>
00036 #include <stdlib.h>
00037 #include <unistd.h>
00038 #include <errno.h>
00039 #include <fcntl.h>
00040 #include <sys/types.h>
00041
00050 typedef unsigned char uint8_t;
00051
00061 # ifndef __int8_t_defined
00062 typedef short int int16_t;
00063 #endif
00064
00065
00070 #define DEBUG 0
00071
00072
00078 #define MORPHO_ERROR -1
00079
00084 #define MORPHO_SUCCESS 0
00085
00086
00087 int imageTranspose(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight);
00088 int is_size_valid_1D(int size, int imageWidth, char *func, int odd);
00089
00090
00091 int erosionByAnchor_1D_horizontal(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00092 int erosionByAnchor_1D_vertical(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00093 int erosionByAnchor_2D(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int seWidth, int seHeight);
00094
00095
00096 int dilationByAnchor_1D_horizontal(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00097 int dilationByAnchor_1D_vertical(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00098 int dilationByAnchor_2D(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int seWidth, int seHeight);
00099
00100
00101 int openingByAnchor_1D_horizontal(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00102 int openingByAnchor_1D_vertical(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00103 int openingByAnchor_2D(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int seWidth, int seHeight);
00104
00105
00106 int closingByAnchor_1D_horizontal(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00107 int closingByAnchor_1D_vertical(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int size);
00108 int closingByAnchor_2D(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, int seWidth, int seHeight);
00109
00110
00111 int erosion_arbitrary_SE(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, uint8_t *se, int seWidth, int seHeight, int seHorizontalOrigin, int seVerticalOrigin);
00112
00113
00114 int dilation_arbitrary_SE(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, uint8_t *se, int seWidth, int seHeight, int seHorizontalOrigin, int seVerticalOrigin);
00115
00116
00117 int opening_arbitrary_SE(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, uint8_t *se1, int seWidth, int seHeight, int seHorizontalOrigin, int seVerticalOrigin);
00118
00119
00120 int closing_arbitrary_SE(uint8_t *imageIn, uint8_t *imageOut, int imageWidth, int imageHeight, uint8_t *se1, int seWidth, int seHeight, int seHorizontalOrigin, int seVerticalOrigin);
00121
00122
00123 int erosion_arbitrary_SF(int16_t *imageIn, int16_t *imageOut, int imageWidth, int imageHeight, uint8_t *sf, int sfWidth, int sfHeight, int sfHorizontalOrigin, int sfVerticalOrigin);
00124
00125
00126 int dilation_arbitrary_SF(int16_t *imageIn, int16_t *imageOut, int imageWidth, int imageHeight, uint8_t *sf, int sfWidth, int sfHeight, int sfHorizontalOrigin, int sfVerticalOrigin);
00127
00128
00129 int opening_arbitrary_SF(int16_t *imageIn, int16_t *imageOut, int imageWidth, int imageHeight, uint8_t *sf1, int sfWidth, int sfHeight, int sfHorizontalOrigin, int sfVerticalOrigin);
00130
00131
00132 int closing_arbitrary_SF(int16_t *imageIn, int16_t *imageOut, int imageWidth, int imageHeight, uint8_t *sf1, int sfWidth, int sfHeight, int sfHorizontalOrigin, int sfVerticalOrigin);
00133
00134 #endif
00135