-
Notifications
You must be signed in to change notification settings - Fork 5
/
quadtree.h
72 lines (61 loc) · 1.51 KB
/
quadtree.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
/** @file quadtree.h
** @brief Quadtree
** @author Zhiwei Zeng
** @date 2018.04.19
**/
/*
Copyright (C) 2018 Zhiwei Zeng.
Copyright (C) 2018 Chengdu ZLT Technology Co., Ltd.
All rights reserved.
This file is part of the railway monitor toolkit and is made available under
the terms of the BSD license (see the COPYING file).
*/
#ifndef _QUADTREE_H_
#define _QUADTREE_H_
#ifdef __cplusplus
extern "C"
{
#endif
/** @typedef struct Quadrant
** @brief quadrant structure
**/
typedef struct
{
unsigned int top; /**< y position of top side. */
unsigned int left; /**< x position of left side. */
unsigned int bottom; /**< y position of bottom side. */
unsigned int right; /**< x position of right side. */
}Quadrant;
/** @typedef struct Blob
** @brief blob structure
**/
typedef struct
{
Quadrant quad; /**< blob position. */
unsigned int range; /**< blob gray range. */
}Blob;
/** @typedef struct QTree
** @brief quadtree structure
**/
struct tagQTree;
typedef struct tagQTree QTree;
/** @name Create, Initialize, and destroy
** @{ */
QTree *qtree_new();
void qtree_init(QTree *self, unsigned int minbw,
unsigned int minbh, unsigned int mingr);
void qtree_delete(QTree *self);
/** @} */
/** @name decompose image with quadtree
** @{ */
void qtree_decompose(QTree *self,
const unsigned char *image,
unsigned int width,
unsigned int height);
int gtree_get_leafnode(QTree *self, Blob *blobs);
void qtree_reset(QTree *self);
/** @} */
#ifdef __cplusplus
}
#endif
#endif