PIPS
erode_dilate.c File Reference

Go to the source code of this file.

Data Structures

struct  image
 code taken from
http://fast-edge.googlecode.com and adapted to c99 More...
 

Macros

#define min(a, b)   ((a)>(b) ? (b) : (a))
 
#define max(a, b)   ((a)>(b) ? (a) : (b))
 

Typedefs

typedef float type_t
 

Functions

void dilate_1d_h (int width, int height, type_t img[width][height], type_t img_out[width][height])
 
void dilate_1d_v (struct image *img, struct image *img_out)
 
void erode_1d_h (int width, int height, type_t img[width][height], type_t img_out[width][height])
 
void erode_1d_v (struct image *img, struct image *img_out)
 
void erode (int width, int height, type_t img_in[width][height], type_t img_scratch[width][height], type_t img_out[width][height])
 
void dilate (int width, int height, type_t img_in[width][height], type_t img_scratch[width][height], type_t img_out[width][height])
 

Macro Definition Documentation

◆ max

#define max (   a,
 
)    ((a)>(b) ? (a) : (b))

Definition at line 39 of file erode_dilate.c.

◆ min

#define min (   a,
 
)    ((a)>(b) ? (b) : (a))

Definition at line 38 of file erode_dilate.c.

Typedef Documentation

◆ type_t

typedef float type_t

Definition at line 41 of file erode_dilate.c.

Function Documentation

◆ dilate()

void dilate ( int  width,
int  height,
type_t  img_in[width][height],
type_t  img_scratch[width][height],
type_t  img_out[width][height] 
)

Definition at line 85 of file erode_dilate.c.

85  {
86  dilate_1d_h(height,width,img_in, img_scratch);
87  dilate_1d_v(height,width,img_scratch, img_out);
88 }
void dilate_1d_h(int width, int height, type_t img[width][height], type_t img_out[width][height])
Definition: erode_dilate.c:44
void dilate_1d_v(struct image *img, struct image *img_out)
Definition: erode_dilate.c:53

References dilate_1d_h(), and dilate_1d_v().

+ Here is the call graph for this function:

◆ dilate_1d_h()

void dilate_1d_h ( int  width,
int  height,
type_t  img[width][height],
type_t  img_out[width][height] 
)

Definition at line 44 of file erode_dilate.c.

44  {
45  int x, y;
46  for (y = 2 ; y < height -2 ; ++y) {
47  for (x = 2; x < width - 2; x++) {
48  img_out[y][x] = max(max(max(max(img[y][x-2], img[y][x-1]), img[y][x]), img[y][x+1]), img[y][x+2]);
49  }
50  }
51 }
#define max(a, b)
Definition: erode_dilate.c:39
static char * x
Definition: split_file.c:159

References max, and x.

Referenced by dilate().

+ Here is the caller graph for this function:

◆ dilate_1d_v()

void dilate_1d_v ( struct image img,
struct image img_out 
)

Definition at line 53 of file erode_dilate.c.

53  {
54  int x, y;
55  for (y = 2 ; y < height -2 ; ++y) {
56  for (x = 2; x < width - 2; x++) {
57  img_out[y][x] = max(max(max(max(img[y-2][x], img[y-1][x]), img[y][x]), img[y+1][x]), img[y+2][x]);
58  }
59  }
60 }

References max, and x.

Referenced by dilate().

+ Here is the caller graph for this function:

◆ erode()

void erode ( int  width,
int  height,
type_t  img_in[width][height],
type_t  img_scratch[width][height],
type_t  img_out[width][height] 
)

Definition at line 80 of file erode_dilate.c.

80  {
81  erode_1d_h(height,width,img_in, img_scratch);
82  erode_1d_v(height,width,img_scratch, img_out);
83 }
void erode_1d_v(struct image *img, struct image *img_out)
Definition: erode_dilate.c:71
void erode_1d_h(int width, int height, type_t img[width][height], type_t img_out[width][height])
Definition: erode_dilate.c:62

References erode_1d_h(), and erode_1d_v().

+ Here is the call graph for this function:

◆ erode_1d_h()

void erode_1d_h ( int  width,
int  height,
type_t  img[width][height],
type_t  img_out[width][height] 
)

Definition at line 62 of file erode_dilate.c.

62  {
63  int x, y;
64  for (y = 2 ; y < height -2 ; ++y) {
65  for (x = 2; x < width - 2; x++) {
66  img_out[y][x] = min(min(min(min(img[y][x-2], img[y][x-1]), img[y][x]), img[y][x+1]), img[y][x+2]);
67  }
68  }
69 }
#define min(a, b)
Definition: erode_dilate.c:38

References min, and x.

Referenced by erode().

+ Here is the caller graph for this function:

◆ erode_1d_v()

void erode_1d_v ( struct image img,
struct image img_out 
)

Definition at line 71 of file erode_dilate.c.

71  {
72  int x, y;
73  for (y = 2 ; y < height -2 ; ++y) {
74  for (x = 2; x < width - 2; x++) {
75  img_out[y][x] = min(min(min(min(img[y-2][x], img[y-1][x]), img[y][x]), img[y+1][x]), img[y+2][x]);
76  }
77  }
78 }

References min, and x.

Referenced by erode().

+ Here is the caller graph for this function: