-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathimage.h
96 lines (76 loc) · 3.46 KB
/
image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*------------------------------------------------------------------------------
Copyright (c) 2007-2011 rafael grompone von gioi ([email protected])
Copyright (c) 2012-2014 viorica patraucean ([email protected])
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
image.h - This file belongs to ELSDc project (Ellipse and Line Segment
Detector with continuous validation).
- It defines data structures for char / int / double images, function
prototypes to free / allocate / allocate and initialize these
structures, and prototype for image gradient computation.
----------------------------------------------------------------------------*/
#ifndef IMAGE_H
#define IMAGE_H
#include "misc.h"
/*----------------------------------------------------------------------------*/
/** char image data type.
*/
typedef struct ImageChar
{
unsigned char *data;
unsigned int xsize, ysize;
} *PImageChar; /* pointer to ImageChar */
void free_PImageChar( PImageChar i );
PImageChar new_PImageChar( unsigned int xsize, unsigned int ysize );
PImageChar new_PImageChar_ini( unsigned int xsize, unsigned int ysize,
unsigned char fill_value );
/*----------------------------------------------------------------------------*/
/** int image data type.
*/
typedef struct ImageInt
{
int *data;
unsigned int xsize, ysize;
} *PImageInt; /* pointer to ImageInt */
void free_PImageInt( PImageInt i );
PImageInt new_PImageInt( unsigned int xsize, unsigned int ysize );
PImageInt new_PImageInt_ini( unsigned int xsize, unsigned int ysize,
int fill_value );
/*----------------------------------------------------------------------------*/
/** double image data type.
*/
typedef struct ImageDouble
{
double *data;
unsigned int xsize, ysize;
} *PImageDouble; /* pointer to ImageDouble */
/*----------------------------------------------------------------------------*/
/** Data structure for linked list of point coordinates.
*/
typedef struct list CoordList;
struct list
{
int x, y;
CoordList *next;
};
void free_PImageDouble( PImageDouble i );
PImageDouble new_PImageDouble( unsigned int xsize, unsigned int ysize );
PImageDouble new_PImageDouble_ini( unsigned int xsize, unsigned int ysize,
double fill_value );
PImageDouble img_gradient_angle( PImageDouble in, double threshold );
void img_gradient_sort( PImageDouble in, double threshold, CoordList **list_p,
void **mem_p, unsigned int n_bins, double max_grad,
PImageDouble *angles, PImageDouble *gradmag,
PImageDouble *gradx, PImageDouble *grady );
void mark_img_pts( PImageInt im, Point *pts, int start, int end, int label );
int in_image( int x, int y, unsigned int xsize, unsigned int ysize);
int local_max( PImageDouble im, int x, int y );
#endif