-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.h
60 lines (47 loc) · 1.88 KB
/
defs.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
/************************************************************************
Demo software: Invariant keypoint matching.
Author: David Lowe
defs.h:
This file contains the headers for a sample program to read images and
keypoints, then perform simple keypoint matching.
*************************************************************************/
/* From the standard C libaray: */
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
/*------------------------------ Macros ---------------------------------*/
#define ABS(x) (((x) > 0) ? (x) : (-(x)))
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
/*---------------------------- Structures --------------------------------*/
/* Data structure for a float image.
*/
typedef struct ImageSt {
int rows, cols; /* Dimensions of image. */
float **pixels; /* 2D array of image pixels. */
struct ImageSt *next; /* Pointer to next image in sequence. */
} *Image;
/* Data structure for a keypoint. Lists of keypoints are linked
by the "next" field.
*/
typedef struct KeypointSt {
float row, col; /* Subpixel location of keypoint. */
float scale, ori; /* Scale and orientation (range [-PI,PI]) */
unsigned char *descrip; /* Vector of descriptor values */
struct KeypointSt *next; /* Pointer to next keypoint in list. */
} *Keypoint;
/*-------------------------- Function prototypes -------------------------*/
/* These are prototypes for the external functions that are shared
between files.
*/
/* From util.c */
void FatalError(char *fmt, ...);
Image CreateImage(int rows, int cols);
Image ReadPGMFile(char *filename);
Image ReadPGM(FILE *fp);
void WritePGM(FILE *fp, Image image);
void DrawLine(Image image, int r1, int c1, int r2, int c2);
Keypoint ReadKeyFile(char *filename);
Keypoint ReadKeys(FILE *fp);